-
Notifications
You must be signed in to change notification settings - Fork 499
[js-api] Add test case for externref global #1983
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -167,5 +167,31 @@ test(() => { | |
|
|
||
| test(() => { | ||
| const argument = { "value": "v128" }; | ||
| assert_throws_js(TypeError, () =>new WebAssembly.Global(argument)); | ||
| assert_throws_js(TypeError, () => new WebAssembly.Global(argument)); | ||
| }, "Construct v128 global"); | ||
|
|
||
| test(() => { | ||
| let global = new WebAssembly.Global({value: "externref"}, "initial value"); | ||
| assert_Global(global, "initial value"); | ||
| for (let value of [ | ||
| undefined, | ||
| null, | ||
| true, | ||
| 1, | ||
| -0, | ||
| 1.5, | ||
| -2n, | ||
| Symbol("test"), | ||
| "string", | ||
| {"an": "object"}, | ||
| () => null | ||
| ]) { | ||
| global.value = value; | ||
| assert_Global(global, value); | ||
| } | ||
| }, "externref global"); | ||
|
Comment on lines
185
to
190
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This case isn't testing the constructor, which is what this file is for. I believe there's a file for the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch. After checking how I missed that, I realized that I missed one "include" in my invocation for this file and that script was reponsible for actually executing the test cases. (It isn't very obvious to me how to run these scripts in e.g. I addressed this issue now by splitting it up into testing the constructor and a separate test case for get-set. |
||
|
|
||
| test(() => { | ||
| let global = new WebAssembly.Global({value: "externref"}); | ||
| assert_Global(global, undefined); | ||
| }, "externref global with default value"); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this going to throw an assertion in step 5 because you didn't pass
mutable: truein the constructor?