package org.shedlang.compiler.shid; import org.junit.jupiter.api.Test; import org.shedlang.compiler.ast.typed.Typed; import static org.shedlang.compiler.shid.instructions.ShidMatchers.*; import static org.zwobble.precisely.AssertThat.assertThat; import static org.zwobble.precisely.Matchers.isSequence; public class ShidCodeGenStringAddTests { @Test public void stringAddIsCompiledToStringAddInstruction() { var node = Typed.stringAdd( Typed.stringLiteral("a"), Typed.stringLiteral("b") ); var context = ShidCodeGen.Context.EMPTY; var result = ShidCodeGen.compileExpression(node, context); assertThat(result.instructions(), isSequence( isShidPushString("a"), isShidPushString("b"), isShidStringAdd() )); } }