summaryrefslogtreecommitdiff
path: root/test/binaryen.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/binaryen.js')
-rw-r--r--test/binaryen.js/debug-names.js14
-rw-r--r--test/binaryen.js/debug-names.js.txt32
-rw-r--r--test/binaryen.js/kitchen-sink.js.txt2
3 files changed, 36 insertions, 12 deletions
diff --git a/test/binaryen.js/debug-names.js b/test/binaryen.js/debug-names.js
index 539b119aa..0be6bf365 100644
--- a/test/binaryen.js/debug-names.js
+++ b/test/binaryen.js/debug-names.js
@@ -1,13 +1,13 @@
var wast = `
-(module $hello
- (global $world i32 (i32.const 0))
+(module $hel
+ (memory $lo 0 0)
+ (table $wor 0 0 funcref)
+ (global $ld i32 (i32.const 0))
(func $of (param $wasm i32)
(local $!#$%&'*+-./:<=>?@\\^_\`|~ f64)
)
)
`;
-// Note that global names are not yet covered by the name section, so it is
-// expected that the global's name is lost after roundtripping.
console.log("=== input wast ===" + wast);
@@ -33,4 +33,10 @@ module.dispose();
console.log("=== roundtripped ===\n" + module2.emitText());
+var module3 = binaryen.readBinary(module2.emitBinary());
+
module2.dispose();
+
+console.log("=== roundtripped again ===\n" + module3.emitText());
+
+module3.dispose();
diff --git a/test/binaryen.js/debug-names.js.txt b/test/binaryen.js/debug-names.js.txt
index c982f2dc1..40e94c248 100644
--- a/test/binaryen.js/debug-names.js.txt
+++ b/test/binaryen.js/debug-names.js.txt
@@ -1,15 +1,19 @@
=== input wast ===
-(module $hello
- (global $world i32 (i32.const 0))
+(module $hel
+ (memory $lo 0 0)
+ (table $wor 0 0 funcref)
+ (global $ld i32 (i32.const 0))
(func $of (param $wasm i32)
(local $!#$%&'*+-./:<=>?@\^_`|~ f64)
)
)
=== parsed wast ===
-(module $hello
+(module $hel
(type $i32_=>_none (func (param i32)))
- (global $world i32 (i32.const 0))
+ (memory $lo 0 0)
+ (table $wor 0 0 funcref)
+ (global $ld i32 (i32.const 0))
(func $of (param $wasm i32)
(local $!#$%&'*+-./:<=>?@\^_`|~ f64)
(nop)
@@ -17,11 +21,25 @@
)
=== roundtripped ===
-(module $hello
+(module $hel
(type $i32_=>_none (func (param i32)))
- (global $global$0 i32 (i32.const 0))
+ (memory $lo 0 0)
+ (table $wor 0 0 funcref)
+ (global $ld i32 (i32.const 0))
(func $of (param $js i32)
- (local $!#$%&'*+-./:<=>?@\^_`|~ f64)
+ (local $!#$%&'*+-./:<=>?@\5c^_`|~ f64)
+ (nop)
+ )
+)
+
+=== roundtripped again ===
+(module $hel
+ (type $i32_=>_none (func (param i32)))
+ (memory $lo 0 0)
+ (table $wor 0 0 funcref)
+ (global $ld i32 (i32.const 0))
+ (func $of (param $js i32)
+ (local $!#$%&'*+-./:<=>?@\5c^_`|~ f64)
(nop)
)
)
diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt
index 9fca3ae53..491f11cec 100644
--- a/test/binaryen.js/kitchen-sink.js.txt
+++ b/test/binaryen.js/kitchen-sink.js.txt
@@ -4344,7 +4344,7 @@ module loaded from binary form:
(module
(type $i32_i32_=>_none (func (param i32 i32)))
(type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
- (global $global$0 i32 (i32.const 3))
+ (global $a-global i32 (i32.const 3))
(event $event$0 (attr 0) (param i32 i32))
(func $adder (param $0 i32) (param $1 i32) (result i32)
(i32.add