Debian Codegraph @

js/src/tests/test262/built-ins/Promise/resolve/S25.4.4.5_A4.1_T1.js

raw
1 // |reftest| async
2 // Copyright 2014 Cubane Canada, Inc. All rights reserved.
3 // See LICENSE for details.
4
5 /*---
6 info: |
7 Section 25.4.1.4.2
8 es6id: S25.4.4.5_A3.1_T1
9 author: Sam Mikes
10 description: self-resolved Promise throws TypeError
11 flags: [async]
12 ---*/
13
14 var resolveP,
15 p = new Promise(function(resolve) {
16 resolveP = resolve;
17 });
18
19 resolveP(p);
20
21 p.then(function() {
22 throw new Test262Error("Should not fulfill: should reject with TypeError.");
23 }, function(err) {
24 assert(!!(err instanceof TypeError), 'The value of !!(err instanceof TypeError) is expected to be true');
25 }).then($DONE, $DONE);