| 1 |
// Copyright (C) 2015 the V8 project authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
es6id: 25.4.3.1 |
| 6 |
description: Promise executor is invoked synchronously |
| 7 |
info: | |
| 8 |
9. Let completion be Call(executor, undefined, |
| 9 |
«resolvingFunctions.[[Resolve]], resolvingFunctions.[[Reject]]»). |
| 10 |
|
| 11 |
25.4.1.3.2 Promise Resolve Functions |
| 12 |
|
| 13 |
The length property of a promise resolve function is 1. |
| 14 |
|
| 15 |
25.4.1.3.1 Promise Reject Functions |
| 16 |
|
| 17 |
The length property of a promise reject function is 1. |
| 18 |
---*/ |
| 19 |
|
| 20 |
var callCount = 0; |
| 21 |
var resolve, reject, argCount; |
| 22 |
|
| 23 |
new Promise(function(a, b) { |
| 24 |
resolve = a; |
| 25 |
reject = b; |
| 26 |
argCount = arguments.length; |
| 27 |
}); |
| 28 |
|
| 29 |
assert.sameValue(typeof resolve, 'function', 'type of first argument'); |
| 30 |
assert.sameValue(resolve.length, 1, 'length of first argument'); |
| 31 |
assert.sameValue(typeof reject, 'function', 'type of second argument'); |
| 32 |
assert.sameValue(reject.length, 1, 'length of second argument'); |
| 33 |
assert.sameValue(argCount, 2); |