Standardize built-in constructor testing

This commit is contained in:
Rick Waldron 2020-10-02 11:35:57 -04:00
parent 12ed905003
commit 8aacff591c
46 changed files with 1064 additions and 51 deletions

View File

@ -0,0 +1,19 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: |
Provides uniform access to built-in constructors that are not exposed to the global object.
defines:
- ArrowFunction
- AsyncArrowFunction
- AsyncFunction
- AsyncGeneratorFunction
- GeneratorFunction
---*/
var ArrowFunction = Object.getPrototypeOf(() => {}).constructor;
var AsyncArrowFunction = Object.getPrototypeOf(async () => {}).constructor;
var AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;
var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor;

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
Array implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct]
---*/
assert.sameValue(isConstructor(Array), true, 'isConstructor(Array) must return true');
new Array();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The ArrayBuffer constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct, ArrayBuffer]
---*/
assert.sameValue(isConstructor(ArrayBuffer), true, 'isConstructor(ArrayBuffer) must return true');
new ArrayBuffer();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The ArrowFunction constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js, hidden-constructors.js]
features: [Reflect.construct]
---*/
assert.sameValue(isConstructor(ArrowFunction), true, 'isConstructor(ArrowFunction) must return true');
new ArrowFunction();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The AsyncArrowFunction constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js, hidden-constructors.js]
features: [Reflect.construct]
---*/
assert.sameValue(isConstructor(AsyncArrowFunction), true, 'isConstructor(AsyncArrowFunction) must return true');
new AsyncArrowFunction();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The AsyncFunction constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js, hidden-constructors.js]
features: [Reflect.construct]
---*/
assert.sameValue(isConstructor(AsyncFunction), true, 'isConstructor(AsyncFunction) must return true');
new AsyncFunction();

View File

@ -0,0 +1,28 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The AsyncGeneratorFunction constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js, hidden-constructors.js]
features: [Reflect.construct]
---*/
assert.sameValue(
isConstructor(AsyncGeneratorFunction),
true,
'isConstructor(AsyncGeneratorFunction) must return true'
);
new AsyncGeneratorFunction();

View File

@ -0,0 +1,33 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
BigInt is a constructor, and does implement [[Construct]], but is not new target
info: |
sec-bigint-constructor
- is not intended to be used with the new operator or to be subclassed. It may be used as the value of an extends clause of a class definition but a super call to the BigInt constructor will cause an exception.
sec-bigint-constructor-number-value
1. If NewTarget is not undefined, throw a TypeError exception.
includes: [isConstructor.js]
features: [BigInt, Reflect.construct, arrow-function]
---*/
assert.sameValue(
isConstructor(BigInt),
true,
'isConstructor(BigInt) must return true'
);
assert.throws(TypeError, () => {
new BigInt({
valueOf() {
new Test262Error();
}
});
}, '`new BigInt({ valueOf() {new Test262Error();}})` throws TypeError');

View File

@ -1,24 +0,0 @@
// Copyright (C) 2017 Robin Templeton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Throws a TypeError if BigInt is called with a new target
esid: sec-bigint-constructor
info: |
1. If NewTarget is not undefined, throw a TypeError exception.
...
features: [BigInt]
---*/
assert.sameValue(typeof BigInt, 'function');
assert.throws(TypeError, function() {
new BigInt();
});
assert.throws(TypeError, function() {
new BigInt({
valueOf: function() {
throw new Test262Error("unreachable");
}
});
});

View File

