mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
96093981de
add common.crashOnUnhandledRejection() in test-wasm-simple.js PR-URL: https://github.com/nodejs/node/pull/17236 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
20 lines
489 B
JavaScript
20 lines
489 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const fixtures = require('../common/fixtures');
|
|
|
|
common.crashOnUnhandledRejection();
|
|
|
|
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.',
|
|
);
|
|
});
|