Sha256: 175745daafcaed4cc0233809f4829228528c87030459645e8493b013cd3e9f98

Contents?: true

Size: 1.59 KB

Versions: 27

Compression:

Stored size: 1.59 KB

Contents

const assert = require('assert');
const wasm = require('wasm-bindgen-test');

exports.call_exports = async function() {
  await wasm.async_do_nothing();
  assert.strictEqual(1, await wasm.async_return_1());
  assert.strictEqual(2, await wasm.async_return_2());
  await wasm.async_nothing_again();
  assert.strictEqual(3, await wasm.async_return_3());
  assert.strictEqual(4, await wasm.async_return_4());
  assert.strictEqual(5, (await wasm.async_return_5()).val);
  assert.strictEqual(6, (await wasm.async_return_6()).val);
  await assert.rejects(wasm.async_throw_7(), /7/);
  await assert.rejects(wasm.async_throw_custom(), /\[object Object\]/);
  await assert.rejects(wasm.async_throw_message(), /async message/);
  await assert.rejects(wasm.async_throw_jserror(), /async message/);
  await assert.rejects(wasm.async_throw_custom_error(), /custom error/);
  assert.strictEqual("Hi, Jim!", await wasm.async_take_reference("Jim"));
  const foo = await new wasm.AsyncStruct();
  assert.strictEqual(42, await foo.method());
  await wasm.async_take_js_reference(42);
  const buffer = new Int32Array([1, 2, 3, 4]);
  await wasm.async_take_mut_slice(buffer);
  assert.deepStrictEqual(buffer, new Int32Array([42, 42, 42, 42]));
};

exports.call_promise = async function() {
    return "ok";
}

exports.call_promise_ok = async function() {
    return "ok";
}

exports.call_promise_err = async function() {
    throw "error";
}

exports.call_promise_unit = async function() {
    console.log("asdfasdf");
}

exports.call_promise_ok_unit = async function() {
}

exports.call_promise_err_unit = async function() {
    throw "error";
}

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
wasmtime-23.0.2 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/futures.js
wasmtime-22.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/futures.js
wasmtime-21.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/futures.js
wasmtime-20.0.2 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/futures.js
wasmtime-20.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/futures.js
wasmtime-18.0.3 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/futures.js
wasmtime-17.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/futures.js
wasmtime-17.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/futures.js
wasmtime-16.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/futures.js
wasmtime-15.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/futures.js
wasmtime-15.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/tests/wasm/futures.js
wasmtime-14.0.4 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/futures.js
wasmtime-14.0.3 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/futures.js
wasmtime-14.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/futures.js
wasmtime-14.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/futures.js
wasmtime-13.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/futures.js
wasmtime-12.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/futures.js
wasmtime-12.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/futures.js
wasmtime-11.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/futures.js
wasmtime-10.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.87/tests/wasm/futures.js