mirror of
https://github.com/tc39/test262.git
synced 2025-04-08 19:35:28 +02:00
* Add constructor descriptor test * Rename & improve non-callable executor test * Rename & simplify executor call context tests * Remove duplicate reject via abrupt test * Deduplicate undefined NewTarget tests * Add basic constructor test * Add abrupt prototype getting tests
30 lines
648 B
JavaScript
30 lines
648 B
JavaScript
// Copyright 2014 Cubane Canada, Inc. All rights reserved.
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
/*---
|
|
esid: sec-promise-executor
|
|
author: Sam Mikes
|
|
description: >
|
|
Promise constructor throws TypeError if executor is not callable.
|
|
info: |
|
|
25.6.3.1 Promise ( executor )
|
|
|
|
[...]
|
|
2. If IsCallable(executor) is false, throw a TypeError exception.
|
|
---*/
|
|
|
|
assert.throws(TypeError, function() {
|
|
new Promise('not callable');
|
|
});
|
|
|
|
assert.throws(TypeError, function() {
|
|
new Promise(1);
|
|
});
|
|
|
|
assert.throws(TypeError, function() {
|
|
new Promise(null);
|
|
});
|
|
|
|
assert.throws(TypeError, function() {
|
|
new Promise({});
|
|
});
|