-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
test: Add basic WebAssembly test #16760
Changes from all commits
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
|
||
const assert = require('assert'); | ||
const fixtures = require('../common/fixtures'); | ||
|
||
const buffer = fixtures.readSync('test.wasm'); | ||
|
||
assert.ok(WebAssembly.validate(buffer), 'Buffer should be valid WebAssembly'); | ||
|
||
WebAssembly.instantiate(buffer, {}).then((results) => { | ||
assert.strictEqual( | ||
results.instance.exports.addTwo(10, 20), | ||
30, | ||
'Exported function should add two numbers.', | ||
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. Suggestion: it would likely be better to either omit the message here or include the 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. is this worth blocking on or should we land and fix in a follow up? 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. yea, we should just land this |
||
); | ||
}); |
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.
Nit:
common.mustCall
around thethen
would be better.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.
oh, right … we might also want
common.crashOnUnhandledRejection()
to make sure it really crashes when the promise gets rejectededit: this test might be trickier than first thought 😄