summaryrefslogtreecommitdiff
path: root/test/lit/validation
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2024-02-07 15:04:51 -0800
committerGitHub <noreply@github.com>2024-02-07 15:04:51 -0800
commitd4c3fddd3de605983398756d3b46e2f14e55aba2 (patch)
treed64c2d8ee79a5d204345f3ca1588ccbd4239f1cc /test/lit/validation
parentf12977dd8aae5a0a42e65a8e448bca1453f018c6 (diff)
downloadbinaryen-d4c3fddd3de605983398756d3b46e2f14e55aba2.tar.gz
binaryen-d4c3fddd3de605983398756d3b46e2f14e55aba2.tar.bz2
binaryen-d4c3fddd3de605983398756d3b46e2f14e55aba2.zip
Get more tests working with the new text parser (#6284)
The new parser enforces the rule that imports must come before declarations (except for type declarations). The old parser does not enforce this rule, so many of our tests did not follow it. Fix them to follow that rule and fix other invalid syntax. Also add missing finalization of Load expressions in wasm-builder.h that was causing a test to fail under the new parser and guard against an error case in wasm-ir-builder.cpp that used to cause a segfault.
Diffstat (limited to 'test/lit/validation')
-rw-r--r--test/lit/validation/closed-world-interface.wast14
-rw-r--r--test/lit/validation/extended-const.wast4
2 files changed, 9 insertions, 9 deletions
diff --git a/test/lit/validation/closed-world-interface.wast b/test/lit/validation/closed-world-interface.wast
index daedaf990..19b0faa10 100644
--- a/test/lit/validation/closed-world-interface.wast
+++ b/test/lit/validation/closed-world-interface.wast
@@ -39,29 +39,29 @@
(type $private (func (param v128)))
- (func $1 (export "test1") (type $void)
+ ;; Ok even though it is an import instead of an export.
+ (func $1 (import "env" "test5") (type $exported-pair-1))
+
+ (func $2 (export "test1") (type $void)
(unreachable)
)
;; Ok because it only refers to basic heap types
- (func $2 (export "test2") (type $abstract)
+ (func $3 (export "test2") (type $abstract)
(unreachable)
)
;; Not ok because it refers to $struct.
- (func $3 (export "test3") (type $concrete)
+ (func $4 (export "test3") (type $concrete)
(unreachable)
)
;; Ok even though it is in a rec group because the rest of the group and the
;; types this refers to are on the boundary as well.
- (func $4 (export "test4") (type $exported-pair-0)
+ (func $5 (export "test4") (type $exported-pair-0)
(unreachable)
)
- ;; Ok even though it is an import instead of an export.
- (func $5 (import "env" "test5") (type $exported-pair-1))
-
;; Ok, and we also allow the other type in the group.
(func $6 (export "test6") (type $partial-pair-0)
(unreachable)
diff --git a/test/lit/validation/extended-const.wast b/test/lit/validation/extended-const.wast
index 9317f47b7..6b506671f 100644
--- a/test/lit/validation/extended-const.wast
+++ b/test/lit/validation/extended-const.wast
@@ -17,8 +17,8 @@
;; EXTENDED: ) "hello world")
(module
- (memory 1 1)
(import "env" "global" (global i32))
+ (memory 1 1)
(global i32 (i32.add (global.get 0) (i32.const 42)))
- (data (i32.sub (global.get 0) (i32.const 10)) "hello world")
+ (data (offset (i32.sub (global.get 0) (i32.const 10))) "hello world")
)