Skip to content

Commit a11727f

Browse files
tlivelyradekdoulik
authored andcommitted
Fix incorrect wat in tests (WebAssembly#6207)
The new wat parser is much more strict than the legacy wat parser; the latter accepts all sorts of things that the spec does not allow. To ease an eventual transition to using the new wat parser by default, update the tests to use the standard text format in many places where they previously did not. We do not yet have a way to prevent new errors from being introduced into the test suite, but at least there will now be many fewer errors when it comes time to make the switch.
1 parent 257e1c9 commit a11727f

File tree

62 files changed

+274
-302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+274
-302
lines changed

test/ctor-eval/bad-indirect-call.wast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
(data (i32.const 10) "waka waka waka waka waka")
55
(table 1 1 funcref)
66
(elem (i32.const 0) $call-indirect)
7-
(export "test1" $test1)
7+
(export "test1" (func $test1))
88
(func $test1
99
(call_indirect (type $v) (i32.const 1)) ;; unsafe to call, out of range
1010
(i32.store8 (i32.const 20) (i32.const 120))

test/ctor-eval/bad-indirect-call2.wast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
(import "env" "_abort" (func $_abort))
66
(table 2 2 funcref)
77
(elem (i32.const 0) $_abort $call-indirect)
8-
(export "test1" $test1)
8+
(export "test1" (func $test1))
99
(func $test1
1010
(call_indirect (type $v) (i32.const 0)) ;; unsafe to call, imported
1111
(i32.store8 (i32.const 20) (i32.const 120))

test/ctor-eval/basics-flatten.wast

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
(data (i32.const 20) "waka waka waka")
88
(table 1 1 funcref)
99
(elem (i32.const 0) $call-indirect)
10-
(export "test1" $test1)
11-
(export "test2" $test2)
12-
(export "test3" $test3)
10+
(export "test1" (func $test1))
11+
(export "test2" (func $test2))
12+
(export "test3" (func $test3))
1313
(func $test1
1414
(drop (i32.const 0)) ;; no work at all, really
1515
(call $safe-to-call) ;; safe to call

test/ctor-eval/basics.wast

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
(data (i32.const 10) "waka waka waka waka waka")
55
(table 1 1 funcref)
66
(elem (i32.const 0) $call-indirect)
7-
(export "test1" $test1)
8-
(export "test2" $test2)
9-
(export "test3" $test3)
7+
(export "test1" (func $test1))
8+
(export "test2" (func $test2))
9+
(export "test3" (func $test3))
1010
(func $test1
1111
(drop (i32.const 0)) ;; no work at all, really
1212
(call $safe-to-call) ;; safe to call

test/ctor-eval/imported-global.wast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
(data (i32.const 10) "waka waka waka waka waka")
44
;; imports must not be used
55
(import "env" "tempDoublePtr" (global $tempDoublePtr i32))
6-
(export "test1" $test1)
6+
(export "test1" (func $test1))
77
(global $mine (mut i32) (global.get $tempDoublePtr)) ;; BAD, if used
88
(func $test1
99
(i32.store8 (i32.const 13) (i32.const 115)) ;; we never get here.

test/ctor-eval/indirect-call3.wast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
(import "env" "_abort" (func $_abort))
66
(table 2 2 funcref)
77
(elem (i32.const 0) $_abort $call-indirect)
8-
(export "test1" $test1)
8+
(export "test1" (func $test1))
99
(func $test1
1010
(call_indirect (type $v) (i32.const 1)) ;; safe to call
1111
(i32.store8 (i32.const 20) (i32.const 120))

test/ctor-eval/just_some.wast

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
(module
22
(memory 256 256)
33
(data (i32.const 10) "waka waka waka waka waka")
4-
(export "test1" $test1)
5-
(export "test2" $test2)
6-
(export "test3" $test3)
4+
(export "test1" (func $test1))
5+
(export "test2" (func $test2))
6+
(export "test3" (func $test3))
77
(func $test1
88
(i32.store8 (i32.const 12) (i32.const 115)) ;; a safe store, should alter memory
99
)

test/ctor-eval/partial-locals-tee.wast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
(memory 256 256)
55
(data (i32.const 10) "_________________")
66

7-
(export "test1" $test1)
7+
(export "test1" (func $test1))
88

99
(func $test1
1010
(local $temp i32)

test/ctor-eval/partial-locals.wast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
(memory 256 256)
55
(data (i32.const 10) "_________________")
66

7-
(export "test1" $test1)
7+
(export "test1" (func $test1))
88

99
(global $sp (mut i32) (i32.const 100))
1010

test/ctor-eval/partial-return.wast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
(memory 256 256)
55
(data (i32.const 10) "_________________")
66

7-
(export "test1" $test1)
7+
(export "test1" (func $test1))
88
(export "memory" (memory $0))
99

1010
(func $test1

0 commit comments

Comments
 (0)