diff options
Diffstat (limited to 'src/test/java')
| -rw-r--r-- | src/test/java/org/shedlang/compiler/backends/wasm/WasmCodeGenPushUnitTests.java | 2 | ||||
| -rw-r--r-- | src/test/java/org/shedlang/compiler/backends/wasm/WasmCodeGenReturnTests.java | 25 |
2 files changed, 25 insertions, 2 deletions
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 919f57f8..ed9f3221 100644 --- a/src/test/java/org/shedlang/compiler/backends/wasm/WasmCodeGenPushUnitTests.java +++ b/src/test/java/org/shedlang/compiler/backends/wasm/WasmCodeGenPushUnitTests.java @@ -12,8 +12,6 @@ import static org.shedlang.compiler.backends.wasm.structure.WasmObjdump.objdump; @ExtendWith({SnapshotResolver.class}) public class WasmCodeGenPushUnitTests { - // TODO: handle larger ints - @Test public void pushIntIsCompiledToOperandInStack(Snapshotter snapshotter) throws IOException, InterruptedException { var instruction = Instructions.pushUnit(); diff --git a/src/test/java/org/shedlang/compiler/backends/wasm/WasmCodeGenReturnTests.java b/src/test/java/org/shedlang/compiler/backends/wasm/WasmCodeGenReturnTests.java new file mode 100644 index 00000000..01c26402 --- /dev/null +++ b/src/test/java/org/shedlang/compiler/backends/wasm/WasmCodeGenReturnTests.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 WasmCodeGenReturnTests { + @Test + public void returnCompilesToReturnInstruction(Snapshotter snapshotter) throws IOException, InterruptedException { + var instruction = Instructions.return_(); + var context = WasmCodeGenContext.EMPTY; + + var result = WasmCodeGen.generateInstruction(instruction, context); + + var module = result.toFunction().toModule(); + snapshotter.assertSnapshot(objdump(module)); + } +} |
