Vendor dependencies
Let's see how I like this workflow.
This commit is contained in:
parent
34d1830413
commit
9c435dc440
7500 changed files with 1665121 additions and 99 deletions
43
vendor/wasm-bindgen/tests/wasm/validate_prt.js
vendored
Normal file
43
vendor/wasm-bindgen/tests/wasm/validate_prt.js
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
const wasm = require('wasm-bindgen-test.js');
|
||||
const assert = require('assert');
|
||||
|
||||
// NB: `wasm-pack` uses the presence of checks for moved values as a way to test
|
||||
// whether it is correctly enabling `--debug` when configured to do so, so don't
|
||||
// change this expected debug output without also updating `wasm-pack`'s tests.
|
||||
const assertMovedPtrThrows = process.env.WASM_BINDGEN_NO_DEBUG == null
|
||||
? f => assert.throws(f, /Attempt to use a moved value/)
|
||||
: f => assert.throws(f, /null pointer passed to rust/);
|
||||
|
||||
const useMoved = () => {
|
||||
const apple = new wasm.Fruit('apple');
|
||||
apple.name();
|
||||
wasm.eat(apple);
|
||||
assertMovedPtrThrows(() => apple.name());
|
||||
};
|
||||
|
||||
const moveMoved = () => {
|
||||
const pear = new wasm.Fruit('pear');
|
||||
pear.name();
|
||||
wasm.eat(pear);
|
||||
assertMovedPtrThrows(() => wasm.eat(pear));
|
||||
};
|
||||
|
||||
const methodMoved = () => {
|
||||
const quince = new wasm.Fruit('quince');
|
||||
quince.name();
|
||||
quince.rot();
|
||||
assertMovedPtrThrows(() => quince.rot());
|
||||
};
|
||||
|
||||
exports.js_works = () => {
|
||||
useMoved();
|
||||
moveMoved();
|
||||
methodMoved();
|
||||
|
||||
const a = new wasm.Fruit('a');
|
||||
a.prop;
|
||||
assertMovedPtrThrows(() => a.prop);
|
||||
const b = new wasm.Fruit('a');
|
||||
b.prop = 3;
|
||||
assertMovedPtrThrows(() => { b.prop = 4; });
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue