diff options
Diffstat (limited to 'src/test/java')
| -rw-r--r-- | src/test/java/org/shedlang/compiler/backends/wasm/WasmCodeGenCallTests.java | 26 |
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)); + } +} |
