Debian Codegraph @

js/src/jit-test/tests/promise/newpromisecapability-error-message.js

raw
1 // |jit-test| skip-if: getBuildConfiguration('pbl')
2 // (justification: PBL does not invoke the decompiler in the same way and so
3 // will not have an error message referring to the specific value name)
4 load(libdir + "asserts.js");
5
6 let foo = {};
7 for (let method of ["resolve", "reject", "race"]) {
8 assertErrorMessage(
9 () => Promise[method].call(foo),
10 TypeError,
11 "foo is not a constructor"
12 );
13 assertErrorMessage(
14 () => Promise[method].call(foo, []),
15 TypeError,
16 "foo is not a constructor"
17 );
18 assertErrorMessage(
19 () => Promise[method].call({}, [], foo),
20 TypeError,
21 "({}) is not a constructor"
22 );
23 }