diff --git a/harness/hidden-constructors.js b/harness/hidden-constructors.js new file mode 100644 index 0000000000..dec450810d --- /dev/null +++ b/harness/hidden-constructors.js @@ -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; diff --git a/test/built-ins/Array/is-a-constructor.js b/test/built-ins/Array/is-a-constructor.js new file mode 100644 index 0000000000..c3c9c2a163 --- /dev/null +++ b/test/built-ins/Array/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/ArrayBuffer/is-a-constructor.js b/test/built-ins/ArrayBuffer/is-a-constructor.js new file mode 100644 index 0000000000..6ef0adc319 --- /dev/null +++ b/test/built-ins/ArrayBuffer/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/ArrowFunction/is-a-constructor.js b/test/built-ins/ArrowFunction/is-a-constructor.js new file mode 100644 index 0000000000..ffc37add8d --- /dev/null +++ b/test/built-ins/ArrowFunction/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/AsyncArrowFunction/is-a-constructor.js b/test/built-ins/AsyncArrowFunction/is-a-constructor.js new file mode 100644 index 0000000000..acbc03d958 --- /dev/null +++ b/test/built-ins/AsyncArrowFunction/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/AsyncFunction/is-a-constructor.js b/test/built-ins/AsyncFunction/is-a-constructor.js new file mode 100644 index 0000000000..86149297a7 --- /dev/null +++ b/test/built-ins/AsyncFunction/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/AsyncGeneratorFunction/is-a-constructor.js b/test/built-ins/AsyncGeneratorFunction/is-a-constructor.js new file mode 100644 index 0000000000..bc53bc79d5 --- /dev/null +++ b/test/built-ins/AsyncGeneratorFunction/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/BigInt/is-a-constructor.js b/test/built-ins/BigInt/is-a-constructor.js new file mode 100644 index 0000000000..8f5182e289 --- /dev/null +++ b/test/built-ins/BigInt/is-a-constructor.js @@ -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'); + diff --git a/test/built-ins/BigInt/new-target-throws.js b/test/built-ins/BigInt/new-target-throws.js deleted file mode 100644 index c61ef6e2b2..0000000000 --- a/test/built-ins/BigInt/new-target-throws.js +++ /dev/null @@ -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"); - } - }); -}); diff --git a/test/built-ins/BigInt/not-a-constructor.js b/test/built-ins/BigInt/not-a-constructor.js deleted file mode 100644 index 4cdd591572..0000000000 --- a/test/built-ins/BigInt/not-a-constructor.js +++ /dev/null @@ -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'); - diff --git a/test/built-ins/Boolean/is-a-constructor.js b/test/built-ins/Boolean/is-a-constructor.js new file mode 100644 index 0000000000..67990e3862 --- /dev/null +++ b/test/built-ins/Boolean/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/DataView/is-a-constructor.js b/test/built-ins/DataView/is-a-constructor.js new file mode 100644 index 0000000000..c9564d8ddb --- /dev/null +++ b/test/built-ins/DataView/is-a-constructor.js @@ -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)); + diff --git a/test/built-ins/Date/is-a-constructor.js b/test/built-ins/Date/is-a-constructor.js new file mode 100644 index 0000000000..92bc249c6b --- /dev/null +++ b/test/built-ins/Date/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/Error/is-a-constructor.js b/test/built-ins/Error/is-a-constructor.js new file mode 100644 index 0000000000..79c70b1073 --- /dev/null +++ b/test/built-ins/Error/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/FinalizationRegistry/is-a-constructor.js b/test/built-ins/FinalizationRegistry/is-a-constructor.js new file mode 100644 index 0000000000..20fee3ea0f --- /dev/null +++ b/test/built-ins/FinalizationRegistry/is-a-constructor.js @@ -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(() => {}); + diff --git a/test/built-ins/Function/is-a-constructor.js b/test/built-ins/Function/is-a-constructor.js new file mode 100644 index 0000000000..07b82455d3 --- /dev/null +++ b/test/built-ins/Function/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/GeneratorFunction/is-a-constructor.js b/test/built-ins/GeneratorFunction/is-a-constructor.js new file mode 100644 index 0000000000..d42ccc4be5 --- /dev/null +++ b/test/built-ins/GeneratorFunction/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/Map/is-a-constructor.js b/test/built-ins/Map/is-a-constructor.js new file mode 100644 index 0000000000..fe9dbee757 --- /dev/null +++ b/test/built-ins/Map/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/NativeErrors/AggregateError/is-a-constructor.js b/test/built-ins/NativeErrors/AggregateError/is-a-constructor.js new file mode 100644 index 0000000000..f51ad171b6 --- /dev/null +++ b/test/built-ins/NativeErrors/AggregateError/is-a-constructor.js @@ -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([]); + diff --git a/test/built-ins/NativeErrors/EvalError/is-a-constructor.js b/test/built-ins/NativeErrors/EvalError/is-a-constructor.js new file mode 100644 index 0000000000..a7b2d811fd --- /dev/null +++ b/test/built-ins/NativeErrors/EvalError/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/NativeErrors/RangeError/is-a-constructor.js b/test/built-ins/NativeErrors/RangeError/is-a-constructor.js new file mode 100644 index 0000000000..3552998c98 --- /dev/null +++ b/test/built-ins/NativeErrors/RangeError/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/NativeErrors/ReferenceError/is-a-constructor.js b/test/built-ins/NativeErrors/ReferenceError/is-a-constructor.js new file mode 100644 index 0000000000..d83e2999da --- /dev/null +++ b/test/built-ins/NativeErrors/ReferenceError/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/NativeErrors/SyntaxError/is-a-constructor.js b/test/built-ins/NativeErrors/SyntaxError/is-a-constructor.js new file mode 100644 index 0000000000..332f0920ef --- /dev/null +++ b/test/built-ins/NativeErrors/SyntaxError/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/NativeErrors/TypeError/is-a-constructor.js b/test/built-ins/NativeErrors/TypeError/is-a-constructor.js new file mode 100644 index 0000000000..c9381fcba3 --- /dev/null +++ b/test/built-ins/NativeErrors/TypeError/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/NativeErrors/URIError/is-a-constructor.js b/test/built-ins/NativeErrors/URIError/is-a-constructor.js new file mode 100644 index 0000000000..7da8453dc5 --- /dev/null +++ b/test/built-ins/NativeErrors/URIError/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/Number/is-a-constructor.js b/test/built-ins/Number/is-a-constructor.js new file mode 100644 index 0000000000..6f9b353979 --- /dev/null +++ b/test/built-ins/Number/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/Object/is-a-constructor.js b/test/built-ins/Object/is-a-constructor.js new file mode 100644 index 0000000000..20d39f4159 --- /dev/null +++ b/test/built-ins/Object/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/Promise/is-a-constructor.js b/test/built-ins/Promise/is-a-constructor.js new file mode 100644 index 0000000000..bba914e5ce --- /dev/null +++ b/test/built-ins/Promise/is-a-constructor.js @@ -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(() => {}); + diff --git a/test/built-ins/RegExp/is-a-constructor.js b/test/built-ins/RegExp/is-a-constructor.js new file mode 100644 index 0000000000..82b8eea011 --- /dev/null +++ b/test/built-ins/RegExp/is-a-constructor.js @@ -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(''); + diff --git a/test/built-ins/Set/is-a-constructor.js b/test/built-ins/Set/is-a-constructor.js new file mode 100644 index 0000000000..2ecb6c1814 --- /dev/null +++ b/test/built-ins/Set/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/SharedArrayBuffer/is-a-constructor.js b/test/built-ins/SharedArrayBuffer/is-a-constructor.js new file mode 100644 index 0000000000..06c05d601c --- /dev/null +++ b/test/built-ins/SharedArrayBuffer/is-a-constructor.js @@ -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); + diff --git a/test/built-ins/String/is-a-constructor.js b/test/built-ins/String/is-a-constructor.js new file mode 100644 index 0000000000..33db46e08f --- /dev/null +++ b/test/built-ins/String/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/TypedArrayConstructors/BigInt64Array/is-a-constructor.js b/test/built-ins/TypedArrayConstructors/BigInt64Array/is-a-constructor.js new file mode 100644 index 0000000000..3cb114236f --- /dev/null +++ b/test/built-ins/TypedArrayConstructors/BigInt64Array/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/TypedArrayConstructors/BigUint64Array/is-a-constructor.js b/test/built-ins/TypedArrayConstructors/BigUint64Array/is-a-constructor.js new file mode 100644 index 0000000000..befe1c848c --- /dev/null +++ b/test/built-ins/TypedArrayConstructors/BigUint64Array/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/TypedArrayConstructors/Float32Array/is-a-constructor.js b/test/built-ins/TypedArrayConstructors/Float32Array/is-a-constructor.js new file mode 100644 index 0000000000..641b12a50d --- /dev/null +++ b/test/built-ins/TypedArrayConstructors/Float32Array/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/TypedArrayConstructors/Float64Array/is-a-constructor.js b/test/built-ins/TypedArrayConstructors/Float64Array/is-a-constructor.js new file mode 100644 index 0000000000..d028cecac9 --- /dev/null +++ b/test/built-ins/TypedArrayConstructors/Float64Array/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/TypedArrayConstructors/Int16Array/is-a-constructor.js b/test/built-ins/TypedArrayConstructors/Int16Array/is-a-constructor.js new file mode 100644 index 0000000000..8757330ebc --- /dev/null +++ b/test/built-ins/TypedArrayConstructors/Int16Array/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/TypedArrayConstructors/Int32Array/is-a-constructor.js b/test/built-ins/TypedArrayConstructors/Int32Array/is-a-constructor.js new file mode 100644 index 0000000000..9177df1952 --- /dev/null +++ b/test/built-ins/TypedArrayConstructors/Int32Array/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/TypedArrayConstructors/Int8Array/is-a-constructor.js b/test/built-ins/TypedArrayConstructors/Int8Array/is-a-constructor.js new file mode 100644 index 0000000000..59a3e94d26 --- /dev/null +++ b/test/built-ins/TypedArrayConstructors/Int8Array/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/TypedArrayConstructors/Uint16Array/is-a-constructor.js b/test/built-ins/TypedArrayConstructors/Uint16Array/is-a-constructor.js new file mode 100644 index 0000000000..0386f601f8 --- /dev/null +++ b/test/built-ins/TypedArrayConstructors/Uint16Array/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/TypedArrayConstructors/Uint32Array/is-a-constructor.js b/test/built-ins/TypedArrayConstructors/Uint32Array/is-a-constructor.js new file mode 100644 index 0000000000..7c20818592 --- /dev/null +++ b/test/built-ins/TypedArrayConstructors/Uint32Array/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/TypedArrayConstructors/Uint8Array/is-a-constructor.js b/test/built-ins/TypedArrayConstructors/Uint8Array/is-a-constructor.js new file mode 100644 index 0000000000..9719e8bfa0 --- /dev/null +++ b/test/built-ins/TypedArrayConstructors/Uint8Array/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/TypedArrayConstructors/Uint8ClampedArray/is-a-constructor.js b/test/built-ins/TypedArrayConstructors/Uint8ClampedArray/is-a-constructor.js new file mode 100644 index 0000000000..4e529de1ea --- /dev/null +++ b/test/built-ins/TypedArrayConstructors/Uint8ClampedArray/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/WeakMap/is-a-constructor.js b/test/built-ins/WeakMap/is-a-constructor.js new file mode 100644 index 0000000000..bda087b141 --- /dev/null +++ b/test/built-ins/WeakMap/is-a-constructor.js @@ -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(); + diff --git a/test/built-ins/WeakRef/is-a-constructor.js b/test/built-ins/WeakRef/is-a-constructor.js new file mode 100644 index 0000000000..07cfd01353 --- /dev/null +++ b/test/built-ins/WeakRef/is-a-constructor.js @@ -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({}) + diff --git a/test/built-ins/WeakSet/is-a-constructor.js b/test/built-ins/WeakSet/is-a-constructor.js new file mode 100644 index 0000000000..2359285512 --- /dev/null +++ b/test/built-ins/WeakSet/is-a-constructor.js @@ -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(); +