diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-06-24 19:52:45 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-06-24 19:52:45 +0100 |
| commit | 03a83877a5fa055543ca5bc62adac269cf59dc93 (patch) | |
| tree | 6167278fe791f724b0169c50225dfe6a32ab98a6 /src/test/java | |
| parent | 4ea7fb648b0c6f95e6383c34912aad411a43cdbf (diff) | |
WASM binary format: support memory sections
Diffstat (limited to 'src/test/java')
| -rw-r--r-- | src/test/java/org/shedlang/compiler/backends/wasm/structure/WasmBinaryFormatModuleTests.java | 17 |
1 files changed, 13 insertions, 4 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 8083a36a..9772917f 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 @@ -2,10 +2,7 @@ package org.shedlang.compiler.backends.wasm.structure; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.shedlang.compiler.backends.wasm.structure.ast.modules.WasmModule; -import org.shedlang.compiler.backends.wasm.structure.ast.modules.WasmImport; -import org.shedlang.compiler.backends.wasm.structure.ast.modules.WasmImportDescriptor; -import org.shedlang.compiler.backends.wasm.structure.ast.modules.WasmTable; +import org.shedlang.compiler.backends.wasm.structure.ast.modules.*; import org.shedlang.compiler.backends.wasm.structure.ast.types.*; import org.shedlang.compiler.testing.ProcessRunner; import org.shedlang.compiler.testing.snapshots.SnapshotResolver; @@ -146,6 +143,18 @@ public class WasmBinaryFormatModuleTests { snapshotter.assertSnapshot(result); } + @Test + public void canSerializeModuleWithMemories(Snapshotter snapshotter) throws IOException, InterruptedException { + var module = WasmModule.EMPTY + .addMemory(new WasmMemory(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"); |
