aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/shedlang/compiler/stackir
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-11-02 23:07:44 +0000
committerMichael Williamson <mike@zwobble.org>2023-11-02 23:07:44 +0000
commitc9ffb931adc50091fd86ea9d09c423ab16020416 (patch)
tree88f7d0b258ff083293e0fb292765252c5676a3f8 /src/test/java/org/shedlang/compiler/stackir
parent298700108a286fa7154e4a638017c9fbebf5c3ff (diff)
Add typed unit node
Diffstat (limited to 'src/test/java/org/shedlang/compiler/stackir')
-rw-r--r--src/test/java/org/shedlang/compiler/stackir/StackCompilerUnitLiteralTests.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/java/org/shedlang/compiler/stackir/StackCompilerUnitLiteralTests.java b/src/test/java/org/shedlang/compiler/stackir/StackCompilerUnitLiteralTests.java
new file mode 100644
index 00000000..024b9561
--- /dev/null
+++ b/src/test/java/org/shedlang/compiler/stackir/StackCompilerUnitLiteralTests.java
@@ -0,0 +1,22 @@
+package org.shedlang.compiler.stackir;
+
+import org.junit.jupiter.api.Test;
+import org.shedlang.compiler.ast.typed.Typed;
+
+import static org.shedlang.compiler.stackir.instructions.InstructionMatchers.isPushUnitInstruction;
+import static org.zwobble.precisely.AssertThat.assertThat;
+import static org.zwobble.precisely.Matchers.isSequence;
+
+public class StackCompilerUnitLiteralTests {
+ @Test
+ public void unitLiteralIsCompiledToPushUnitInstruction() {
+ var node = Typed.unitLiteral();
+ var context = StackCompiler.Context.EMPTY;
+
+ var result = StackCompiler.compileExpression(node, context);
+
+ assertThat(result.instructions(), isSequence(
+ isPushUnitInstruction()
+ ));
+ }
+}