xref: /third_party/node/test/fixtures/wpt/wasm/jsapi/exception/is.tentative.any.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/fixtures/wpt/wasm/jsapi/exception/
11cb0ef41Sopenharmony_ci// META: global=window,dedicatedworker,jsshell
21cb0ef41Sopenharmony_ci// META: script=/wasm/jsapi/memory/assertions.js
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_citest(() => {
51cb0ef41Sopenharmony_ci  const tag = new WebAssembly.Tag({ parameters: [] });
61cb0ef41Sopenharmony_ci  const exn = new WebAssembly.Exception(tag, []);
71cb0ef41Sopenharmony_ci  assert_throws_js(TypeError, () => exn.is());
81cb0ef41Sopenharmony_ci}, "Missing arguments");
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_citest(() => {
111cb0ef41Sopenharmony_ci  const invalidValues = [undefined, null, true, "", Symbol(), 1, {}];
121cb0ef41Sopenharmony_ci  const tag = new WebAssembly.Tag({ parameters: [] });
131cb0ef41Sopenharmony_ci  const exn = new WebAssembly.Exception(tag, []);
141cb0ef41Sopenharmony_ci  for (argument of invalidValues) {
151cb0ef41Sopenharmony_ci    assert_throws_js(TypeError, () => exn.is(argument));
161cb0ef41Sopenharmony_ci  }
171cb0ef41Sopenharmony_ci}, "Invalid exception argument");
181cb0ef41Sopenharmony_ci
191cb0ef41Sopenharmony_citest(() => {
201cb0ef41Sopenharmony_ci  const tag1 = new WebAssembly.Tag({ parameters: ["i32"] });
211cb0ef41Sopenharmony_ci  const tag2 = new WebAssembly.Tag({ parameters: ["i32"] });
221cb0ef41Sopenharmony_ci  const exn = new WebAssembly.Exception(tag1, [42]);
231cb0ef41Sopenharmony_ci  assert_true(exn.is(tag1));
241cb0ef41Sopenharmony_ci  assert_false(exn.is(tag2));
251cb0ef41Sopenharmony_ci}, "is");
26

Indexes created Thu Nov 07 10:32:03 CST 2024