diff options
Diffstat (limited to 'src/test/java')
| -rw-r--r-- | src/test/java/org/shedlang/compiler/backends/wasm/structure/WasmBinaryFormatModuleTests.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/java/org/shedlang/compiler/backends/wasm/structure/WasmBinaryFormatModuleTests.java b/src/test/java/org/shedlang/compiler/backends/wasm/structure/WasmBinaryFormatModuleTests.java index 5941c790..5495d798 100644 --- a/src/test/java/org/shedlang/compiler/backends/wasm/structure/WasmBinaryFormatModuleTests.java +++ b/src/test/java/org/shedlang/compiler/backends/wasm/structure/WasmBinaryFormatModuleTests.java @@ -92,6 +92,28 @@ public class WasmBinaryFormatModuleTests { } @Test + public void localNamesHaveCorrectFuncIndexWhenThereAreImportedFunctions(Snapshotter snapshotter) throws IOException, InterruptedException { + var module = WasmModule.EMPTY + .addFunction(new WasmFunction( + List.of( + new WasmLocal("paramA", WasmValueType.F32) + ), + List.of(), + List.of(WasmValueType.I32), + List.of(new WasmI32Const(0)) + )) + .addImport(new WasmImport( + "ModuleName1", + "EntityName1", + new WasmImportDescriptor.Func("Identifier1", new WasmFuncType(List.of(), List.of())) + )); + + var result = serializeModule(module); + + snapshotter.assertSnapshot(result); + } + + @Test public void canSerializeModuleWithTableImports(Snapshotter snapshotter) throws IOException, InterruptedException { var module = WasmModule.EMPTY .addImport(new WasmImport( |
