aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-06-24 18:41:38 +0100
committerMichael Williamson <mike@zwobble.org>2023-06-24 18:41:38 +0100
commit56a992c96740b647b7f6feb40ce0204aec0ff2c4 (patch)
tree51fa456eb81a193eeb3bffaca019413a7ecad9ea /src/test/java
parent4f8c81e479b5e83bc301f04f01a12466f9e1edf2 (diff)
WASM binary format: support memory imports
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/shedlang/compiler/backends/wasm/structure/WasmBinaryFormatModuleTests.java16
1 files changed, 16 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 e8de81a4..b3652f98 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
@@ -87,6 +87,22 @@ public class WasmBinaryFormatModuleTests {
snapshotter.assertSnapshot(result);
}
+ @Test
+ public void canSerializeModuleWithMemoryImports(Snapshotter snapshotter) throws IOException, InterruptedException {
+ var module = WasmModule.EMPTY
+ .addImport(new WasmImport(
+ "ModuleName1",
+ "EntityName1",
+ new WasmImportDescriptor.Memory(new WasmMemoryType(
+ WasmLimits.min(1)
+ ))
+ ));
+
+ var result = serializeModule(module);
+
+ snapshotter.assertSnapshot(result);
+ }
+
private String serializeModule(WasmModule module) throws IOException, InterruptedException {
Files.createDirectories(Path.of("tests-tmp"));
var temporaryDirectory = Files.createTempDirectory(Path.of("tests-tmp"), "WasmBinaryFormat");