diff --git a/test/built-ins/TypedArray/invoked-as-ctor-with-arguments.js b/test/built-ins/TypedArray/invoked-as-ctor-with-arguments.js new file mode 100644 index 0000000000000000000000000000000000000000..6bc266f56bfaf85482b704417ebf7845459384d5 --- /dev/null +++ b/test/built-ins/TypedArray/invoked-as-ctor-with-arguments.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es7id: pending +description: TypedArray(length) cannot be direclty invoked as a constructor +info: > + 22.2.1.1 %TypedArray%()# + + 1. If NewTarget is undefined, throw a TypeError exception. + 2. Let here be the active function object. + 3. If SameValue(NewTarget, here) is true, throw a TypeError exception. + ... + + Note: there's a breaking change from ES2015's 22.2.1.2 step 7 where calling + the %TypedArray% constructor with a floating number as the argument throws a + RangeError exception before checking `SameValue(NewTarget, here)`. +includes: [testTypedArray.js] +---*/ + +assert.throws(TypeError, function() { + new TypedArray(1); +}); + +assert.throws(TypeError, function() { + new TypedArray({}); +}); + +assert.throws(TypeError, function() { + new TypedArray(1.1); +}); diff --git a/test/built-ins/TypedArray/length-invalid.js b/test/built-ins/TypedArray/length-invalid.js deleted file mode 100644 index fc51e5465dbd3858b5699c5443b90934e77ef340..0000000000000000000000000000000000000000 --- a/test/built-ins/TypedArray/length-invalid.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -es6id: 22.2.1.2 -description: TypedArray rejects non-integer arguments -info: > - 22.2.1.2 %TypedArray% ( length ) - - ... - 4. Let numberLength be ToNumber(length). - 5. Let elementLength be ToLength(numberLength). - 6. ReturnIfAbrupt(elementLength). - 7. If SameValueZero(numberLength, elementLength) is false, throw a RangeError - exception. - ... -features: [TypedArray] -includes: [testTypedArray.js] ----*/ - -assert.throws(RangeError, function() { - new TypedArray(1.1); -});