From e6462d8438d7eccd9c3c812a65036b210cf7ae33 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 22 Dec 2024 17:22:23 +0000 Subject: Add symbols for tables --- .../binary/WasmBinaryFormatModulesTests.java | 55 ++++++++++++++-------- 1 file changed, 35 insertions(+), 20 deletions(-) (limited to 'src/test/java') diff --git a/src/test/java/org/shedlang/compiler/backends/wasm/structure/binary/WasmBinaryFormatModulesTests.java b/src/test/java/org/shedlang/compiler/backends/wasm/structure/binary/WasmBinaryFormatModulesTests.java index 7054c4cf..4d7ba09c 100644 --- a/src/test/java/org/shedlang/compiler/backends/wasm/structure/binary/WasmBinaryFormatModulesTests.java +++ b/src/test/java/org/shedlang/compiler/backends/wasm/structure/binary/WasmBinaryFormatModulesTests.java @@ -125,18 +125,24 @@ public class WasmBinaryFormatModulesTests { .addImport(new WasmImport( "ModuleName1", "EntityName1", - new WasmImportDescriptor.Table(new WasmTableType( - WasmReferenceType.EXTERN_REF, - WasmLimits.min32(1) - )) + new WasmImportDescriptor.Table( + "TableName1", + new WasmTableType( + WasmReferenceType.EXTERN_REF, + WasmLimits.min32(1) + ) + ) )) .addImport(new WasmImport( "ModuleName2", "EntityName2", - new WasmImportDescriptor.Table(new WasmTableType( - WasmReferenceType.FUNC_REF, - WasmLimits.range32(2, 5) - )) + new WasmImportDescriptor.Table( + "TableName2", + new WasmTableType( + WasmReferenceType.FUNC_REF, + WasmLimits.range32(2, 5) + ) + ) )); var result = serializeModuleWasm32(module); @@ -204,14 +210,20 @@ public class WasmBinaryFormatModulesTests { @Test public void canSerializeModuleWithTables(Snapshotter snapshotter) throws IOException, InterruptedException { var module = WasmModule.EMPTY - .addTable(new WasmTable(new WasmTableType( - WasmReferenceType.FUNC_REF, - WasmLimits.min32(1) - ))) - .addTable(new WasmTable(new WasmTableType( - WasmReferenceType.EXTERN_REF, - WasmLimits.range32(2, 3) - ))); + .addTable(new WasmTable( + "Table1", + new WasmTableType( + WasmReferenceType.FUNC_REF, + WasmLimits.min32(1) + ) + )) + .addTable(new WasmTable( + "Table2", + new WasmTableType( + WasmReferenceType.EXTERN_REF, + WasmLimits.range32(2, 3) + ) + )); var result = serializeModuleWasm32(module); @@ -285,10 +297,13 @@ public class WasmBinaryFormatModulesTests { List.of(), new WasmExpression(List.of()) )) - .addTable(new WasmTable(new WasmTableType( - WasmReferenceType.FUNC_REF, - WasmLimits.min32(1) - ))) + .addTable(new WasmTable( + "Table1", + new WasmTableType( + WasmReferenceType.FUNC_REF, + WasmLimits.min32(1) + ) + )) .addElementSegment(WasmElementSegment.funcIndicesActive(List.of( new WasmFuncIndex(0), new WasmFuncIndex(2) -- cgit v1.2.3