Debian Codegraph @

js/src/tests/test262/built-ins/Promise/resolve-non-obj-immed.js

raw
1 // |reftest| async
2 // Copyright (C) 2016 the V8 project authors. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 description: Resolving with a non-object value from within the executor function
6 es6id: 25.4.3.1
7 info: |
8 [...]
9 8. Let resolvingFunctions be CreateResolvingFunctions(promise).
10 9. Let completion be Call(executor, undefined,
11 «resolvingFunctions.[[Resolve]], resolvingFunctions.[[Reject]]»).
12
13 25.4.1.3.2 Promise Resolve Functions
14 7. If Type(resolution) is not Object, then
15 a. Return FulfillPromise(promise, resolution).
16 flags: [async]
17 ---*/
18
19 var returnValue = null;
20 var promise = new Promise(function(resolve) {
21 returnValue = resolve(45);
22 });
23
24 assert.sameValue(returnValue, undefined, '"resolve" return value');
25
26 promise.then(function(value) {
27 if (value !== 45) {
28 $DONE('The promise should be fulfilled with the provided value.');
29 return;
30 }
31
32 $DONE();
33 }, function() {
34 $DONE('The promise should not be rejected.');
35 });