summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/promise/newpromisecapability-error-message.js
blob: 4fb96013f4f15e8f1cca5fcb2481b468dd8030b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// |jit-test| skip-if: getBuildConfiguration('pbl')
// (justification: PBL does not invoke the decompiler in the same way and so
// will not have an error message referring to the specific value name)
load(libdir + "asserts.js");

let foo = {};
for (let method of ["resolve", "reject", "race"]) {
  assertErrorMessage(
    () => Promise[method].call(foo),
    TypeError,
    "foo is not a constructor"
  );
  assertErrorMessage(
    () => Promise[method].call(foo, []),
    TypeError,
    "foo is not a constructor"
  );
  assertErrorMessage(
    () => Promise[method].call({}, [], foo),
    TypeError,
    "({}) is not a constructor"
  );
}