Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Promise/resolve-non-obj-deferred.js

raw
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 description: >
5 Resolving with a non-object value after invocation of 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 resolve;
21 var promise = new Promise(function(_resolve) {
22 resolve = _resolve;
23 });
24
25 promise.then(function(value) {
26 if (value !== 45) {
27 $DONE('The promise should be fulfilled with the provided value.');
28 return;
29 }
30
31 $DONE();
32 }, function() {
33 $DONE('The promise should not be rejected.');
34 });
35
36 returnValue = resolve(45);
37
38 assert.sameValue(returnValue, undefined, '"resolve" return value');