Skip to content

[test] elem.wast: force to use exprs in a element #1561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions test/core/elem.wast
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,25 @@
(assert_return (invoke "call-7") (i32.const 65))
(assert_return (invoke "call-9") (i32.const 66))

;; Same as the above, but use ref.null to ensure the elements use exprs.
;; Note: some tools like wast2json avoid using exprs when possible.
(module
(type $out-i32 (func (result i32)))
(table 11 funcref)
(elem (i32.const 6) funcref (ref.null func) (ref.func $const-i32-a))
(elem (i32.const 9) funcref (ref.func $const-i32-b) (ref.null func))
(func $const-i32-a (type $out-i32) (i32.const 65))
(func $const-i32-b (type $out-i32) (i32.const 66))
(func (export "call-7") (type $out-i32)
(call_indirect (type $out-i32) (i32.const 7))
)
(func (export "call-9") (type $out-i32)
(call_indirect (type $out-i32) (i32.const 9))
)
)
(assert_return (invoke "call-7") (i32.const 65))
(assert_return (invoke "call-9") (i32.const 66))

(assert_invalid
(module (table 1 funcref) (global i32 (i32.const 0)) (elem (global.get 0) $f) (func $f))
"unknown global"
Expand Down