@ -1,27 +0,0 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
BigInt does not implement [[Construct]]
info: |
ECMAScript Function Objects
Built-in function objects that are not identified as constructors do not
implement the [[Construct]] internal method unless otherwise specified in
the description of a particular function.
includes: [isConstructor.js]
features: [BigInt, Reflect.construct, arrow-function]
---*/
assert.sameValue(
isConstructor(BigInt),
false,
'isConstructor(BigInt) must return false'
);
assert.throws(TypeError, () => {
new BigInt(1n);
}, '`new BigInt(1n)` throws TypeError');

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The Boolean constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct]
---*/
assert.sameValue(isConstructor(Boolean), true, 'isConstructor(Boolean) must return true');
new Boolean();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The DataView constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct, DataView, ArrayBuffer]
---*/
assert.sameValue(isConstructor(DataView), true, 'isConstructor(DataView) must return true');
new DataView(new ArrayBuffer(16));

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The Date constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct]
---*/
assert.sameValue(isConstructor(Date), true, 'isConstructor(Date) must return true');
new Date();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The Error constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct]
---*/
assert.sameValue(isConstructor(Error), true, 'isConstructor(Error) must return true');
new Error();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The FinalizationRegistry constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct, FinalizationRegistry, arrow-function]
---*/
assert.sameValue(isConstructor(FinalizationRegistry), true, 'isConstructor(FinalizationRegistry) must return true');
new FinalizationRegistry(() => {});

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The Function constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct]
---*/
assert.sameValue(isConstructor(Function), true, 'isConstructor(Function) must return true');
new Function();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The GeneratorFunction constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js, hidden-constructors.js]
features: [Reflect.construct]
---*/
assert.sameValue(isConstructor(GeneratorFunction), true, 'isConstructor(GeneratorFunction) must return true');
new GeneratorFunction();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The Map constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct, Map]
---*/
assert.sameValue(isConstructor(Map), true, 'isConstructor(Map) must return true');
new Map();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The AggregateError constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct, AggregateError]
---*/
assert.sameValue(isConstructor(AggregateError), true, 'isConstructor(AggregateError) must return true');
new AggregateError([]);

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The EvalError constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct]
---*/
assert.sameValue(isConstructor(EvalError), true, 'isConstructor(EvalError) must return true');
new EvalError();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The RangeError constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct]
---*/
assert.sameValue(isConstructor(RangeError), true, 'isConstructor(RangeError) must return true');
new RangeError();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The ReferenceError constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct]
---*/
assert.sameValue(isConstructor(ReferenceError), true, 'isConstructor(ReferenceError) must return true');
new ReferenceError();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The SyntaxError constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct]
---*/
assert.sameValue(isConstructor(SyntaxError), true, 'isConstructor(SyntaxError) must return true');
new SyntaxError();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The TypeError constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct]
---*/
assert.sameValue(isConstructor(TypeError), true, 'isConstructor(TypeError) must return true');
new TypeError();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The URIError constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct]
---*/
assert.sameValue(isConstructor(URIError), true, 'isConstructor(URIError) must return true');
new URIError();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The Number constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct]
---*/
assert.sameValue(isConstructor(Number), true, 'isConstructor(Number) must return true');
new Number();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The Object constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct]
---*/
assert.sameValue(isConstructor(Object), true, 'isConstructor(Object) must return true');
new Object();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The Promise constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct, arrow-function]
---*/
assert.sameValue(isConstructor(Promise), true, 'isConstructor(Promise) must return true');
new Promise(() => {});

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The RegExp constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct]
---*/
assert.sameValue(isConstructor(RegExp), true, 'isConstructor(RegExp) must return true');
new RegExp('');

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The Set constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct, Set]
---*/
assert.sameValue(isConstructor(Set), true, 'isConstructor(Set) must return true');
new Set();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The SharedArrayBuffer constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct, SharedArrayBuffer]
---*/
assert.sameValue(isConstructor(SharedArrayBuffer), true, 'isConstructor(SharedArrayBuffer) must return true');
new SharedArrayBuffer(1);

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The String constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct]
---*/
assert.sameValue(isConstructor(String), true, 'isConstructor(String) must return true');
new String();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The BigInt64Array constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct, BigInt, TypedArray]
---*/
assert.sameValue(isConstructor(BigInt64Array), true, 'isConstructor(BigInt64Array) must return true');
new BigInt64Array();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The BigUint64Array constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct, TypedArray]
---*/
assert.sameValue(isConstructor(BigUint64Array), true, 'isConstructor(BigUint64Array) must return true');
new BigUint64Array();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The Float32Array constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct, TypedArray]
---*/
assert.sameValue(isConstructor(Float32Array), true, 'isConstructor(Float32Array) must return true');
new Float32Array();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The Float64Array constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct, TypedArray]
---*/
assert.sameValue(isConstructor(Float64Array), true, 'isConstructor(Float64Array) must return true');
new Float64Array();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The Int16Array constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct, TypedArray]
---*/
assert.sameValue(isConstructor(Int16Array), true, 'isConstructor(Int16Array) must return true');
new Int16Array();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The Int32Array constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct, TypedArray]
---*/
assert.sameValue(isConstructor(Int32Array), true, 'isConstructor(Int32Array) must return true');
new Int32Array();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The Int8Array constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct, TypedArray]
---*/
assert.sameValue(isConstructor(Int8Array), true, 'isConstructor(Int8Array) must return true');
new Int8Array();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The Uint16Array constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct, TypedArray]
---*/
assert.sameValue(isConstructor(Uint16Array), true, 'isConstructor(Uint16Array) must return true');
new Uint16Array();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The Uint32Array constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct, TypedArray]
---*/
assert.sameValue(isConstructor(Uint32Array), true, 'isConstructor(Uint32Array) must return true');
new Uint32Array();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The Uint8Array constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct, TypedArray]
---*/
assert.sameValue(isConstructor(Uint8Array), true, 'isConstructor(Uint8Array) must return true');
new Uint8Array();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The Uint8ClampedArray constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct]
---*/
assert.sameValue(isConstructor(Uint8ClampedArray), true, 'isConstructor(Uint8ClampedArray) must return true');
new Uint8ClampedArray();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The WeakMap constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct, WeakMap]
---*/
assert.sameValue(isConstructor(WeakMap), true, 'isConstructor(WeakMap) must return true');
new WeakMap();

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The WeakRef constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct, WeakRef]
---*/
assert.sameValue(isConstructor(WeakRef), true, 'isConstructor(WeakRef) must return true');
new WeakRef({})

View File

@ -0,0 +1,24 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-standard-built-in-objects
description: >
The WeakSet constructor implements [[Construct]]
info: |
IsConstructor ( argument )
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:
If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [Reflect.construct, WeakSet]
---*/
assert.sameValue(isConstructor(WeakSet), true, 'isConstructor(WeakSet) must return true');
new WeakSet();