aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/shedlang/compiler/backends/wasm/structure/WasmBinaryFormatModuleTests.java17
1 files changed, 17 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 4c26a55c..78054d23 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
@@ -213,6 +213,23 @@ public class WasmBinaryFormatModuleTests {
}
@Test
+ public void canSerializeModuleWithGlobals(Snapshotter snapshotter) throws IOException, InterruptedException {
+ var module = WasmModule.EMPTY
+ .addGlobal(new WasmGlobal(
+ new WasmGlobalType(WasmValueType.I32, WasmMutability.MUTABLE),
+ new WasmExpression(List.of(new WasmI32Const(7)))
+ ))
+ .addGlobal(new WasmGlobal(
+ new WasmGlobalType(WasmValueType.I64, WasmMutability.IMMUTABLE),
+ new WasmExpression(List.of(new WasmI64Const(9)))
+ ));
+
+ var result = serializeModule(module);
+
+ snapshotter.assertSnapshot(result);
+ }
+
+ @Test
public void canSerializeModuleWithElementSegments(Snapshotter snapshotter) throws IOException, InterruptedException {
var module = WasmModule.EMPTY
.addFunction(new WasmFunction(