aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-06-26 21:16:03 +0100
committerMichael Williamson <mike@zwobble.org>2023-06-26 21:16:03 +0100
commit90afeef2a50e017be593267c8420df410b2cef7f (patch)
tree6dfa4b73462d61c91ddd87bfa92243bfbbaef59b /src/test/java
parent70fec4f9190b98ea2f27ce9e3a1ff974c8072549 (diff)
Add WASM code gen for call instruction with no args
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/shedlang/compiler/backends/wasm/WasmCodeGenCallTests.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/java/org/shedlang/compiler/backends/wasm/WasmCodeGenCallTests.java b/src/test/java/org/shedlang/compiler/backends/wasm/WasmCodeGenCallTests.java
new file mode 100644
index 00000000..35255ed8
--- /dev/null
+++ b/src/test/java/org/shedlang/compiler/backends/wasm/WasmCodeGenCallTests.java
@@ -0,0 +1,26 @@
+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 java.util.List;
+
+import static org.shedlang.compiler.backends.wasm.structure.WasmObjdump.objdump;
+
+@ExtendWith({SnapshotResolver.class})
+public class WasmCodeGenCallTests {
+ @Test
+ public void canCallFunctionWithNoArgs(Snapshotter snapshotter) throws IOException, InterruptedException {
+ var instruction = Instructions.call(0, List.of());
+ var context = WasmCodeGenContext.EMPTY;
+
+ var result = WasmCodeGen.generateInstruction(instruction, context);
+
+ var module = result.toFunction().toModule();
+ snapshotter.assertSnapshot(objdump(module));
+ }
+}