Debian Codegraph @

js/src/tests/test262/built-ins/Promise/resolve/resolve-non-obj.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
6 es6id: 25.4.4.5
7 info: |
8 [...]
9 6. Let resolveResult be Call(promiseCapability.[[Resolve]], undefined,
10 «x»).
11 [...]
12
13 25.4.1.3.2 Promise Resolve Functions
14 [...]
15 7. If Type(resolution) is not Object, then
16 a. Return FulfillPromise(promise, resolution).
17 flags: [async]
18 ---*/
19
20 Promise.resolve(23).then(function(value) {
21 if (value !== 23) {
22 $DONE('The promise should be fulfilled with the provided value.');
23 return;
24 }
25
26 $DONE();
27 }, function() {
28 $DONE('The promise should not be rejected.');
29 });