Skip to content

Commit 1782235

Browse files
authored
[test] elem.wast: force to use exprs in a element (#1561)
1 parent a54a1d8 commit 1782235

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/core/elem.wast

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,25 @@
148148
(assert_return (invoke "call-7") (i32.const 65))
149149
(assert_return (invoke "call-9") (i32.const 66))
150150

151+
;; Same as the above, but use ref.null to ensure the elements use exprs.
152+
;; Note: some tools like wast2json avoid using exprs when possible.
153+
(module
154+
(type $out-i32 (func (result i32)))
155+
(table 11 funcref)
156+
(elem (i32.const 6) funcref (ref.null func) (ref.func $const-i32-a))
157+
(elem (i32.const 9) funcref (ref.func $const-i32-b) (ref.null func))
158+
(func $const-i32-a (type $out-i32) (i32.const 65))
159+
(func $const-i32-b (type $out-i32) (i32.const 66))
160+
(func (export "call-7") (type $out-i32)
161+
(call_indirect (type $out-i32) (i32.const 7))
162+
)
163+
(func (export "call-9") (type $out-i32)
164+
(call_indirect (type $out-i32) (i32.const 9))
165+
)
166+
)
167+
(assert_return (invoke "call-7") (i32.const 65))
168+
(assert_return (invoke "call-9") (i32.const 66))
169+
151170
(assert_invalid
152171
(module (table 1 funcref) (global i32 (i32.const 0)) (elem (global.get 0) $f) (func $f))
153172
"unknown global"

0 commit comments

Comments
 (0)