| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6f805c6 commit 113dd2b
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,3 +15,7 @@ rules: | |||
| 15 | 15 | inspector-check: error | |
| 16 | 16 | ## common module is mandatory in tests | |
| 17 | 17 | required-modules: [error, common] | |
| 18 | + | ||
| 19 | + # Global scoped methods and vars | ||
| 20 | + globals: | ||
| 21 | + WebAssembly: false | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,18 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + require('../common'); | ||
| 4 | + | ||
| 5 | + const assert = require('assert'); | ||
| 6 | + const fixtures = require('../common/fixtures'); | ||
| 7 | + | ||
| 8 | + const buffer = fixtures.readSync('test.wasm'); | ||
| 9 | + | ||
| 10 | + assert.ok(WebAssembly.validate(buffer), 'Buffer should be valid WebAssembly'); | ||
| 11 | + | ||
| 12 | + WebAssembly.instantiate(buffer, {}).then((results) => { | ||
| 13 | + assert.strictEqual( | ||
| 14 | + results.instance.exports.addTwo(10, 20), | ||
| 15 | + 30, | ||
| 16 | + 'Exported function should add two numbers.', | ||
| 17 | + ); | ||
| 18 | + }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments