aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/shedlang/compiler/backends/wasm/WasmCodeGenDiscardTests.java25
-rw-r--r--src/test/java/org/shedlang/compiler/backends/wasm/WasmCodeGenPushUnitTests.java2
2 files changed, 26 insertions, 1 deletions
diff --git a/src/test/java/org/shedlang/compiler/backends/wasm/WasmCodeGenDiscardTests.java b/src/test/java/org/shedlang/compiler/backends/wasm/WasmCodeGenDiscardTests.java
new file mode 100644
index 00000000..2b1d84d3
--- /dev/null
+++ b/src/test/java/org/shedlang/compiler/backends/wasm/WasmCodeGenDiscardTests.java
@@ -0,0 +1,25 @@
+package org.shedlang.compiler.backends.wasm;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.shedlang.compiler.stackir.instructions.Instructions;
+import org.shedlang.compiler.testing.snapshots.SnapshotResolver;
+import org.shedlang.compiler.testing.snapshots.Snapshotter;
+
+import java.io.IOException;
+
+import static org.shedlang.compiler.backends.wasm.structure.WasmObjdump.objdump;
+
+@ExtendWith({SnapshotResolver.class})
+public class WasmCodeGenDiscardTests {
+ @Test
+ public void discardCompilesToDrop(Snapshotter snapshotter) throws IOException, InterruptedException {
+ var instruction = Instructions.discard();
+ var context = WasmCodeGenContext.EMPTY;
+
+ var result = WasmCodeGen.generateInstruction(instruction, context);
+
+ var module = result.toFunction().toModule();
+ snapshotter.assertSnapshot(objdump(module));
+ }
+}
diff --git a/src/test/java/org/shedlang/compiler/backends/wasm/WasmCodeGenPushUnitTests.java b/src/test/java/org/shedlang/compiler/backends/wasm/WasmCodeGenPushUnitTests.java
index ed9f3221..a58eb091 100644
--- a/src/test/java/org/shedlang/compiler/backends/wasm/WasmCodeGenPushUnitTests.java
+++ b/src/test/java/org/shedlang/compiler/backends/wasm/WasmCodeGenPushUnitTests.java
@@ -13,7 +13,7 @@ import static org.shedlang.compiler.backends.wasm.structure.WasmObjdump.objdump;
@ExtendWith({SnapshotResolver.class})
public class WasmCodeGenPushUnitTests {
@Test
- public void pushIntIsCompiledToOperandInStack(Snapshotter snapshotter) throws IOException, InterruptedException {
+ public void pushUnitIsCompiledToOperandInStack(Snapshotter snapshotter) throws IOException, InterruptedException {
var instruction = Instructions.pushUnit();
var context = WasmCodeGenContext.EMPTY;