From 9232d65b303620da18e2fe57945275cd3b29cb22 Mon Sep 17 00:00:00 2001 From: Robin Templeton Date: Tue, 24 Oct 2017 11:50:47 -0400 Subject: BigInt TypedArray tests - add @jakobkummerow's changes - remove EOL whitespace - use 'Array.isArray' instead of 'instanceof Array' - check for BigInt type in toLocaleString tests - specify TypedArray constructor list for non-BigInt tests - update TypedArray harness test for BigInt - add a missing type coercion - disable more tests for Big(U)Int64Array - check for BigInt before using BigInt TypedArray constructors --- harness/testTypedArray.js | 20 +++- .../prototype/copyWithin/coerced-values-end.js | 26 ++--- .../prototype/copyWithin/coerced-values-start.js | 34 +++---- .../prototype/copyWithin/coerced-values-target.js | 34 +++---- .../prototype/copyWithin/negative-end.js | 34 +++---- .../copyWithin/negative-out-of-bounds-end.js | 42 ++++---- .../copyWithin/negative-out-of-bounds-start.js | 34 +++---- .../copyWithin/negative-out-of-bounds-target.js | 18 ++-- .../prototype/copyWithin/negative-start.js | 26 ++--- .../prototype/copyWithin/negative-target.js | 14 +-- .../copyWithin/non-negative-out-of-bounds-end.js | 18 ++-- .../non-negative-out-of-bounds-target-and-start.js | 30 +++--- .../copyWithin/non-negative-target-and-start.js | 18 ++-- .../non-negative-target-start-and-end.js | 22 ++--- .../TypedArray/prototype/copyWithin/return-this.js | 4 +- .../prototype/copyWithin/undefined-end.js | 10 +- .../TypedArray/prototype/entries/iter-prototype.js | 4 +- .../TypedArray/prototype/entries/return-itor.js | 12 +-- .../every/callbackfn-arguments-with-thisarg.js | 10 +- .../every/callbackfn-arguments-without-thisarg.js | 10 +- .../callbackfn-no-interaction-over-non-integer.js | 8 +- .../callbackfn-return-does-not-change-instance.js | 10 +- .../callbackfn-set-value-during-interaction.js | 16 +-- .../every/get-length-uses-internal-arraylength.js | 4 +- .../prototype/every/values-are-not-cached.js | 8 +- .../TypedArray/prototype/fill/coerced-indexes.js | 30 +++--- .../prototype/fill/fill-values-conversion-once.js | 8 +- .../fill/fill-values-custom-start-and-end.js | 12 +-- .../prototype/fill/fill-values-non-numeric.js | 36 +++---- .../prototype/fill/fill-values-relative-end.js | 10 +- .../prototype/fill/fill-values-relative-start.js | 10 +- .../TypedArray/prototype/fill/fill-values.js | 6 +- .../fill/get-length-ignores-length-prop.js | 4 +- .../prototype/fill/return-abrupt-from-end.js | 4 +- .../prototype/fill/return-abrupt-from-set-value.js | 4 +- .../prototype/fill/return-abrupt-from-start.js | 4 +- .../TypedArray/prototype/fill/return-this.js | 6 +- .../filter/callbackfn-arguments-with-thisarg.js | 10 +- .../filter/callbackfn-arguments-without-thisarg.js | 10 +- .../callbackfn-no-iteration-over-non-integer.js | 8 +- .../callbackfn-return-does-not-change-instance.js | 10 +- .../callbackfn-set-value-during-iteration.js | 16 +-- .../filter/result-does-not-share-buffer.js | 4 +- .../filter/result-full-callbackfn-returns-true.js | 4 +- .../filter/speciesctor-get-ctor-abrupt.js | 4 +- .../filter/speciesctor-get-ctor-inherited.js | 4 +- .../filter/speciesctor-get-ctor-returns-throws.js | 4 +- .../prototype/filter/speciesctor-get-ctor.js | 4 +- ...eciesctor-get-species-custom-ctor-invocation.js | 6 +- ...species-custom-ctor-returns-another-instance.js | 4 +- .../filter/speciesctor-get-species-custom-ctor.js | 6 +- .../prototype/filter/values-are-not-cached.js | 8 +- .../TypedArray/prototype/filter/values-are-set.js | 10 +- .../find/get-length-ignores-length-prop.js | 6 +- .../prototype/find/predicate-call-changes-value.js | 24 ++--- .../prototype/find/predicate-call-parameters.js | 10 +- .../return-found-value-predicate-result-is-true.js | 20 ++-- .../findIndex/get-length-ignores-length-prop.js | 4 +- .../findIndex/predicate-call-changes-value.js | 20 ++-- .../findIndex/predicate-call-parameters.js | 10 +- .../return-index-predicate-result-is-true.js | 6 +- ...egative-one-if-predicate-returns-false-value.js | 4 +- .../forEach/callbackfn-arguments-with-thisarg.js | 10 +- .../callbackfn-arguments-without-thisarg.js | 10 +- .../callbackfn-no-interaction-over-non-integer.js | 8 +- .../callbackfn-return-does-not-change-instance.js | 10 +- .../callbackfn-set-value-during-interaction.js | 16 +-- .../prototype/forEach/values-are-not-cached.js | 8 +- .../prototype/includes/fromIndex-infinity.js | 8 +- .../prototype/includes/fromIndex-minus-zero.js | 10 +- .../get-length-uses-internal-arraylength.js | 6 +- .../return-abrupt-tointeger-fromindex-symbol.js | 6 +- .../includes/return-abrupt-tointeger-fromindex.js | 6 +- .../TypedArray/prototype/includes/samevaluezero.js | 4 +- .../includes/search-found-returns-true.js | 22 ++--- .../includes/search-not-found-returns-false.js | 16 +-- .../prototype/includes/tointeger-fromindex.js | 36 +++---- .../prototype/indexOf/fromIndex-infinity.js | 8 +- .../prototype/indexOf/fromIndex-minus-zero.js | 8 +- .../get-length-uses-internal-arraylength.js | 6 +- .../indexOf/search-found-returns-index.js | 22 ++--- .../indexOf/search-not-found-returns-minus-one.js | 16 +-- .../prototype/indexOf/strict-comparison.js | 4 +- .../prototype/indexOf/tointeger-fromindex.js | 36 +++---- ...or-result-from-tostring-on-each-simple-value.js | 4 +- ...separator-result-from-tostring-on-each-value.js | 4 +- .../join/get-length-uses-internal-arraylength.js | 4 +- .../result-from-tostring-on-each-simple-value.js | 4 +- .../join/result-from-tostring-on-each-value.js | 4 +- .../TypedArray/prototype/keys/iter-prototype.js | 4 +- .../TypedArray/prototype/keys/return-itor.js | 6 +- .../prototype/lastIndexOf/fromIndex-infinity.js | 8 +- .../prototype/lastIndexOf/fromIndex-minus-zero.js | 8 +- .../get-length-uses-internal-arraylength.js | 6 +- .../lastIndexOf/search-found-returns-index.js | 48 ++++----- .../search-not-found-returns-minus-one.js | 24 ++--- .../prototype/lastIndexOf/strict-comparison.js | 4 +- .../prototype/lastIndexOf/tointeger-fromindex.js | 36 +++---- .../prototype/map/arraylength-internal.js | 4 +- .../map/callbackfn-arguments-with-thisarg.js | 11 ++- .../map/callbackfn-arguments-without-thisarg.js | 11 ++- .../prototype/map/callbackfn-detachbuffer.js | 1 + ...n-no-interaction-over-non-integer-properties.js | 9 +- .../callbackfn-return-affects-returned-object.js | 12 +-- .../callbackfn-return-does-not-change-instance.js | 12 +-- ...-return-does-not-copy-non-integer-properties.js | 6 +- .../map/callbackfn-set-value-during-interaction.js | 17 ++-- .../TypedArray/prototype/map/callbackfn-this.js | 6 +- .../prototype/map/values-are-not-cached.js | 10 +- .../callbackfn-arguments-custom-accumulator.js | 10 +- .../callbackfn-arguments-default-accumulator.js | 14 +-- ...kfn-no-iteration-over-non-integer-properties.js | 8 +- .../callbackfn-return-does-not-change-instance.js | 10 +- .../callbackfn-set-value-during-iteration.js | 16 +-- .../reduce/get-length-uses-internal-arraylength.js | 4 +- .../reduce/result-is-last-callbackfn-return.js | 6 +- .../prototype/reduce/result-of-any-type.js | 4 +- .../return-first-value-without-callbackfn.js | 6 +- .../prototype/reduce/values-are-not-cached.js | 8 +- .../callbackfn-arguments-custom-accumulator.js | 10 +- .../callbackfn-arguments-default-accumulator.js | 14 +-- ...kfn-no-iteration-over-non-integer-properties.js | 8 +- .../callbackfn-return-does-not-change-instance.js | 10 +- .../callbackfn-set-value-during-iteration.js | 16 +-- .../get-length-uses-internal-arraylength.js | 4 +- .../result-is-last-callbackfn-return.js | 6 +- .../prototype/reduceRight/result-of-any-type.js | 4 +- .../return-first-value-without-callbackfn.js | 6 +- .../prototype/reduceRight/values-are-not-cached.js | 8 +- .../get-length-uses-internal-arraylength.js | 4 +- .../TypedArray/prototype/reverse/reverts.js | 30 +++--- .../prototype/set/array-arg-offset-tointeger.js | 110 ++++++++++----------- .../array-arg-return-abrupt-from-src-get-length.js | 4 +- .../array-arg-return-abrupt-from-src-get-value.js | 28 +++--- ...ray-arg-return-abrupt-from-src-length-symbol.js | 4 +- .../set/array-arg-return-abrupt-from-src-length.js | 4 +- ...return-abrupt-from-src-tonumber-value-symbol.js | 20 ++-- ...ay-arg-return-abrupt-from-src-tonumber-value.js | 28 +++--- ...array-arg-return-abrupt-from-toobject-offset.js | 4 +- .../prototype/set/array-arg-set-values-in-order.js | 10 +- .../prototype/set/array-arg-set-values.js | 32 +++--- ...rray-arg-src-tonumber-value-type-conversions.js | 34 ++++--- .../set/array-arg-src-values-are-not-cached.js | 22 ++--- .../set/array-arg-target-arraylength-internal.js | 4 +- ...argetbuffer-detached-on-get-src-value-throws.js | 6 +- .../set/typedarray-arg-offset-tointeger.js | 76 +++++++------- ...darray-arg-set-values-diff-buffer-other-type.js | 19 ++-- ...edarray-arg-set-values-diff-buffer-same-type.js | 16 +-- ...darray-arg-set-values-same-buffer-other-type.js | 2 +- ...edarray-arg-set-values-same-buffer-same-type.js | 14 +-- .../set/typedarray-arg-src-arraylength-internal.js | 4 +- .../set/typedarray-arg-src-byteoffset-internal.js | 9 +- .../typedarray-arg-target-arraylength-internal.js | 4 +- .../typedarray-arg-target-byteoffset-internal.js | 9 +- .../prototype/slice/arraylength-internal.js | 8 +- .../TypedArray/prototype/slice/infinity.js | 8 +- .../TypedArray/prototype/slice/minus-zero.js | 8 +- .../result-does-not-copy-ordinary-properties.js | 4 +- .../slice/results-with-different-length.js | 60 +++++------ .../prototype/slice/results-with-empty-length.js | 4 +- .../prototype/slice/results-with-same-length.js | 12 +-- .../slice/set-values-from-different-ctor-type.js | 9 +- .../prototype/slice/speciesctor-get-ctor-abrupt.js | 4 +- .../slice/speciesctor-get-ctor-inherited.js | 4 +- .../slice/speciesctor-get-ctor-returns-throws.js | 4 +- .../prototype/slice/speciesctor-get-ctor.js | 4 +- ...eciesctor-get-species-custom-ctor-invocation.js | 4 +- ...species-custom-ctor-returns-another-instance.js | 4 +- .../slice/speciesctor-get-species-custom-ctor.js | 6 +- .../TypedArray/prototype/slice/tointeger-end.js | 20 ++-- .../TypedArray/prototype/slice/tointeger-start.js | 30 +++--- .../some/callbackfn-arguments-with-thisarg.js | 10 +- .../some/callbackfn-arguments-without-thisarg.js | 10 +- .../callbackfn-no-interaction-over-non-integer.js | 8 +- .../callbackfn-return-does-not-change-instance.js | 10 +- .../callbackfn-set-value-during-interaction.js | 16 +-- .../some/get-length-uses-internal-arraylength.js | 4 +- .../prototype/some/values-are-not-cached.js | 8 +- .../prototype/sort/arraylength-internal.js | 4 +- .../prototype/sort/comparefn-call-throws.js | 4 +- .../TypedArray/prototype/sort/comparefn-calls.js | 8 +- .../sort/comparefn-nonfunction-call-throws.js | 4 +- .../prototype/sort/return-same-instance.js | 4 +- .../prototype/sort/sortcompare-with-no-tostring.js | 6 +- .../TypedArray/prototype/sort/sorted-values.js | 18 ++-- .../TypedArray/prototype/subarray/infinity.js | 8 +- .../TypedArray/prototype/subarray/minus-zero.js | 8 +- .../result-does-not-copy-ordinary-properties.js | 4 +- .../result-is-new-instance-from-same-ctor.js | 6 +- .../result-is-new-instance-with-shared-buffer.js | 12 +-- .../subarray/results-with-different-length.js | 60 +++++------ .../subarray/results-with-empty-length.js | 4 +- .../prototype/subarray/results-with-same-length.js | 12 +-- .../subarray/speciesctor-get-ctor-abrupt.js | 4 +- .../subarray/speciesctor-get-ctor-inherited.js | 4 +- .../speciesctor-get-ctor-returns-throws.js | 4 +- .../prototype/subarray/speciesctor-get-ctor.js | 4 +- ...eciesctor-get-species-custom-ctor-invocation.js | 4 +- ...species-custom-ctor-returns-another-instance.js | 4 +- .../speciesctor-get-species-custom-ctor.js | 6 +- .../prototype/subarray/tointeger-begin.js | 30 +++--- .../TypedArray/prototype/subarray/tointeger-end.js | 20 ++-- .../calls-tolocalestring-from-each-value.js | 10 +- .../calls-tostring-from-each-value.js | 8 +- .../calls-valueof-from-each-value.js | 8 +- .../get-length-uses-internal-arraylength.js | 4 +- ...turn-abrupt-from-firstelement-tolocalestring.js | 8 +- .../return-abrupt-from-firstelement-tostring.js | 8 +- .../return-abrupt-from-firstelement-valueof.js | 8 +- ...eturn-abrupt-from-nextelement-tolocalestring.js | 8 +- .../return-abrupt-from-nextelement-tostring.js | 8 +- .../return-abrupt-from-nextelement-valueof.js | 8 +- .../prototype/toLocaleString/return-result.js | 4 +- .../TypedArray/prototype/values/iter-prototype.js | 4 +- .../TypedArray/prototype/values/return-itor.js | 12 +-- .../from/custom-ctor-returns-other-instance.js | 12 ++- test/built-ins/TypedArrays/from/mapfn-arguments.js | 3 +- .../TypedArrays/from/mapfn-this-with-thisarg.js | 3 +- .../from/mapfn-this-without-thisarg-non-strict.js | 7 +- .../from/mapfn-this-without-thisarg-strict.js | 3 +- .../from/new-instance-using-custom-ctor.js | 10 +- .../TypedArrays/from/new-instance-with-mapfn.js | 10 +- .../TypedArrays/from/new-instance-without-mapfn.js | 10 +- .../from/set-value-abrupt-completion.js | 5 +- .../DefineOwnProperty/desc-value-throws.js | 4 +- .../key-is-greater-than-last-index.js | 4 +- .../DefineOwnProperty/key-is-lower-than-zero.js | 4 +- .../DefineOwnProperty/key-is-minus-zero.js | 4 +- .../key-is-not-canonical-index.js | 16 +-- .../DefineOwnProperty/key-is-not-integer.js | 16 +-- .../DefineOwnProperty/key-is-not-numeric-index.js | 4 +- .../key-is-numericindex-accessor-desc.js | 8 +- .../key-is-numericindex-desc-configurable.js | 4 +- .../key-is-numericindex-desc-not-enumerable.js | 4 +- .../key-is-numericindex-desc-not-writable.js | 4 +- .../DefineOwnProperty/key-is-numericindex.js | 10 +- .../internals/DefineOwnProperty/key-is-symbol.js | 4 +- .../DefineOwnProperty/non-extensible-new-key.js | 4 +- .../non-extensible-redefine-key.js | 4 +- .../internals/DefineOwnProperty/set-value.js | 12 +-- .../DefineOwnProperty/this-is-not-extensible.js | 4 +- .../detached-buffer-key-is-not-numeric-index.js | 4 +- .../internals/Get/detached-buffer-key-is-symbol.js | 4 +- .../TypedArrays/internals/Get/detached-buffer.js | 4 +- .../TypedArrays/internals/Get/indexed-value-sab.js | 8 +- .../TypedArrays/internals/Get/indexed-value.js | 8 +- .../internals/Get/key-is-not-integer.js | 4 +- .../internals/Get/key-is-not-minus-zero.js | 4 +- .../internals/Get/key-is-not-numeric-index.js | 4 +- .../internals/Get/key-is-out-of-bounds.js | 4 +- .../TypedArrays/internals/Get/key-is-symbol.js | 4 +- .../detached-buffer-key-is-not-number.js | 4 +- .../detached-buffer-key-is-symbol.js | 4 +- .../internals/GetOwnProperty/index-prop-desc.js | 8 +- .../internals/GetOwnProperty/key-is-minus-zero.js | 4 +- .../GetOwnProperty/key-is-not-canonical-index.js | 4 +- .../internals/GetOwnProperty/key-is-not-integer.js | 4 +- .../GetOwnProperty/key-is-not-numeric-index.js | 4 +- .../GetOwnProperty/key-is-out-of-bounds.js | 4 +- .../internals/GetOwnProperty/key-is-symbol.js | 4 +- .../detached-buffer-key-is-not-number.js | 4 +- .../HasProperty/detached-buffer-key-is-symbol.js | 4 +- .../internals/HasProperty/indexed-value.js | 4 +- .../HasProperty/key-is-not-canonical-index.js | 4 +- .../integer-indexes-and-string-and-symbol-keys-.js | 4 +- .../integer-indexes-and-string-keys.js | 4 +- .../internals/OwnPropertyKeys/integer-indexes.js | 4 +- .../detached-buffer-key-is-not-numeric-index.js | 4 +- .../internals/Set/detached-buffer-key-is-symbol.js | 4 +- .../TypedArrays/internals/Set/detached-buffer.js | 16 +-- .../TypedArrays/internals/Set/indexed-value.js | 12 +-- .../TypedArrays/internals/Set/key-is-minus-zero.js | 4 +- .../internals/Set/key-is-not-canonical-index.js | 4 +- .../internals/Set/key-is-not-integer.js | 4 +- .../internals/Set/key-is-not-numeric-index.js | 4 +- .../internals/Set/key-is-out-of-bounds.js | 4 +- .../TypedArrays/internals/Set/key-is-symbol.js | 4 +- .../internals/Set/tonumber-value-throws.js | 4 +- .../built-ins/TypedArrays/length-arg-init-zeros.js | 20 ++-- .../length-arg-proto-from-ctor-realm.js | 2 +- .../TypedArrays/object-arg-as-array-returns.js | 8 +- .../object-arg-as-generator-iterable-returns.js | 8 +- .../object-arg-new-instance-extensibility.js | 16 +-- test/built-ins/TypedArrays/object-arg-returns.js | 4 +- .../TypedArrays/object-arg-throws-from-property.js | 4 +- ...rg-throws-setting-obj-to-primitive-typeerror.js | 4 +- .../object-arg-throws-setting-obj-to-primitive.js | 4 +- .../object-arg-throws-setting-obj-tostring.js | 4 +- ...ect-arg-throws-setting-obj-valueof-typeerror.js | 4 +- .../object-arg-throws-setting-obj-valueof.js | 4 +- .../object-arg-throws-setting-property.js | 4 +- .../TypedArrays/of/argument-number-value-throws.js | 30 +++--- .../of/custom-ctor-returns-other-instance.js | 6 +- .../of/new-instance-using-custom-ctor.js | 10 +- test/built-ins/TypedArrays/of/new-instance.js | 10 +- ...darray-arg-other-ctor-returns-new-typedarray.js | 6 +- .../typedarray-arg-returns-new-instance.js | 2 +- .../typedarray-arg-use-custom-proto-if-object.js | 2 +- ...-default-proto-if-custom-proto-is-not-object.js | 2 +- test/harness/testTypedArray.js | 6 ++ 300 files changed, 1623 insertions(+), 1513 deletions(-) diff --git a/harness/testTypedArray.js b/harness/testTypedArray.js index 2699214ca..7f777b56c 100644 --- a/harness/testTypedArray.js +++ b/harness/testTypedArray.js @@ -20,11 +20,22 @@ var typedArrayConstructors = [ Uint8ClampedArray ]; +var numericTypedArrayConstructors = typedArrayConstructors.slice(); + +if (typeof BigInt !== "undefined") { + typedArrayConstructors.push(BigInt64Array); + typedArrayConstructors.push(BigUint64Array); +} + /** * The %TypedArray% intrinsic constructor function. */ var TypedArray = Object.getPrototypeOf(Int8Array); +function convertToBigInt(x) { + return (Array.isArray(x)) ? x.map(convertToBigInt) : BigInt(x); +} + /** * Callback for testing a typed array constructor. * @@ -41,9 +52,14 @@ var TypedArray = Object.getPrototypeOf(Int8Array); function testWithTypedArrayConstructors(f, selected) { var constructors = selected || typedArrayConstructors; for (var i = 0; i < constructors.length; ++i) { + var N = function(x) { return x; }; var constructor = constructors[i]; + if (constructor.name == "BigInt64Array" || + constructor.name == "BigUint64Array") { + N = convertToBigInt; + } try { - f(constructor); + f(constructor, N); } catch (e) { e.message += " (Testing with " + constructor.name + ".)"; throw e; @@ -75,5 +91,5 @@ function testTypedArrayConversions(byteConversionValues, fn) { } fn(TA, value, exp, initial); }); - }); + }, numericTypedArrayConstructors); } diff --git a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js index 1cd62be56..50f6de2c3 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js @@ -26,51 +26,51 @@ info: | includes: [compareArray.js, testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(1, 0, null), - [0, 1, 2, 3] + new TA(N([0, 1, 2, 3])).copyWithin(1, 0, null), + N([0, 1, 2, 3]) ), 'null value coerced to 0' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(1, 0, NaN), - [0, 1, 2, 3] + new TA(N([0, 1, 2, 3])).copyWithin(1, 0, NaN), + N([0, 1, 2, 3]) ), 'NaN value coerced to 0' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(1, 0, false), - [0, 1, 2, 3] + new TA(N([0, 1, 2, 3])).copyWithin(1, 0, false), + N([0, 1, 2, 3]) ), 'false value coerced to 0' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(1, 0, true), - [0, 0, 2, 3] + new TA(N([0, 1, 2, 3])).copyWithin(1, 0, true), + N([0, 0, 2, 3]) ), 'true value coerced to 1' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(1, 0, '-2'), - [0, 0, 1, 3] + new TA(N([0, 1, 2, 3])).copyWithin(1, 0, '-2'), + N([0, 0, 1, 3]) ), 'string "-2" value coerced to integer -2' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(1, 0, -2.5), - [0, 0, 1, 3] + new TA(N([0, 1, 2, 3])).copyWithin(1, 0, -2.5), + N([0, 0, 1, 3]) ), 'float -2.5 value coerced to integer -2' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js index 96819e395..1fecbd46d 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js @@ -25,67 +25,67 @@ info: | includes: [compareArray.js, testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(1, undefined), - [0, 0, 1, 2] + new TA(N([0, 1, 2, 3])).copyWithin(1, undefined), + N([0, 0, 1, 2]) ), 'undefined value coerced to 0' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(1, false), - [0, 0, 1, 2] + new TA(N([0, 1, 2, 3])).copyWithin(1, false), + N([0, 0, 1, 2]) ), 'false value coerced to 0' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(1, NaN), - [0, 0, 1, 2] + new TA(N([0, 1, 2, 3])).copyWithin(1, NaN), + N([0, 0, 1, 2]) ), 'NaN value coerced to 0' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(1, null), - [0, 0, 1, 2] + new TA(N([0, 1, 2, 3])).copyWithin(1, null), + N([0, 0, 1, 2]) ), 'null value coerced to 0' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(0, true), - [1, 2, 3, 3] + new TA(N([0, 1, 2, 3])).copyWithin(0, true), + N([1, 2, 3, 3]) ), 'true value coerced to 1' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(0, '1'), - [1, 2, 3, 3] + new TA(N([0, 1, 2, 3])).copyWithin(0, '1'), + N([1, 2, 3, 3]) ), 'string "1" value coerced to 1' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(1, 0.5), - [0, 0, 1, 2] + new TA(N([0, 1, 2, 3])).copyWithin(1, 0.5), + N([0, 0, 1, 2]) ), '0.5 float value coerced to integer 0' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(0, 1.5), - [1, 2, 3, 3] + new TA(N([0, 1, 2, 3])).copyWithin(0, 1.5), + N([1, 2, 3, 3]) ), '1.5 float value coerced to integer 1' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js index 8d0c2816d..f49d147b2 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js @@ -25,67 +25,67 @@ info: | includes: [compareArray.js, testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(undefined, 1), - [1, 2, 3, 3] + new TA(N([0, 1, 2, 3])).copyWithin(undefined, 1), + N([1, 2, 3, 3]) ), 'undefined value coerced to 0' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(false, 1), - [1, 2, 3, 3] + new TA(N([0, 1, 2, 3])).copyWithin(false, 1), + N([1, 2, 3, 3]) ), 'false value coerced to 0' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(NaN, 1), - [1, 2, 3, 3] + new TA(N([0, 1, 2, 3])).copyWithin(NaN, 1), + N([1, 2, 3, 3]) ), 'NaN value coerced to 0' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(null, 1), - [1, 2, 3, 3] + new TA(N([0, 1, 2, 3])).copyWithin(null, 1), + N([1, 2, 3, 3]) ), 'null value coerced to 0' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(true, 0), - [0, 0, 1, 2] + new TA(N([0, 1, 2, 3])).copyWithin(true, 0), + N([0, 0, 1, 2]) ), 'true value coerced to 1' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin('1', 0), - [0, 0, 1, 2] + new TA(N([0, 1, 2, 3])).copyWithin('1', 0), + N([0, 0, 1, 2]) ), 'string "1" value coerced to 1' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(0.5, 1), - [1, 2, 3, 3] + new TA(N([0, 1, 2, 3])).copyWithin(0.5, 1), + N([1, 2, 3, 3]) ), '0.5 float value coerced to integer 0' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(1.5, 0), - [0, 0, 1, 2] + new TA(N([0, 1, 2, 3])).copyWithin(1.5, 0), + N([0, 0, 1, 2]) ), '1.5 float value coerced to integer 1' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js index 96c9823f8..4d1bb72cf 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js @@ -28,67 +28,67 @@ info: | includes: [compareArray.js, testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(0, 1, -1), - [1, 2, 2, 3] + new TA(N([0, 1, 2, 3])).copyWithin(0, 1, -1), + N([1, 2, 2, 3]) ), '[0, 1, 2, 3].copyWithin(0, 1, -1) -> [1, 2, 2, 3]' ); assert( compareArray( - new TA([0, 1, 2, 3, 4]).copyWithin(2, 0, -1), - [0, 1, 0, 1, 2] + new TA(N([0, 1, 2, 3, 4])).copyWithin(2, 0, -1), + N([0, 1, 0, 1, 2]) ), '[0, 1, 2, 3, 4].copyWithin(2, 0, -1) -> [0, 1, 0, 1, 2]' ); assert( compareArray( - new TA([0, 1, 2, 3, 4]).copyWithin(1, 2, -2), - [0, 2, 2, 3, 4] + new TA(N([0, 1, 2, 3, 4])).copyWithin(1, 2, -2), + N([0, 2, 2, 3, 4]) ), '[0, 1, 2, 3, 4].copyWithin(1, 2, -2) -> [0, 2, 2, 3, 4]' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(0, -2, -1), - [2, 1, 2, 3] + new TA(N([0, 1, 2, 3])).copyWithin(0, -2, -1), + N([2, 1, 2, 3]) ), '[0, 1, 2, 3].copyWithin(0, -2, -1) -> [2, 1, 2, 3]' ); assert( compareArray( - new TA([0, 1, 2, 3, 4]).copyWithin(2, -2, -1), - [0, 1, 3, 3, 4] + new TA(N([0, 1, 2, 3, 4])).copyWithin(2, -2, -1), + N([0, 1, 3, 3, 4]) ), '[0, 1, 2, 3, 4].copyWithin(2, -2, 1) -> [0, 1, 3, 3, 4]' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(-3, -2, -1), - [0, 2, 2, 3] + new TA(N([0, 1, 2, 3])).copyWithin(-3, -2, -1), + N([0, 2, 2, 3]) ), '[0, 1, 2, 3].copyWithin(-3, -2, -1) -> [0, 2, 2, 3]' ); assert( compareArray( - new TA([0, 1, 2, 3, 4]).copyWithin(-2, -3, -1), - [0, 1, 2, 2, 3] + new TA(N([0, 1, 2, 3, 4])).copyWithin(-2, -3, -1), + N([0, 1, 2, 2, 3]) ), '[0, 1, 2, 3, 4].copyWithin(-2, -3, -1) -> [0, 1, 2, 2, 3]' ); assert( compareArray( - new TA([0, 1, 2, 3, 4]).copyWithin(-5, -2, -1), - [3, 1, 2, 3, 4] + new TA(N([0, 1, 2, 3, 4])).copyWithin(-5, -2, -1), + N([3, 1, 2, 3, 4]) ), '[0, 1, 2, 3, 4].copyWithin(-5, -2, -1) -> [3, 1, 2, 3, 4]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js index 7c55118aa..25ddbcf72 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js @@ -28,83 +28,83 @@ info: | includes: [compareArray.js, testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(0, 1, -10), - [0, 1, 2, 3] + new TA(N([0, 1, 2, 3])).copyWithin(0, 1, -10), + N([0, 1, 2, 3]) ), '[0, 1, 2, 3].copyWithin(0, 1, -10) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA([1, 2, 3, 4, 5]).copyWithin(0, 1, -Infinity), - [1, 2, 3, 4, 5] + new TA(N([1, 2, 3, 4, 5])).copyWithin(0, 1, -Infinity), + N([1, 2, 3, 4, 5]) ), '[1, 2, 3, 4, 5].copyWithin(0, 1, -Infinity) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(0, -2, -10), - [0, 1, 2, 3] + new TA(N([0, 1, 2, 3])).copyWithin(0, -2, -10), + N([0, 1, 2, 3]) ), '[0, 1, 2, 3].copyWithin(0, -2, -10) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA([1, 2, 3, 4, 5]).copyWithin(0, -2, -Infinity), - [1, 2, 3, 4, 5] + new TA(N([1, 2, 3, 4, 5])).copyWithin(0, -2, -Infinity), + N([1, 2, 3, 4, 5]) ), '[1, 2, 3, 4, 5].copyWithin(0, -2, -Infinity) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(0, -9, -10), - [0, 1, 2, 3] + new TA(N([0, 1, 2, 3])).copyWithin(0, -9, -10), + N([0, 1, 2, 3]) ), '[0, 1, 2, 3].copyWithin(0, -9, -10) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA([1, 2, 3, 4, 5]).copyWithin(0, -9, -Infinity), - [1, 2, 3, 4, 5] + new TA(N([1, 2, 3, 4, 5])).copyWithin(0, -9, -Infinity), + N([1, 2, 3, 4, 5]) ), '[1, 2, 3, 4, 5].copyWithin(0, -9, -Infinity) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(-3, -2, -10), - [0, 1, 2, 3] + new TA(N([0, 1, 2, 3])).copyWithin(-3, -2, -10), + N([0, 1, 2, 3]) ), '[0, 1, 2, 3].copyWithin(-3, -2, -10) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA([1, 2, 3, 4, 5]).copyWithin(-3, -2, -Infinity), - [1, 2, 3, 4, 5] + new TA(N([1, 2, 3, 4, 5])).copyWithin(-3, -2, -Infinity), + N([1, 2, 3, 4, 5]) ), '[1, 2, 3, 4, 5].copyWithin(-3, -2, -Infinity) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(-7, -8, -9), - [0, 1, 2, 3] + new TA(N([0, 1, 2, 3])).copyWithin(-7, -8, -9), + N([0, 1, 2, 3]) ), '[0, 1, 2, 3].copyWithin(-7, -8, -9) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA([1, 2, 3, 4, 5]).copyWithin(-7, -8, -Infinity), - [1, 2, 3, 4, 5] + new TA(N([1, 2, 3, 4, 5])).copyWithin(-7, -8, -Infinity), + N([1, 2, 3, 4, 5]) ), '[1, 2, 3, 4, 5].copyWithin(-7, -8, -Infinity) -> [1, 2, 3, 4, 5]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js index 4fdc4eb12..b439a5d2b 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js @@ -26,67 +26,67 @@ info: | includes: [compareArray.js, testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(0, -10), - [0, 1, 2, 3] + new TA(N([0, 1, 2, 3])).copyWithin(0, -10), + N([0, 1, 2, 3]) ), '[0, 1, 2, 3]).copyWithin(0, -10) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA([1, 2, 3, 4, 5]).copyWithin(0, -Infinity), - [1, 2, 3, 4, 5] + new TA(N([1, 2, 3, 4, 5])).copyWithin(0, -Infinity), + N([1, 2, 3, 4, 5]) ), '[1, 2, 3, 4, 5]).copyWithin(0, -Infinity) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA([0, 1, 2, 3, 4]).copyWithin(2, -10), - [0, 1, 0, 1, 2] + new TA(N([0, 1, 2, 3, 4])).copyWithin(2, -10), + N([0, 1, 0, 1, 2]) ), '[0, 1, 2, 3, 4]).copyWithin(2, -2) -> [0, 1, 0, 1, 2]' ); assert( compareArray( - new TA([1, 2, 3, 4, 5]).copyWithin(2, -Infinity), - [1, 2, 1, 2, 3] + new TA(N([1, 2, 3, 4, 5])).copyWithin(2, -Infinity), + N([1, 2, 1, 2, 3]) ), '[1, 2, 3, 4, 5]).copyWithin(2, -Infinity) -> [1, 2, 1, 2, 3]' ); assert( compareArray( - new TA([0, 1, 2, 3, 4]).copyWithin(10, -10), - [0, 1, 2, 3, 4] + new TA(N([0, 1, 2, 3, 4])).copyWithin(10, -10), + N([0, 1, 2, 3, 4]) ), '[0, 1, 2, 3, 4]).copyWithin(10, -10) -> [0, 1, 2, 3, 4]' ); assert( compareArray( - new TA([1, 2, 3, 4, 5]).copyWithin(10, -Infinity), - [1, 2, 3, 4, 5] + new TA(N([1, 2, 3, 4, 5])).copyWithin(10, -Infinity), + N([1, 2, 3, 4, 5]) ), '[1, 2, 3, 4, 5]).copyWithin(10, -Infinity) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(-9, -10), - [0, 1, 2, 3] + new TA(N([0, 1, 2, 3])).copyWithin(-9, -10), + N([0, 1, 2, 3]) ), '[0, 1, 2, 3].copyWithin(-9, -10) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA([1, 2, 3, 4, 5]).copyWithin(-9, -Infinity), - [1, 2, 3, 4, 5] + new TA(N([1, 2, 3, 4, 5])).copyWithin(-9, -Infinity), + N([1, 2, 3, 4, 5]) ), '[1, 2, 3, 4, 5].copyWithin(-9, -Infinity) -> [1, 2, 3, 4, 5]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js index dc46906d3..da99b0918 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js @@ -26,35 +26,35 @@ info: | includes: [compareArray.js, testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(-10, 0), - [0, 1, 2, 3] + new TA(N([0, 1, 2, 3])).copyWithin(-10, 0), + N([0, 1, 2, 3]) ), '[0, 1, 2, 3].copyWithin(-10, 0) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA([1, 2, 3, 4, 5]).copyWithin(-Infinity, 0), - [1, 2, 3, 4, 5] + new TA(N([1, 2, 3, 4, 5])).copyWithin(-Infinity, 0), + N([1, 2, 3, 4, 5]) ), '[1, 2, 3, 4, 5].copyWithin(-Infinity, 0) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA([0, 1, 2, 3, 4]).copyWithin(-10, 2), - [2, 3, 4, 3, 4] + new TA(N([0, 1, 2, 3, 4])).copyWithin(-10, 2), + N([2, 3, 4, 3, 4]) ), '[0, 1, 2, 3, 4].copyWithin(-10, 2) -> [2, 3, 4, 3, 4]' ); assert( compareArray( - new TA([1, 2, 3, 4, 5]).copyWithin(-Infinity, 2), - [3, 4, 5, 4, 5] + new TA(N([1, 2, 3, 4, 5])).copyWithin(-Infinity, 2), + N([3, 4, 5, 4, 5]) ), '[1, 2, 3, 4, 5].copyWithin(-Infinity, 2) -> [3, 4, 5, 4, 5]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js index df73879d4..a5c12e04d 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js @@ -26,51 +26,51 @@ info: | includes: [compareArray.js, testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(0, -1), - [3, 1, 2, 3] + new TA(N([0, 1, 2, 3])).copyWithin(0, -1), + N([3, 1, 2, 3]) ), '[0, 1, 2, 3].copyWithin(0, -1) -> [3, 1, 2, 3]' ); assert( compareArray( - new TA([0, 1, 2, 3, 4]).copyWithin(2, -2), - [0, 1, 3, 4, 4] + new TA(N([0, 1, 2, 3, 4])).copyWithin(2, -2), + N([0, 1, 3, 4, 4]) ), '[0, 1, 2, 3, 4].copyWithin(2, -2) -> [0, 1, 3, 4, 4]' ); assert( compareArray( - new TA([0, 1, 2, 3, 4]).copyWithin(1, -2), - [0, 3, 4, 3, 4] + new TA(N([0, 1, 2, 3, 4])).copyWithin(1, -2), + N([0, 3, 4, 3, 4]) ), '[0, 1, 2, 3, 4].copyWithin(1, -2) -> [0, 3, 4, 3, 4]' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(-1, -2), - [0, 1, 2, 2] + new TA(N([0, 1, 2, 3])).copyWithin(-1, -2), + N([0, 1, 2, 2]) ), '[0, 1, 2, 3].copyWithin(-1, -2) -> [ 0, 1, 2, 2 ]' ); assert( compareArray( - new TA([0, 1, 2, 3, 4]).copyWithin(-2, -3), - [0, 1, 2, 2, 3] + new TA(N([0, 1, 2, 3, 4])).copyWithin(-2, -3), + N([0, 1, 2, 2, 3]) ), '[0, 1, 2, 3, 4].copyWithin(-2, -3) -> [0, 1, 2, 2, 3]' ); assert( compareArray( - new TA([0, 1, 2, 3, 4]).copyWithin(-5, -2), - [3, 4, 2, 3, 4] + new TA(N([0, 1, 2, 3, 4])).copyWithin(-5, -2), + N([3, 4, 2, 3, 4]) ), '[0, 1, 2, 3, 4].copyWithin(-5, -2) -> [3, 4, 2, 3, 4]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js index dfc252b1e..18760a102 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js @@ -26,27 +26,27 @@ info: | includes: [compareArray.js, testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(-1, 0), - [0, 1, 2, 0] + new TA(N([0, 1, 2, 3])).copyWithin(-1, 0), + N([0, 1, 2, 0]) ), '[0, 1, 2, 3].copyWithin(-1, 0) -> [0, 1, 2, 0]' ); assert( compareArray( - new TA([0, 1, 2, 3, 4]).copyWithin(-2, 2), - [0, 1, 2, 2, 3] + new TA(N([0, 1, 2, 3, 4])).copyWithin(-2, 2), + N([0, 1, 2, 2, 3]) ), '[0, 1, 2, 3, 4].copyWithin(-2, 2) -> [0, 1, 2, 2, 3]' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(-1, 2), - [0, 1, 2, 2] + new TA(N([0, 1, 2, 3])).copyWithin(-1, 2), + N([0, 1, 2, 2]) ), '[0, 1, 2, 3].copyWithin(-1, 2) -> [0, 1, 2, 2]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js index 9767106c0..ace11ebb5 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js @@ -19,35 +19,35 @@ info: | includes: [compareArray.js, testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(0, 1, 6), - [1, 2, 3, 3] + new TA(N([0, 1, 2, 3])).copyWithin(0, 1, 6), + N([1, 2, 3, 3]) ), '[0, 1, 2, 3].copyWithin(0, 1, 6) -> [1, 2, 3, 3]' ); assert( compareArray( - new TA([1, 2, 3, 4, 5]).copyWithin(0, 1, Infinity), - [2, 3, 4, 5, 5] + new TA(N([1, 2, 3, 4, 5])).copyWithin(0, 1, Infinity), + N([2, 3, 4, 5, 5]) ), '[1, 2, 3, 4, 5].copyWithin(0, 1, Infinity) -> [2, 3, 4, 5, 5]' ); assert( compareArray( - new TA([0, 1, 2, 3, 4, 5]).copyWithin(1, 3, 6), - [0, 3, 4, 5, 4, 5] + new TA(N([0, 1, 2, 3, 4, 5])).copyWithin(1, 3, 6), + N([0, 3, 4, 5, 4, 5]) ), '[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 6) -> [0, 3, 4, 5, 4, 5]' ); assert( compareArray( - new TA([1, 2, 3, 4, 5]).copyWithin(1, 3, Infinity), - [1, 4, 5, 4, 5] + new TA(N([1, 2, 3, 4, 5])).copyWithin(1, 3, Infinity), + N([1, 4, 5, 4, 5]) ), '[1, 2, 3, 4, 5].copyWithin(1, 3, Infinity) -> [1, 4, 5, 4, 5]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js index f1cc0504a..878009f36 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js @@ -19,55 +19,55 @@ info: | includes: [compareArray.js, testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { assert( compareArray( - new TA([0, 1, 2, 3, 4, 5]).copyWithin(6, 0), - [0, 1, 2, 3, 4, 5] + new TA(N([0, 1, 2, 3, 4, 5])).copyWithin(6, 0), + N([0, 1, 2, 3, 4, 5]) ) ); assert( compareArray( - new TA([1, 2, 3, 4, 5]).copyWithin(Infinity, 0), - [1, 2, 3, 4, 5] + new TA(N([1, 2, 3, 4, 5])).copyWithin(Infinity, 0), + N([1, 2, 3, 4, 5]) ), '[1, 2, 3, 4, 5].copyWithin(Infinity, 0) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA([0, 1, 2, 3, 4, 5]).copyWithin(0, 6), - [0, 1, 2, 3, 4, 5] + new TA(N([0, 1, 2, 3, 4, 5])).copyWithin(0, 6), + N([0, 1, 2, 3, 4, 5]) ) ); assert( compareArray( - new TA([1, 2, 3, 4, 5]).copyWithin(0, Infinity), - [1, 2, 3, 4, 5] + new TA(N([1, 2, 3, 4, 5])).copyWithin(0, Infinity), + N([1, 2, 3, 4, 5]) ), '[1, 2, 3, 4, 5].copyWithin(0, Infinity) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA([0, 1, 2, 3, 4, 5]).copyWithin(6, 6), - [0, 1, 2, 3, 4, 5] + new TA(N([0, 1, 2, 3, 4, 5])).copyWithin(6, 6), + N([0, 1, 2, 3, 4, 5]) ) ); assert( compareArray( - new TA([0, 1, 2, 3, 4, 5]).copyWithin(10, 10), - [0, 1, 2, 3, 4, 5] + new TA(N([0, 1, 2, 3, 4, 5])).copyWithin(10, 10), + N([0, 1, 2, 3, 4, 5]) ) ); assert( compareArray( - new TA([1, 2, 3, 4, 5]).copyWithin(Infinity, Infinity), - [1, 2, 3, 4, 5] + new TA(N([1, 2, 3, 4, 5])).copyWithin(Infinity, Infinity), + N([1, 2, 3, 4, 5]) ), '[1, 2, 3, 4, 5].copyWithin(Infinity, Infinity) -> [1, 2, 3, 4, 5]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js index 4dec6eff8..261223948 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js @@ -19,32 +19,32 @@ info: | includes: [compareArray.js, testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { assert( compareArray( - new TA([1, 2, 3, 4, 5, 6]).copyWithin(0, 0), - [1, 2, 3, 4, 5, 6] + new TA(N([1, 2, 3, 4, 5, 6])).copyWithin(0, 0), + N([1, 2, 3, 4, 5, 6]) ) ); assert( compareArray( - new TA([1, 2, 3, 4, 5, 6]).copyWithin(0, 2), - [3, 4, 5, 6, 5, 6] + new TA(N([1, 2, 3, 4, 5, 6])).copyWithin(0, 2), + N([3, 4, 5, 6, 5, 6]) ) ); assert( compareArray( - new TA([1, 2, 3, 4, 5, 6]).copyWithin(3, 0), - [1, 2, 3, 1, 2, 3] + new TA(N([1, 2, 3, 4, 5, 6])).copyWithin(3, 0), + N([1, 2, 3, 1, 2, 3]) ) ); assert( compareArray( - new TA([0, 1, 2, 3, 4, 5]).copyWithin(1, 4), - [0, 4, 5, 3, 4, 5] + new TA(N([0, 1, 2, 3, 4, 5])).copyWithin(1, 4), + N([0, 4, 5, 3, 4, 5]) ) ); }); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js index c8cd09f17..bbb794cc0 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js @@ -19,27 +19,27 @@ info: | includes: [compareArray.js, testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(0, 0, 0), - [0, 1, 2, 3] + new TA(N([0, 1, 2, 3])).copyWithin(0, 0, 0), + N([0, 1, 2, 3]) ), '[0, 1, 2, 3].copyWithin(0, 0, 0) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(0, 0, 2), - [0, 1, 2, 3] + new TA(N([0, 1, 2, 3])).copyWithin(0, 0, 2), + N([0, 1, 2, 3]) ), '[0, 1, 2, 3].copyWithin(0, 0, 2) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(0, 1, 2), - [1, 1, 2, 3] + new TA(N([0, 1, 2, 3])).copyWithin(0, 1, 2), + N([1, 1, 2, 3]) ), '[0, 1, 2, 3].copyWithin(0, 1, 2) -> [1, 1, 2, 3]' ); @@ -57,16 +57,16 @@ testWithTypedArrayConstructors(function(TA) { */ assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(1, 0, 2), - [0, 0, 1, 3] + new TA(N([0, 1, 2, 3])).copyWithin(1, 0, 2), + N([0, 0, 1, 3]) ), '[0, 1, 2, 3].copyWithin(1, 0, 2) -> [0, 0, 1, 3]' ); assert( compareArray( - new TA([0, 1, 2, 3, 4, 5]).copyWithin(1, 3, 5), - [0, 3, 4, 3, 4, 5] + new TA(N([0, 1, 2, 3, 4, 5])).copyWithin(1, 3, 5), + N([0, 3, 4, 3, 4, 5]) ), '[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 5) -> [0, 3, 4, 3, 4, 5]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/return-this.js b/test/built-ins/TypedArray/prototype/copyWithin/return-this.js index c6ab41ced..cf34d6583 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/return-this.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/return-this.js @@ -24,13 +24,13 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample1 = new TA(); var result1 = sample1.copyWithin(0, 0); assert.sameValue(result1, sample1); - var sample2 = new TA([1, 2, 3]); + var sample2 = new TA(N([1, 2, 3])); var result2 = sample2.copyWithin(1, 0); assert.sameValue(result2, sample2); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js b/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js index bd011026f..4f00f0f33 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js @@ -26,19 +26,19 @@ info: | includes: [compareArray.js, testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(0, 1, undefined), - [1, 2, 3, 3] + new TA(N([0, 1, 2, 3])).copyWithin(0, 1, undefined), + N([1, 2, 3, 3]) ), '[0, 1, 2, 3].copyWithin(0, 1, undefined) -> [1, 2, 3]' ); assert( compareArray( - new TA([0, 1, 2, 3]).copyWithin(0, 1), - [1, 2, 3, 3] + new TA(N([0, 1, 2, 3])).copyWithin(0, 1), + N([1, 2, 3, 3]) ), '[0, 1, 2, 3].copyWithin(0, 1) -> [1, 2, 3, 3]' ); diff --git a/test/built-ins/TypedArray/prototype/entries/iter-prototype.js b/test/built-ins/TypedArray/prototype/entries/iter-prototype.js index f8635fe57..bc16cf1f3 100644 --- a/test/built-ins/TypedArray/prototype/entries/iter-prototype.js +++ b/test/built-ins/TypedArray/prototype/entries/iter-prototype.js @@ -17,8 +17,8 @@ features: [Symbol.iterator, TypedArray] var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]()); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([0, 42, 64]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([0, 42, 64])); var iter = sample.entries(); assert.sameValue(Object.getPrototypeOf(iter), ArrayIteratorProto); diff --git a/test/built-ins/TypedArray/prototype/entries/return-itor.js b/test/built-ins/TypedArray/prototype/entries/return-itor.js index a69d4404e..d7db93696 100644 --- a/test/built-ins/TypedArray/prototype/entries/return-itor.js +++ b/test/built-ins/TypedArray/prototype/entries/return-itor.js @@ -13,22 +13,22 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -var sample = new Int8Array([0, 42, 64]); +var sample = [0, 42, 64]; -testWithTypedArrayConstructors(function(TA) { - var typedArray = new TA(sample); +testWithTypedArrayConstructors(function(TA, N) { + var typedArray = new TA(N(sample)); var itor = typedArray.entries(); var next = itor.next(); - assert(compareArray(next.value, [0, 0])); + assert(compareArray(next.value, [0, N(0)])); assert.sameValue(next.done, false); next = itor.next(); - assert(compareArray(next.value, [1, 42])); + assert(compareArray(next.value, [1, N(42)])); assert.sameValue(next.done, false); next = itor.next(); - assert(compareArray(next.value, [2, 64])); + assert(compareArray(next.value, [2, N(64)])); assert.sameValue(next.done, false); next = itor.next(); diff --git a/test/built-ins/TypedArray/prototype/every/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/every/callbackfn-arguments-with-thisarg.js index 548fa2602..703db4713 100644 --- a/test/built-ins/TypedArray/prototype/every/callbackfn-arguments-with-thisarg.js +++ b/test/built-ins/TypedArray/prototype/every/callbackfn-arguments-with-thisarg.js @@ -25,8 +25,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); var results = []; var thisArg = ["test262", 0, "ecma262", 0]; @@ -40,17 +40,17 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(thisArg.length, 4, "thisArg.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], 42, "results[0][0] - kValue"); + assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], 43, "results[1][0] - kValue"); + assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], 44, "results[2][0] - kValue"); + assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/every/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/every/callbackfn-arguments-without-thisarg.js index 5c3a74689..033e54eac 100644 --- a/test/built-ins/TypedArray/prototype/every/callbackfn-arguments-without-thisarg.js +++ b/test/built-ins/TypedArray/prototype/every/callbackfn-arguments-without-thisarg.js @@ -25,8 +25,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); var results = []; @@ -38,17 +38,17 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(results.length, 3, "results.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], 42, "results[0][0] - kValue"); + assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], 43, "results[1][0] - kValue"); + assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], 44, "results[2][0] - kValue"); + assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/every/callbackfn-no-interaction-over-non-integer.js b/test/built-ins/TypedArray/prototype/every/callbackfn-no-interaction-over-non-integer.js index cfd6aa77e..3631c549e 100644 --- a/test/built-ins/TypedArray/prototype/every/callbackfn-no-interaction-over-non-integer.js +++ b/test/built-ins/TypedArray/prototype/every/callbackfn-no-interaction-over-non-integer.js @@ -18,8 +18,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([7, 8]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([7, 8])); var results = []; @@ -36,6 +36,6 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(results[0][1], 0, "results[0][1] - key"); assert.sameValue(results[1][1], 1, "results[1][1] - key"); - assert.sameValue(results[0][0], 7, "results[0][0] - value"); - assert.sameValue(results[1][0], 8, "results[1][0] - value"); + assert.sameValue(results[0][0], N(7), "results[0][0] - value"); + assert.sameValue(results[1][0], N(8), "results[1][0] - value"); }); diff --git a/test/built-ins/TypedArray/prototype/every/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/every/callbackfn-return-does-not-change-instance.js index 5eeb597c9..c882314fe 100644 --- a/test/built-ins/TypedArray/prototype/every/callbackfn-return-does-not-change-instance.js +++ b/test/built-ins/TypedArray/prototype/every/callbackfn-return-does-not-change-instance.js @@ -25,14 +25,14 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42])); sample.every(function() { return 43; }); - assert.sameValue(sample[0], 40, "[0] == 40"); - assert.sameValue(sample[1], 41, "[1] == 41"); - assert.sameValue(sample[2], 42, "[2] == 42"); + assert.sameValue(sample[0], N(40), "[0] == 40"); + assert.sameValue(sample[1], N(41), "[1] == 41"); + assert.sameValue(sample[2], N(42), "[2] == 42"); }); diff --git a/test/built-ins/TypedArray/prototype/every/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/every/callbackfn-set-value-during-interaction.js index 3b8f537e1..290a3fd69 100644 --- a/test/built-ins/TypedArray/prototype/every/callbackfn-set-value-during-interaction.js +++ b/test/built-ins/TypedArray/prototype/every/callbackfn-set-value-during-interaction.js @@ -25,24 +25,24 @@ includes: [testTypedArray.js] features: [Reflect.set, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); var newVal = 0; sample.every(function(val, i) { if (i > 0) { assert.sameValue( - sample[i - 1], newVal - 1, + sample[i - 1], N(newVal - 1), "get the changed value during the loop" ); assert.sameValue( - Reflect.set(sample, 0, 7), + Reflect.set(sample, 0, N(7)), true, "re-set a value for sample[0]" ); } assert.sameValue( - Reflect.set(sample, i, newVal), + Reflect.set(sample, i, N(newVal)), true, "set value during iteration" ); @@ -52,7 +52,7 @@ testWithTypedArrayConstructors(function(TA) { return true; }); - assert.sameValue(sample[0], 7, "changed values after iteration [0] == 7"); - assert.sameValue(sample[1], 1, "changed values after iteration [1] == 1"); - assert.sameValue(sample[2], 2, "changed values after iteration [2] == 2"); + assert.sameValue(sample[0], N(7), "changed values after iteration [0] == 7"); + assert.sameValue(sample[1], N(1), "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], N(2), "changed values after iteration [2] == 2"); }); diff --git a/test/built-ins/TypedArray/prototype/every/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/every/get-length-uses-internal-arraylength.js index e7bbae8fc..7101f75c6 100644 --- a/test/built-ins/TypedArray/prototype/every/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/every/get-length-uses-internal-arraylength.js @@ -30,8 +30,8 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); var calls = 0; Object.defineProperty(TA.prototype, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/every/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/every/values-are-not-cached.js index d9afa33bb..e9cec7b7f 100644 --- a/test/built-ins/TypedArray/prototype/every/values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/every/values-are-not-cached.js @@ -26,16 +26,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); sample.every(function(v, i) { if (i < sample.length - 1) { - sample[i+1] = 42; + sample[i+1] = N(42); } assert.sameValue( - v, 42, "method does not cache values before callbackfn calls" + v, N(42), "method does not cache values before callbackfn calls" ); return true; }); diff --git a/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js b/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js index 352a91d1a..1fb4c00de 100644 --- a/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js +++ b/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js @@ -31,74 +31,74 @@ info: | includes: [compareArray.js, testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { assert( - compareArray(new TA([0, 0]).fill(1, undefined), [1, 1]), + compareArray(new TA(N([0, 0])).fill(N(1), undefined), N([1, 1])), '`undefined` start coerced to 0' ); assert( - compareArray(new TA([0, 0]).fill(1, 0, undefined), [1, 1]), + compareArray(new TA(N([0, 0])).fill(N(1), 0, undefined), N([1, 1])), 'If end is undefined, let relativeEnd be len' ); assert( - compareArray(new TA([0, 0]).fill(1, null), [1, 1]), + compareArray(new TA(N([0, 0])).fill(N(1), null), N([1, 1])), '`null` start coerced to 0' ); assert( - compareArray(new TA([0, 0]).fill(1, 0, null), [0, 0]), + compareArray(new TA(N([0, 0])).fill(N(1), 0, null), N([0, 0])), '`null` end coerced to 0' ); assert( - compareArray(new TA([0, 0]).fill(1, true), [0, 1]), + compareArray(new TA(N([0, 0])).fill(N(1), true), N([0, 1])), '`true` start coerced to 1' ); assert( - compareArray(new TA([0, 0]).fill(1, 0, true), [1, 0]), + compareArray(new TA(N([0, 0])).fill(N(1), 0, true), N([1, 0])), '`true` end coerced to 1' ); assert( - compareArray(new TA([0, 0]).fill(1, false), [1, 1]), + compareArray(new TA(N([0, 0])).fill(N(1), false), N([1, 1])), '`false` start coerced to 0' ); assert( - compareArray(new TA([0, 0]).fill(1, 0, false), [0, 0]), + compareArray(new TA(N([0, 0])).fill(N(1), 0, false), N([0, 0])), '`false` end coerced to 0' ); assert( - compareArray(new TA([0, 0]).fill(1, NaN), [1, 1]), + compareArray(new TA(N([0, 0])).fill(N(1), NaN), N([1, 1])), '`NaN` start coerced to 0' ); assert( - compareArray(new TA([0, 0]).fill(1, 0, NaN), [0, 0]), + compareArray(new TA(N([0, 0])).fill(N(1), 0, NaN), N([0, 0])), '`NaN` end coerced to 0' ); assert( - compareArray(new TA([0, 0]).fill(1, '1'), [0, 1]), + compareArray(new TA(N([0, 0])).fill(N(1), '1'), N([0, 1])), 'string start coerced' ); assert( - compareArray(new TA([0, 0]).fill(1, 0, '1'), [1, 0]), + compareArray(new TA(N([0, 0])).fill(N(1), 0, '1'), N([1, 0])), 'string end coerced' ); assert( - compareArray(new TA([0, 0]).fill(1, 1.5), [0, 1]), + compareArray(new TA(N([0, 0])).fill(N(1), 1.5), N([0, 1])), 'start as a float number coerced' ); assert( - compareArray(new TA([0, 0]).fill(1, 0, 1.5), [1, 0]), + compareArray(new TA(N([0, 0])).fill(N(1), 0, 1.5), N([1, 0])), 'end as a float number coerced' ); }); diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-once.js b/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-once.js index f5e1bd6b7..4237c8061 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-once.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-once.js @@ -14,14 +14,14 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample = new TA(2); var n = 1; - sample.fill({ valueOf() { return n++; } }); + sample.fill({ valueOf() { return N(n++); } }); assert.sameValue(n, 2, "additional unexpected ToNumber() calls"); - assert.sameValue(sample[0], 1, "incorrect ToNumber result in index 0"); - assert.sameValue(sample[1], 1, "incorrect ToNumber result in index 1"); + assert.sameValue(sample[0], N(1), "incorrect ToNumber result in index 0"); + assert.sameValue(sample[1], N(1), "incorrect ToNumber result in index 1"); }); diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js b/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js index 8db9082d4..836a0986f 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js @@ -33,10 +33,10 @@ info: | includes: [compareArray.js, testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(TA) { - assert(compareArray(new TA([0, 0, 0]).fill(8, 1, 2), [0, 8, 0])); - assert(compareArray(new TA([0, 0, 0, 0, 0]).fill(8, -3, 4), [0, 0, 8, 8, 0])); - assert(compareArray(new TA([0, 0, 0, 0, 0]).fill(8, -2, -1), [0, 0, 0, 8, 0])); - assert(compareArray(new TA([0, 0, 0, 0, 0]).fill(8, -1, -3), [0, 0, 0, 0, 0])); - assert(compareArray(new TA([0, 0, 0, 0, 0]).fill(8, 1, 3), [0, 8, 8, 0, 0])); +testWithTypedArrayConstructors(function(TA, N) { + assert(compareArray(new TA(N([0, 0, 0])).fill(N(8), 1, 2), N([0, 8, 0]))); + assert(compareArray(new TA(N([0, 0, 0, 0, 0])).fill(N(8), -3, 4), N([0, 0, 8, 8, 0]))); + assert(compareArray(new TA(N([0, 0, 0, 0, 0])).fill(N(8), -2, -1), N([0, 0, 0, 8, 0]))); + assert(compareArray(new TA(N([0, 0, 0, 0, 0])).fill(N(8), -1, -3), N([0, 0, 0, 0, 0]))); + assert(compareArray(new TA(N([0, 0, 0, 0, 0])).fill(N(8), 1, 3), N([0, 8, 8, 0, 0]))); }); diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js b/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js index 1d8cd4b6a..0b935fd44 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js @@ -37,41 +37,43 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample; - sample = new TA([42]); - sample.fill(null); - assert.sameValue(sample[0], 0, "null => 0"); + if (numericTypedArrayConstructors.includes(TA)) { + sample = new TA(N([42])); + sample.fill(null); + assert.sameValue(sample[0], 0, "null => 0"); + } - sample = new TA([42]); + sample = new TA(N([42])); sample.fill(false); - assert.sameValue(sample[0], 0, "false => 0"); + assert.sameValue(sample[0], N(0), "false => 0"); - sample = new TA([42]); + sample = new TA(N([42])); sample.fill(true); - assert.sameValue(sample[0], 1, "true => 1"); + assert.sameValue(sample[0], N(1), "true => 1"); - sample = new TA([42]); + sample = new TA(N([42])); sample.fill("7"); - assert.sameValue(sample[0], 7, "string conversion"); + assert.sameValue(sample[0], N(7), "string conversion"); - sample = new TA([42]); + sample = new TA(N([42])); sample.fill({ toString: function() { - return 1; + return "1"; }, valueOf: function() { - return 7; + return N(7); } }); - assert.sameValue(sample[0], 7, "object valueOf conversion before toString"); + assert.sameValue(sample[0], N(7), "object valueOf conversion before toString"); - sample = new TA([42]); + sample = new TA(N([42])); sample.fill({ toString: function() { - return 7; + return "7"; } }); - assert.sameValue(sample[0], 7, "object toString when valueOf is absent"); + assert.sameValue(sample[0], N(7), "object toString when valueOf is absent"); }); diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js index fe0b82d75..786169b34 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js @@ -30,24 +30,24 @@ info: | includes: [compareArray.js, testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { assert( - compareArray(new TA([0, 0, 0]).fill(8, 0, 1), [8, 0, 0]), + compareArray(new TA(N([0, 0, 0])).fill(N(8), 0, 1), N([8, 0, 0])), "Fill elements from custom end position" ); assert( - compareArray(new TA([0, 0, 0]).fill(8, 0, -1), [8, 8, 0]), + compareArray(new TA(N([0, 0, 0])).fill(N(8), 0, -1), N([8, 8, 0])), "negative end sets final position to max((length + relativeEnd), 0)" ); assert( - compareArray(new TA([0, 0, 0]).fill(8, 0, 5), [8, 8, 8]), + compareArray(new TA(N([0, 0, 0])).fill(N(8), 0, 5), N([8, 8, 8])), "end position is never higher than of length" ); assert( - compareArray(new TA([0, 0, 0]).fill(8, 0, -4), [0, 0, 0]), + compareArray(new TA(N([0, 0, 0])).fill(N(8), 0, -4), N([0, 0, 0])), "end position is 0 when (len + relativeEnd) < 0" ); }); diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js index 68ca82f00..4a9f38799 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js @@ -28,24 +28,24 @@ info: | includes: [compareArray.js, testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { assert( - compareArray(new TA([0, 0, 0]).fill(8, 1), [0, 8, 8]), + compareArray(new TA(N([0, 0, 0])).fill(N(8), 1), N([0, 8, 8])), "Fill elements from custom start position" ); assert( - compareArray(new TA([0, 0, 0]).fill(8, 4), [0, 0, 0]), + compareArray(new TA(N([0, 0, 0])).fill(N(8), 4), N([0, 0, 0])), "start position is never higher than length" ); assert( - compareArray(new TA([0, 0, 0]).fill(8, -1), [0, 0, 8]), + compareArray(new TA(N([0, 0, 0])).fill(N(8), -1), N([0, 0, 8])), "start < 0 sets initial position to max((len + relativeStart), 0)" ); assert( - compareArray(new TA([0, 0, 0]).fill(8, -5), [8, 8, 8]), + compareArray(new TA(N([0, 0, 0])).fill(N(8), -5), N([8, 8, 8])), "start position is 0 when (len + relativeStart) < 0" ); }); diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values.js b/test/built-ins/TypedArray/prototype/fill/fill-values.js index 70da31da6..0f3ceddf5 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values.js @@ -28,17 +28,17 @@ info: | includes: [compareArray.js, testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { assert( compareArray( - new TA().fill(8), + new TA().fill(N(8)), [] ), "does not fill an empty instance" ); assert( - compareArray(new TA([0, 0, 0]).fill(8), [8, 8, 8]), + compareArray(new TA(N([0, 0, 0])).fill(N(8)), N([8, 8, 8])), "Default start and end indexes are 0 and this.length" ); }); diff --git a/test/built-ins/TypedArray/prototype/fill/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/fill/get-length-ignores-length-prop.js index d3d9723d2..b0432cb2a 100644 --- a/test/built-ins/TypedArray/prototype/fill/get-length-ignores-length-prop.js +++ b/test/built-ins/TypedArray/prototype/fill/get-length-ignores-length-prop.js @@ -34,7 +34,7 @@ Object.defineProperty(TypedArray.prototype, "length", { } }); -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { Object.defineProperty(TA.prototype, "length", { get: function() { throw new Test262Error(); @@ -48,5 +48,5 @@ testWithTypedArrayConstructors(function(TA) { } }); - assert.sameValue(sample.fill(1, 0), sample); + assert.sameValue(sample.fill(N(1), 0), sample); }); diff --git a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end.js b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end.js index 7a90c2888..f50c840d7 100644 --- a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end.js +++ b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end.js @@ -35,9 +35,9 @@ var end = { } }; -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample = new TA(); assert.throws(Test262Error, function() { - sample.fill(1, 0, end); + sample.fill(N(1), 0, end); }); }); diff --git a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js index d57b5189c..207b67a7e 100644 --- a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js +++ b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js @@ -37,8 +37,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42])); var obj = { valueOf: function() { throw new Test262Error(); diff --git a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start.js b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start.js index 5e4ac67a1..6f3dc4070 100644 --- a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start.js +++ b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start.js @@ -34,9 +34,9 @@ var start = { } }; -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample = new TA(); assert.throws(Test262Error, function() { - sample.fill(1, start); + sample.fill(N(1), start); }); }); diff --git a/test/built-ins/TypedArray/prototype/fill/return-this.js b/test/built-ins/TypedArray/prototype/fill/return-this.js index 38c91d71a..b920053a5 100644 --- a/test/built-ins/TypedArray/prototype/fill/return-this.js +++ b/test/built-ins/TypedArray/prototype/fill/return-this.js @@ -9,13 +9,13 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample1 = new TA(); - var result1 = sample1.fill(1); + var result1 = sample1.fill(N(1)); assert.sameValue(result1, sample1); var sample2 = new TA(42); - var result2 = sample2.fill(7); + var result2 = sample2.fill(N(7)); assert.sameValue(result2, sample2); }); diff --git a/test/built-ins/TypedArray/prototype/filter/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/filter/callbackfn-arguments-with-thisarg.js index ea90d12a0..d16a5e361 100644 --- a/test/built-ins/TypedArray/prototype/filter/callbackfn-arguments-with-thisarg.js +++ b/test/built-ins/TypedArray/prototype/filter/callbackfn-arguments-with-thisarg.js @@ -16,8 +16,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); var results = []; var thisArg = ["test262", 0, "ecma262", 0]; @@ -30,17 +30,17 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(thisArg.length, 4, "thisArg.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], 42, "results[0][0] - kValue"); + assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], 43, "results[1][0] - kValue"); + assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], 44, "results[2][0] - kValue"); + assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/filter/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/filter/callbackfn-arguments-without-thisarg.js index 557107c93..95a30a38e 100644 --- a/test/built-ins/TypedArray/prototype/filter/callbackfn-arguments-without-thisarg.js +++ b/test/built-ins/TypedArray/prototype/filter/callbackfn-arguments-without-thisarg.js @@ -16,8 +16,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); var results = []; @@ -28,17 +28,17 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(results.length, 3, "results.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], 42, "results[0][0] - kValue"); + assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], 43, "results[1][0] - kValue"); + assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], 44, "results[2][0] - kValue"); + assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/filter/callbackfn-no-iteration-over-non-integer.js b/test/built-ins/TypedArray/prototype/filter/callbackfn-no-iteration-over-non-integer.js index 6a9c5d282..16691aac8 100644 --- a/test/built-ins/TypedArray/prototype/filter/callbackfn-no-iteration-over-non-integer.js +++ b/test/built-ins/TypedArray/prototype/filter/callbackfn-no-iteration-over-non-integer.js @@ -16,8 +16,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([7, 8]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([7, 8])); var results = []; @@ -33,6 +33,6 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); - assert.sameValue(results[0][0], 7, "results[0][0] - kValue"); - assert.sameValue(results[1][0], 8, "results[1][0] - kValue"); + assert.sameValue(results[0][0], N(7), "results[0][0] - kValue"); + assert.sameValue(results[1][0], N(8), "results[1][0] - kValue"); }); diff --git a/test/built-ins/TypedArray/prototype/filter/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/filter/callbackfn-return-does-not-change-instance.js index 7d3776296..6bf3f93af 100644 --- a/test/built-ins/TypedArray/prototype/filter/callbackfn-return-does-not-change-instance.js +++ b/test/built-ins/TypedArray/prototype/filter/callbackfn-return-does-not-change-instance.js @@ -8,16 +8,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample1 = new TA(3); - sample1[1] = 1; + sample1[1] = N(1); sample1.filter(function() { return 42; }); - assert.sameValue(sample1[0], 0, "[0] == 0"); - assert.sameValue(sample1[1], 1, "[1] == 1"); - assert.sameValue(sample1[2], 0, "[2] == 0"); + assert.sameValue(sample1[0], N(0), "[0] == 0"); + assert.sameValue(sample1[1], N(1), "[1] == 1"); + assert.sameValue(sample1[2], N(0), "[2] == 0"); }); diff --git a/test/built-ins/TypedArray/prototype/filter/callbackfn-set-value-during-iteration.js b/test/built-ins/TypedArray/prototype/filter/callbackfn-set-value-during-iteration.js index 97c4ae7d3..5ef780ce1 100644 --- a/test/built-ins/TypedArray/prototype/filter/callbackfn-set-value-during-iteration.js +++ b/test/built-ins/TypedArray/prototype/filter/callbackfn-set-value-during-iteration.js @@ -16,24 +16,24 @@ includes: [testTypedArray.js] features: [Reflect.set, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); var newVal = 0; sample.filter(function(val, i) { if (i > 0) { assert.sameValue( - sample[i - 1], newVal - 1, + sample[i - 1], N(newVal - 1), "get the changed value during the loop" ); assert.sameValue( - Reflect.set(sample, 0, 7), + Reflect.set(sample, 0, N(7)), true, "re-set a value for sample[0]" ); } assert.sameValue( - Reflect.set(sample, i, newVal), + Reflect.set(sample, i, N(newVal)), true, "set value during interaction" ); @@ -41,7 +41,7 @@ testWithTypedArrayConstructors(function(TA) { newVal++; }); - assert.sameValue(sample[0], 7, "changed values after interaction [0] == 7"); - assert.sameValue(sample[1], 1, "changed values after interaction [1] == 1"); - assert.sameValue(sample[2], 2, "changed values after interaction [2] == 2"); + assert.sameValue(sample[0], N(7), "changed values after interaction [0] == 7"); + assert.sameValue(sample[1], N(1), "changed values after interaction [1] == 1"); + assert.sameValue(sample[2], N(2), "changed values after interaction [2] == 2"); }); diff --git a/test/built-ins/TypedArray/prototype/filter/result-does-not-share-buffer.js b/test/built-ins/TypedArray/prototype/filter/result-does-not-share-buffer.js index bbd292d14..1d68757d6 100644 --- a/test/built-ins/TypedArray/prototype/filter/result-does-not-share-buffer.js +++ b/test/built-ins/TypedArray/prototype/filter/result-does-not-share-buffer.js @@ -15,8 +15,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42])); var result; result = sample.filter(function() { return true; }); diff --git a/test/built-ins/TypedArray/prototype/filter/result-full-callbackfn-returns-true.js b/test/built-ins/TypedArray/prototype/filter/result-full-callbackfn-returns-true.js index f46bf483d..299979989 100644 --- a/test/built-ins/TypedArray/prototype/filter/result-full-callbackfn-returns-true.js +++ b/test/built-ins/TypedArray/prototype/filter/result-full-callbackfn-returns-true.js @@ -16,8 +16,8 @@ includes: [testTypedArray.js, compareArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42])); [ true, diff --git a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-abrupt.js b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-abrupt.js index 6f9099eae..e4d589050 100644 --- a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-abrupt.js +++ b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-abrupt.js @@ -26,8 +26,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); Object.defineProperty(sample, "constructor", { get: function() { diff --git a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-inherited.js b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-inherited.js index 9db63a8eb..f58f47211 100644 --- a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-inherited.js +++ b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-inherited.js @@ -26,8 +26,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); var calls = 0; var result; diff --git a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-returns-throws.js b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-returns-throws.js index a63bd2e53..9b574031c 100644 --- a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-returns-throws.js +++ b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-returns-throws.js @@ -30,8 +30,8 @@ features: [Symbol, TypedArray] var callbackfn = function() { return true; }; -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); sample.constructor = 42; assert.throws(TypeError, function() { diff --git a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor.js b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor.js index 6308fe92f..23b11e3fd 100644 --- a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor.js +++ b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor.js @@ -26,8 +26,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); var calls = 0; var result; diff --git a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor-invocation.js b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor-invocation.js index ad8313a26..3339c513a 100644 --- a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor-invocation.js +++ b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor-invocation.js @@ -36,8 +36,8 @@ includes: [testTypedArray.js] features: [Symbol.species, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 42, 42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 42, 42])); var result, ctorThis; sample.constructor = {}; @@ -47,7 +47,7 @@ testWithTypedArrayConstructors(function(TA) { return new TA(count); }; - sample.filter(function(v) { return v === 42; }); + sample.filter(function(v) { return v === N(42); }); assert.sameValue(result.length, 1, "called with 1 argument"); assert.sameValue(result[0], 2, "[0] is the new captured length"); diff --git a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor-returns-another-instance.js b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor-returns-another-instance.js index 79547878b..5181cf3c7 100644 --- a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor-returns-another-instance.js +++ b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor-returns-another-instance.js @@ -36,8 +36,8 @@ includes: [testTypedArray.js, compareArray.js] features: [Symbol.species, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40])); var otherTA = TA === Int8Array ? Int16Array : Int8Array; var other = new otherTA([1, 0, 1]); var result; diff --git a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor.js b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor.js index 28e12b135..309f646a3 100644 --- a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor.js +++ b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor.js @@ -36,8 +36,8 @@ includes: [testTypedArray.js, compareArray.js] features: [Symbol.species, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42])); var calls = 0; var other, result; @@ -52,5 +52,5 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(calls, 1, "ctor called once"); assert.sameValue(result, other, "return is instance of custom constructor"); - assert(compareArray(result, [40, 41, 42]), "values are set on the new obj"); + assert(compareArray(result, N([40, 41, 42])), "values are set on the new obj"); }); diff --git a/test/built-ins/TypedArray/prototype/filter/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/filter/values-are-not-cached.js index 1b24d310e..47c0d465f 100644 --- a/test/built-ins/TypedArray/prototype/filter/values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/filter/values-are-not-cached.js @@ -16,16 +16,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); sample.filter(function(v, i) { if (i < sample.length - 1) { - sample[i+1] = 42; + sample[i+1] = N(42); } assert.sameValue( - v, 42, "method does not cache values before callbackfn calls" + v, N(42), "method does not cache values before callbackfn calls" ); }); }); diff --git a/test/built-ins/TypedArray/prototype/filter/values-are-set.js b/test/built-ins/TypedArray/prototype/filter/values-are-set.js index c9f16b8df..2a033c701 100644 --- a/test/built-ins/TypedArray/prototype/filter/values-are-set.js +++ b/test/built-ins/TypedArray/prototype/filter/values-are-set.js @@ -16,15 +16,15 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([41, 1, 42, 7]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([41, 1, 42, 7])); var result; result = sample.filter(function() { return true; }); - assert(compareArray(result, [41, 1, 42, 7]), "values are set #1"); + assert(compareArray(result, N([41, 1, 42, 7])), "values are set #1"); result = sample.filter(function(v) { - return v > 40; + return v > N(40); }); - assert(compareArray(result, [41, 42]), "values are set #2"); + assert(compareArray(result, N([41, 42])), "values are set #2"); }); diff --git a/test/built-ins/TypedArray/prototype/find/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/find/get-length-ignores-length-prop.js index b62f9170f..754c2d307 100644 --- a/test/built-ins/TypedArray/prototype/find/get-length-ignores-length-prop.js +++ b/test/built-ins/TypedArray/prototype/find/get-length-ignores-length-prop.js @@ -32,14 +32,14 @@ Object.defineProperty(TypedArray.prototype, "length", { } }); -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { Object.defineProperty(TA.prototype, "length", { get: function() { throw new Test262Error(); } }); - var sample = new TA([42]); + var sample = new TA(N([42])); Object.defineProperty(sample, "length", { get: function() { @@ -50,6 +50,6 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue( sample.find(function() { return true; }), - 42 + N(42) ); }); diff --git a/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js index 556fb9851..b036a7c92 100644 --- a/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js +++ b/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js @@ -29,8 +29,8 @@ info: | includes: [compareArray.js, testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(TA) { - var arr = [1, 2, 3]; +testWithTypedArrayConstructors(function(TA, N) { + var arr = N([1, 2, 3]); var sample; var result; @@ -38,41 +38,41 @@ testWithTypedArrayConstructors(function(TA) { sample.find(function(val, i) { sample[i] = arr[i]; - assert.sameValue(val, 0, "value is not mapped to instance"); + assert.sameValue(val, N(0), "value is not mapped to instance"); }); assert(compareArray(sample, arr), "values set during each predicate call"); sample = new TA(arr); result = sample.find(function(val, i) { if ( i === 0 ) { - sample[2] = 7; + sample[2] = N(7); } - return val === 7; + return val === N(7); }); - assert.sameValue(result, 7, "value found"); + assert.sameValue(result, N(7), "value found"); sample = new TA(arr); result = sample.find(function(val, i) { if ( i === 0 ) { - sample[2] = 7; + sample[2] = N(7); } - return val === 3; + return val === N(3); }); assert.sameValue(result, undefined, "value not found"); sample = new TA(arr); result = sample.find(function(val, i) { if ( i > 0 ) { - sample[0] = 7; + sample[0] = N(7); } - return val === 7; + return val === N(7); }); assert.sameValue(result, undefined, "value not found - changed after call"); sample = new TA(arr); result = sample.find(function() { - sample[0] = 7; + sample[0] = N(7); return true; }); - assert.sameValue(result, 1, "find() returns previous found value"); + assert.sameValue(result, N(1), "find() returns previous found value"); }); diff --git a/test/built-ins/TypedArray/prototype/find/predicate-call-parameters.js b/test/built-ins/TypedArray/prototype/find/predicate-call-parameters.js index 02c20a2c9..e31cb9522 100644 --- a/test/built-ins/TypedArray/prototype/find/predicate-call-parameters.js +++ b/test/built-ins/TypedArray/prototype/find/predicate-call-parameters.js @@ -30,8 +30,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([39, 2, 62]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([39, 2, 62])); var results = []; var result; @@ -44,19 +44,19 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(results.length, 3, "predicate is called for each index"); result = results[0]; - assert.sameValue(result[0], 39, "results[0][0] === 39, value"); + assert.sameValue(result[0], N(39), "results[0][0] === 39, value"); assert.sameValue(result[1], 0, "results[0][1] === 0, index"); assert.sameValue(result[2], sample, "results[0][2] === sample, instance"); assert.sameValue(result.length, 3, "results[0].length === 3 arguments"); result = results[1]; - assert.sameValue(result[0], 2, "results[1][0] === 2, value"); + assert.sameValue(result[0], N(2), "results[1][0] === 2, value"); assert.sameValue(result[1], 1, "results[1][1] === 1, index"); assert.sameValue(result[2], sample, "results[1][2] === sample, instance"); assert.sameValue(result.length, 3, "results[1].length === 3 arguments"); result = results[2]; - assert.sameValue(result[0], 62, "results[2][0] === 62, value"); + assert.sameValue(result[0], N(62), "results[2][0] === 62, value"); assert.sameValue(result[1], 2, "results[2][1] === 2, index"); assert.sameValue(result[2], sample, "results[2][2] === sample, instance"); assert.sameValue(result.length, 3, "results[2].length === 3 arguments"); diff --git a/test/built-ins/TypedArray/prototype/find/return-found-value-predicate-result-is-true.js b/test/built-ins/TypedArray/prototype/find/return-found-value-predicate-result-is-true.js index a2d0302c6..716b1638b 100644 --- a/test/built-ins/TypedArray/prototype/find/return-found-value-predicate-result-is-true.js +++ b/test/built-ins/TypedArray/prototype/find/return-found-value-predicate-result-is-true.js @@ -29,8 +29,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([39, 2, 62]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([39, 2, 62])); var called, result; called = 0; @@ -38,29 +38,29 @@ testWithTypedArrayConstructors(function(TA) { called++; return true; }); - assert.sameValue(result, 39, "returned true on sample[0]"); + assert.sameValue(result, N(39), "returned true on sample[0]"); assert.sameValue(called, 1, "predicate was called once"); called = 0; result = sample.find(function(val) { called++; - return val === 62; + return val === N(62); }); assert.sameValue(called, 3, "predicate was called three times"); - assert.sameValue(result, 62, "returned true on sample[3]"); + assert.sameValue(result, N(62), "returned true on sample[3]"); result = sample.find(function() { return "string"; }); - assert.sameValue(result, 39, "ToBoolean(string)"); + assert.sameValue(result, N(39), "ToBoolean(string)"); result = sample.find(function() { return {}; }); - assert.sameValue(result, 39, "ToBoolean(object)"); + assert.sameValue(result, N(39), "ToBoolean(object)"); result = sample.find(function() { return Symbol(""); }); - assert.sameValue(result, 39, "ToBoolean(symbol)"); + assert.sameValue(result, N(39), "ToBoolean(symbol)"); result = sample.find(function() { return 1; }); - assert.sameValue(result, 39, "ToBoolean(number)"); + assert.sameValue(result, N(39), "ToBoolean(number)"); result = sample.find(function() { return -1; }); - assert.sameValue(result, 39, "ToBoolean(negative number)"); + assert.sameValue(result, N(39), "ToBoolean(negative number)"); }); diff --git a/test/built-ins/TypedArray/prototype/findIndex/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/findIndex/get-length-ignores-length-prop.js index 99566c3d5..697f3ef43 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/get-length-ignores-length-prop.js +++ b/test/built-ins/TypedArray/prototype/findIndex/get-length-ignores-length-prop.js @@ -30,14 +30,14 @@ Object.defineProperty(TypedArray.prototype, "length", { } }); -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { Object.defineProperty(TA.prototype, "length", { get: function() { throw new Test262Error(); } }); - var sample = new TA([42]); + var sample = new TA(N([42])); Object.defineProperty(sample, "length", { get: function() { diff --git a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js index 84efabc26..e2a0fab02 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js +++ b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js @@ -25,8 +25,8 @@ info: | includes: [compareArray.js, testTypedArray.js] ---*/ -testWithTypedArrayConstructors(function(TA) { - var arr = [10, 20, 30]; +testWithTypedArrayConstructors(function(TA, N) { + var arr = N([10, 20, 30]); var sample; var result; @@ -34,34 +34,34 @@ testWithTypedArrayConstructors(function(TA) { sample.findIndex(function(val, i) { sample[i] = arr[i]; - assert.sameValue(val, 0, "value is not mapped to instance"); + assert.sameValue(val, N(0), "value is not mapped to instance"); }); assert(compareArray(sample, arr), "values set during each predicate call"); sample = new TA(arr); result = sample.findIndex(function(val, i) { if ( i === 0 ) { - sample[2] = 7; + sample[2] = N(7); } - return val === 7; + return val === N(7); }); assert.sameValue(result, 2, "value found"); sample = new TA(arr); result = sample.findIndex(function(val, i) { if ( i === 0 ) { - sample[2] = 7; + sample[2] = N(7); } - return val === 30; + return val === N(30); }); assert.sameValue(result, -1, "value not found"); sample = new TA(arr); result = sample.findIndex(function(val, i) { if ( i > 0 ) { - sample[0] = 7; + sample[0] = N(7); } - return val === 7; + return val === N(7); }); assert.sameValue(result, -1, "value not found - changed after call"); -}); \ No newline at end of file +}); diff --git a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-parameters.js b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-parameters.js index a4102dcb3..c19ccd1d9 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-parameters.js +++ b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-parameters.js @@ -28,8 +28,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([39, 2, 62]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([39, 2, 62])); var results = []; var result; @@ -42,19 +42,19 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(results.length, 3, "predicate is called for each index"); result = results[0]; - assert.sameValue(result[0], 39, "results[0][0] === 39, value"); + assert.sameValue(result[0], N(39), "results[0][0] === 39, value"); assert.sameValue(result[1], 0, "results[0][1] === 0, index"); assert.sameValue(result[2], sample, "results[0][2] === sample, instance"); assert.sameValue(result.length, 3, "results[0].length === 3, arguments"); result = results[1]; - assert.sameValue(result[0], 2, "results[1][0] === 2, value"); + assert.sameValue(result[0], N(2), "results[1][0] === 2, value"); assert.sameValue(result[1], 1, "results[1][1] === 1, index"); assert.sameValue(result[2], sample, "results[1][2] === sample, instance"); assert.sameValue(result.length, 3, "results[1].length === 3, arguments"); result = results[2]; - assert.sameValue(result[0], 62, "results[2][0] === 62, value"); + assert.sameValue(result[0], N(62), "results[2][0] === 62, value"); assert.sameValue(result[1], 2, "results[2][1] === 2, index"); assert.sameValue(result[2], sample, "results[2][2] === sample, instance"); assert.sameValue(result.length, 3, "results[2].length === 3, arguments"); diff --git a/test/built-ins/TypedArray/prototype/findIndex/return-index-predicate-result-is-true.js b/test/built-ins/TypedArray/prototype/findIndex/return-index-predicate-result-is-true.js index 9e4880f22..1e56448ca 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/return-index-predicate-result-is-true.js +++ b/test/built-ins/TypedArray/prototype/findIndex/return-index-predicate-result-is-true.js @@ -28,8 +28,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([39, 3, 9]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([39, 3, 9])); var called = 0; var result = sample.findIndex(function() { @@ -43,7 +43,7 @@ testWithTypedArrayConstructors(function(TA) { called = 0; result = sample.findIndex(function(val) { called++; - return val === 9; + return val === N(9); }); assert.sameValue(called, 3, "predicate was called three times"); diff --git a/test/built-ins/TypedArray/prototype/findIndex/return-negative-one-if-predicate-returns-false-value.js b/test/built-ins/TypedArray/prototype/findIndex/return-negative-one-if-predicate-returns-false-value.js index f3367fbfa..7a8b9d9e5 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/return-negative-one-if-predicate-returns-false-value.js +++ b/test/built-ins/TypedArray/prototype/findIndex/return-negative-one-if-predicate-returns-false-value.js @@ -27,8 +27,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([1, 2, 3]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([1, 2, 3])); var called = 0; var result = sample.findIndex(function() { diff --git a/test/built-ins/TypedArray/prototype/forEach/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/forEach/callbackfn-arguments-with-thisarg.js index 13ae208be..15a960ab9 100644 --- a/test/built-ins/TypedArray/prototype/forEach/callbackfn-arguments-with-thisarg.js +++ b/test/built-ins/TypedArray/prototype/forEach/callbackfn-arguments-with-thisarg.js @@ -25,8 +25,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); var results = []; var thisArg = ["test262", 0, "ecma262", 0]; @@ -39,17 +39,17 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(thisArg.length, 4, "thisArg.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], 42, "results[0][0] - kValue"); + assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], 43, "results[1][0] - kValue"); + assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], 44, "results[2][0] - kValue"); + assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/forEach/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/forEach/callbackfn-arguments-without-thisarg.js index 1255dbf2b..454df6941 100644 --- a/test/built-ins/TypedArray/prototype/forEach/callbackfn-arguments-without-thisarg.js +++ b/test/built-ins/TypedArray/prototype/forEach/callbackfn-arguments-without-thisarg.js @@ -25,8 +25,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); var results = []; @@ -37,17 +37,17 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(results.length, 3, "results.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], 42, "results[0][0] - kValue"); + assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], 43, "results[1][0] - kValue"); + assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], 44, "results[2][0] - kValue"); + assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/forEach/callbackfn-no-interaction-over-non-integer.js b/test/built-ins/TypedArray/prototype/forEach/callbackfn-no-interaction-over-non-integer.js index 4056d65f4..a36a8824b 100644 --- a/test/built-ins/TypedArray/prototype/forEach/callbackfn-no-interaction-over-non-integer.js +++ b/test/built-ins/TypedArray/prototype/forEach/callbackfn-no-interaction-over-non-integer.js @@ -19,8 +19,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([7, 8]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([7, 8])); var results = []; @@ -36,6 +36,6 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); - assert.sameValue(results[0][0], 7, "results[0][0] - kValue"); - assert.sameValue(results[1][0], 8, "results[1][0] - kValue"); + assert.sameValue(results[0][0], N(7), "results[0][0] - kValue"); + assert.sameValue(results[1][0], N(8), "results[1][0] - kValue"); }); diff --git a/test/built-ins/TypedArray/prototype/forEach/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/forEach/callbackfn-return-does-not-change-instance.js index 19584f112..b2c7f3ff5 100644 --- a/test/built-ins/TypedArray/prototype/forEach/callbackfn-return-does-not-change-instance.js +++ b/test/built-ins/TypedArray/prototype/forEach/callbackfn-return-does-not-change-instance.js @@ -15,16 +15,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample1 = new TA(3); - sample1[1] = 1; + sample1[1] = N(1); sample1.forEach(function() { return 42; }); - assert.sameValue(sample1[0], 0, "[0] == 0"); - assert.sameValue(sample1[1], 1, "[1] == 1"); - assert.sameValue(sample1[2], 0, "[2] == 0"); + assert.sameValue(sample1[0], N(0), "[0] == 0"); + assert.sameValue(sample1[1], N(1), "[1] == 1"); + assert.sameValue(sample1[2], N(0), "[2] == 0"); }); diff --git a/test/built-ins/TypedArray/prototype/forEach/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/forEach/callbackfn-set-value-during-interaction.js index 8cae0a4c5..4c5a73bbf 100644 --- a/test/built-ins/TypedArray/prototype/forEach/callbackfn-set-value-during-interaction.js +++ b/test/built-ins/TypedArray/prototype/forEach/callbackfn-set-value-during-interaction.js @@ -16,24 +16,24 @@ includes: [testTypedArray.js] features: [Reflect.set, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); var newVal = 0; sample.forEach(function(val, i) { if (i > 0) { assert.sameValue( - sample[i - 1], newVal - 1, + sample[i - 1], N(newVal - 1), "get the changed value during the loop" ); assert.sameValue( - Reflect.set(sample, 0, 7), + Reflect.set(sample, 0, N(7)), true, "re-set a value for sample[0]" ); } assert.sameValue( - Reflect.set(sample, i, newVal), + Reflect.set(sample, i, N(newVal)), true, "set value during iteration" ); @@ -41,7 +41,7 @@ testWithTypedArrayConstructors(function(TA) { newVal++; }); - assert.sameValue(sample[0], 7, "changed values after iteration [0] == 7"); - assert.sameValue(sample[1], 1, "changed values after iteration [1] == 1"); - assert.sameValue(sample[2], 2, "changed values after iteration [2] == 2"); + assert.sameValue(sample[0], N(7), "changed values after iteration [0] == 7"); + assert.sameValue(sample[1], N(1), "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], N(2), "changed values after iteration [2] == 2"); }); diff --git a/test/built-ins/TypedArray/prototype/forEach/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/forEach/values-are-not-cached.js index 10b311356..7a965668d 100644 --- a/test/built-ins/TypedArray/prototype/forEach/values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/forEach/values-are-not-cached.js @@ -16,16 +16,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); sample.forEach(function(v, i) { if (i < sample.length - 1) { - sample[i+1] = 42; + sample[i+1] = N(42); } assert.sameValue( - v, 42, "method does not cache values before callbackfn calls" + v, N(42), "method does not cache values before callbackfn calls" ); }); }); diff --git a/test/built-ins/TypedArray/prototype/includes/fromIndex-infinity.js b/test/built-ins/TypedArray/prototype/includes/fromIndex-infinity.js index b9af6be50..f904d82a5 100644 --- a/test/built-ins/TypedArray/prototype/includes/fromIndex-infinity.js +++ b/test/built-ins/TypedArray/prototype/includes/fromIndex-infinity.js @@ -29,16 +29,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 43, 41]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 43, 41])); assert.sameValue( - sample.includes(43, Infinity), + sample.includes(N(43), Infinity), false, "includes(43, Infinity)" ); assert.sameValue( - sample.includes(43, -Infinity), + sample.includes(N(43), -Infinity), true, "includes(43, -Infinity)"); }); diff --git a/test/built-ins/TypedArray/prototype/includes/fromIndex-minus-zero.js b/test/built-ins/TypedArray/prototype/includes/fromIndex-minus-zero.js index be2fedf7c..3d4c08fb7 100644 --- a/test/built-ins/TypedArray/prototype/includes/fromIndex-minus-zero.js +++ b/test/built-ins/TypedArray/prototype/includes/fromIndex-minus-zero.js @@ -24,11 +24,11 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample; - sample = new TA([42, 43]); - assert.sameValue(sample.includes(42, -0), true, "-0 [0]"); - assert.sameValue(sample.includes(43, -0), true, "-0 [1]"); - assert.sameValue(sample.includes(44, -0), false, "-0 [2]"); + sample = new TA(N([42, 43])); + assert.sameValue(sample.includes(N(42), -0), true, "-0 [0]"); + assert.sameValue(sample.includes(N(43), -0), true, "-0 [1]"); + assert.sameValue(sample.includes(N(44), -0), false, "-0 [2]"); }); diff --git a/test/built-ins/TypedArray/prototype/includes/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/includes/get-length-uses-internal-arraylength.js index eb10a80bd..c8b6b6280 100644 --- a/test/built-ins/TypedArray/prototype/includes/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/includes/get-length-uses-internal-arraylength.js @@ -23,11 +23,11 @@ features: [TypedArray] Object.defineProperty(TypedArray.prototype, "length", {value: 0}); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([7]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([7])); Object.defineProperty(TA.prototype, "length", {value: 0}); Object.defineProperty(sample, "length", {value: 0}); - assert.sameValue(sample.includes(7), true); + assert.sameValue(sample.includes(N(7)), true); }); diff --git a/test/built-ins/TypedArray/prototype/includes/return-abrupt-tointeger-fromindex-symbol.js b/test/built-ins/TypedArray/prototype/includes/return-abrupt-tointeger-fromindex-symbol.js index 5e5364d5b..cc4207aa3 100644 --- a/test/built-ins/TypedArray/prototype/includes/return-abrupt-tointeger-fromindex-symbol.js +++ b/test/built-ins/TypedArray/prototype/includes/return-abrupt-tointeger-fromindex-symbol.js @@ -24,10 +24,10 @@ features: [Symbol, TypedArray] var fromIndex = Symbol("1"); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([7]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([7])); assert.throws(TypeError, function() { - sample.includes(7, fromIndex); + sample.includes(N(7), fromIndex); }); }); diff --git a/test/built-ins/TypedArray/prototype/includes/return-abrupt-tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/includes/return-abrupt-tointeger-fromindex.js index b17b6e343..40a1f6dbc 100644 --- a/test/built-ins/TypedArray/prototype/includes/return-abrupt-tointeger-fromindex.js +++ b/test/built-ins/TypedArray/prototype/includes/return-abrupt-tointeger-fromindex.js @@ -28,10 +28,10 @@ var fromIndex = { } }; -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([7]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([7])); assert.throws(Test262Error, function() { - sample.includes(7, fromIndex); + sample.includes(N(7), fromIndex); }); }); diff --git a/test/built-ins/TypedArray/prototype/includes/samevaluezero.js b/test/built-ins/TypedArray/prototype/includes/samevaluezero.js index c6ad3785b..c06e20b1a 100644 --- a/test/built-ins/TypedArray/prototype/includes/samevaluezero.js +++ b/test/built-ins/TypedArray/prototype/includes/samevaluezero.js @@ -36,7 +36,9 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(sample.includes(false), false, "false"); assert.sameValue(sample.includes(null), false, "null"); assert.sameValue(sample.includes(""), false, "empty string"); -}); +}, + // ToBigInt(undefined) throws a TypeError exception. + numericTypedArrayConstructors); testWithTypedArrayConstructors(function(FloatArray) { var sample = new FloatArray([42, 0, 1, undefined, NaN]); diff --git a/test/built-ins/TypedArray/prototype/includes/search-found-returns-true.js b/test/built-ins/TypedArray/prototype/includes/search-found-returns-true.js index e77ace260..27c6e25f0 100644 --- a/test/built-ins/TypedArray/prototype/includes/search-found-returns-true.js +++ b/test/built-ins/TypedArray/prototype/includes/search-found-returns-true.js @@ -29,16 +29,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 42, 41]); - assert.sameValue(sample.includes(42), true, "includes(42)"); - assert.sameValue(sample.includes(43), true, "includes(43)"); - assert.sameValue(sample.includes(43, 1), true, "includes(43, 1)"); - assert.sameValue(sample.includes(42, 1), true, "includes(42, 1)"); - assert.sameValue(sample.includes(42, 2), true, "includes(42, 2)"); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 42, 41])); + assert.sameValue(sample.includes(N(42)), true, "includes(42)"); + assert.sameValue(sample.includes(N(43)), true, "includes(43)"); + assert.sameValue(sample.includes(N(43), 1), true, "includes(43, 1)"); + assert.sameValue(sample.includes(N(42), 1), true, "includes(42, 1)"); + assert.sameValue(sample.includes(N(42), 2), true, "includes(42, 2)"); - assert.sameValue(sample.includes(42, -4), true, "includes(42, -4)"); - assert.sameValue(sample.includes(42, -3), true, "includes(42, -3)"); - assert.sameValue(sample.includes(42, -2), true, "includes(42, -2)"); - assert.sameValue(sample.includes(42, -5), true, "includes(42, -5)"); + assert.sameValue(sample.includes(N(42), -4), true, "includes(42, -4)"); + assert.sameValue(sample.includes(N(42), -3), true, "includes(42, -3)"); + assert.sameValue(sample.includes(N(42), -2), true, "includes(42, -2)"); + assert.sameValue(sample.includes(N(42), -5), true, "includes(42, -5)"); }); diff --git a/test/built-ins/TypedArray/prototype/includes/search-not-found-returns-false.js b/test/built-ins/TypedArray/prototype/includes/search-not-found-returns-false.js index 4000cd39b..8654b4d36 100644 --- a/test/built-ins/TypedArray/prototype/includes/search-not-found-returns-false.js +++ b/test/built-ins/TypedArray/prototype/includes/search-not-found-returns-false.js @@ -29,14 +29,14 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample; - sample = new TA([42, 43, 42, 41]); - assert.sameValue(sample.includes(44), false, "includes(44)"); - assert.sameValue(sample.includes(43, 2), false, "includes(43, 2)"); - assert.sameValue(sample.includes(42, 3), false, "includes(42, 3)"); - assert.sameValue(sample.includes(44, -4), false, "includes(44, -4)"); - assert.sameValue(sample.includes(44, -5), false, "includes(44, -5)"); - assert.sameValue(sample.includes(42, -1), false, "includes(42, -1)"); + sample = new TA(N([42, 43, 42, 41])); + assert.sameValue(sample.includes(N(44)), false, "includes(44)"); + assert.sameValue(sample.includes(N(43), 2), false, "includes(43, 2)"); + assert.sameValue(sample.includes(N(42), 3), false, "includes(42, 3)"); + assert.sameValue(sample.includes(N(44), -4), false, "includes(44, -4)"); + assert.sameValue(sample.includes(N(44), -5), false, "includes(44, -5)"); + assert.sameValue(sample.includes(N(42), -1), false, "includes(42, -1)"); }); diff --git a/test/built-ins/TypedArray/prototype/includes/tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/includes/tointeger-fromindex.js index 9a2be979f..9ab7c404a 100644 --- a/test/built-ins/TypedArray/prototype/includes/tointeger-fromindex.js +++ b/test/built-ins/TypedArray/prototype/includes/tointeger-fromindex.js @@ -35,31 +35,31 @@ var obj = { } }; -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample; - sample = new TA([42, 43]); - assert.sameValue(sample.includes(42, "1"), false, "string [0]"); - assert.sameValue(sample.includes(43, "1"), true, "string [1]"); + sample = new TA(N([42, 43])); + assert.sameValue(sample.includes(N(42), "1"), false, "string [0]"); + assert.sameValue(sample.includes(N(43), "1"), true, "string [1]"); - assert.sameValue(sample.includes(42, true), false, "true [0]"); - assert.sameValue(sample.includes(43, true), true, "true [1]"); + assert.sameValue(sample.includes(N(42), true), false, "true [0]"); + assert.sameValue(sample.includes(N(43), true), true, "true [1]"); - assert.sameValue(sample.includes(42, false), true, "false [0]"); - assert.sameValue(sample.includes(43, false), true, "false [1]"); + assert.sameValue(sample.includes(N(42), false), true, "false [0]"); + assert.sameValue(sample.includes(N(43), false), true, "false [1]"); - assert.sameValue(sample.includes(42, NaN), true, "NaN [0]"); - assert.sameValue(sample.includes(43, NaN), true, "NaN [1]"); + assert.sameValue(sample.includes(N(42), NaN), true, "NaN [0]"); + assert.sameValue(sample.includes(N(43), NaN), true, "NaN [1]"); - assert.sameValue(sample.includes(42, null), true, "null [0]"); - assert.sameValue(sample.includes(43, null), true, "null [1]"); + assert.sameValue(sample.includes(N(42), null), true, "null [0]"); + assert.sameValue(sample.includes(N(43), null), true, "null [1]"); - assert.sameValue(sample.includes(42, undefined), true, "undefined [0]"); - assert.sameValue(sample.includes(43, undefined), true, "undefined [1]"); + assert.sameValue(sample.includes(N(42), undefined), true, "undefined [0]"); + assert.sameValue(sample.includes(N(43), undefined), true, "undefined [1]"); - assert.sameValue(sample.includes(42, null), true, "null [0]"); - assert.sameValue(sample.includes(43, null), true, "null [1]"); + assert.sameValue(sample.includes(N(42), null), true, "null [0]"); + assert.sameValue(sample.includes(N(43), null), true, "null [1]"); - assert.sameValue(sample.includes(42, obj), false, "object [0]"); - assert.sameValue(sample.includes(43, obj), true, "object [1]"); + assert.sameValue(sample.includes(N(42), obj), false, "object [0]"); + assert.sameValue(sample.includes(N(43), obj), true, "object [1]"); }); diff --git a/test/built-ins/TypedArray/prototype/indexOf/fromIndex-infinity.js b/test/built-ins/TypedArray/prototype/indexOf/fromIndex-infinity.js index a048138c0..e4a61ec96 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/fromIndex-infinity.js +++ b/test/built-ins/TypedArray/prototype/indexOf/fromIndex-infinity.js @@ -31,9 +31,9 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 43, 41]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 43, 41])); - assert.sameValue(sample.indexOf(43, Infinity), -1, "indexOf(43, Infinity)"); - assert.sameValue(sample.indexOf(43, -Infinity), 1, "indexOf(43, -Infinity)"); + assert.sameValue(sample.indexOf(N(43), Infinity), -1, "indexOf(43, Infinity)"); + assert.sameValue(sample.indexOf(N(43), -Infinity), 1, "indexOf(43, -Infinity)"); }); diff --git a/test/built-ins/TypedArray/prototype/indexOf/fromIndex-minus-zero.js b/test/built-ins/TypedArray/prototype/indexOf/fromIndex-minus-zero.js index 3e4dfae8f..46fbb0550 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/fromIndex-minus-zero.js +++ b/test/built-ins/TypedArray/prototype/indexOf/fromIndex-minus-zero.js @@ -21,10 +21,10 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample; - sample = new TA([42, 43]); - assert.sameValue(sample.indexOf(42, -0), 0, "-0 [0]"); - assert.sameValue(sample.indexOf(43, -0), 1, "-0 [1]"); + sample = new TA(N([42, 43])); + assert.sameValue(sample.indexOf(N(42), -0), 0, "-0 [0]"); + assert.sameValue(sample.indexOf(N(43), -0), 1, "-0 [1]"); }); diff --git a/test/built-ins/TypedArray/prototype/indexOf/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/indexOf/get-length-uses-internal-arraylength.js index 2703a0519..fb3d62349 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/indexOf/get-length-uses-internal-arraylength.js @@ -22,11 +22,11 @@ features: [TypedArray] Object.defineProperty(TypedArray.prototype, "length", {value: 0}); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([7]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([7])); Object.defineProperty(TA.prototype, "length", {value: 0}); Object.defineProperty(sample, "length", {value: 0}); - assert.sameValue(sample.indexOf(7), 0); + assert.sameValue(sample.indexOf(N(7)), 0); }); diff --git a/test/built-ins/TypedArray/prototype/indexOf/search-found-returns-index.js b/test/built-ins/TypedArray/prototype/indexOf/search-found-returns-index.js index 48500c1a8..4a75a3a0a 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/search-found-returns-index.js +++ b/test/built-ins/TypedArray/prototype/indexOf/search-found-returns-index.js @@ -31,16 +31,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 42, 41]); - assert.sameValue(sample.indexOf(42), 0, "indexOf(42)"); - assert.sameValue(sample.indexOf(43), 1, "indexOf(43)"); - assert.sameValue(sample.indexOf(43, 1), 1, "indexOf(43, 1)"); - assert.sameValue(sample.indexOf(42, 1), 2, "indexOf(42, 1)"); - assert.sameValue(sample.indexOf(42, 2), 2, "indexOf(42, 2)"); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 42, 41])); + assert.sameValue(sample.indexOf(N(42)), 0, "indexOf(42)"); + assert.sameValue(sample.indexOf(N(43)), 1, "indexOf(43)"); + assert.sameValue(sample.indexOf(N(43), 1), 1, "indexOf(43, 1)"); + assert.sameValue(sample.indexOf(N(42), 1), 2, "indexOf(42, 1)"); + assert.sameValue(sample.indexOf(N(42), 2), 2, "indexOf(42, 2)"); - assert.sameValue(sample.indexOf(42, -4), 0, "indexOf(42, -4)"); - assert.sameValue(sample.indexOf(42, -3), 2, "indexOf(42, -3)"); - assert.sameValue(sample.indexOf(42, -2), 2, "indexOf(42, -2)"); - assert.sameValue(sample.indexOf(42, -5), 0, "indexOf(42, -5)"); + assert.sameValue(sample.indexOf(N(42), -4), 0, "indexOf(42, -4)"); + assert.sameValue(sample.indexOf(N(42), -3), 2, "indexOf(42, -3)"); + assert.sameValue(sample.indexOf(N(42), -2), 2, "indexOf(42, -2)"); + assert.sameValue(sample.indexOf(N(42), -5), 0, "indexOf(42, -5)"); }); diff --git a/test/built-ins/TypedArray/prototype/indexOf/search-not-found-returns-minus-one.js b/test/built-ins/TypedArray/prototype/indexOf/search-not-found-returns-minus-one.js index ee8f513dc..8c0917920 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/search-not-found-returns-minus-one.js +++ b/test/built-ins/TypedArray/prototype/indexOf/search-not-found-returns-minus-one.js @@ -25,14 +25,14 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample; - sample = new TA([42, 43, 42, 41]); - assert.sameValue(sample.indexOf(44), -1, "indexOf(44)"); - assert.sameValue(sample.indexOf(43, 2), -1, "indexOf(43, 2)"); - assert.sameValue(sample.indexOf(42, 3), -1, "indexOf(42, 3)"); - assert.sameValue(sample.indexOf(44, -4), -1, "indexOf(44, -4)"); - assert.sameValue(sample.indexOf(44, -5), -1, "indexOf(44, -5)"); - assert.sameValue(sample.indexOf(42, -1), -1, "indexOf(42, -1)"); + sample = new TA(N([42, 43, 42, 41])); + assert.sameValue(sample.indexOf(N(44)), -1, "indexOf(44)"); + assert.sameValue(sample.indexOf(N(43), 2), -1, "indexOf(43, 2)"); + assert.sameValue(sample.indexOf(N(42), 3), -1, "indexOf(42, 3)"); + assert.sameValue(sample.indexOf(N(44), -4), -1, "indexOf(44, -4)"); + assert.sameValue(sample.indexOf(N(44), -5), -1, "indexOf(44, -5)"); + assert.sameValue(sample.indexOf(N(42), -1), -1, "indexOf(42, -1)"); }); diff --git a/test/built-ins/TypedArray/prototype/indexOf/strict-comparison.js b/test/built-ins/TypedArray/prototype/indexOf/strict-comparison.js index 5a7883f97..ddd3540f8 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/strict-comparison.js +++ b/test/built-ins/TypedArray/prototype/indexOf/strict-comparison.js @@ -38,4 +38,6 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(sample.indexOf(null), -1, "null"); assert.sameValue(sample.indexOf(undefined), -1, "undefined"); assert.sameValue(sample.indexOf(""), -1, "empty string"); -}); +}, + // Cannot create Big*64Arrays from non-safe integers. + numericTypedArrayConstructors); diff --git a/test/built-ins/TypedArray/prototype/indexOf/tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/indexOf/tointeger-fromindex.js index f733d249c..2672ddb12 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/tointeger-fromindex.js +++ b/test/built-ins/TypedArray/prototype/indexOf/tointeger-fromindex.js @@ -27,31 +27,31 @@ var obj = { } }; -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample; - sample = new TA([42, 43]); - assert.sameValue(sample.indexOf(42, "1"), -1, "string [0]"); - assert.sameValue(sample.indexOf(43, "1"), 1, "string [1]"); + sample = new TA(N([42, 43])); + assert.sameValue(sample.indexOf(N(42), "1"), -1, "string [0]"); + assert.sameValue(sample.indexOf(N(43), "1"), 1, "string [1]"); - assert.sameValue(sample.indexOf(42, true), -1, "true [0]"); - assert.sameValue(sample.indexOf(43, true), 1, "true [1]"); + assert.sameValue(sample.indexOf(N(42), true), -1, "true [0]"); + assert.sameValue(sample.indexOf(N(43), true), 1, "true [1]"); - assert.sameValue(sample.indexOf(42, false), 0, "false [0]"); - assert.sameValue(sample.indexOf(43, false), 1, "false [1]"); + assert.sameValue(sample.indexOf(N(42), false), 0, "false [0]"); + assert.sameValue(sample.indexOf(N(43), false), 1, "false [1]"); - assert.sameValue(sample.indexOf(42, NaN), 0, "NaN [0]"); - assert.sameValue(sample.indexOf(43, NaN), 1, "NaN [1]"); + assert.sameValue(sample.indexOf(N(42), NaN), 0, "NaN [0]"); + assert.sameValue(sample.indexOf(N(43), NaN), 1, "NaN [1]"); - assert.sameValue(sample.indexOf(42, null), 0, "null [0]"); - assert.sameValue(sample.indexOf(43, null), 1, "null [1]"); + assert.sameValue(sample.indexOf(N(42), null), 0, "null [0]"); + assert.sameValue(sample.indexOf(N(43), null), 1, "null [1]"); - assert.sameValue(sample.indexOf(42, undefined), 0, "undefined [0]"); - assert.sameValue(sample.indexOf(43, undefined), 1, "undefined [1]"); + assert.sameValue(sample.indexOf(N(42), undefined), 0, "undefined [0]"); + assert.sameValue(sample.indexOf(N(43), undefined), 1, "undefined [1]"); - assert.sameValue(sample.indexOf(42, null), 0, "null [0]"); - assert.sameValue(sample.indexOf(43, null), 1, "null [1]"); + assert.sameValue(sample.indexOf(N(42), null), 0, "null [0]"); + assert.sameValue(sample.indexOf(N(43), null), 1, "null [1]"); - assert.sameValue(sample.indexOf(42, obj), -1, "object [0]"); - assert.sameValue(sample.indexOf(43, obj), 1, "object [1]"); + assert.sameValue(sample.indexOf(N(42), obj), -1, "object [0]"); + assert.sameValue(sample.indexOf(N(43), obj), 1, "object [1]"); }); diff --git a/test/built-ins/TypedArray/prototype/join/custom-separator-result-from-tostring-on-each-simple-value.js b/test/built-ins/TypedArray/prototype/join/custom-separator-result-from-tostring-on-each-simple-value.js index 694f81db0..13cb0624a 100644 --- a/test/built-ins/TypedArray/prototype/join/custom-separator-result-from-tostring-on-each-simple-value.js +++ b/test/built-ins/TypedArray/prototype/join/custom-separator-result-from-tostring-on-each-simple-value.js @@ -29,8 +29,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([1, 0, 2, 3, 42, 127]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([1, 0, 2, 3, 42, 127])); var result; diff --git a/test/built-ins/TypedArray/prototype/join/custom-separator-result-from-tostring-on-each-value.js b/test/built-ins/TypedArray/prototype/join/custom-separator-result-from-tostring-on-each-value.js index 94caedf65..d135c173f 100644 --- a/test/built-ins/TypedArray/prototype/join/custom-separator-result-from-tostring-on-each-value.js +++ b/test/built-ins/TypedArray/prototype/join/custom-separator-result-from-tostring-on-each-value.js @@ -132,4 +132,6 @@ testWithTypedArrayConstructors(function(TA) { }).join(separator); result = sample.join(separator); assert.sameValue(result, expected, "using: " + separator); -}); +}, + // Cannot create Big*64Arrays from non-safe integers. + numericTypedArrayConstructors); diff --git a/test/built-ins/TypedArray/prototype/join/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/join/get-length-uses-internal-arraylength.js index 558829704..a98f8b84e 100644 --- a/test/built-ins/TypedArray/prototype/join/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/join/get-length-uses-internal-arraylength.js @@ -32,8 +32,8 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); Object.defineProperty(TA.prototype, "length", desc); Object.defineProperty(sample, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/join/result-from-tostring-on-each-simple-value.js b/test/built-ins/TypedArray/prototype/join/result-from-tostring-on-each-simple-value.js index b6d91a035..dd6f98103 100644 --- a/test/built-ins/TypedArray/prototype/join/result-from-tostring-on-each-simple-value.js +++ b/test/built-ins/TypedArray/prototype/join/result-from-tostring-on-each-simple-value.js @@ -28,8 +28,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([1, 0, 2, 3, 42, 127]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([1, 0, 2, 3, 42, 127])); var result = sample.join(); diff --git a/test/built-ins/TypedArray/prototype/join/result-from-tostring-on-each-value.js b/test/built-ins/TypedArray/prototype/join/result-from-tostring-on-each-value.js index d3d699ffa..df27d079c 100644 --- a/test/built-ins/TypedArray/prototype/join/result-from-tostring-on-each-value.js +++ b/test/built-ins/TypedArray/prototype/join/result-from-tostring-on-each-value.js @@ -41,4 +41,6 @@ testWithTypedArrayConstructors(function(TA) { var result = sample.join(); assert.sameValue(result, expected); -}); +}, + // Cannot construct Big*64Arrays from non-safe integers. + numericTypedArrayConstructors); diff --git a/test/built-ins/TypedArray/prototype/keys/iter-prototype.js b/test/built-ins/TypedArray/prototype/keys/iter-prototype.js index fd5509ac6..a01464f54 100644 --- a/test/built-ins/TypedArray/prototype/keys/iter-prototype.js +++ b/test/built-ins/TypedArray/prototype/keys/iter-prototype.js @@ -17,8 +17,8 @@ features: [Symbol.iterator, TypedArray] var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]()); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([0, 42, 64]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([0, 42, 64])); var iter = sample.keys(); assert.sameValue(Object.getPrototypeOf(iter), ArrayIteratorProto); diff --git a/test/built-ins/TypedArray/prototype/keys/return-itor.js b/test/built-ins/TypedArray/prototype/keys/return-itor.js index 877f06965..e0fa5bdfb 100644 --- a/test/built-ins/TypedArray/prototype/keys/return-itor.js +++ b/test/built-ins/TypedArray/prototype/keys/return-itor.js @@ -13,10 +13,10 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -var sample = new Int8Array([0, 42, 64]); +var sample = [0, 42, 64]; -testWithTypedArrayConstructors(function(TA) { - var typedArray = new TA(sample); +testWithTypedArrayConstructors(function(TA, N) { + var typedArray = new TA(N(sample)); var itor = typedArray.keys(); var next = itor.next(); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/fromIndex-infinity.js b/test/built-ins/TypedArray/prototype/lastIndexOf/fromIndex-infinity.js index 118fa2981..6e828e8c5 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/fromIndex-infinity.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/fromIndex-infinity.js @@ -24,9 +24,9 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 43, 41]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 43, 41])); - assert.sameValue(sample.lastIndexOf(43, Infinity), 2, "lastIndexOf(43, Infinity)"); - assert.sameValue(sample.lastIndexOf(43, -Infinity), -1, "lastIndexOf(43, -Infinity)"); + assert.sameValue(sample.lastIndexOf(N(43), Infinity), 2, "lastIndexOf(43, Infinity)"); + assert.sameValue(sample.lastIndexOf(N(43), -Infinity), -1, "lastIndexOf(43, -Infinity)"); }); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/fromIndex-minus-zero.js b/test/built-ins/TypedArray/prototype/lastIndexOf/fromIndex-minus-zero.js index 1cf02d329..c18cd6c68 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/fromIndex-minus-zero.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/fromIndex-minus-zero.js @@ -21,10 +21,10 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample; - sample = new TA([42, 43]); - assert.sameValue(sample.lastIndexOf(42, -0), 0, "-0 [0]"); - assert.sameValue(sample.lastIndexOf(43, -0), -1, "-0 [1]"); + sample = new TA(N([42, 43])); + assert.sameValue(sample.lastIndexOf(N(42), -0), 0, "-0 [0]"); + assert.sameValue(sample.lastIndexOf(N(43), -0), -1, "-0 [1]"); }); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/lastIndexOf/get-length-uses-internal-arraylength.js index 076d0b8d8..cc846e7ec 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/get-length-uses-internal-arraylength.js @@ -22,11 +22,11 @@ features: [TypedArray] Object.defineProperty(TypedArray.prototype, "length", {value: 0}); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([7]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([7])); Object.defineProperty(TA.prototype, "length", {value: 0}); Object.defineProperty(sample, "length", {value: 0}); - assert.sameValue(sample.lastIndexOf(7), 0); + assert.sameValue(sample.lastIndexOf(N(7)), 0); }); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/search-found-returns-index.js b/test/built-ins/TypedArray/prototype/lastIndexOf/search-found-returns-index.js index ecf7b2a84..cfcae34fe 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/search-found-returns-index.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/search-found-returns-index.js @@ -30,28 +30,28 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 42, 41]); - assert.sameValue(sample.lastIndexOf(42), 2, "lastIndexOf(42)"); - assert.sameValue(sample.lastIndexOf(43), 1, "lastIndexOf(43)"); - assert.sameValue(sample.lastIndexOf(41), 3, "lastIndexOf(41)"); - assert.sameValue(sample.lastIndexOf(41, 3), 3, "lastIndexOf(41, 3)"); - assert.sameValue(sample.lastIndexOf(41, 4), 3, "lastIndexOf(41, 4)"); - assert.sameValue(sample.lastIndexOf(43, 1), 1, "lastIndexOf(43, 1)"); - assert.sameValue(sample.lastIndexOf(43, 2), 1, "lastIndexOf(43, 2)"); - assert.sameValue(sample.lastIndexOf(43, 3), 1, "lastIndexOf(43, 3)"); - assert.sameValue(sample.lastIndexOf(43, 4), 1, "lastIndexOf(43, 4)"); - assert.sameValue(sample.lastIndexOf(42, 0), 0, "lastIndexOf(42, 0)"); - assert.sameValue(sample.lastIndexOf(42, 1), 0, "lastIndexOf(42, 1)"); - assert.sameValue(sample.lastIndexOf(42, 2), 2, "lastIndexOf(42, 2)"); - assert.sameValue(sample.lastIndexOf(42, 3), 2, "lastIndexOf(42, 3)"); - assert.sameValue(sample.lastIndexOf(42, 4), 2, "lastIndexOf(42, 4)"); - assert.sameValue(sample.lastIndexOf(42, -4), 0, "lastIndexOf(42, -4)"); - assert.sameValue(sample.lastIndexOf(42, -3), 0, "lastIndexOf(42, -3)"); - assert.sameValue(sample.lastIndexOf(42, -2), 2, "lastIndexOf(42, -2)"); - assert.sameValue(sample.lastIndexOf(42, -1), 2, "lastIndexOf(42, -1)"); - assert.sameValue(sample.lastIndexOf(43, -3), 1, "lastIndexOf(43, -3)"); - assert.sameValue(sample.lastIndexOf(43, -2), 1, "lastIndexOf(43, -2)"); - assert.sameValue(sample.lastIndexOf(43, -1), 1, "lastIndexOf(43, -1)"); - assert.sameValue(sample.lastIndexOf(41, -1), 3, "lastIndexOf(41, -1)"); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 42, 41])); + assert.sameValue(sample.lastIndexOf(N(42)), 2, "lastIndexOf(42)"); + assert.sameValue(sample.lastIndexOf(N(43)), 1, "lastIndexOf(43)"); + assert.sameValue(sample.lastIndexOf(N(41)), 3, "lastIndexOf(41)"); + assert.sameValue(sample.lastIndexOf(N(41), 3), 3, "lastIndexOf(41, 3)"); + assert.sameValue(sample.lastIndexOf(N(41), 4), 3, "lastIndexOf(41, 4)"); + assert.sameValue(sample.lastIndexOf(N(43), 1), 1, "lastIndexOf(43, 1)"); + assert.sameValue(sample.lastIndexOf(N(43), 2), 1, "lastIndexOf(43, 2)"); + assert.sameValue(sample.lastIndexOf(N(43), 3), 1, "lastIndexOf(43, 3)"); + assert.sameValue(sample.lastIndexOf(N(43), 4), 1, "lastIndexOf(43, 4)"); + assert.sameValue(sample.lastIndexOf(N(42), 0), 0, "lastIndexOf(42, 0)"); + assert.sameValue(sample.lastIndexOf(N(42), 1), 0, "lastIndexOf(42, 1)"); + assert.sameValue(sample.lastIndexOf(N(42), 2), 2, "lastIndexOf(42, 2)"); + assert.sameValue(sample.lastIndexOf(N(42), 3), 2, "lastIndexOf(42, 3)"); + assert.sameValue(sample.lastIndexOf(N(42), 4), 2, "lastIndexOf(42, 4)"); + assert.sameValue(sample.lastIndexOf(N(42), -4), 0, "lastIndexOf(42, -4)"); + assert.sameValue(sample.lastIndexOf(N(42), -3), 0, "lastIndexOf(42, -3)"); + assert.sameValue(sample.lastIndexOf(N(42), -2), 2, "lastIndexOf(42, -2)"); + assert.sameValue(sample.lastIndexOf(N(42), -1), 2, "lastIndexOf(42, -1)"); + assert.sameValue(sample.lastIndexOf(N(43), -3), 1, "lastIndexOf(43, -3)"); + assert.sameValue(sample.lastIndexOf(N(43), -2), 1, "lastIndexOf(43, -2)"); + assert.sameValue(sample.lastIndexOf(N(43), -1), 1, "lastIndexOf(43, -1)"); + assert.sameValue(sample.lastIndexOf(N(41), -1), 3, "lastIndexOf(41, -1)"); }); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/search-not-found-returns-minus-one.js b/test/built-ins/TypedArray/prototype/lastIndexOf/search-not-found-returns-minus-one.js index 4669b5fc5..2094a40b3 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/search-not-found-returns-minus-one.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/search-not-found-returns-minus-one.js @@ -25,18 +25,18 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample; - sample = new TA([42, 43, 42, 41]); - assert.sameValue(sample.lastIndexOf(44), -1, "lastIndexOf(44)"); - assert.sameValue(sample.lastIndexOf(44, -4), -1, "lastIndexOf(44, -4)"); - assert.sameValue(sample.lastIndexOf(44, -5), -1, "lastIndexOf(44, -5)"); - assert.sameValue(sample.lastIndexOf(42, -5), -1, "lastIndexOf(42, -5)"); - assert.sameValue(sample.lastIndexOf(43, -4), -1, "lastIndexOf(43, -4)"); - assert.sameValue(sample.lastIndexOf(43, -5), -1, "lastIndexOf(43, -5)"); - assert.sameValue(sample.lastIndexOf(41, 0), -1, "lastIndexOf(41, 0)"); - assert.sameValue(sample.lastIndexOf(41, 1), -1, "lastIndexOf(41, 1)"); - assert.sameValue(sample.lastIndexOf(41, 2), -1, "lastIndexOf(41, 2)"); - assert.sameValue(sample.lastIndexOf(43, 0), -1, "lastIndexOf(43, 0)"); + sample = new TA(N([42, 43, 42, 41])); + assert.sameValue(sample.lastIndexOf(N(44)), -1, "lastIndexOf(44)"); + assert.sameValue(sample.lastIndexOf(N(44), -4), -1, "lastIndexOf(44, -4)"); + assert.sameValue(sample.lastIndexOf(N(44), -5), -1, "lastIndexOf(44, -5)"); + assert.sameValue(sample.lastIndexOf(N(42), -5), -1, "lastIndexOf(42, -5)"); + assert.sameValue(sample.lastIndexOf(N(43), -4), -1, "lastIndexOf(43, -4)"); + assert.sameValue(sample.lastIndexOf(N(43), -5), -1, "lastIndexOf(43, -5)"); + assert.sameValue(sample.lastIndexOf(N(41), 0), -1, "lastIndexOf(41, 0)"); + assert.sameValue(sample.lastIndexOf(N(41), 1), -1, "lastIndexOf(41, 1)"); + assert.sameValue(sample.lastIndexOf(N(41), 2), -1, "lastIndexOf(41, 2)"); + assert.sameValue(sample.lastIndexOf(N(43), 0), -1, "lastIndexOf(43, 0)"); }); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/strict-comparison.js b/test/built-ins/TypedArray/prototype/lastIndexOf/strict-comparison.js index 374cebfa5..1adeec42f 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/strict-comparison.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/strict-comparison.js @@ -38,4 +38,6 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(sample.lastIndexOf(null), -1, "null"); assert.sameValue(sample.lastIndexOf(undefined), -1, "undefined"); assert.sameValue(sample.lastIndexOf(""), -1, "empty string"); -}); +}, + // Cannot create Big*64Arrays from non-safe integers. + numericTypedArrayConstructors); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/lastIndexOf/tointeger-fromindex.js index 5d47be334..c516ee8ca 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/tointeger-fromindex.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/tointeger-fromindex.js @@ -27,31 +27,31 @@ var obj = { } }; -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample; - sample = new TA([42, 43]); - assert.sameValue(sample.lastIndexOf(42, "1"), 0, "string [0]"); - assert.sameValue(sample.lastIndexOf(43, "1"), 1, "string [1]"); + sample = new TA(N([42, 43])); + assert.sameValue(sample.lastIndexOf(N(42), "1"), 0, "string [0]"); + assert.sameValue(sample.lastIndexOf(N(43), "1"), 1, "string [1]"); - assert.sameValue(sample.lastIndexOf(42, true), 0, "true [0]"); - assert.sameValue(sample.lastIndexOf(43, true), 1, "true [1]"); + assert.sameValue(sample.lastIndexOf(N(42), true), 0, "true [0]"); + assert.sameValue(sample.lastIndexOf(N(43), true), 1, "true [1]"); - assert.sameValue(sample.lastIndexOf(42, false), 0, "false [0]"); - assert.sameValue(sample.lastIndexOf(43, false), -1, "false [1]"); + assert.sameValue(sample.lastIndexOf(N(42), false), 0, "false [0]"); + assert.sameValue(sample.lastIndexOf(N(43), false), -1, "false [1]"); - assert.sameValue(sample.lastIndexOf(42, NaN), 0, "NaN [0]"); - assert.sameValue(sample.lastIndexOf(43, NaN), -1, "NaN [1]"); + assert.sameValue(sample.lastIndexOf(N(42), NaN), 0, "NaN [0]"); + assert.sameValue(sample.lastIndexOf(N(43), NaN), -1, "NaN [1]"); - assert.sameValue(sample.lastIndexOf(42, null), 0, "null [0]"); - assert.sameValue(sample.lastIndexOf(43, null), -1, "null [1]"); + assert.sameValue(sample.lastIndexOf(N(42), null), 0, "null [0]"); + assert.sameValue(sample.lastIndexOf(N(43), null), -1, "null [1]"); - assert.sameValue(sample.lastIndexOf(42, undefined), 0, "undefined [0]"); - assert.sameValue(sample.lastIndexOf(43, undefined), -1, "undefined [1]"); + assert.sameValue(sample.lastIndexOf(N(42), undefined), 0, "undefined [0]"); + assert.sameValue(sample.lastIndexOf(N(43), undefined), -1, "undefined [1]"); - assert.sameValue(sample.lastIndexOf(42, null), 0, "null [0]"); - assert.sameValue(sample.lastIndexOf(43, null), -1, "null [1]"); + assert.sameValue(sample.lastIndexOf(N(42), null), 0, "null [0]"); + assert.sameValue(sample.lastIndexOf(N(43), null), -1, "null [1]"); - assert.sameValue(sample.lastIndexOf(42, obj), 0, "object [0]"); - assert.sameValue(sample.lastIndexOf(43, obj), 1, "object [1]"); + assert.sameValue(sample.lastIndexOf(N(42), obj), 0, "object [0]"); + assert.sameValue(sample.lastIndexOf(N(43), obj), 1, "object [1]"); }); diff --git a/test/built-ins/TypedArray/prototype/map/arraylength-internal.js b/test/built-ins/TypedArray/prototype/map/arraylength-internal.js index 0f9ec0807..39b34ae8a 100644 --- a/test/built-ins/TypedArray/prototype/map/arraylength-internal.js +++ b/test/built-ins/TypedArray/prototype/map/arraylength-internal.js @@ -14,7 +14,7 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample1 = new TA(42); var loop = 0; @@ -22,6 +22,7 @@ testWithTypedArrayConstructors(function(TA) { sample1.map(function() { loop++; + return N(0); }); assert.sameValue(loop, 42, "data descriptor"); @@ -37,6 +38,7 @@ testWithTypedArrayConstructors(function(TA) { sample2.map(function() { loop++; + return N(0); }); assert.sameValue(loop, 4, "accessor descriptor"); }); diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-with-thisarg.js index 5ffb6ce94..b0442e5e2 100644 --- a/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-with-thisarg.js +++ b/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-with-thisarg.js @@ -17,31 +17,32 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); var results = []; var thisArg = ["test262", 0, "ecma262", 0]; sample.map(function() { results.push(arguments); + return N(0); }, thisArg); assert.sameValue(results.length, 3, "results.length"); assert.sameValue(thisArg.length, 4, "thisArg.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], 42, "results[0][0] - kValue"); + assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], 43, "results[1][0] - kValue"); + assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], 44, "results[2][0] - kValue"); + assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-without-thisarg.js index 97386a564..506f3e1ed 100644 --- a/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-without-thisarg.js +++ b/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-without-thisarg.js @@ -17,29 +17,30 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); var results = []; sample.map(function() { results.push(arguments); + return N(0); }); assert.sameValue(results.length, 3, "results.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], 42, "results[0][0] - kValue"); + assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], 43, "results[1][0] - kValue"); + assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], 44, "results[2][0] - kValue"); + assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/map/callbackfn-detachbuffer.js index 1a7e78fae..ef5b7fee7 100644 --- a/test/built-ins/TypedArray/prototype/map/callbackfn-detachbuffer.js +++ b/test/built-ins/TypedArray/prototype/map/callbackfn-detachbuffer.js @@ -27,6 +27,7 @@ testWithTypedArrayConstructors(function(TA) { } $DETACHBUFFER(sample.buffer); loops++; + return N(0); }); }); diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-no-interaction-over-non-integer-properties.js b/test/built-ins/TypedArray/prototype/map/callbackfn-no-interaction-over-non-integer-properties.js index 0ce305a7e..eff8277d6 100644 --- a/test/built-ins/TypedArray/prototype/map/callbackfn-no-interaction-over-non-integer-properties.js +++ b/test/built-ins/TypedArray/prototype/map/callbackfn-no-interaction-over-non-integer-properties.js @@ -18,8 +18,8 @@ includes: [testTypedArray.js, compareArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([7, 8]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([7, 8])); var results = []; @@ -28,6 +28,7 @@ testWithTypedArrayConstructors(function(TA) { sample.map(function() { results.push(arguments); + return N(0); }); assert.sameValue(results.length, 2, "results.length"); @@ -35,6 +36,6 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); - assert.sameValue(results[0][0], 7, "results[0][0] - kValue"); - assert.sameValue(results[1][0], 8, "results[1][0] - kValue"); + assert.sameValue(results[0][0], N(7), "results[0][0] - kValue"); + assert.sameValue(results[1][0], N(8), "results[1][0] - kValue"); }); diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-return-affects-returned-object.js b/test/built-ins/TypedArray/prototype/map/callbackfn-return-affects-returned-object.js index 6f19e2277..b05d96894 100644 --- a/test/built-ins/TypedArray/prototype/map/callbackfn-return-affects-returned-object.js +++ b/test/built-ins/TypedArray/prototype/map/callbackfn-return-affects-returned-object.js @@ -19,13 +19,13 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([1, 2, 4]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([1, 2, 4])); var result = sample.map(function(v) { - return v * 3; + return v * N(3); }); - assert.sameValue(result[0], 3, "result[0] == 3"); - assert.sameValue(result[1], 6, "result[1] == 6"); - assert.sameValue(result[2], 12, "result[2] == 12"); + assert.sameValue(result[0], N(3), "result[0] == 3"); + assert.sameValue(result[1], N(6), "result[1] == 6"); + assert.sameValue(result[2], N(12), "result[2] == 12"); }); diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/map/callbackfn-return-does-not-change-instance.js index fe298618b..311fbde66 100644 --- a/test/built-ins/TypedArray/prototype/map/callbackfn-return-does-not-change-instance.js +++ b/test/built-ins/TypedArray/prototype/map/callbackfn-return-does-not-change-instance.js @@ -10,16 +10,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample1 = new TA(3); - sample1[1] = 1; + sample1[1] = N(1); sample1.map(function() { - return 42; + return N(42); }); - assert.sameValue(sample1[0], 0, "[0] == 0"); - assert.sameValue(sample1[1], 1, "[1] == 1"); - assert.sameValue(sample1[2], 0, "[2] == 0"); + assert.sameValue(sample1[0], N(0), "[0] == 0"); + assert.sameValue(sample1[1], N(1), "[1] == 1"); + assert.sameValue(sample1[2], N(0), "[2] == 0"); }); diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-return-does-not-copy-non-integer-properties.js b/test/built-ins/TypedArray/prototype/map/callbackfn-return-does-not-copy-non-integer-properties.js index cbe3316cd..d9fcda6ca 100644 --- a/test/built-ins/TypedArray/prototype/map/callbackfn-return-does-not-copy-non-integer-properties.js +++ b/test/built-ins/TypedArray/prototype/map/callbackfn-return-does-not-copy-non-integer-properties.js @@ -17,15 +17,15 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([7, 8]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([7, 8])); var bar = Symbol("1"); sample.foo = 42; sample[bar] = 1; var result = sample.map(function() { - return 0; + return N(0); }); assert.sameValue(result.length, 2, "result.length"); diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/map/callbackfn-set-value-during-interaction.js index 0d520cd45..b401826c6 100644 --- a/test/built-ins/TypedArray/prototype/map/callbackfn-set-value-during-interaction.js +++ b/test/built-ins/TypedArray/prototype/map/callbackfn-set-value-during-interaction.js @@ -11,32 +11,33 @@ includes: [testTypedArray.js] features: [Reflect.set, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); var newVal = 0; sample.map(function(val, i) { if (i > 0) { assert.sameValue( - sample[i - 1], newVal - 1, + sample[i - 1], N(newVal - 1), "get the changed value during the loop" ); assert.sameValue( - Reflect.set(sample, 0, 7), + Reflect.set(sample, 0, N(7)), true, "re-set a value for sample[0]" ); } assert.sameValue( - Reflect.set(sample, i, newVal), + Reflect.set(sample, i, N(newVal)), true, "set value during iteration" ); newVal++; + return N(0); }); - assert.sameValue(sample[0], 7, "changed values after iteration [0] == 7"); - assert.sameValue(sample[1], 1, "changed values after iteration [1] == 1"); - assert.sameValue(sample[2], 2, "changed values after iteration [2] == 2"); + assert.sameValue(sample[0], N(7), "changed values after iteration [0] == 7"); + assert.sameValue(sample[1], N(1), "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], N(2), "changed values after iteration [2] == 2"); }); diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-this.js b/test/built-ins/TypedArray/prototype/map/callbackfn-this.js index 43d3159bc..46d990972 100644 --- a/test/built-ins/TypedArray/prototype/map/callbackfn-this.js +++ b/test/built-ins/TypedArray/prototype/map/callbackfn-this.js @@ -21,14 +21,14 @@ features: [TypedArray] var expected = (function() { return this; })(); var thisArg = {}; -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample = new TA(3); var results1 = []; sample.map(function() { results1.push(this); - return 0; + return N(0); }); assert.sameValue(results1.length, 3, "results1"); @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(function(TA) { sample.map(function() { results2.push(this); - return 0; + return N(0); }, thisArg); assert.sameValue(results2.length, 3, "results2"); diff --git a/test/built-ins/TypedArray/prototype/map/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/map/values-are-not-cached.js index d2345b13c..e7d87ff1d 100644 --- a/test/built-ins/TypedArray/prototype/map/values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/map/values-are-not-cached.js @@ -11,16 +11,18 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); sample.map(function(v, i) { if (i < sample.length - 1) { - sample[i+1] = 42; + sample[i+1] = N(42); } assert.sameValue( - v, 42, "method does not cache values before callbackfn calls" + v, N(42), "method does not cache values before callbackfn calls" ); + + return N(0); }); }); diff --git a/test/built-ins/TypedArray/prototype/reduce/callbackfn-arguments-custom-accumulator.js b/test/built-ins/TypedArray/prototype/reduce/callbackfn-arguments-custom-accumulator.js index c99ad441b..3ed389aff 100644 --- a/test/built-ins/TypedArray/prototype/reduce/callbackfn-arguments-custom-accumulator.js +++ b/test/built-ins/TypedArray/prototype/reduce/callbackfn-arguments-custom-accumulator.js @@ -26,8 +26,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); var results = []; @@ -40,19 +40,19 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(results[0].length, 4, "results[0].length"); assert.sameValue(results[0][0], 7, "results[0][0] - accumulator"); - assert.sameValue(results[0][1], 42, "results[0][1] - kValue"); + assert.sameValue(results[0][1], N(42), "results[0][1] - kValue"); assert.sameValue(results[0][2], 0, "results[0][2] - k"); assert.sameValue(results[0][3], sample, "results[0][3] - this"); assert.sameValue(results[1].length, 4, "results[1].length"); assert.sameValue(results[1][0], 8, "results[1][0] - accumulator"); - assert.sameValue(results[1][1], 43, "results[1][1] - kValue"); + assert.sameValue(results[1][1], N(43), "results[1][1] - kValue"); assert.sameValue(results[1][2], 1, "results[1][2] - k"); assert.sameValue(results[1][3], sample, "results[1][3] - this"); assert.sameValue(results[2].length, 4, "results[2].length"); assert.sameValue(results[2][0], 9, "results[2][0] - accumulator"); - assert.sameValue(results[2][1], 44, "results[2][1] - kValue"); + assert.sameValue(results[2][1], N(44), "results[2][1] - kValue"); assert.sameValue(results[2][2], 2, "results[2][2] - k"); assert.sameValue(results[2][3], sample, "results[2][3] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/reduce/callbackfn-arguments-default-accumulator.js b/test/built-ins/TypedArray/prototype/reduce/callbackfn-arguments-default-accumulator.js index f293ef1b9..bdf5f7c64 100644 --- a/test/built-ins/TypedArray/prototype/reduce/callbackfn-arguments-default-accumulator.js +++ b/test/built-ins/TypedArray/prototype/reduce/callbackfn-arguments-default-accumulator.js @@ -33,27 +33,27 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); var results = []; sample.reduce(function(accumulator) { results.push(arguments); - return accumulator - 1; + return accumulator - N(1); }); assert.sameValue(results.length, 2, "results.length"); assert.sameValue(results[0].length, 4, "results[1].length"); - assert.sameValue(results[0][0], 42, "results[1][0] - accumulator"); - assert.sameValue(results[0][1], 43, "results[1][1] - kValue"); + assert.sameValue(results[0][0], N(42), "results[1][0] - accumulator"); + assert.sameValue(results[0][1], N(43), "results[1][1] - kValue"); assert.sameValue(results[0][2], 1, "results[1][2] - k"); assert.sameValue(results[0][3], sample, "results[1][3] - this"); assert.sameValue(results[1].length, 4, "results[2].length"); - assert.sameValue(results[1][0], 41, "results[2][0] - accumulator"); - assert.sameValue(results[1][1], 44, "results[2][1] - kValue"); + assert.sameValue(results[1][0], N(41), "results[2][0] - accumulator"); + assert.sameValue(results[1][1], N(44), "results[2][1] - kValue"); assert.sameValue(results[1][2], 2, "results[2][2] - k"); assert.sameValue(results[1][3], sample, "results[2][3] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/reduce/callbackfn-no-iteration-over-non-integer-properties.js b/test/built-ins/TypedArray/prototype/reduce/callbackfn-no-iteration-over-non-integer-properties.js index 18982a9d3..14911508c 100644 --- a/test/built-ins/TypedArray/prototype/reduce/callbackfn-no-iteration-over-non-integer-properties.js +++ b/test/built-ins/TypedArray/prototype/reduce/callbackfn-no-iteration-over-non-integer-properties.js @@ -26,8 +26,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([7, 8]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([7, 8])); var results = []; @@ -43,6 +43,6 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(results[0][2], 0, "results[0][2] - k"); assert.sameValue(results[1][2], 1, "results[1][2] - k"); - assert.sameValue(results[0][1], 7, "results[0][1] - kValue"); - assert.sameValue(results[1][1], 8, "results[1][1] - kValue"); + assert.sameValue(results[0][1], N(7), "results[0][1] - kValue"); + assert.sameValue(results[1][1], N(8), "results[1][1] - kValue"); }); diff --git a/test/built-ins/TypedArray/prototype/reduce/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/reduce/callbackfn-return-does-not-change-instance.js index 6969dd9b5..8c0dcd9aa 100644 --- a/test/built-ins/TypedArray/prototype/reduce/callbackfn-return-does-not-change-instance.js +++ b/test/built-ins/TypedArray/prototype/reduce/callbackfn-return-does-not-change-instance.js @@ -8,14 +8,14 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([0, 1, 0]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([0, 1, 0])); sample.reduce(function() { return 42; }, 7); - assert.sameValue(sample[0], 0, "[0] == 0"); - assert.sameValue(sample[1], 1, "[1] == 1"); - assert.sameValue(sample[2], 0, "[2] == 0"); + assert.sameValue(sample[0], N(0), "[0] == 0"); + assert.sameValue(sample[1], N(1), "[1] == 1"); + assert.sameValue(sample[2], N(0), "[2] == 0"); }); diff --git a/test/built-ins/TypedArray/prototype/reduce/callbackfn-set-value-during-iteration.js b/test/built-ins/TypedArray/prototype/reduce/callbackfn-set-value-during-iteration.js index 41ae9c0c7..0afa1860c 100644 --- a/test/built-ins/TypedArray/prototype/reduce/callbackfn-set-value-during-iteration.js +++ b/test/built-ins/TypedArray/prototype/reduce/callbackfn-set-value-during-iteration.js @@ -18,24 +18,24 @@ includes: [testTypedArray.js] features: [Reflect.set, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); var newVal = 0; sample.reduce(function(acc, val, i) { if (i > 0) { assert.sameValue( - sample[i - 1], newVal - 1, + sample[i - 1], N(newVal - 1), "get the changed value during the loop" ); assert.sameValue( - Reflect.set(sample, 0, 7), + Reflect.set(sample, 0, N(7)), true, "re-set a value for sample[0]" ); } assert.sameValue( - Reflect.set(sample, i, newVal), + Reflect.set(sample, i, N(newVal)), true, "set value during iteration" ); @@ -43,7 +43,7 @@ testWithTypedArrayConstructors(function(TA) { newVal++; }, 0); - assert.sameValue(sample[0], 7, "changed values after iteration [0] == 7"); - assert.sameValue(sample[1], 1, "changed values after iteration [1] == 1"); - assert.sameValue(sample[2], 2, "changed values after iteration [2] == 2"); + assert.sameValue(sample[0], N(7), "changed values after iteration [0] == 7"); + assert.sameValue(sample[1], N(1), "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], N(2), "changed values after iteration [2] == 2"); }); diff --git a/test/built-ins/TypedArray/prototype/reduce/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/reduce/get-length-uses-internal-arraylength.js index 53f976f0f..b72ca4671 100644 --- a/test/built-ins/TypedArray/prototype/reduce/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/reduce/get-length-uses-internal-arraylength.js @@ -30,8 +30,8 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); var calls = 0; Object.defineProperty(TA.prototype, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/reduce/result-is-last-callbackfn-return.js b/test/built-ins/TypedArray/prototype/reduce/result-is-last-callbackfn-return.js index 17280f159..99ae68cef 100644 --- a/test/built-ins/TypedArray/prototype/reduce/result-is-last-callbackfn-return.js +++ b/test/built-ins/TypedArray/prototype/reduce/result-is-last-callbackfn-return.js @@ -34,11 +34,11 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var calls, result; calls = 0; - result = new TA([1, 2, 3]).reduce(function() { + result = new TA(N([1, 2, 3])).reduce(function() { calls++; if (calls == 2) { @@ -48,7 +48,7 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(result, 42, "using default accumulator"); calls = 0; - result = new TA([1, 2, 3]).reduce(function() { + result = new TA(N([1, 2, 3])).reduce(function() { calls++; if (calls == 3) { diff --git a/test/built-ins/TypedArray/prototype/reduce/result-of-any-type.js b/test/built-ins/TypedArray/prototype/reduce/result-of-any-type.js index 0519cc88a..3ff22b46f 100644 --- a/test/built-ins/TypedArray/prototype/reduce/result-of-any-type.js +++ b/test/built-ins/TypedArray/prototype/reduce/result-of-any-type.js @@ -34,8 +34,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); [ ["test262", "string"], ["", "empty string"], diff --git a/test/built-ins/TypedArray/prototype/reduce/return-first-value-without-callbackfn.js b/test/built-ins/TypedArray/prototype/reduce/return-first-value-without-callbackfn.js index 236b332e4..965cec5c2 100644 --- a/test/built-ins/TypedArray/prototype/reduce/return-first-value-without-callbackfn.js +++ b/test/built-ins/TypedArray/prototype/reduce/return-first-value-without-callbackfn.js @@ -31,12 +31,12 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var called = false; - var result = new TA([42]).reduce(function() { + var result = new TA(N([42])).reduce(function() { called = true; }); - assert.sameValue(result, 42); + assert.sameValue(result, N(42)); assert.sameValue(called, false); }); diff --git a/test/built-ins/TypedArray/prototype/reduce/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/reduce/values-are-not-cached.js index e091df1f9..ecb194d96 100644 --- a/test/built-ins/TypedArray/prototype/reduce/values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/reduce/values-are-not-cached.js @@ -26,16 +26,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); sample.reduce(function(a, v, i) { if (i < sample.length - 1) { - sample[i+1] = 42; + sample[i+1] = N(42); } assert.sameValue( - v, 42, "method does not cache values before callbackfn calls" + v, N(42), "method does not cache values before callbackfn calls" ); }, 0); }); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-arguments-custom-accumulator.js b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-arguments-custom-accumulator.js index aecfae24e..c280aeef0 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-arguments-custom-accumulator.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-arguments-custom-accumulator.js @@ -27,8 +27,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); var results = []; @@ -41,19 +41,19 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(results[0].length, 4, "results[0].length"); assert.sameValue(results[0][0], 7, "results[0][0] - accumulator"); - assert.sameValue(results[0][1], 44, "results[0][1] - kValue"); + assert.sameValue(results[0][1], N(44), "results[0][1] - kValue"); assert.sameValue(results[0][2], 2, "results[0][2] - k"); assert.sameValue(results[0][3], sample, "results[0][3] - this"); assert.sameValue(results[1].length, 4, "results[1].length"); assert.sameValue(results[1][0], 8, "results[1][0] - accumulator"); - assert.sameValue(results[1][1], 43, "results[1][1] - kValue"); + assert.sameValue(results[1][1], N(43), "results[1][1] - kValue"); assert.sameValue(results[1][2], 1, "results[1][2] - k"); assert.sameValue(results[1][3], sample, "results[1][3] - this"); assert.sameValue(results[2].length, 4, "results[2].length"); assert.sameValue(results[2][0], 9, "results[2][0] - accumulator"); - assert.sameValue(results[2][1], 42, "results[2][1] - kValue"); + assert.sameValue(results[2][1], N(42), "results[2][1] - kValue"); assert.sameValue(results[2][2], 0, "results[2][2] - k"); assert.sameValue(results[2][3], sample, "results[2][3] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-arguments-default-accumulator.js b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-arguments-default-accumulator.js index 51509985e..e689c9fe7 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-arguments-default-accumulator.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-arguments-default-accumulator.js @@ -36,27 +36,27 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); var results = []; sample.reduceRight(function(accumulator) { results.push(arguments); - return accumulator + 1; + return accumulator + N(1); }); assert.sameValue(results.length, 2, "results.length"); assert.sameValue(results[0].length, 4, "results[1].length"); - assert.sameValue(results[0][0], 44, "results[1][0] - accumulator"); - assert.sameValue(results[0][1], 43, "results[1][1] - kValue"); + assert.sameValue(results[0][0], N(44), "results[1][0] - accumulator"); + assert.sameValue(results[0][1], N(43), "results[1][1] - kValue"); assert.sameValue(results[0][2], 1, "results[1][2] - k"); assert.sameValue(results[0][3], sample, "results[1][3] - this"); assert.sameValue(results[1].length, 4, "results[2].length"); - assert.sameValue(results[1][0], 45, "results[2][0] - accumulator"); - assert.sameValue(results[1][1], 42, "results[2][1] - kValue"); + assert.sameValue(results[1][0], N(45), "results[2][0] - accumulator"); + assert.sameValue(results[1][1], N(42), "results[2][1] - kValue"); assert.sameValue(results[1][2], 0, "results[2][2] - k"); assert.sameValue(results[1][3], sample, "results[2][3] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-no-iteration-over-non-integer-properties.js b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-no-iteration-over-non-integer-properties.js index b81c9a91e..c807f650a 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-no-iteration-over-non-integer-properties.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-no-iteration-over-non-integer-properties.js @@ -27,8 +27,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([7, 8]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([7, 8])); var results = []; @@ -44,6 +44,6 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(results[0][2], 1, "results[0][2] - k"); assert.sameValue(results[1][2], 0, "results[1][2] - k"); - assert.sameValue(results[0][1], 8, "results[0][1] - kValue"); - assert.sameValue(results[1][1], 7, "results[1][1] - kValue"); + assert.sameValue(results[0][1], N(8), "results[0][1] - kValue"); + assert.sameValue(results[1][1], N(7), "results[1][1] - kValue"); }); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-return-does-not-change-instance.js index d1c746ffa..294eb33ea 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-return-does-not-change-instance.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-return-does-not-change-instance.js @@ -8,14 +8,14 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([0, 1, 0]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([0, 1, 0])); sample.reduceRight(function() { return 42; }, 7); - assert.sameValue(sample[0], 0, "[0] == 0"); - assert.sameValue(sample[1], 1, "[1] == 1"); - assert.sameValue(sample[2], 0, "[2] == 0"); + assert.sameValue(sample[0], N(0), "[0] == 0"); + assert.sameValue(sample[1], N(1), "[1] == 1"); + assert.sameValue(sample[2], N(0), "[2] == 0"); }); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-set-value-during-iteration.js b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-set-value-during-iteration.js index 290f197c0..62c9ef47a 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-set-value-during-iteration.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-set-value-during-iteration.js @@ -18,24 +18,24 @@ includes: [testTypedArray.js] features: [Reflect.set, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); var newVal = 0; sample.reduceRight(function(acc, val, i) { if (i < sample.length - 1) { assert.sameValue( - sample[i + 1], newVal - 1, + sample[i + 1], N(newVal - 1), "get the changed value during the loop" ); assert.sameValue( - Reflect.set(sample, 2, 7), + Reflect.set(sample, 2, N(7)), true, "re-set a value for sample[2]" ); } assert.sameValue( - Reflect.set(sample, i, newVal), + Reflect.set(sample, i, N(newVal)), true, "set value during iteration" ); @@ -43,7 +43,7 @@ testWithTypedArrayConstructors(function(TA) { newVal++; }, 0); - assert.sameValue(sample[0], 2, "changed values after iteration [0] == 2"); - assert.sameValue(sample[1], 1, "changed values after iteration [1] == 1"); - assert.sameValue(sample[2], 7, "changed values after iteration [2] == 7"); + assert.sameValue(sample[0], N(2), "changed values after iteration [0] == 2"); + assert.sameValue(sample[1], N(1), "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], N(7), "changed values after iteration [2] == 7"); }); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/reduceRight/get-length-uses-internal-arraylength.js index 32c560242..b1ff04f5d 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/get-length-uses-internal-arraylength.js @@ -30,8 +30,8 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); var calls = 0; Object.defineProperty(TA.prototype, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/result-is-last-callbackfn-return.js b/test/built-ins/TypedArray/prototype/reduceRight/result-is-last-callbackfn-return.js index 67504f27b..41771b6f7 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/result-is-last-callbackfn-return.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/result-is-last-callbackfn-return.js @@ -36,11 +36,11 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var calls, result; calls = 0; - result = new TA([1, 2, 3]).reduceRight(function() { + result = new TA(N([1, 2, 3])).reduceRight(function() { calls++; if (calls == 2) { @@ -50,7 +50,7 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(result, 42, "using default accumulator"); calls = 0; - result = new TA([1, 2, 3]).reduceRight(function() { + result = new TA(N([1, 2, 3])).reduceRight(function() { calls++; if (calls == 3) { diff --git a/test/built-ins/TypedArray/prototype/reduceRight/result-of-any-type.js b/test/built-ins/TypedArray/prototype/reduceRight/result-of-any-type.js index a7f2d6df8..2cb4a4f62 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/result-of-any-type.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/result-of-any-type.js @@ -36,8 +36,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); [ ["test262", "string"], ["", "empty string"], diff --git a/test/built-ins/TypedArray/prototype/reduceRight/return-first-value-without-callbackfn.js b/test/built-ins/TypedArray/prototype/reduceRight/return-first-value-without-callbackfn.js index 7100baf43..7992c27c3 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/return-first-value-without-callbackfn.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/return-first-value-without-callbackfn.js @@ -32,12 +32,12 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var called = false; - var result = new TA([42]).reduceRight(function() { + var result = new TA(N([42])).reduceRight(function() { called = true; }); - assert.sameValue(result, 42); + assert.sameValue(result, N(42)); assert.sameValue(called, false); }); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/reduceRight/values-are-not-cached.js index fb93d3e20..014ba87dd 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/values-are-not-cached.js @@ -27,16 +27,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([44, 43, 42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([44, 43, 42])); sample.reduceRight(function(a, v, i) { if (i > 0) { - sample[i-1] = 42; + sample[i-1] = N(42); } assert.sameValue( - v, 42, "method does not cache values before callbackfn calls" + v, N(42), "method does not cache values before callbackfn calls" ); }, 0); }); diff --git a/test/built-ins/TypedArray/prototype/reverse/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/reverse/get-length-uses-internal-arraylength.js index 4a51f2ffb..35150f289 100644 --- a/test/built-ins/TypedArray/prototype/reverse/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/reverse/get-length-uses-internal-arraylength.js @@ -30,8 +30,8 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); Object.defineProperty(TA.prototype, "length", desc); Object.defineProperty(sample, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/reverse/reverts.js b/test/built-ins/TypedArray/prototype/reverse/reverts.js index 5bec740e5..be321a62f 100644 --- a/test/built-ins/TypedArray/prototype/reverse/reverts.js +++ b/test/built-ins/TypedArray/prototype/reverse/reverts.js @@ -21,37 +21,37 @@ features: [TypedArray] var buffer = new ArrayBuffer(64); -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample = new TA(buffer, 0, 4); var other = new TA(buffer, 0, 5); - sample[0] = 42; - sample[1] = 43; - sample[2] = 2; - sample[3] = 1; - other[4] = 7; + sample[0] = N(42); + sample[1] = N(43); + sample[2] = N(2); + sample[3] = N(1); + other[4] = N(7); sample.reverse(); assert( - compareArray(sample, [1, 2, 43, 42]) + compareArray(sample, N([1, 2, 43, 42])) ); assert( - compareArray(other, [1, 2, 43, 42, 7]) + compareArray(other, N([1, 2, 43, 42, 7])) ); - sample[0] = 7; - sample[1] = 17; - sample[2] = 1; - sample[3] = 0; - other[4] = 42; + sample[0] = N(7); + sample[1] = N(17); + sample[2] = N(1); + sample[3] = N(0); + other[4] = N(42); other.reverse(); assert( - compareArray(other, [42, 0, 1, 17, 7]) + compareArray(other, N([42, 0, 1, 17, 7])) ); assert( - compareArray(sample, [42, 0, 1, 17]) + compareArray(sample, N([42, 0, 1, 17])) ); }); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-offset-tointeger.js b/test/built-ins/TypedArray/prototype/set/array-arg-offset-tointeger.js index a5ab52773..c0e88a13d 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-offset-tointeger.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-offset-tointeger.js @@ -18,78 +18,78 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample; - sample = new TA([1, 2]); - sample.set([42], ""); - assert(compareArray(sample, [42, 2]), "the empty string"); + sample = new TA(N([1, 2])); + sample.set([N(42)], ""); + assert(compareArray(sample, N([42, 2])), "the empty string"); - sample = new TA([1, 2]); - sample.set([42], "0"); - assert(compareArray(sample, [42, 2]), "'0'"); + sample = new TA(N([1, 2])); + sample.set([N(42)], "0"); + assert(compareArray(sample, N([42, 2])), "'0'"); - sample = new TA([1, 2]); - sample.set([42], false); - assert(compareArray(sample, [42, 2]), "false"); + sample = new TA(N([1, 2])); + sample.set([N(42)], false); + assert(compareArray(sample, N([42, 2])), "false"); - sample = new TA([1, 2]); - sample.set([42], 0.1); - assert(compareArray(sample, [42, 2]), "0.1"); + sample = new TA(N([1, 2])); + sample.set([N(42)], 0.1); + assert(compareArray(sample, N([42, 2])), "0.1"); - sample = new TA([1, 2]); - sample.set([42], 0.9); - assert(compareArray(sample, [42, 2]), "0.9"); + sample = new TA(N([1, 2])); + sample.set([N(42)], 0.9); + assert(compareArray(sample, N([42, 2])), "0.9"); - sample = new TA([1, 2]); - sample.set([42], -0.5); - assert(compareArray(sample, [42, 2]), "-0.5"); + sample = new TA(N([1, 2])); + sample.set([N(42)], -0.5); + assert(compareArray(sample, N([42, 2])), "-0.5"); - sample = new TA([1, 2]); - sample.set([42], 1.1); - assert(compareArray(sample, [1, 42]), "1.1"); + sample = new TA(N([1, 2])); + sample.set([N(42)], 1.1); + assert(compareArray(sample, N([1, 42])), "1.1"); - sample = new TA([1, 2]); - sample.set([42], NaN); - assert(compareArray(sample, [42, 2]), "NaN"); + sample = new TA(N([1, 2])); + sample.set([N(42)], NaN); + assert(compareArray(sample, N([42, 2])), "NaN"); - sample = new TA([1, 2]); - sample.set([42], null); - assert(compareArray(sample, [42, 2]), "null"); + sample = new TA(N([1, 2])); + sample.set([N(42)], null); + assert(compareArray(sample, N([42, 2])), "null"); - sample = new TA([1, 2]); - sample.set([42], undefined); - assert(compareArray(sample, [42, 2]), "undefined"); + sample = new TA(N([1, 2])); + sample.set([N(42)], undefined); + assert(compareArray(sample, N([42, 2])), "undefined"); - sample = new TA([1, 2]); - sample.set([42], {}); - assert(compareArray(sample, [42, 2]), "{}"); + sample = new TA(N([1, 2])); + sample.set([N(42)], {}); + assert(compareArray(sample, N([42, 2])), "{}"); - sample = new TA([1, 2]); - sample.set([42], []); - assert(compareArray(sample, [42, 2]), "[]"); + sample = new TA(N([1, 2])); + sample.set([N(42)], []); + assert(compareArray(sample, N([42, 2])), "[]"); - sample = new TA([1, 2]); - sample.set([42], [0]); - assert(compareArray(sample, [42, 2]), "[0]"); + sample = new TA(N([1, 2])); + sample.set([N(42)], [0]); + assert(compareArray(sample, N([42, 2])), "[0]"); - sample = new TA([1, 2]); - sample.set([42], true); - assert(compareArray(sample, [1, 42]), "true"); + sample = new TA(N([1, 2])); + sample.set([N(42)], true); + assert(compareArray(sample, N([1, 42])), "true"); - sample = new TA([1, 2]); - sample.set([42], "1"); - assert(compareArray(sample, [1, 42]), "'1'"); + sample = new TA(N([1, 2])); + sample.set([N(42)], "1"); + assert(compareArray(sample, N([1, 42])), "'1'"); - sample = new TA([1, 2]); - sample.set([42], [1]); - assert(compareArray(sample, [1, 42]), "[1]"); + sample = new TA(N([1, 2])); + sample.set([N(42)], [1]); + assert(compareArray(sample, N([1, 42])), "[1]"); - sample = new TA([1, 2]); - sample.set([42], { valueOf: function() {return 1;} }); - assert(compareArray(sample, [1, 42]), "valueOf"); + sample = new TA(N([1, 2])); + sample.set([N(42)], { valueOf: function() {return 1;} }); + assert(compareArray(sample, N([1, 42])), "valueOf"); - sample = new TA([1, 2]); - sample.set([42], { toString: function() {return 1;} }); - assert(compareArray(sample, [1, 42]), "toString"); + sample = new TA(N([1, 2])); + sample.set([N(42)], { toString: function() {return 1;} }); + assert(compareArray(sample, N([1, 42])), "toString"); }); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-get-length.js b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-get-length.js index 2c67c5cc4..e4b1b7726 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-get-length.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-get-length.js @@ -24,8 +24,8 @@ Object.defineProperty(obj, "length", { } }); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([1, 2, 3]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([1, 2, 3])); assert.throws(Test262Error, function() { sample.set(obj); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-get-value.js b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-get-value.js index e47046247..c96f7bcb9 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-get-value.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-get-value.js @@ -22,27 +22,27 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -var obj = { - length: 4, - "0": 42, - "1": 43, - "3": 44 -}; -Object.defineProperty(obj, "2", { - get: function() { - throw new Test262Error(); - } -}); +testWithTypedArrayConstructors(function(TA, N) { + var obj = { + length: 4, + "0": N(42), + "1": N(43), + "3": N(44) + }; + Object.defineProperty(obj, "2", { + get: function() { + throw new Test262Error(); + } + }); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([1, 2, 3, 4]); + var sample = new TA(N([1, 2, 3, 4])); assert.throws(Test262Error, function() { sample.set(obj); }); assert( - compareArray(sample, [42, 43, 3, 4]), + compareArray(sample, N([42, 43, 3, 4])), "values are set until exception" ); }); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length-symbol.js b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length-symbol.js index f5b2289d8..a1c8bd795 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length-symbol.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length-symbol.js @@ -21,8 +21,8 @@ var obj = { length: Symbol("1") }; -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([1, 2, 3]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([1, 2, 3])); assert.throws(TypeError, function() { sample.set(obj); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length.js b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length.js index 8252ebbef..bac8f5b74 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length.js @@ -33,8 +33,8 @@ var obj2 = { } }; -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([1, 2, 3]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([1, 2, 3])); assert.throws(Test262Error, function() { sample.set(obj1); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value-symbol.js b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value-symbol.js index 250b66c0b..db48b41d7 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value-symbol.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value-symbol.js @@ -22,23 +22,23 @@ includes: [testTypedArray.js, compareArray.js] features: [Symbol, TypedArray] ---*/ -var obj = { - length: 4, - "0": 42, - "1": 43, - "2": Symbol("1"), - "3": 44 -}; +testWithTypedArrayConstructors(function(TA, N) { + var obj = { + length: 4, + "0": N(42), + "1": N(43), + "2": Symbol("1"), + "3": N(44) + }; -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([1, 2, 3, 4]); + var sample = new TA(N([1, 2, 3, 4])); assert.throws(TypeError, function() { sample.set(obj); }); assert( - compareArray(sample, [42, 43, 3, 4]), + compareArray(sample, N([42, 43, 3, 4])), "values are set until exception" ); }); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value.js b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value.js index 535841f58..6348580e2 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value.js @@ -22,27 +22,27 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -var obj = { - length: 4, - "0": 42, - "1": 43, - "2": { - valueOf: function() { - throw new Test262Error(); - } - }, - "3": 44 -}; +testWithTypedArrayConstructors(function(TA, N) { + var obj = { + length: 4, + "0": N(42), + "1": N(43), + "2": { + valueOf: function() { + throw new Test262Error(); + } + }, + "3": N(44) + }; -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([1, 2, 3, 4]); + var sample = new TA(N([1, 2, 3, 4])); assert.throws(Test262Error, function() { sample.set(obj); }); assert( - compareArray(sample, [42, 43, 3, 4]), + compareArray(sample, N([42, 43, 3, 4])), "values are set until exception" ); }); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-toobject-offset.js b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-toobject-offset.js index d36712393..78a3c00d0 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-toobject-offset.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-toobject-offset.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([1, 2, 3]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([1, 2, 3])); assert.throws(TypeError, function() { sample.set(undefined); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-set-values-in-order.js b/test/built-ins/TypedArray/prototype/set/array-arg-set-values-in-order.js index 9c1603a30..95ef44d9f 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-set-values-in-order.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-set-values-in-order.js @@ -22,7 +22,7 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample = new TA(5); var calls = []; var obj = { @@ -32,7 +32,7 @@ testWithTypedArrayConstructors(function(TA) { get: function() { calls.push(0); calls.push(sample.join()); - return 42; + return N(42); } }); @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(function(TA) { get: function() { calls.push(1); calls.push(sample.join()); - return 43; + return N(43); } }); @@ -48,7 +48,7 @@ testWithTypedArrayConstructors(function(TA) { get: function() { calls.push(2); calls.push(sample.join()); - return 44; + return N(44); } }); @@ -61,7 +61,7 @@ testWithTypedArrayConstructors(function(TA) { sample.set(obj, 1); assert( - compareArray(sample, [0, 42, 43, 44, 0]), + compareArray(sample, N([0, 42, 43, 44, 0])), "values are set for src length" ); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-set-values.js b/test/built-ins/TypedArray/prototype/set/array-arg-set-values.js index 6e53dbc94..5490305d0 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-set-values.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-set-values.js @@ -22,42 +22,42 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var src = [42, 43]; +testWithTypedArrayConstructors(function(TA, N) { + var src = N([42, 43]); var srcObj = { length: 2, - '0': 7, - '1': 17 + '0': N(7), + '1': N(17) }; var sample, result; - sample = new TA([1, 2, 3, 4]); + sample = new TA(N([1, 2, 3, 4])); result = sample.set(src, 0); - assert(compareArray(sample, [42, 43, 3, 4]), "offset: 0, result: " + sample); + assert(compareArray(sample, N([42, 43, 3, 4])), "offset: 0, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA([1, 2, 3, 4]); + sample = new TA(N([1, 2, 3, 4])); result = sample.set(src, 1); - assert(compareArray(sample, [1, 42, 43, 4]), "offset: 1, result: " + sample); + assert(compareArray(sample, N([1, 42, 43, 4])), "offset: 1, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA([1, 2, 3, 4]); + sample = new TA(N([1, 2, 3, 4])); result = sample.set(src, 2); - assert(compareArray(sample, [1, 2, 42, 43]), "offset: 2, result: " + sample); + assert(compareArray(sample, N([1, 2, 42, 43])), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA([1, 2, 3, 4]); + sample = new TA(N([1, 2, 3, 4])); result = sample.set(srcObj, 0); - assert(compareArray(sample, [7, 17, 3, 4]), "offset: 0, result: " + sample); + assert(compareArray(sample, N([7, 17, 3, 4])), "offset: 0, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA([1, 2, 3, 4]); + sample = new TA(N([1, 2, 3, 4])); result = sample.set(srcObj, 1); - assert(compareArray(sample, [1, 7, 17, 4]), "offset: 1, result: " + sample); + assert(compareArray(sample, N([1, 7, 17, 4])), "offset: 1, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA([1, 2, 3, 4]); + sample = new TA(N([1, 2, 3, 4])); result = sample.set(srcObj, 2); - assert(compareArray(sample, [1, 2, 7, 17]), "offset: 2, result: " + sample); + assert(compareArray(sample, N([1, 2, 7, 17])), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); }); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-type-conversions.js b/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-type-conversions.js index 0256df84e..78ed1b455 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-type-conversions.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-type-conversions.js @@ -22,24 +22,30 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -var obj1 = { - valueOf: function() { - return 42; - } -}; +testWithTypedArrayConstructors(function(TA, N) { + var obj1 = { + valueOf: function() { + return N(42); + } + }; -var obj2 = { - toString: function() { - return 42; - } -}; + var obj2 = { + toString: function() { + return "42"; + } + }; -// undefined and NaN covered on typedArrayConversions -var arr = ["1", "", false, true, null, obj1, obj2, [], [1]]; + // undefined and NaN covered on typedArrayConversions + var nullish; + try { + nullish = N(null); + } catch (e) { + nullish = 0n; + } + var arr = ["1", "", false, true, nullish, obj1, obj2, [], [1]]; -testWithTypedArrayConstructors(function(TA) { var sample = new TA(arr.length); - var expected = new TA([1, 0, 0, 1, 0, 42, 42, 0, 1]); + var expected = new TA(N([1, 0, 0, 1, 0, 42, 42, 0, 1])); sample.set(arr); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-src-values-are-not-cached.js b/test/built-ins/TypedArray/prototype/set/array-arg-src-values-are-not-cached.js index a3750490f..8931748ec 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-src-values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-src-values-are-not-cached.js @@ -22,26 +22,26 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample = new TA(5); var obj = { length: 5, - '1': 7, - '2': 7, - '3': 7, - '4': 7 + '1': N(7), + '2': N(7), + '3': N(7), + '4': N(7) }; Object.defineProperty(obj, 0, { get: function() { - obj[1] = 43; - obj[2] = 44; - obj[3] = 45; - obj[4] = 46; - return 42; + obj[1] = N(43); + obj[2] = N(44); + obj[3] = N(45); + obj[4] = N(46); + return N(42); } }); sample.set(obj); - assert(compareArray(sample, [42, 43, 44, 45, 46])); + assert(compareArray(sample, N([42, 43, 44, 45, 46]))); }); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-target-arraylength-internal.js b/test/built-ins/TypedArray/prototype/set/array-arg-target-arraylength-internal.js index 97bead5c9..4a6e1ee39 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-target-arraylength-internal.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-target-arraylength-internal.js @@ -29,13 +29,13 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample = new TA(2); Object.defineProperty(TA.prototype, "length", desc); Object.defineProperty(sample, "length", desc); - sample.set([42, 43]); + sample.set(N([42, 43])); assert.sameValue(getCalls, 0, "ignores length properties"); }); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-targetbuffer-detached-on-get-src-value-throws.js b/test/built-ins/TypedArray/prototype/set/array-arg-targetbuffer-detached-on-get-src-value-throws.js index eed7db083..e77c0bdfd 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-targetbuffer-detached-on-get-src-value-throws.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-targetbuffer-detached-on-get-src-value-throws.js @@ -22,11 +22,11 @@ includes: [testTypedArray.js, detachArrayBuffer.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([1, 2, 3]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([1, 2, 3])); var obj = { length: 3, - "0": 42 + "0": N(42) }; Object.defineProperty(obj, 1, { get: function() { diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-offset-tointeger.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-offset-tointeger.js index 7f63cb996..2bdb3ded3 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-offset-tointeger.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-offset-tointeger.js @@ -15,79 +15,79 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample; - var src = new TA([42]); + var src = new TA(N([42])); - sample = new TA([1, 2]); + sample = new TA(N([1, 2])); sample.set(src, ""); - assert(compareArray(sample, [42, 2]), "the empty string"); + assert(compareArray(sample, N([42, 2])), "the empty string"); - sample = new TA([1, 2]); + sample = new TA(N([1, 2])); sample.set(src, "0"); - assert(compareArray(sample, [42, 2]), "'0'"); + assert(compareArray(sample, N([42, 2])), "'0'"); - sample = new TA([1, 2]); + sample = new TA(N([1, 2])); sample.set(src, false); - assert(compareArray(sample, [42, 2]), "false"); + assert(compareArray(sample, N([42, 2])), "false"); - sample = new TA([1, 2]); + sample = new TA(N([1, 2])); sample.set(src, 0.1); - assert(compareArray(sample, [42, 2]), "0.1"); + assert(compareArray(sample, N([42, 2])), "0.1"); - sample = new TA([1, 2]); + sample = new TA(N([1, 2])); sample.set(src, 0.9); - assert(compareArray(sample, [42, 2]), "0.9"); + assert(compareArray(sample, N([42, 2])), "0.9"); - sample = new TA([1, 2]); + sample = new TA(N([1, 2])); sample.set(src, -0.5); - assert(compareArray(sample, [42, 2]), "-0.5"); + assert(compareArray(sample, N([42, 2])), "-0.5"); - sample = new TA([1, 2]); + sample = new TA(N([1, 2])); sample.set(src, 1.1); - assert(compareArray(sample, [1, 42]), "1.1"); + assert(compareArray(sample, N([1, 42])), "1.1"); - sample = new TA([1, 2]); + sample = new TA(N([1, 2])); sample.set(src, NaN); - assert(compareArray(sample, [42, 2]), "NaN"); + assert(compareArray(sample, N([42, 2])), "NaN"); - sample = new TA([1, 2]); + sample = new TA(N([1, 2])); sample.set(src, null); - assert(compareArray(sample, [42, 2]), "null"); + assert(compareArray(sample, N([42, 2])), "null"); - sample = new TA([1, 2]); + sample = new TA(N([1, 2])); sample.set(src, undefined); - assert(compareArray(sample, [42, 2]), "undefined"); + assert(compareArray(sample, N([42, 2])), "undefined"); - sample = new TA([1, 2]); + sample = new TA(N([1, 2])); sample.set(src, {}); - assert(compareArray(sample, [42, 2]), "{}"); + assert(compareArray(sample, N([42, 2])), "{}"); - sample = new TA([1, 2]); + sample = new TA(N([1, 2])); sample.set(src, []); - assert(compareArray(sample, [42, 2]), "[]"); + assert(compareArray(sample, N([42, 2])), "[]"); - sample = new TA([1, 2]); + sample = new TA(N([1, 2])); sample.set(src, [0]); - assert(compareArray(sample, [42, 2]), "[0]"); + assert(compareArray(sample, N([42, 2])), "[0]"); - sample = new TA([1, 2]); + sample = new TA(N([1, 2])); sample.set(src, true); - assert(compareArray(sample, [1, 42]), "true"); + assert(compareArray(sample, N([1, 42])), "true"); - sample = new TA([1, 2]); + sample = new TA(N([1, 2])); sample.set(src, "1"); - assert(compareArray(sample, [1, 42]), "'1'"); + assert(compareArray(sample, N([1, 42])), "'1'"); - sample = new TA([1, 2]); + sample = new TA(N([1, 2])); sample.set(src, [1]); - assert(compareArray(sample, [1, 42]), "[1]"); + assert(compareArray(sample, N([1, 42])), "[1]"); - sample = new TA([1, 2]); + sample = new TA(N([1, 2])); sample.set(src, { valueOf: function() {return 1;} }); - assert(compareArray(sample, [1, 42]), "valueOf"); + assert(compareArray(sample, N([1, 42])), "valueOf"); - sample = new TA([1, 2]); + sample = new TA(N([1, 2])); sample.set(src, { toString: function() {return 1;} }); - assert(compareArray(sample, [1, 42]), "toString"); + assert(compareArray(sample, N([1, 42])), "toString"); }); diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type.js index 04ddb5237..4f21a918d 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type.js @@ -26,23 +26,26 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var other = TA === Float32Array ? Float64Array : Float32Array; - var src = new other([42, 43]); + if (typeof BigInt !== "undefined") + other = TA === BigInt64Array ? BigUint64Array : + TA === BigUint64Array ? BigInt64Array : other; + var src = new other(N([42, 43])); var sample, result; - sample = new TA([1, 2, 3, 4]); + sample = new TA(N([1, 2, 3, 4])); result = sample.set(src, 0); - assert(compareArray(sample, [42, 43, 3, 4]), "offset: 0, result: " + sample); + assert(compareArray(sample, N([42, 43, 3, 4])), "offset: 0, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA([1, 2, 3, 4]); + sample = new TA(N([1, 2, 3, 4])); result = sample.set(src, 1); - assert(compareArray(sample, [1, 42, 43, 4]), "offset: 1, result: " + sample); + assert(compareArray(sample, N([1, 42, 43, 4])), "offset: 1, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA([1, 2, 3, 4]); + sample = new TA(N([1, 2, 3, 4])); result = sample.set(src, 2); - assert(compareArray(sample, [1, 2, 42, 43]), "offset: 2, result: " + sample); + assert(compareArray(sample, N([1, 2, 42, 43])), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); }); diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type.js index b91574785..4dcde7c09 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type.js @@ -29,22 +29,22 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample, result; - var src = new TA([42, 43]); + var src = new TA(N([42, 43])); - sample = new TA([1, 2, 3, 4]); + sample = new TA(N([1, 2, 3, 4])); result = sample.set(src, 1); - assert(compareArray(sample, [1, 42, 43, 4]), "offset: 1, result: " + sample); + assert(compareArray(sample, N([1, 42, 43, 4])), "offset: 1, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA([1, 2, 3, 4]); + sample = new TA(N([1, 2, 3, 4])); result = sample.set(src, 0); - assert(compareArray(sample, [42, 43, 3, 4]), "offset: 0, result: " + sample); + assert(compareArray(sample, N([42, 43, 3, 4])), "offset: 0, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA([1, 2, 3, 4]); + sample = new TA(N([1, 2, 3, 4])); result = sample.set(src, 2); - assert(compareArray(sample, [1, 2, 42, 43]), "offset: 2, result: " + sample); + assert(compareArray(sample, N([1, 2, 42, 43])), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); }); diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-other-type.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-other-type.js index 45d648c1a..9ea3f3ef0 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-other-type.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-other-type.js @@ -56,4 +56,4 @@ testWithTypedArrayConstructors(function(TA) { assert(compareArray(sample, expected[TA.name]), sample); assert.sameValue(result, undefined, "returns undefined"); -}); +}, numericTypedArrayConstructors); diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type.js index 02d15ddee..bd3256da6 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type.js @@ -30,24 +30,24 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample, src, result; - sample = new TA([1, 2, 3, 4]); + sample = new TA(N([1, 2, 3, 4])); src = new TA(sample.buffer, 0, 2); result = sample.set(src, 0); - assert(compareArray(sample, [1, 2, 3, 4]), "offset: 0, result: " + sample); + assert(compareArray(sample, N([1, 2, 3, 4])), "offset: 0, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA([1, 2, 3, 4]); + sample = new TA(N([1, 2, 3, 4])); src = new TA(sample.buffer, 0, 2); result = sample.set(src, 1); - assert(compareArray(sample, [1, 1, 2, 4]), "offset: 1, result: " + sample); + assert(compareArray(sample, N([1, 1, 2, 4])), "offset: 1, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA([1, 2, 3, 4]); + sample = new TA(N([1, 2, 3, 4])); src = new TA(sample.buffer, 0, 2); result = sample.set(src, 2); - assert(compareArray(sample, [1, 2, 1, 2]), "offset: 2, result: " + sample); + assert(compareArray(sample, N([1, 2, 1, 2])), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); }); diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-arraylength-internal.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-arraylength-internal.js index 864172b96..0009dae86 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-arraylength-internal.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-arraylength-internal.js @@ -28,9 +28,9 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample = new TA(2); - var src = new TA([42, 43]); + var src = new TA(N([42, 43])); Object.defineProperty(TA.prototype, "length", desc); Object.defineProperty(src, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-byteoffset-internal.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-byteoffset-internal.js index c3bfdeb28..811c2c86a 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-byteoffset-internal.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-byteoffset-internal.js @@ -25,11 +25,14 @@ var desc = { Object.defineProperty(TypedArray.prototype, "byteOffset", desc); -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample = new TA(2); - var src = new TA([42, 43]); + var src = new TA(N([42, 43])); var differentTA = TA === Uint8Array ? Int8Array : Uint8Array; - var src2 = new differentTA([42, 43]); + if (typeof BigInt !== "undefined") + differentTA = TA === BigInt64Array ? BigUint64Array : + TA === BigUint64Array ? BigInt64Array : differentTA; + var src2 = new differentTA(N([42, 43])); var src3 = new differentTA(sample.buffer, 0, 2); Object.defineProperty(TA.prototype, "byteOffset", desc); diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-arraylength-internal.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-arraylength-internal.js index fe251f1f1..df8f06859 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-arraylength-internal.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-arraylength-internal.js @@ -29,9 +29,9 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample = new TA(2); - var src = new TA([42, 43]); + var src = new TA(N([42, 43])); Object.defineProperty(TA.prototype, "length", desc); Object.defineProperty(sample, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-byteoffset-internal.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-byteoffset-internal.js index 9e2802617..29dd574df 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-byteoffset-internal.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-byteoffset-internal.js @@ -26,11 +26,14 @@ var desc = { Object.defineProperty(TypedArray.prototype, "byteOffset", desc); -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample = new TA(2); - var src = new TA([42, 43]); + var src = new TA(N([42, 43])); var differentTA = TA === Uint8Array ? Int8Array : Uint8Array; - var src2 = new differentTA([42, 43]); + if (typeof BigInt !== "undefined") + differentTA = TA === BigInt64Array ? BigUint64Array : + TA === BigUint64Array ? BigInt64Array : differentTA; + var src2 = new differentTA(N([42, 43])); var src3 = new differentTA(sample.buffer, 0, 2); Object.defineProperty(TA.prototype, "byteOffset", desc); diff --git a/test/built-ins/TypedArray/prototype/slice/arraylength-internal.js b/test/built-ins/TypedArray/prototype/slice/arraylength-internal.js index 2c9e7cba3..8cf705583 100644 --- a/test/built-ins/TypedArray/prototype/slice/arraylength-internal.js +++ b/test/built-ins/TypedArray/prototype/slice/arraylength-internal.js @@ -23,8 +23,8 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); Object.defineProperty(TA.prototype, "length", desc); Object.defineProperty(sample, "length", desc); @@ -32,7 +32,7 @@ testWithTypedArrayConstructors(function(TA) { var result = sample.slice(); assert.sameValue(getCalls, 0, "ignores length properties"); - assert.sameValue(result[0], 42); - assert.sameValue(result[1], 43); + assert.sameValue(result[0], N(42)); + assert.sameValue(result[1], N(43)); assert.sameValue(result.hasOwnProperty(2), false); }); diff --git a/test/built-ins/TypedArray/prototype/slice/infinity.js b/test/built-ins/TypedArray/prototype/slice/infinity.js index a93cd713a..7fda1ec89 100644 --- a/test/built-ins/TypedArray/prototype/slice/infinity.js +++ b/test/built-ins/TypedArray/prototype/slice/infinity.js @@ -7,11 +7,11 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); assert( - compareArray(sample.slice(-Infinity), [40, 41, 42, 43]), + compareArray(sample.slice(-Infinity), N([40, 41, 42, 43])), "start == -Infinity" ); assert( @@ -23,7 +23,7 @@ testWithTypedArrayConstructors(function(TA) { "end == -Infinity" ); assert( - compareArray(sample.slice(0, Infinity), [40, 41, 42, 43]), + compareArray(sample.slice(0, Infinity), N([40, 41, 42, 43])), "end == Infinity" ); }); diff --git a/test/built-ins/TypedArray/prototype/slice/minus-zero.js b/test/built-ins/TypedArray/prototype/slice/minus-zero.js index c597dadec..b4c000bc0 100644 --- a/test/built-ins/TypedArray/prototype/slice/minus-zero.js +++ b/test/built-ins/TypedArray/prototype/slice/minus-zero.js @@ -9,15 +9,15 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); assert( - compareArray(sample.slice(-0), [40, 41, 42, 43]), + compareArray(sample.slice(-0), N([40, 41, 42, 43])), "start == -0" ); assert( - compareArray(sample.slice(-0, 4), [40, 41, 42, 43]), + compareArray(sample.slice(-0, 4), N([40, 41, 42, 43])), "start == -0, end == length" ); assert( diff --git a/test/built-ins/TypedArray/prototype/slice/result-does-not-copy-ordinary-properties.js b/test/built-ins/TypedArray/prototype/slice/result-does-not-copy-ordinary-properties.js index 91df72a33..ca2b9d8e9 100644 --- a/test/built-ins/TypedArray/prototype/slice/result-does-not-copy-ordinary-properties.js +++ b/test/built-ins/TypedArray/prototype/slice/result-does-not-copy-ordinary-properties.js @@ -9,8 +9,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([41, 42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([41, 42, 43, 44])); sample.foo = 42; var result = sample.slice(); diff --git a/test/built-ins/TypedArray/prototype/slice/results-with-different-length.js b/test/built-ins/TypedArray/prototype/slice/results-with-different-length.js index 34a4ad11b..b6a62afb8 100644 --- a/test/built-ins/TypedArray/prototype/slice/results-with-different-length.js +++ b/test/built-ins/TypedArray/prototype/slice/results-with-different-length.js @@ -7,47 +7,47 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); function testRes(result, expected, msg) { assert(compareArray(result, expected), msg + ", result: [" + result + "]"); } - testRes(sample.slice(1), [41, 42, 43], "begin == 1"); - testRes(sample.slice(2), [42, 43], "begin == 2"); - testRes(sample.slice(3), [43], "begin == 3"); + testRes(sample.slice(1), N([41, 42, 43]), "begin == 1"); + testRes(sample.slice(2), N([42, 43]), "begin == 2"); + testRes(sample.slice(3), N([43]), "begin == 3"); - testRes(sample.slice(1, 4), [41, 42, 43], "begin == 1, end == length"); - testRes(sample.slice(2, 4), [42, 43], "begin == 2, end == length"); - testRes(sample.slice(3, 4), [43], "begin == 3, end == length"); + testRes(sample.slice(1, 4), N([41, 42, 43]), "begin == 1, end == length"); + testRes(sample.slice(2, 4), N([42, 43]), "begin == 2, end == length"); + testRes(sample.slice(3, 4), N([43]), "begin == 3, end == length"); - testRes(sample.slice(0, 1), [40], "begin == 0, end == 1"); - testRes(sample.slice(0, 2), [40, 41], "begin == 0, end == 2"); - testRes(sample.slice(0, 3), [40, 41, 42], "begin == 0, end == 3"); + testRes(sample.slice(0, 1), N([40]), "begin == 0, end == 1"); + testRes(sample.slice(0, 2), N([40, 41]), "begin == 0, end == 2"); + testRes(sample.slice(0, 3), N([40, 41, 42]), "begin == 0, end == 3"); - testRes(sample.slice(-1), [43], "begin == -1"); - testRes(sample.slice(-2), [42, 43], "begin == -2"); - testRes(sample.slice(-3), [41, 42, 43], "begin == -3"); + testRes(sample.slice(-1), N([43]), "begin == -1"); + testRes(sample.slice(-2), N([42, 43]), "begin == -2"); + testRes(sample.slice(-3), N([41, 42, 43]), "begin == -3"); - testRes(sample.slice(-1, 4), [43], "begin == -1, end == length"); - testRes(sample.slice(-2, 4), [42, 43], "begin == -2, end == length"); - testRes(sample.slice(-3, 4), [41, 42, 43], "begin == -3, end == length"); + testRes(sample.slice(-1, 4), N([43]), "begin == -1, end == length"); + testRes(sample.slice(-2, 4), N([42, 43]), "begin == -2, end == length"); + testRes(sample.slice(-3, 4), N([41, 42, 43]), "begin == -3, end == length"); - testRes(sample.slice(0, -1), [40, 41, 42], "begin == 0, end == -1"); - testRes(sample.slice(0, -2), [40, 41], "begin == 0, end == -2"); - testRes(sample.slice(0, -3), [40], "begin == 0, end == -3"); + testRes(sample.slice(0, -1), N([40, 41, 42]), "begin == 0, end == -1"); + testRes(sample.slice(0, -2), N([40, 41]), "begin == 0, end == -2"); + testRes(sample.slice(0, -3), N([40]), "begin == 0, end == -3"); - testRes(sample.slice(-0, -1), [40, 41, 42], "begin == -0, end == -1"); - testRes(sample.slice(-0, -2), [40, 41], "begin == -0, end == -2"); - testRes(sample.slice(-0, -3), [40], "begin == -0, end == -3"); + testRes(sample.slice(-0, -1), N([40, 41, 42]), "begin == -0, end == -1"); + testRes(sample.slice(-0, -2), N([40, 41]), "begin == -0, end == -2"); + testRes(sample.slice(-0, -3), N([40]), "begin == -0, end == -3"); - testRes(sample.slice(-2, -1), [42], "length == 4, begin == -2, end == -1"); - testRes(sample.slice(1, -1), [41, 42], "length == 4, begin == 1, end == -1"); - testRes(sample.slice(1, -2), [41], "length == 4, begin == 1, end == -2"); - testRes(sample.slice(2, -1), [42], "length == 4, begin == 2, end == -1"); + testRes(sample.slice(-2, -1), N([42]), "length == 4, begin == -2, end == -1"); + testRes(sample.slice(1, -1), N([41, 42]), "length == 4, begin == 1, end == -1"); + testRes(sample.slice(1, -2), N([41]), "length == 4, begin == 1, end == -2"); + testRes(sample.slice(2, -1), N([42]), "length == 4, begin == 2, end == -1"); - testRes(sample.slice(-1, 5), [43], "begin == -1, end > length"); - testRes(sample.slice(-2, 4), [42, 43], "begin == -2, end > length"); - testRes(sample.slice(-3, 4), [41, 42, 43], "begin == -3, end > length"); + testRes(sample.slice(-1, 5), N([43]), "begin == -1, end > length"); + testRes(sample.slice(-2, 4), N([42, 43]), "begin == -2, end > length"); + testRes(sample.slice(-3, 4), N([41, 42, 43]), "begin == -3, end > length"); }); diff --git a/test/built-ins/TypedArray/prototype/slice/results-with-empty-length.js b/test/built-ins/TypedArray/prototype/slice/results-with-empty-length.js index 7cd44b9c6..a3c749057 100644 --- a/test/built-ins/TypedArray/prototype/slice/results-with-empty-length.js +++ b/test/built-ins/TypedArray/prototype/slice/results-with-empty-length.js @@ -7,8 +7,8 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); function testRes(result, msg) { assert.sameValue(result.length, 0, msg); diff --git a/test/built-ins/TypedArray/prototype/slice/results-with-same-length.js b/test/built-ins/TypedArray/prototype/slice/results-with-same-length.js index d89cbbdf5..904efd50b 100644 --- a/test/built-ins/TypedArray/prototype/slice/results-with-same-length.js +++ b/test/built-ins/TypedArray/prototype/slice/results-with-same-length.js @@ -7,15 +7,15 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); function testRes(result, msg) { assert.sameValue(result.length, 4, msg); - assert.sameValue(result[0], 40, msg + " & result[0] === 40"); - assert.sameValue(result[1], 41, msg + " & result[1] === 41"); - assert.sameValue(result[2], 42, msg + " & result[2] === 42"); - assert.sameValue(result[3], 43, msg + " & result[3] === 43"); + assert.sameValue(result[0], N(40), msg + " & result[0] === 40"); + assert.sameValue(result[1], N(41), msg + " & result[1] === 41"); + assert.sameValue(result[2], N(42), msg + " & result[2] === 42"); + assert.sameValue(result[3], N(43), msg + " & result[3] === 43"); } testRes(sample.slice(0), "begin == 0"); diff --git a/test/built-ins/TypedArray/prototype/slice/set-values-from-different-ctor-type.js b/test/built-ins/TypedArray/prototype/slice/set-values-from-different-ctor-type.js index cb19d311d..89f322ce0 100644 --- a/test/built-ins/TypedArray/prototype/slice/set-values-from-different-ctor-type.js +++ b/test/built-ins/TypedArray/prototype/slice/set-values-from-different-ctor-type.js @@ -32,16 +32,19 @@ features: [Symbol.species, TypedArray] var arr = [42, 43, 44]; -testWithTypedArrayConstructors(function(TA) { - var sample = new TA(arr); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N(arr)); var other = TA === Int8Array ? Uint8Array : Int8Array; + if (typeof BigInt !== "undefined") { + other = TA === BigInt64Array ? BigUint64Array : + TA === BigUint64Array ? BigInt64Array : other; sample.constructor = {}; sample.constructor[Symbol.species] = other; var result = sample.slice(); - assert(compareArray(result, arr), "values are set"); + assert(compareArray(result, N(arr)), "values are set"); assert.notSameValue(result.buffer, sample.buffer, "creates a new buffer"); assert.sameValue(result.constructor, other, "used the custom ctor"); }); diff --git a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-abrupt.js b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-abrupt.js index d7baa426e..d0f2d147b 100644 --- a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-abrupt.js +++ b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-abrupt.js @@ -26,8 +26,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); Object.defineProperty(sample, "constructor", { get: function() { diff --git a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-inherited.js b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-inherited.js index 79c9df2a7..d2d7667a9 100644 --- a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-inherited.js +++ b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-inherited.js @@ -26,8 +26,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); var calls = 0; var result; diff --git a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-returns-throws.js b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-returns-throws.js index c048632f2..9910c9b4e 100644 --- a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-returns-throws.js +++ b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-returns-throws.js @@ -28,8 +28,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); sample.constructor = 42; assert.throws(TypeError, function() { diff --git a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor.js b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor.js index c09681ec0..ca237fb6d 100644 --- a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor.js +++ b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor.js @@ -26,8 +26,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); var calls = 0; var result; diff --git a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor-invocation.js b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor-invocation.js index d1642f1b7..15acea7c6 100644 --- a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor-invocation.js +++ b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor-invocation.js @@ -36,8 +36,8 @@ includes: [testTypedArray.js] features: [Symbol.species, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42])); var result, ctorThis; sample.constructor = {}; diff --git a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor-returns-another-instance.js b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor-returns-another-instance.js index 7bb19f5df..6b95f571b 100644 --- a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor-returns-another-instance.js +++ b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor-returns-another-instance.js @@ -36,8 +36,8 @@ includes: [testTypedArray.js, compareArray.js] features: [Symbol.species, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40])); var other = new Int8Array([1, 0, 1]); var result; diff --git a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor.js b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor.js index 0477a0fd4..5a5151e72 100644 --- a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor.js +++ b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor.js @@ -36,8 +36,8 @@ includes: [testTypedArray.js, compareArray.js] features: [Symbol.species, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42])); var calls = 0; var result; @@ -50,5 +50,5 @@ testWithTypedArrayConstructors(function(TA) { result = sample.slice(1); assert.sameValue(calls, 1, "ctor called once"); - assert(compareArray(result, [41, 42]), "expected object"); + assert(compareArray(result, N([41, 42])), "expected object"); }); diff --git a/test/built-ins/TypedArray/prototype/slice/tointeger-end.js b/test/built-ins/TypedArray/prototype/slice/tointeger-end.js index 2a9be9406..df15d831c 100644 --- a/test/built-ins/TypedArray/prototype/slice/tointeger-end.js +++ b/test/built-ins/TypedArray/prototype/slice/tointeger-end.js @@ -20,28 +20,28 @@ var obj = { } }; -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); assert(compareArray(sample.slice(0, false), []), "false"); - assert(compareArray(sample.slice(0, true), [40]), "true"); + assert(compareArray(sample.slice(0, true), N([40])), "true"); assert(compareArray(sample.slice(0, NaN), []), "NaN"); assert(compareArray(sample.slice(0, null), []), "null"); - assert(compareArray(sample.slice(0, undefined), [40, 41, 42, 43]), "undefined"); + assert(compareArray(sample.slice(0, undefined), N([40, 41, 42, 43])), "undefined"); assert(compareArray(sample.slice(0, 0.6), []), "0.6"); - assert(compareArray(sample.slice(0, 1.1), [40]), "1.1"); - assert(compareArray(sample.slice(0, 1.5), [40]), "1.5"); + assert(compareArray(sample.slice(0, 1.1), N([40])), "1.1"); + assert(compareArray(sample.slice(0, 1.5), N([40])), "1.5"); assert(compareArray(sample.slice(0, -0.6), []), "-0.6"); - assert(compareArray(sample.slice(0, -1.1), [40, 41, 42]), "-1.1"); - assert(compareArray(sample.slice(0, -1.5), [40, 41, 42]), "-1.5"); + assert(compareArray(sample.slice(0, -1.1), N([40, 41, 42])), "-1.1"); + assert(compareArray(sample.slice(0, -1.5), N([40, 41, 42])), "-1.5"); - assert(compareArray(sample.slice(0, "3"), [40, 41, 42]), "string"); + assert(compareArray(sample.slice(0, "3"), N([40, 41, 42])), "string"); assert( compareArray( sample.slice(0, obj), - [40, 41] + N([40, 41]) ), "object" ); diff --git a/test/built-ins/TypedArray/prototype/slice/tointeger-start.js b/test/built-ins/TypedArray/prototype/slice/tointeger-start.js index f67ee090c..353ac46e2 100644 --- a/test/built-ins/TypedArray/prototype/slice/tointeger-start.js +++ b/test/built-ins/TypedArray/prototype/slice/tointeger-start.js @@ -19,29 +19,29 @@ var obj = { } }; -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); - assert(compareArray(sample.slice(false), [40, 41, 42, 43]), "false"); - assert(compareArray(sample.slice(true), [41, 42, 43]), "true"); + assert(compareArray(sample.slice(false), N([40, 41, 42, 43])), "false"); + assert(compareArray(sample.slice(true), N([41, 42, 43])), "true"); - assert(compareArray(sample.slice(NaN), [40, 41, 42, 43]), "NaN"); - assert(compareArray(sample.slice(null), [40, 41, 42, 43]), "null"); - assert(compareArray(sample.slice(undefined), [40, 41, 42, 43]), "undefined"); + assert(compareArray(sample.slice(NaN), N([40, 41, 42, 43])), "NaN"); + assert(compareArray(sample.slice(null), N([40, 41, 42, 43])), "null"); + assert(compareArray(sample.slice(undefined), N([40, 41, 42, 43])), "undefined"); - assert(compareArray(sample.slice(1.1), [41, 42, 43]), "1.1"); - assert(compareArray(sample.slice(1.5), [41, 42, 43]), "1.5"); - assert(compareArray(sample.slice(0.6), [40, 41, 42, 43]), "0.6"); + assert(compareArray(sample.slice(1.1), N([41, 42, 43])), "1.1"); + assert(compareArray(sample.slice(1.5), N([41, 42, 43])), "1.5"); + assert(compareArray(sample.slice(0.6), N([40, 41, 42, 43])), "0.6"); - assert(compareArray(sample.slice(-1.5), [43]), "-1.5"); - assert(compareArray(sample.slice(-1.1), [43]), "-1.1"); - assert(compareArray(sample.slice(-0.6), [40, 41, 42, 43]), "-0.6"); + assert(compareArray(sample.slice(-1.5), N([43])), "-1.5"); + assert(compareArray(sample.slice(-1.1), N([43])), "-1.1"); + assert(compareArray(sample.slice(-0.6), N([40, 41, 42, 43])), "-0.6"); - assert(compareArray(sample.slice("3"), [43]), "string"); + assert(compareArray(sample.slice("3"), N([43])), "string"); assert( compareArray( sample.slice(obj), - [42, 43] + N([42, 43]) ), "object" ); diff --git a/test/built-ins/TypedArray/prototype/some/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/some/callbackfn-arguments-with-thisarg.js index 57fbcf3f5..cb579688a 100644 --- a/test/built-ins/TypedArray/prototype/some/callbackfn-arguments-with-thisarg.js +++ b/test/built-ins/TypedArray/prototype/some/callbackfn-arguments-with-thisarg.js @@ -27,8 +27,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); var results = []; var thisArg = ["test262", 0, "ecma262", 0]; @@ -41,17 +41,17 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(thisArg.length, 4, "thisArg.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], 42, "results[0][0] - kValue"); + assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], 43, "results[1][0] - kValue"); + assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], 44, "results[2][0] - kValue"); + assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/some/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/some/callbackfn-arguments-without-thisarg.js index fff82e93b..44d890c4d 100644 --- a/test/built-ins/TypedArray/prototype/some/callbackfn-arguments-without-thisarg.js +++ b/test/built-ins/TypedArray/prototype/some/callbackfn-arguments-without-thisarg.js @@ -27,8 +27,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); var results = []; @@ -39,17 +39,17 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(results.length, 3, "results.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], 42, "results[0][0] - kValue"); + assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], 43, "results[1][0] - kValue"); + assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], 44, "results[2][0] - kValue"); + assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/some/callbackfn-no-interaction-over-non-integer.js b/test/built-ins/TypedArray/prototype/some/callbackfn-no-interaction-over-non-integer.js index d7a55a444..f28e0d907 100644 --- a/test/built-ins/TypedArray/prototype/some/callbackfn-no-interaction-over-non-integer.js +++ b/test/built-ins/TypedArray/prototype/some/callbackfn-no-interaction-over-non-integer.js @@ -18,8 +18,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([7, 8]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([7, 8])); var results = []; @@ -35,6 +35,6 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(results[0][1], 0, "results[0][1] - key"); assert.sameValue(results[1][1], 1, "results[1][1] - key"); - assert.sameValue(results[0][0], 7, "results[0][0] - value"); - assert.sameValue(results[1][0], 8, "results[1][0] - value"); + assert.sameValue(results[0][0], N(7), "results[0][0] - value"); + assert.sameValue(results[1][0], N(8), "results[1][0] - value"); }); diff --git a/test/built-ins/TypedArray/prototype/some/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/some/callbackfn-return-does-not-change-instance.js index ddfedf5af..e7df5442d 100644 --- a/test/built-ins/TypedArray/prototype/some/callbackfn-return-does-not-change-instance.js +++ b/test/built-ins/TypedArray/prototype/some/callbackfn-return-does-not-change-instance.js @@ -25,14 +25,14 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42])); sample.some(function() { return 0; }); - assert.sameValue(sample[0], 40, "[0] == 40"); - assert.sameValue(sample[1], 41, "[1] == 41"); - assert.sameValue(sample[2], 42, "[2] == 42"); + assert.sameValue(sample[0], N(40), "[0] == 40"); + assert.sameValue(sample[1], N(41), "[1] == 41"); + assert.sameValue(sample[2], N(42), "[2] == 42"); }); diff --git a/test/built-ins/TypedArray/prototype/some/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/some/callbackfn-set-value-during-interaction.js index da68b8a16..c779dbb04 100644 --- a/test/built-ins/TypedArray/prototype/some/callbackfn-set-value-during-interaction.js +++ b/test/built-ins/TypedArray/prototype/some/callbackfn-set-value-during-interaction.js @@ -25,24 +25,24 @@ includes: [testTypedArray.js] features: [Reflect.set, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); var newVal = 0; sample.some(function(val, i) { if (i > 0) { assert.sameValue( - sample[i - 1], newVal - 1, + sample[i - 1], N(newVal - 1), "get the changed value during the loop" ); assert.sameValue( - Reflect.set(sample, 0, 7), + Reflect.set(sample, 0, N(7)), true, "re-set a value for sample[0]" ); } assert.sameValue( - Reflect.set(sample, i, newVal), + Reflect.set(sample, i, N(newVal)), true, "set value during iteration" ); @@ -50,7 +50,7 @@ testWithTypedArrayConstructors(function(TA) { newVal++; }); - assert.sameValue(sample[0], 7, "changed values after iteration [0] == 7"); - assert.sameValue(sample[1], 1, "changed values after iteration [1] == 1"); - assert.sameValue(sample[2], 2, "changed values after iteration [2] == 2"); + assert.sameValue(sample[0], N(7), "changed values after iteration [0] == 7"); + assert.sameValue(sample[1], N(1), "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], N(2), "changed values after iteration [2] == 2"); }); diff --git a/test/built-ins/TypedArray/prototype/some/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/some/get-length-uses-internal-arraylength.js index 3fd958a92..14c21cab2 100644 --- a/test/built-ins/TypedArray/prototype/some/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/some/get-length-uses-internal-arraylength.js @@ -30,8 +30,8 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); var calls = 0; Object.defineProperty(TA.prototype, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/some/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/some/values-are-not-cached.js index c8a3c2cde..12fc43d9c 100644 --- a/test/built-ins/TypedArray/prototype/some/values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/some/values-are-not-cached.js @@ -25,16 +25,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44])); sample.some(function(v, i) { if (i < sample.length - 1) { - sample[i+1] = 42; + sample[i+1] = N(42); } assert.sameValue( - v, 42, "method does not cache values before callbackfn calls" + v, N(42), "method does not cache values before callbackfn calls" ); }); }); diff --git a/test/built-ins/TypedArray/prototype/sort/arraylength-internal.js b/test/built-ins/TypedArray/prototype/sort/arraylength-internal.js index 543c4eaa6..833ed4cd1 100644 --- a/test/built-ins/TypedArray/prototype/sort/arraylength-internal.js +++ b/test/built-ins/TypedArray/prototype/sort/arraylength-internal.js @@ -22,8 +22,8 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 42, 42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 42, 42])); getCalls = 0; Object.defineProperty(TA.prototype, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/sort/comparefn-call-throws.js b/test/built-ins/TypedArray/prototype/sort/comparefn-call-throws.js index 3370975d0..6754d8523 100644 --- a/test/built-ins/TypedArray/prototype/sort/comparefn-call-throws.js +++ b/test/built-ins/TypedArray/prototype/sort/comparefn-call-throws.js @@ -25,8 +25,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44, 45, 46]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44, 45, 46])); var calls = 0; var comparefn = function() { diff --git a/test/built-ins/TypedArray/prototype/sort/comparefn-calls.js b/test/built-ins/TypedArray/prototype/sort/comparefn-calls.js index 6c0602182..52ba9cce2 100644 --- a/test/built-ins/TypedArray/prototype/sort/comparefn-calls.js +++ b/test/built-ins/TypedArray/prototype/sort/comparefn-calls.js @@ -22,8 +22,8 @@ var expectedThis = (function() { return this; })(); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 42, 42, 42, 42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 42, 42, 42, 42])); var calls = []; var comparefn = function() { @@ -36,7 +36,7 @@ testWithTypedArrayConstructors(function(TA) { calls.forEach(function(args) { assert.sameValue(args[0], expectedThis, "comparefn is called no specific this"); assert.sameValue(args[1].length, 2, "comparefn is always called with 2 args"); - assert.sameValue(args[1][0], 42, "x is a listed value"); - assert.sameValue(args[1][0], 42, "y is a listed value"); + assert.sameValue(args[1][0], N(42), "x is a listed value"); + assert.sameValue(args[1][0], N(42), "y is a listed value"); }); }); diff --git a/test/built-ins/TypedArray/prototype/sort/comparefn-nonfunction-call-throws.js b/test/built-ins/TypedArray/prototype/sort/comparefn-nonfunction-call-throws.js index dceb36d66..a2e5cf0ef 100644 --- a/test/built-ins/TypedArray/prototype/sort/comparefn-nonfunction-call-throws.js +++ b/test/built-ins/TypedArray/prototype/sort/comparefn-nonfunction-call-throws.js @@ -18,8 +18,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43, 44, 45, 46]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43, 44, 45, 46])); assert.throws(TypeError, function() { sample.sort(null); diff --git a/test/built-ins/TypedArray/prototype/sort/return-same-instance.js b/test/built-ins/TypedArray/prototype/sort/return-same-instance.js index f95885080..e45ad5eaf 100644 --- a/test/built-ins/TypedArray/prototype/sort/return-same-instance.js +++ b/test/built-ins/TypedArray/prototype/sort/return-same-instance.js @@ -14,8 +14,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([2, 1]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([2, 1])); var result = sample.sort(); assert.sameValue(sample, result, "without comparefn"); diff --git a/test/built-ins/TypedArray/prototype/sort/sortcompare-with-no-tostring.js b/test/built-ins/TypedArray/prototype/sort/sortcompare-with-no-tostring.js index f3bb0cac0..ec42fb069 100644 --- a/test/built-ins/TypedArray/prototype/sort/sortcompare-with-no-tostring.js +++ b/test/built-ins/TypedArray/prototype/sort/sortcompare-with-no-tostring.js @@ -20,8 +20,8 @@ features: [TypedArray] var origToString = Number.prototype.toString; -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([20, 100, 3]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([20, 100, 3])); var result = sample.sort(); - assert(compareArray(result, [3, 20, 100])); + assert(compareArray(result, N([3, 20, 100]))); }); diff --git a/test/built-ins/TypedArray/prototype/sort/sorted-values.js b/test/built-ins/TypedArray/prototype/sort/sorted-values.js index 83d870e9e..ad3515350 100644 --- a/test/built-ins/TypedArray/prototype/sort/sorted-values.js +++ b/test/built-ins/TypedArray/prototype/sort/sorted-values.js @@ -14,20 +14,20 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample; - sample = new TA([4, 3, 2, 1]).sort(); - assert(compareArray(sample, [1, 2, 3, 4]), "descending values"); + sample = new TA(N([4, 3, 2, 1])).sort(); + assert(compareArray(sample, N([1, 2, 3, 4])), "descending values"); - sample = new TA([3, 4, 1, 2]).sort(); - assert(compareArray(sample, [1, 2, 3, 4]), "mixed numbers"); + sample = new TA(N([3, 4, 1, 2])).sort(); + assert(compareArray(sample, N([1, 2, 3, 4])), "mixed numbers"); - sample = new TA([3, 4, 3, 1, 0, 1, 2]).sort(); - assert(compareArray(sample, [0, 1, 1, 2, 3, 3, 4]), "repeating numbers"); + sample = new TA(N([3, 4, 3, 1, 0, 1, 2])).sort(); + assert(compareArray(sample, N([0, 1, 1, 2, 3, 3, 4])), "repeating numbers"); - sample = new TA([1, 0, -0, 2]).sort(); - assert(compareArray(sample, [0, 0, 1, 2]), "0s"); + sample = new TA(N([1, 0, -0, 2])).sort(); + assert(compareArray(sample, N([0, 0, 1, 2])), "0s"); }); testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/subarray/infinity.js b/test/built-ins/TypedArray/prototype/subarray/infinity.js index 8a2746492..df67a42c1 100644 --- a/test/built-ins/TypedArray/prototype/subarray/infinity.js +++ b/test/built-ins/TypedArray/prototype/subarray/infinity.js @@ -9,11 +9,11 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); assert( - compareArray(sample.subarray(-Infinity), [40, 41, 42, 43]), + compareArray(sample.subarray(-Infinity), N([40, 41, 42, 43])), "begin == -Infinity" ); assert( @@ -25,7 +25,7 @@ testWithTypedArrayConstructors(function(TA) { "end == -Infinity" ); assert( - compareArray(sample.subarray(0, Infinity), [40, 41, 42, 43]), + compareArray(sample.subarray(0, Infinity), N([40, 41, 42, 43])), "end == Infinity" ); }); diff --git a/test/built-ins/TypedArray/prototype/subarray/minus-zero.js b/test/built-ins/TypedArray/prototype/subarray/minus-zero.js index de714ad46..def5ab035 100644 --- a/test/built-ins/TypedArray/prototype/subarray/minus-zero.js +++ b/test/built-ins/TypedArray/prototype/subarray/minus-zero.js @@ -9,15 +9,15 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); assert( - compareArray(sample.subarray(-0), [40, 41, 42, 43]), + compareArray(sample.subarray(-0), N([40, 41, 42, 43])), "begin == -0" ); assert( - compareArray(sample.subarray(-0, 4), [40, 41, 42, 43]), + compareArray(sample.subarray(-0, 4), N([40, 41, 42, 43])), "being == -0, end == length" ); assert( diff --git a/test/built-ins/TypedArray/prototype/subarray/result-does-not-copy-ordinary-properties.js b/test/built-ins/TypedArray/prototype/subarray/result-does-not-copy-ordinary-properties.js index c8e9e0d6c..f08f99d50 100644 --- a/test/built-ins/TypedArray/prototype/subarray/result-does-not-copy-ordinary-properties.js +++ b/test/built-ins/TypedArray/prototype/subarray/result-does-not-copy-ordinary-properties.js @@ -12,8 +12,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([41, 42, 43, 44]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([41, 42, 43, 44])); var result; sample.foo = 42; diff --git a/test/built-ins/TypedArray/prototype/subarray/result-is-new-instance-from-same-ctor.js b/test/built-ins/TypedArray/prototype/subarray/result-is-new-instance-from-same-ctor.js index a507518bb..f995d6a5f 100644 --- a/test/built-ins/TypedArray/prototype/subarray/result-is-new-instance-from-same-ctor.js +++ b/test/built-ins/TypedArray/prototype/subarray/result-is-new-instance-from-same-ctor.js @@ -12,8 +12,8 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); var result = sample.subarray(1); assert.sameValue( @@ -25,7 +25,7 @@ testWithTypedArrayConstructors(function(TA) { assert(result instanceof TA, "instanceof"); assert( - compareArray(sample, [40, 41, 42, 43]), + compareArray(sample, N([40, 41, 42, 43])), "original sample remains the same" ); }); diff --git a/test/built-ins/TypedArray/prototype/subarray/result-is-new-instance-with-shared-buffer.js b/test/built-ins/TypedArray/prototype/subarray/result-is-new-instance-with-shared-buffer.js index ff3925eb6..704a2feb3 100644 --- a/test/built-ins/TypedArray/prototype/subarray/result-is-new-instance-with-shared-buffer.js +++ b/test/built-ins/TypedArray/prototype/subarray/result-is-new-instance-with-shared-buffer.js @@ -12,8 +12,8 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); var buffer = sample.buffer; var result = sample.subarray(1); @@ -21,15 +21,15 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(result.buffer, sample.buffer, "shared buffer"); assert.sameValue(sample.buffer, buffer, "original buffer is preserved"); - sample[1] = 100; + sample[1] = N(100); assert( - compareArray(result, [100, 42, 43]), + compareArray(result, N([100, 42, 43])), "changes on the original sample values affect the new instance" ); - result[1] = 111; + result[1] = N(111); assert( - compareArray(sample, [40, 100, 111, 43]), + compareArray(sample, N([40, 100, 111, 43])), "changes on the new instance values affect the original sample" ); }); diff --git a/test/built-ins/TypedArray/prototype/subarray/results-with-different-length.js b/test/built-ins/TypedArray/prototype/subarray/results-with-different-length.js index c206e2462..89c9846ea 100644 --- a/test/built-ins/TypedArray/prototype/subarray/results-with-different-length.js +++ b/test/built-ins/TypedArray/prototype/subarray/results-with-different-length.js @@ -12,47 +12,47 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); function testRes(result, expected, msg) { assert(compareArray(result, expected), msg + ", result: [" + result + "]"); } - testRes(sample.subarray(1), [41, 42, 43], "begin == 1"); - testRes(sample.subarray(2), [42, 43], "begin == 2"); - testRes(sample.subarray(3), [43], "begin == 3"); + testRes(sample.subarray(1), N([41, 42, 43]), "begin == 1"); + testRes(sample.subarray(2), N([42, 43]), "begin == 2"); + testRes(sample.subarray(3), N([43]), "begin == 3"); - testRes(sample.subarray(1, 4), [41, 42, 43], "begin == 1, end == length"); - testRes(sample.subarray(2, 4), [42, 43], "begin == 2, end == length"); - testRes(sample.subarray(3, 4), [43], "begin == 3, end == length"); + testRes(sample.subarray(1, 4), N([41, 42, 43]), "begin == 1, end == length"); + testRes(sample.subarray(2, 4), N([42, 43]), "begin == 2, end == length"); + testRes(sample.subarray(3, 4), N([43]), "begin == 3, end == length"); - testRes(sample.subarray(0, 1), [40], "begin == 0, end == 1"); - testRes(sample.subarray(0, 2), [40, 41], "begin == 0, end == 2"); - testRes(sample.subarray(0, 3), [40, 41, 42], "begin == 0, end == 3"); + testRes(sample.subarray(0, 1), N([40]), "begin == 0, end == 1"); + testRes(sample.subarray(0, 2), N([40, 41]), "begin == 0, end == 2"); + testRes(sample.subarray(0, 3), N([40, 41, 42]), "begin == 0, end == 3"); - testRes(sample.subarray(-1), [43], "begin == -1"); - testRes(sample.subarray(-2), [42, 43], "begin == -2"); - testRes(sample.subarray(-3), [41, 42, 43], "begin == -3"); + testRes(sample.subarray(-1), N([43]), "begin == -1"); + testRes(sample.subarray(-2), N([42, 43]), "begin == -2"); + testRes(sample.subarray(-3), N([41, 42, 43]), "begin == -3"); - testRes(sample.subarray(-1, 4), [43], "begin == -1, end == length"); - testRes(sample.subarray(-2, 4), [42, 43], "begin == -2, end == length"); - testRes(sample.subarray(-3, 4), [41, 42, 43], "begin == -3, end == length"); + testRes(sample.subarray(-1, 4), N([43]), "begin == -1, end == length"); + testRes(sample.subarray(-2, 4), N([42, 43]), "begin == -2, end == length"); + testRes(sample.subarray(-3, 4), N([41, 42, 43]), "begin == -3, end == length"); - testRes(sample.subarray(0, -1), [40, 41, 42], "begin == 0, end == -1"); - testRes(sample.subarray(0, -2), [40, 41], "begin == 0, end == -2"); - testRes(sample.subarray(0, -3), [40], "begin == 0, end == -3"); + testRes(sample.subarray(0, -1), N([40, 41, 42]), "begin == 0, end == -1"); + testRes(sample.subarray(0, -2), N([40, 41]), "begin == 0, end == -2"); + testRes(sample.subarray(0, -3), N([40]), "begin == 0, end == -3"); - testRes(sample.subarray(-0, -1), [40, 41, 42], "begin == -0, end == -1"); - testRes(sample.subarray(-0, -2), [40, 41], "begin == -0, end == -2"); - testRes(sample.subarray(-0, -3), [40], "begin == -0, end == -3"); + testRes(sample.subarray(-0, -1), N([40, 41, 42]), "begin == -0, end == -1"); + testRes(sample.subarray(-0, -2), N([40, 41]), "begin == -0, end == -2"); + testRes(sample.subarray(-0, -3), N([40]), "begin == -0, end == -3"); - testRes(sample.subarray(-2, -1), [42], "length == 4, begin == -2, end == -1"); - testRes(sample.subarray(1, -1), [41, 42], "length == 4, begin == 1, end == -1"); - testRes(sample.subarray(1, -2), [41], "length == 4, begin == 1, end == -2"); - testRes(sample.subarray(2, -1), [42], "length == 4, begin == 2, end == -1"); + testRes(sample.subarray(-2, -1), N([42]), "length == 4, begin == -2, end == -1"); + testRes(sample.subarray(1, -1), N([41, 42]), "length == 4, begin == 1, end == -1"); + testRes(sample.subarray(1, -2), N([41]), "length == 4, begin == 1, end == -2"); + testRes(sample.subarray(2, -1), N([42]), "length == 4, begin == 2, end == -1"); - testRes(sample.subarray(-1, 5), [43], "begin == -1, end > length"); - testRes(sample.subarray(-2, 4), [42, 43], "begin == -2, end > length"); - testRes(sample.subarray(-3, 4), [41, 42, 43], "begin == -3, end > length"); + testRes(sample.subarray(-1, 5), N([43]), "begin == -1, end > length"); + testRes(sample.subarray(-2, 4), N([42, 43]), "begin == -2, end > length"); + testRes(sample.subarray(-3, 4), N([41, 42, 43]), "begin == -3, end > length"); }); diff --git a/test/built-ins/TypedArray/prototype/subarray/results-with-empty-length.js b/test/built-ins/TypedArray/prototype/subarray/results-with-empty-length.js index 0660a1112..23a425836 100644 --- a/test/built-ins/TypedArray/prototype/subarray/results-with-empty-length.js +++ b/test/built-ins/TypedArray/prototype/subarray/results-with-empty-length.js @@ -12,8 +12,8 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); function testRes(result, msg) { assert.sameValue(result.length, 0, msg); diff --git a/test/built-ins/TypedArray/prototype/subarray/results-with-same-length.js b/test/built-ins/TypedArray/prototype/subarray/results-with-same-length.js index 947e95722..a78adfee1 100644 --- a/test/built-ins/TypedArray/prototype/subarray/results-with-same-length.js +++ b/test/built-ins/TypedArray/prototype/subarray/results-with-same-length.js @@ -12,15 +12,15 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); function testRes(result, msg) { assert.sameValue(result.length, 4, msg); - assert.sameValue(result[0], 40, msg + " & result[0] === 40"); - assert.sameValue(result[1], 41, msg + " & result[1] === 41"); - assert.sameValue(result[2], 42, msg + " & result[2] === 42"); - assert.sameValue(result[3], 43, msg + " & result[3] === 43"); + assert.sameValue(result[0], N(40), msg + " & result[0] === 40"); + assert.sameValue(result[1], N(41), msg + " & result[1] === 41"); + assert.sameValue(result[2], N(42), msg + " & result[2] === 42"); + assert.sameValue(result[3], N(43), msg + " & result[3] === 43"); } testRes(sample.subarray(0), "begin == 0"); diff --git a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-abrupt.js b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-abrupt.js index a7d2bc800..ca5a484fa 100644 --- a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-abrupt.js +++ b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-abrupt.js @@ -25,8 +25,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); Object.defineProperty(sample, "constructor", { get: function() { diff --git a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-inherited.js b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-inherited.js index 3fa39b431..65771d46d 100644 --- a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-inherited.js +++ b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-inherited.js @@ -25,8 +25,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); var calls = 0; var result; diff --git a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-returns-throws.js b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-returns-throws.js index 70714191e..1a8b1a472 100644 --- a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-returns-throws.js +++ b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-returns-throws.js @@ -27,8 +27,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); sample.constructor = 42; assert.throws(TypeError, function() { diff --git a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor.js b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor.js index 6e6a65e3b..9622a8477 100644 --- a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor.js +++ b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor.js @@ -25,8 +25,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); var calls = 0; var result; diff --git a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor-invocation.js b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor-invocation.js index 0b62ffdcb..d8931af98 100644 --- a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor-invocation.js +++ b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor-invocation.js @@ -35,8 +35,8 @@ includes: [testTypedArray.js] features: [Symbol.species, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42])); var expectedOffset = TA.BYTES_PER_ELEMENT; var result, ctorThis; diff --git a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor-returns-another-instance.js b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor-returns-another-instance.js index 3ed6ba00a..77e3c2c5b 100644 --- a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor-returns-another-instance.js +++ b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor-returns-another-instance.js @@ -35,8 +35,8 @@ includes: [testTypedArray.js, compareArray.js] features: [Symbol.species, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40])); var other = new Int8Array([1, 0, 1]); var result; diff --git a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor.js b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor.js index 5dbc2cc36..963db60dc 100644 --- a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor.js +++ b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor.js @@ -35,8 +35,8 @@ includes: [testTypedArray.js, compareArray.js] features: [Symbol.species, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42])); var calls = 0; var result; @@ -49,5 +49,5 @@ testWithTypedArrayConstructors(function(TA) { result = sample.subarray(1); assert.sameValue(calls, 1, "ctor called once"); - assert(compareArray(result, [41, 42]), "expected subarray"); + assert(compareArray(result, N([41, 42])), "expected subarray"); }); diff --git a/test/built-ins/TypedArray/prototype/subarray/tointeger-begin.js b/test/built-ins/TypedArray/prototype/subarray/tointeger-begin.js index abf503cb8..d135984a3 100644 --- a/test/built-ins/TypedArray/prototype/subarray/tointeger-begin.js +++ b/test/built-ins/TypedArray/prototype/subarray/tointeger-begin.js @@ -19,29 +19,29 @@ var obj = { } }; -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); - assert(compareArray(sample.subarray(false), [40, 41, 42, 43]), "false"); - assert(compareArray(sample.subarray(true), [41, 42, 43]), "true"); + assert(compareArray(sample.subarray(false), N([40, 41, 42, 43])), "false"); + assert(compareArray(sample.subarray(true), N([41, 42, 43])), "true"); - assert(compareArray(sample.subarray(NaN), [40, 41, 42, 43]), "NaN"); - assert(compareArray(sample.subarray(null), [40, 41, 42, 43]), "null"); - assert(compareArray(sample.subarray(undefined), [40, 41, 42, 43]), "undefined"); + assert(compareArray(sample.subarray(NaN), N([40, 41, 42, 43])), "NaN"); + assert(compareArray(sample.subarray(null), N([40, 41, 42, 43])), "null"); + assert(compareArray(sample.subarray(undefined), N([40, 41, 42, 43])), "undefined"); - assert(compareArray(sample.subarray(1.1), [41, 42, 43]), "1.1"); - assert(compareArray(sample.subarray(1.5), [41, 42, 43]), "1.5"); - assert(compareArray(sample.subarray(0.6), [40, 41, 42, 43]), "0.6"); + assert(compareArray(sample.subarray(1.1), N([41, 42, 43])), "1.1"); + assert(compareArray(sample.subarray(1.5), N([41, 42, 43])), "1.5"); + assert(compareArray(sample.subarray(0.6), N([40, 41, 42, 43])), "0.6"); - assert(compareArray(sample.subarray(-1.5), [43]), "-1.5"); - assert(compareArray(sample.subarray(-1.1), [43]), "-1.1"); - assert(compareArray(sample.subarray(-0.6), [40, 41, 42, 43]), "-0.6"); + assert(compareArray(sample.subarray(-1.5), N([43])), "-1.5"); + assert(compareArray(sample.subarray(-1.1), N([43])), "-1.1"); + assert(compareArray(sample.subarray(-0.6), N([40, 41, 42, 43])), "-0.6"); - assert(compareArray(sample.subarray("3"), [43]), "string"); + assert(compareArray(sample.subarray("3"), N([43])), "string"); assert( compareArray( sample.subarray(obj), - [42, 43] + N([42, 43]) ), "object" ); diff --git a/test/built-ins/TypedArray/prototype/subarray/tointeger-end.js b/test/built-ins/TypedArray/prototype/subarray/tointeger-end.js index 4797bf5b2..ad58835fb 100644 --- a/test/built-ins/TypedArray/prototype/subarray/tointeger-end.js +++ b/test/built-ins/TypedArray/prototype/subarray/tointeger-end.js @@ -20,28 +20,28 @@ var obj = { } }; -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([40, 41, 42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([40, 41, 42, 43])); assert(compareArray(sample.subarray(0, false), []), "false"); - assert(compareArray(sample.subarray(0, true), [40]), "true"); + assert(compareArray(sample.subarray(0, true), N([40])), "true"); assert(compareArray(sample.subarray(0, NaN), []), "NaN"); assert(compareArray(sample.subarray(0, null), []), "null"); - assert(compareArray(sample.subarray(0, undefined), [40, 41, 42, 43]), "undefined"); + assert(compareArray(sample.subarray(0, undefined), N([40, 41, 42, 43])), "undefined"); assert(compareArray(sample.subarray(0, 0.6), []), "0.6"); - assert(compareArray(sample.subarray(0, 1.1), [40]), "1.1"); - assert(compareArray(sample.subarray(0, 1.5), [40]), "1.5"); + assert(compareArray(sample.subarray(0, 1.1), N([40])), "1.1"); + assert(compareArray(sample.subarray(0, 1.5), N([40])), "1.5"); assert(compareArray(sample.subarray(0, -0.6), []), "-0.6"); - assert(compareArray(sample.subarray(0, -1.1), [40, 41, 42]), "-1.1"); - assert(compareArray(sample.subarray(0, -1.5), [40, 41, 42]), "-1.5"); + assert(compareArray(sample.subarray(0, -1.1), N([40, 41, 42])), "-1.1"); + assert(compareArray(sample.subarray(0, -1.5), N([40, 41, 42])), "-1.5"); - assert(compareArray(sample.subarray(0, "3"), [40, 41, 42]), "string"); + assert(compareArray(sample.subarray(0, "3"), N([40, 41, 42])), "string"); assert( compareArray( sample.subarray(0, obj), - [40, 41] + N([40, 41]) ), "object" ); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/calls-tolocalestring-from-each-value.js b/test/built-ins/TypedArray/prototype/toLocaleString/calls-tolocalestring-from-each-value.js index 980670c72..5c4ea06ef 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/calls-tolocalestring-from-each-value.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/calls-tolocalestring-from-each-value.js @@ -39,15 +39,19 @@ Number.prototype.toLocaleString = function() { return "hacks" + calls.length; }; +if (typeof BigInt !== "undefined") { + BigInt.prototype.toLocaleString = Number.prototype.toLocaleString; +} + var arr = [42, 0]; var expected = ["hacks1", "hacks2"].join(separator); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA(arr); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N(arr)); calls = []; assert.sameValue(sample.toLocaleString(), expected, "returns expected value"); assert( - compareArray(new TA(calls), sample), + compareArray(new TA(N(calls)), sample), "toLocaleString called for each item" ); }); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/calls-tostring-from-each-value.js b/test/built-ins/TypedArray/prototype/toLocaleString/calls-tostring-from-each-value.js index 1329e4bd2..5dfcf91d4 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/calls-tostring-from-each-value.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/calls-tostring-from-each-value.js @@ -47,11 +47,15 @@ Number.prototype.toLocaleString = function() { }; }; +if (typeof BigInt !== "undefined") { + BigInt.prototype.toLocaleString = Number.prototype.toLocaleString; +} + var arr = [42, 0]; var expected = ["hacks1", "hacks2"].join(separator); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA(arr); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N(arr)); calls = 0; assert.sameValue(sample.toLocaleString(), expected, "returns expected value"); assert.sameValue(calls, 2, "toString called once for each item"); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/calls-valueof-from-each-value.js b/test/built-ins/TypedArray/prototype/toLocaleString/calls-valueof-from-each-value.js index 06f7bc0e0..25603f372 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/calls-valueof-from-each-value.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/calls-valueof-from-each-value.js @@ -45,11 +45,15 @@ Number.prototype.toLocaleString = function() { }; }; +if (typeof BigInt !== "undefined") { + BigInt.prototype.toLocaleString = Number.prototype.toLocaleString; +} + var arr = [42, 0]; var expected = ["hacks1", "hacks2"].join(separator); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA(arr); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N(arr)); calls = 0; assert.sameValue(sample.toLocaleString(), expected, "returns expected value"); assert.sameValue(calls, 2, "valueOf called once for each item"); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/toLocaleString/get-length-uses-internal-arraylength.js index 5d061ebaf..72e76979e 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/get-length-uses-internal-arraylength.js @@ -30,8 +30,8 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); Object.defineProperty(TA.prototype, "length", desc); Object.defineProperty(sample, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tolocalestring.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tolocalestring.js index ab58c6eac..be087cfd1 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tolocalestring.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tolocalestring.js @@ -31,11 +31,15 @@ Number.prototype.toLocaleString = function() { throw new Test262Error(); }; +if (typeof BigInt !== "undefined") { + BigInt.prototype.toLocaleString = Number.prototype.toLocaleString; +} + var arr = [42, 0]; -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { calls = 0; - var sample = new TA(arr); + var sample = new TA(N(arr)); assert.throws(Test262Error, function() { sample.toLocaleString(); }); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tostring.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tostring.js index 736d7ff06..433613030 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tostring.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tostring.js @@ -43,10 +43,14 @@ Number.prototype.toLocaleString = function() { }; }; +if (typeof BigInt !== "undefined") { + BigInt.prototype.toLocaleString = Number.prototype.toLocaleString; +} + var arr = [42, 0]; -testWithTypedArrayConstructors(function(TA) { - var sample = new TA(arr); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N(arr)); calls = 0; assert.throws(Test262Error, function() { sample.toLocaleString(); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-valueof.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-valueof.js index 81102c73d..b283f1db1 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-valueof.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-valueof.js @@ -44,10 +44,14 @@ Number.prototype.toLocaleString = function() { }; }; +if (typeof BigInt !== "undefined") { + BigInt.prototype.toLocaleString = Number.prototype.toLocaleString; +} + var arr = [42, 0]; -testWithTypedArrayConstructors(function(TA) { - var sample = new TA(arr); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N(arr)); calls = 0; assert.throws(Test262Error, function() { sample.toLocaleString(); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tolocalestring.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tolocalestring.js index 0909a1dcd..013f2afc3 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tolocalestring.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tolocalestring.js @@ -34,11 +34,15 @@ Number.prototype.toLocaleString = function() { } }; +if (typeof BigInt !== "undefined") { + BigInt.prototype.toLocaleString = Number.prototype.toLocaleString; +} + var arr = [42, 0]; -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { calls = 0; - var sample = new TA(arr); + var sample = new TA(N(arr)); assert.throws(Test262Error, function() { sample.toLocaleString(); }); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tostring.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tostring.js index 1b7330e92..9d2eed638 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tostring.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tostring.js @@ -45,10 +45,14 @@ Number.prototype.toLocaleString = function() { }; }; +if (typeof BigInt !== "undefined") { + BigInt.prototype.toLocaleString = Number.prototype.toLocaleString; +} + var arr = [42, 0]; -testWithTypedArrayConstructors(function(TA) { - var sample = new TA(arr); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N(arr)); calls = 0; assert.throws(Test262Error, function() { sample.toLocaleString(); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-valueof.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-valueof.js index 336b4b49b..d70d442f5 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-valueof.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-valueof.js @@ -46,10 +46,14 @@ Number.prototype.toLocaleString = function() { }; }; +if (typeof BigInt !== "undefined") { + BigInt.prototype.toLocaleString = Number.prototype.toLocaleString; +} + var arr = [42, 0]; -testWithTypedArrayConstructors(function(TA) { - var sample = new TA(arr); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N(arr)); calls = 0; assert.throws(Test262Error, function() { sample.toLocaleString(); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-result.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-result.js index 3880798df..f5825158f 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/return-result.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-result.js @@ -35,8 +35,8 @@ var separator = ["", ""].toLocaleString(); var arr = [42, 0, 43]; -testWithTypedArrayConstructors(function(TA) { - var sample = new TA(arr); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N(arr)); var expected = sample[0].toLocaleString().toString() + separator + diff --git a/test/built-ins/TypedArray/prototype/values/iter-prototype.js b/test/built-ins/TypedArray/prototype/values/iter-prototype.js index 4bf31e184..55913d266 100644 --- a/test/built-ins/TypedArray/prototype/values/iter-prototype.js +++ b/test/built-ins/TypedArray/prototype/values/iter-prototype.js @@ -17,8 +17,8 @@ features: [Symbol.iterator, TypedArray] var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]()); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([0, 42, 64]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([0, 42, 64])); var iter = sample.values(); assert.sameValue(Object.getPrototypeOf(iter), ArrayIteratorProto); diff --git a/test/built-ins/TypedArray/prototype/values/return-itor.js b/test/built-ins/TypedArray/prototype/values/return-itor.js index 1877d7bec..31b9f410f 100644 --- a/test/built-ins/TypedArray/prototype/values/return-itor.js +++ b/test/built-ins/TypedArray/prototype/values/return-itor.js @@ -13,22 +13,22 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -var sample = new Int8Array([0, 42, 64]); +var sample = [0, 42, 64]; -testWithTypedArrayConstructors(function(TA) { - var typedArray = new TA(sample); +testWithTypedArrayConstructors(function(TA, N) { + var typedArray = new TA(N(sample)); var itor = typedArray.values(); var next = itor.next(); - assert.sameValue(next.value, 0); + assert.sameValue(next.value, N(0)); assert.sameValue(next.done, false); next = itor.next(); - assert.sameValue(next.value, 42); + assert.sameValue(next.value, N(42)); assert.sameValue(next.done, false); next = itor.next(); - assert.sameValue(next.value, 64); + assert.sameValue(next.value, N(64)); assert.sameValue(next.done, false); next = itor.next(); diff --git a/test/built-ins/TypedArrays/from/custom-ctor-returns-other-instance.js b/test/built-ins/TypedArrays/from/custom-ctor-returns-other-instance.js index 8a0117682..b59bf2297 100644 --- a/test/built-ins/TypedArrays/from/custom-ctor-returns-other-instance.js +++ b/test/built-ins/TypedArrays/from/custom-ctor-returns-other-instance.js @@ -23,12 +23,14 @@ includes: [testTypedArray.js] features: [Symbol.iterator, TypedArray] ---*/ -var sourceItor = [1, 2]; -var sourceObj = { - length: 2 -}; +testWithTypedArrayConstructors(function(TA, N) { + var sourceItor = N([1, 2]); + var sourceObj = { + 0: N(0), + 1: N(0), + length: 2 + }; -testWithTypedArrayConstructors(function(TA) { var result; var custom = new TA(2); var ctor = function() { diff --git a/test/built-ins/TypedArrays/from/mapfn-arguments.js b/test/built-ins/TypedArrays/from/mapfn-arguments.js index 6d102d1b6..65150c85b 100644 --- a/test/built-ins/TypedArrays/from/mapfn-arguments.js +++ b/test/built-ins/TypedArrays/from/mapfn-arguments.js @@ -19,7 +19,7 @@ features: [TypedArray] var source = [42, 43, 44]; -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var results = []; var mapfn = function(kValue, k) { results.push({ @@ -27,6 +27,7 @@ testWithTypedArrayConstructors(function(TA) { k: k, argsLength: arguments.length }); + return N(0); }; TA.from(source, mapfn); diff --git a/test/built-ins/TypedArrays/from/mapfn-this-with-thisarg.js b/test/built-ins/TypedArrays/from/mapfn-this-with-thisarg.js index 2fb965d08..2df9a0efc 100644 --- a/test/built-ins/TypedArrays/from/mapfn-this-with-thisarg.js +++ b/test/built-ins/TypedArrays/from/mapfn-this-with-thisarg.js @@ -22,10 +22,11 @@ features: [TypedArray] var source = [42, 43]; var thisArg = {}; -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var results = []; var mapfn = function() { results.push(this); + return N(0); }; TA.from(source, mapfn, thisArg); diff --git a/test/built-ins/TypedArrays/from/mapfn-this-without-thisarg-non-strict.js b/test/built-ins/TypedArrays/from/mapfn-this-without-thisarg-non-strict.js index 02eeaba11..e136207a3 100644 --- a/test/built-ins/TypedArrays/from/mapfn-this-without-thisarg-non-strict.js +++ b/test/built-ins/TypedArrays/from/mapfn-this-without-thisarg-non-strict.js @@ -23,13 +23,14 @@ features: [TypedArray] var source = [42, 43]; var global = this; -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var results = []; - var mapfn = function() { + var mapfn = function(x) { results.push(this); + return N(x); }; - TA.from(source, mapfn); + TA.from(N(source), mapfn); assert.sameValue(results.length, 2); assert.sameValue(results[0], global); diff --git a/test/built-ins/TypedArrays/from/mapfn-this-without-thisarg-strict.js b/test/built-ins/TypedArrays/from/mapfn-this-without-thisarg-strict.js index 61612fa35..ca2968c7a 100644 --- a/test/built-ins/TypedArrays/from/mapfn-this-without-thisarg-strict.js +++ b/test/built-ins/TypedArrays/from/mapfn-this-without-thisarg-strict.js @@ -22,10 +22,11 @@ features: [TypedArray] var source = [42, 43]; -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var results = []; var mapfn = function() { results.push(this); + return N(0); }; TA.from(source, mapfn); diff --git a/test/built-ins/TypedArrays/from/new-instance-using-custom-ctor.js b/test/built-ins/TypedArrays/from/new-instance-using-custom-ctor.js index 2fe53a328..bf8c34acf 100644 --- a/test/built-ins/TypedArrays/from/new-instance-using-custom-ctor.js +++ b/test/built-ins/TypedArrays/from/new-instance-using-custom-ctor.js @@ -10,7 +10,7 @@ features: [TypedArray] var source = [42, 43, 42]; -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var called = 0; var ctor = function(len) { @@ -19,11 +19,11 @@ testWithTypedArrayConstructors(function(TA) { return new TA(len); }; - var result = TA.from.call(ctor, source); + var result = TA.from.call(ctor, N(source)); assert.sameValue(result.length, 3); - assert.sameValue(result[0], 42); - assert.sameValue(result[1], 43); - assert.sameValue(result[2], 42); + assert.sameValue(result[0], N(42)); + assert.sameValue(result[1], N(43)); + assert.sameValue(result[2], N(42)); assert.sameValue(result.constructor, TA); assert.sameValue(Object.getPrototypeOf(result), TA.prototype); assert.sameValue(called, 1); diff --git a/test/built-ins/TypedArrays/from/new-instance-with-mapfn.js b/test/built-ins/TypedArrays/from/new-instance-with-mapfn.js index ab8da0b98..66536c623 100644 --- a/test/built-ins/TypedArrays/from/new-instance-with-mapfn.js +++ b/test/built-ins/TypedArrays/from/new-instance-with-mapfn.js @@ -10,16 +10,16 @@ features: [TypedArray] var source = [42, 43, 42]; -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var mapfn = function(kValue) { - return kValue * 2; + return N(kValue * 2); }; var result = TA.from(source, mapfn); assert.sameValue(result.length, 3); - assert.sameValue(result[0], 84); - assert.sameValue(result[1], 86); - assert.sameValue(result[2], 84); + assert.sameValue(result[0], N(84)); + assert.sameValue(result[1], N(86)); + assert.sameValue(result[2], N(84)); assert.sameValue(result.constructor, TA); assert.sameValue(Object.getPrototypeOf(result), TA.prototype); }); diff --git a/test/built-ins/TypedArrays/from/new-instance-without-mapfn.js b/test/built-ins/TypedArrays/from/new-instance-without-mapfn.js index d7ac6abc2..ebedc93c8 100644 --- a/test/built-ins/TypedArrays/from/new-instance-without-mapfn.js +++ b/test/built-ins/TypedArrays/from/new-instance-without-mapfn.js @@ -10,12 +10,12 @@ features: [TypedArray] var source = [42, 43, 42]; -testWithTypedArrayConstructors(function(TA) { - var result = TA.from(source); +testWithTypedArrayConstructors(function(TA, N) { + var result = TA.from(N(source)); assert.sameValue(result.length, 3); - assert.sameValue(result[0], 42); - assert.sameValue(result[1], 43); - assert.sameValue(result[2], 42); + assert.sameValue(result[0], N(42)); + assert.sameValue(result[1], N(43)); + assert.sameValue(result[2], N(42)); assert.sameValue(result.constructor, TA); assert.sameValue(Object.getPrototypeOf(result), TA.prototype); }); diff --git a/test/built-ins/TypedArrays/from/set-value-abrupt-completion.js b/test/built-ins/TypedArrays/from/set-value-abrupt-completion.js index ddde226a2..efae38c90 100644 --- a/test/built-ins/TypedArrays/from/set-value-abrupt-completion.js +++ b/test/built-ins/TypedArrays/from/set-value-abrupt-completion.js @@ -25,9 +25,8 @@ var obj = { } }; -var source = [42, obj, 1]; - -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { + var source = [N(42), obj, N(1)]; var lastValue; var mapfn = function(kValue) { lastValue = kValue; diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/desc-value-throws.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/desc-value-throws.js index 6572c1f94..ba658f221 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/desc-value-throws.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/desc-value-throws.js @@ -31,8 +31,8 @@ var obj = { } }; -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42])); assert.throws(Test262Error, function() { Object.defineProperty(sample, "0", {value: obj}); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-greater-than-last-index.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-greater-than-last-index.js index afb5672b9..4cc13c6f5 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-greater-than-last-index.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-greater-than-last-index.js @@ -20,8 +20,8 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); assert.sameValue( Reflect.defineProperty(sample, "2", { diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-lower-than-zero.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-lower-than-zero.js index ba21aec9c..3c63a0ab7 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-lower-than-zero.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-lower-than-zero.js @@ -18,8 +18,8 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); assert.sameValue( Reflect.defineProperty(sample, "-1", { diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-minus-zero.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-minus-zero.js index c891f5cc1..207344f83 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-minus-zero.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-minus-zero.js @@ -18,7 +18,7 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample = new TA(2); assert.sameValue( @@ -31,6 +31,6 @@ testWithTypedArrayConstructors(function(TA) { false, "defineProperty returns false" ); - assert.sameValue(sample[0], 0, "does not change the value for [0]"); + assert.sameValue(sample[0], N(0), "does not change the value for [0]"); assert.sameValue(sample["-0"], undefined, "does define a value for ['-0']"); }); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-canonical-index.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-canonical-index.js index 193d91665..33511ca7b 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-canonical-index.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-canonical-index.js @@ -24,12 +24,6 @@ var keys = [ "0.0000001" ]; -var dataDesc = { - value: 42, - writable: true, - configurable: true -}; - var fnset = function() {}; var fnget = function() {}; @@ -40,8 +34,14 @@ var acDesc = { configurable: false }; -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { keys.forEach(function(key) { + var dataDesc = { + value: N(42), + writable: true, + configurable: true + }; + var sample1 = new TA(); assert.sameValue( @@ -50,7 +50,7 @@ testWithTypedArrayConstructors(function(TA) { "return true after defining data property [" + key + "]" ); - assert.sameValue(sample1[key], 42, "value is set to [" + key + "]"); + assert.sameValue(sample1[key], N(42), "value is set to [" + key + "]"); verifyNotEnumerable(sample1, key); verifyWritable(sample1, key); verifyConfigurable(sample1, key); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-integer.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-integer.js index b30fc17ec..4232ab638 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-integer.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-integer.js @@ -16,7 +16,7 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample = new TA(2); assert.sameValue( @@ -29,7 +29,7 @@ testWithTypedArrayConstructors(function(TA) { false, "0.1" ); - assert.sameValue(sample[0], 0, "'0.1' - does not change the value for [0]"); + assert.sameValue(sample[0], N(0), "'0.1' - does not change the value for [0]"); assert.sameValue( sample["0.1"], undefined, @@ -47,7 +47,7 @@ testWithTypedArrayConstructors(function(TA) { "0.000001" ); assert.sameValue( - sample[0], 0, + sample[0], N(0), "'0.000001' - does not change the value for [0]" ); assert.sameValue( @@ -66,7 +66,7 @@ testWithTypedArrayConstructors(function(TA) { false, "1.1" ); - assert.sameValue(sample[1], 0, "'1.1' - does not change the value for [1]"); + assert.sameValue(sample[1], N(0), "'1.1' - does not change the value for [1]"); assert.sameValue( sample["1.1"], undefined, @@ -84,11 +84,11 @@ testWithTypedArrayConstructors(function(TA) { "Infinity" ); assert.sameValue( - sample[0], 0, + sample[0], N(0), "'Infinity' - does not change the value for [0]" ); assert.sameValue( - sample[1], 0, + sample[1], N(0), "'Infinity' - does not change the value for [1]" ); assert.sameValue( @@ -108,11 +108,11 @@ testWithTypedArrayConstructors(function(TA) { "-Infinity" ); assert.sameValue( - sample[0], 0, + sample[0], N(0), "'-Infinity' - does not change the value for [0]" ); assert.sameValue( - sample[1], 0, + sample[1], N(0), "'-Infinity' - does not change the value for [1]" ); assert.sameValue( diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-numeric-index.js index 845a9afbe..b51e1f237 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-numeric-index.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-numeric-index.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js, propertyHelper.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); assert.sameValue( Reflect.defineProperty(sample, "foo", {value:42}), diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-accessor-desc.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-accessor-desc.js index 5d8be8a2a..0c9e90797 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-accessor-desc.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-accessor-desc.js @@ -18,7 +18,7 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample = new TA(2); assert.sameValue( @@ -31,7 +31,7 @@ testWithTypedArrayConstructors(function(TA) { false, "get accessor" ); - assert.sameValue(sample[0], 0, "get accessor - side effect check"); + assert.sameValue(sample[0], N(0), "get accessor - side effect check"); assert.sameValue( Reflect.defineProperty(sample, "0", { @@ -41,7 +41,7 @@ testWithTypedArrayConstructors(function(TA) { false, "set accessor" ); - assert.sameValue(sample[0], 0, "set accessor - side effect check"); + assert.sameValue(sample[0], N(0), "set accessor - side effect check"); assert.sameValue( Reflect.defineProperty(sample, "0", { @@ -54,5 +54,5 @@ testWithTypedArrayConstructors(function(TA) { false, "get and set accessors" ); - assert.sameValue(sample[0], 0, "get and set accessors - side effect check"); + assert.sameValue(sample[0], N(0), "get and set accessors - side effect check"); }); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-configurable.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-configurable.js index 133f3343d..5b03b57bf 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-configurable.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-configurable.js @@ -18,7 +18,7 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample = new TA(2); assert.sameValue( @@ -31,5 +31,5 @@ testWithTypedArrayConstructors(function(TA) { false, "defineProperty's result" ); - assert.sameValue(sample[0], 0, "side effect check"); + assert.sameValue(sample[0], N(0), "side effect check"); }); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-not-enumerable.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-not-enumerable.js index 09526d11f..7bf886140 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-not-enumerable.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-not-enumerable.js @@ -18,7 +18,7 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample = new TA(2); assert.sameValue( @@ -31,5 +31,5 @@ testWithTypedArrayConstructors(function(TA) { false, "defineProperty's result" ); - assert.sameValue(sample[0], 0, "side effect check"); + assert.sameValue(sample[0], N(0), "side effect check"); }); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-not-writable.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-not-writable.js index 08c9a1b3a..ab460e4e6 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-not-writable.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-not-writable.js @@ -18,7 +18,7 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample = new TA(2); assert.sameValue( @@ -31,5 +31,5 @@ testWithTypedArrayConstructors(function(TA) { false, "defineProperty's result" ); - assert.sameValue(sample[0], 0, "side effect check"); + assert.sameValue(sample[0], N(0), "side effect check"); }); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex.js index d815738b6..c6ddb1070 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex.js @@ -18,12 +18,12 @@ includes: [testTypedArray.js, propertyHelper.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 42])); assert.sameValue( Reflect.defineProperty(sample, "0", { - value: 8, + value: N(8), configurable: false, enumerable: true, writable: true @@ -31,10 +31,10 @@ testWithTypedArrayConstructors(function(TA) { true ); - assert.sameValue(sample[0], 8, "property value was set"); + assert.sameValue(sample[0], N(8), "property value was set"); var desc = Object.getOwnPropertyDescriptor(sample, "0"); - assert.sameValue(desc.value, 8, "desc.value"); + assert.sameValue(desc.value, N(8), "desc.value"); assert.sameValue(desc.writable, true, "property is writable"); verifyEnumerable(sample, "0"); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-symbol.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-symbol.js index c5cff6eee..856997801 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-symbol.js @@ -15,8 +15,8 @@ includes: [testTypedArray.js, propertyHelper.js] features: [Reflect, Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); var s1 = Symbol("foo"); assert.sameValue( diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/non-extensible-new-key.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/non-extensible-new-key.js index e74c95f12..681630928 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/non-extensible-new-key.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/non-extensible-new-key.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); Object.preventExtensions(sample); assert.sameValue( diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/non-extensible-redefine-key.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/non-extensible-redefine-key.js index a0baaf57e..5983e6dfb 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/non-extensible-redefine-key.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/non-extensible-redefine-key.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js, propertyHelper.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); sample.foo = true; sample.bar = true; diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/set-value.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/set-value.js index ff71bee90..0571a46ea 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/set-value.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/set-value.js @@ -25,21 +25,21 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([0, 0]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([0, 0])); assert.sameValue( - Reflect.defineProperty(sample, "0", {value: 1}), + Reflect.defineProperty(sample, "0", {value: N(1)}), true, "set value for sample[0] returns true" ); assert.sameValue( - Reflect.defineProperty(sample, "1", {value: 2}), + Reflect.defineProperty(sample, "1", {value: N(2)}), true, "set value for sample[1] returns true" ); - assert.sameValue(sample[0], 1, "sample[0]"); - assert.sameValue(sample[1], 2, "sample[1]"); + assert.sameValue(sample[0], N(1), "sample[0]"); + assert.sameValue(sample[1], N(2), "sample[1]"); }); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/this-is-not-extensible.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/this-is-not-extensible.js index 5e586c775..e4f54b45e 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/this-is-not-extensible.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/this-is-not-extensible.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js] features: [Reflect, Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); Object.preventExtensions(sample); diff --git a/test/built-ins/TypedArrays/internals/Get/detached-buffer-key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/Get/detached-buffer-key-is-not-numeric-index.js index b0032bad7..4ebb82f7e 100644 --- a/test/built-ins/TypedArrays/internals/Get/detached-buffer-key-is-not-numeric-index.js +++ b/test/built-ins/TypedArrays/internals/Get/detached-buffer-key-is-not-numeric-index.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js, detachArrayBuffer.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); sample.foo = "test262"; $DETACHBUFFER(sample.buffer); diff --git a/test/built-ins/TypedArrays/internals/Get/detached-buffer-key-is-symbol.js b/test/built-ins/TypedArrays/internals/Get/detached-buffer-key-is-symbol.js index 2b18a93ea..9910fe6eb 100644 --- a/test/built-ins/TypedArrays/internals/Get/detached-buffer-key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/Get/detached-buffer-key-is-symbol.js @@ -15,8 +15,8 @@ includes: [testTypedArray.js, detachArrayBuffer.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); $DETACHBUFFER(sample.buffer); var s = Symbol("1"); diff --git a/test/built-ins/TypedArrays/internals/Get/detached-buffer.js b/test/built-ins/TypedArrays/internals/Get/detached-buffer.js index 4e52b1cf0..467aff7cf 100644 --- a/test/built-ins/TypedArrays/internals/Get/detached-buffer.js +++ b/test/built-ins/TypedArrays/internals/Get/detached-buffer.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js, detachArrayBuffer.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42])); $DETACHBUFFER(sample.buffer); assert.throws(TypeError, function() { diff --git a/test/built-ins/TypedArrays/internals/Get/indexed-value-sab.js b/test/built-ins/TypedArrays/internals/Get/indexed-value-sab.js index 6145da9e2..c9e49d861 100644 --- a/test/built-ins/TypedArrays/internals/Get/indexed-value-sab.js +++ b/test/built-ins/TypedArrays/internals/Get/indexed-value-sab.js @@ -18,11 +18,11 @@ var throwDesc = { Object.defineProperty(proto, "0", throwDesc); Object.defineProperty(proto, "1", throwDesc); -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sab = new SharedArrayBuffer(TA.BYTES_PER_ELEMENT * 2); var sample = new TA(sab); - sample.set([42, 1]); + sample.set([N(42), N(1)]); - assert.sameValue(sample["0"], 42); - assert.sameValue(sample["1"], 1); + assert.sameValue(sample["0"], N(42)); + assert.sameValue(sample["1"], N(1)); }); diff --git a/test/built-ins/TypedArrays/internals/Get/indexed-value.js b/test/built-ins/TypedArrays/internals/Get/indexed-value.js index f58c528b6..cb761c6db 100644 --- a/test/built-ins/TypedArrays/internals/Get/indexed-value.js +++ b/test/built-ins/TypedArrays/internals/Get/indexed-value.js @@ -26,9 +26,9 @@ var throwDesc = { Object.defineProperty(proto, "0", throwDesc); Object.defineProperty(proto, "1", throwDesc); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 1]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 1])); - assert.sameValue(sample["0"], 42); - assert.sameValue(sample["1"], 1); + assert.sameValue(sample["0"], N(42)); + assert.sameValue(sample["1"], N(1)); }); diff --git a/test/built-ins/TypedArrays/internals/Get/key-is-not-integer.js b/test/built-ins/TypedArrays/internals/Get/key-is-not-integer.js index 5ad684b78..258f11193 100644 --- a/test/built-ins/TypedArrays/internals/Get/key-is-not-integer.js +++ b/test/built-ins/TypedArrays/internals/Get/key-is-not-integer.js @@ -30,8 +30,8 @@ Object.defineProperty(proto, "1.1", { } }); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); assert.sameValue(sample["1.1"], undefined); }); diff --git a/test/built-ins/TypedArrays/internals/Get/key-is-not-minus-zero.js b/test/built-ins/TypedArrays/internals/Get/key-is-not-minus-zero.js index 851cf72b4..45e7af40f 100644 --- a/test/built-ins/TypedArrays/internals/Get/key-is-not-minus-zero.js +++ b/test/built-ins/TypedArrays/internals/Get/key-is-not-minus-zero.js @@ -30,8 +30,8 @@ Object.defineProperty(proto, "-0", { } }); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); assert.sameValue(sample["-0"], undefined); }); diff --git a/test/built-ins/TypedArrays/internals/Get/key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/Get/key-is-not-numeric-index.js index 53824ad34..116f04275 100644 --- a/test/built-ins/TypedArrays/internals/Get/key-is-not-numeric-index.js +++ b/test/built-ins/TypedArrays/internals/Get/key-is-not-numeric-index.js @@ -19,8 +19,8 @@ features: [TypedArray] TypedArray.prototype.baz = "test262"; -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); assert.sameValue( sample.foo, undefined, diff --git a/test/built-ins/TypedArrays/internals/Get/key-is-out-of-bounds.js b/test/built-ins/TypedArrays/internals/Get/key-is-out-of-bounds.js index a6eaa05df..dfb3d0411 100644 --- a/test/built-ins/TypedArrays/internals/Get/key-is-out-of-bounds.js +++ b/test/built-ins/TypedArrays/internals/Get/key-is-out-of-bounds.js @@ -34,8 +34,8 @@ Object.defineProperty(proto, "-1", throwDesc); Object.defineProperty(proto, "2", throwDesc); Object.defineProperty(proto, "3", throwDesc); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); assert.sameValue(sample["-1"], undefined); assert.sameValue(sample["2"], undefined); diff --git a/test/built-ins/TypedArrays/internals/Get/key-is-symbol.js b/test/built-ins/TypedArrays/internals/Get/key-is-symbol.js index 1d05d06bc..3454fd676 100644 --- a/test/built-ins/TypedArrays/internals/Get/key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/Get/key-is-symbol.js @@ -18,8 +18,8 @@ features: [Symbol, TypedArray] var parentKey = Symbol("2"); TypedArray.prototype[parentKey] = "test262"; -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42])); var s1 = Symbol("1"); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/detached-buffer-key-is-not-number.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/detached-buffer-key-is-not-number.js index 81b274361..c0f54cd4a 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/detached-buffer-key-is-not-number.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/detached-buffer-key-is-not-number.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js, detachArrayBuffer.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); $DETACHBUFFER(sample.buffer); assert.sameValue( diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/detached-buffer-key-is-symbol.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/detached-buffer-key-is-symbol.js index 308a2973f..b637e6fe3 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/detached-buffer-key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/detached-buffer-key-is-symbol.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js, detachArrayBuffer.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); $DETACHBUFFER(sample.buffer); var s = Symbol("foo"); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/index-prop-desc.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/index-prop-desc.js index fe7f1eca2..0771ae51e 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/index-prop-desc.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/index-prop-desc.js @@ -19,17 +19,17 @@ includes: [testTypedArray.js, propertyHelper.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); var desc0 = Object.getOwnPropertyDescriptor(sample, 0); - assert.sameValue(desc0.value, 42, "value", "desc0.value === 42"); + assert.sameValue(desc0.value, N(42), "value", "desc0.value === 42"); assert.sameValue(desc0.writable, true, "index descriptor is writable [0]"); verifyEnumerable(sample, "0", "index descriptor is enumerable [0]"); verifyNotConfigurable(sample, "0", "index descriptor is not configurable [0]"); var desc1 = Object.getOwnPropertyDescriptor(sample, 1); - assert.sameValue(desc1.value, 43, "value", "desc1.value === 43"); + assert.sameValue(desc1.value, N(43), "value", "desc1.value === 43"); assert.sameValue(desc1.writable, true, "index descriptor is writable [1]"); verifyEnumerable(sample, "1", "index descriptor is enumerable [1]"); verifyNotConfigurable(sample, "1", "index descriptor is not configurable [1]"); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-minus-zero.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-minus-zero.js index 1b1c828ab..93fb63a55 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-minus-zero.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-minus-zero.js @@ -29,8 +29,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42])); // -0 as a number value is converted to "0" before calling [[GetOwnProperty]] assert.sameValue(Object.getOwnPropertyDescriptor(sample, "-0"), undefined); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-canonical-index.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-canonical-index.js index 35b6fa01c..e2f7352a0 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-canonical-index.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-canonical-index.js @@ -26,9 +26,9 @@ var keys = [ "0.0000001" ]; -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { keys.forEach(function(key) { - var sample = new TA([42, 43]); + var sample = new TA(N([42, 43])); assert.sameValue( Object.getOwnPropertyDescriptor(sample, key), diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-integer.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-integer.js index f77950d72..78e7e5915 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-integer.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-integer.js @@ -23,8 +23,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); assert.sameValue(Object.getOwnPropertyDescriptor(sample, "1.1"), undefined); assert.sameValue(Object.getOwnPropertyDescriptor(sample, "0.1"), undefined); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-numeric-index.js index 57fd606ae..32f68d2ce 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-numeric-index.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-numeric-index.js @@ -18,8 +18,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); assert.sameValue( Object.getOwnPropertyDescriptor(sample, "undef"), diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-out-of-bounds.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-out-of-bounds.js index 891bc7184..a02b44bb4 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-out-of-bounds.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-out-of-bounds.js @@ -24,8 +24,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42])); assert.sameValue(Object.getOwnPropertyDescriptor(sample, "-1"), undefined); assert.sameValue(Object.getOwnPropertyDescriptor(sample, "-42"), undefined); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-symbol.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-symbol.js index 6b440e119..2d31cb822 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-symbol.js @@ -18,8 +18,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); var s = Symbol("foo"); Object.defineProperty(sample, s, { value: "baz" }); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/detached-buffer-key-is-not-number.js b/test/built-ins/TypedArrays/internals/HasProperty/detached-buffer-key-is-not-number.js index 011e80c0b..4a4b64540 100644 --- a/test/built-ins/TypedArrays/internals/HasProperty/detached-buffer-key-is-not-number.js +++ b/test/built-ins/TypedArrays/internals/HasProperty/detached-buffer-key-is-not-number.js @@ -18,8 +18,8 @@ includes: [testTypedArray.js, detachArrayBuffer.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); Object.defineProperty(sample, "bar", { value: 42 }); $DETACHBUFFER(sample.buffer); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/detached-buffer-key-is-symbol.js b/test/built-ins/TypedArrays/internals/HasProperty/detached-buffer-key-is-symbol.js index 2c34c3caa..abc2bf4e3 100644 --- a/test/built-ins/TypedArrays/internals/HasProperty/detached-buffer-key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/HasProperty/detached-buffer-key-is-symbol.js @@ -20,8 +20,8 @@ features: [Reflect, Symbol, TypedArray] var s1 = Symbol("foo"); var s2 = Symbol("bar"); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); Object.defineProperty(sample, s1, { value: "baz" }); $DETACHBUFFER(sample.buffer); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/indexed-value.js b/test/built-ins/TypedArrays/internals/HasProperty/indexed-value.js index 5a3b0482a..88aea9dc6 100644 --- a/test/built-ins/TypedArrays/internals/HasProperty/indexed-value.js +++ b/test/built-ins/TypedArrays/internals/HasProperty/indexed-value.js @@ -24,8 +24,8 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); assert.sameValue(Reflect.has(sample, 0), true); assert.sameValue(Reflect.has(sample, 1), true); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/key-is-not-canonical-index.js b/test/built-ins/TypedArrays/internals/HasProperty/key-is-not-canonical-index.js index 7e20c5b24..14ffa9072 100644 --- a/test/built-ins/TypedArrays/internals/HasProperty/key-is-not-canonical-index.js +++ b/test/built-ins/TypedArrays/internals/HasProperty/key-is-not-canonical-index.js @@ -25,7 +25,7 @@ var keys = [ "0.0000001" ]; -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { keys.forEach(function(key) { var sample = new TA(1); @@ -43,7 +43,7 @@ testWithTypedArrayConstructors(function(TA) { delete TypedArray.prototype[key]; - Object.defineProperty(sample, key, {value: 42}); + Object.defineProperty(sample, key, {value: N(42)}); assert.sameValue( Reflect.has(sample, key), true, diff --git a/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes-and-string-and-symbol-keys-.js b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes-and-string-and-symbol-keys-.js index 9060bee4d..d469c9ab1 100644 --- a/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes-and-string-and-symbol-keys-.js +++ b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes-and-string-and-symbol-keys-.js @@ -23,8 +23,8 @@ var s2 = Symbol("2"); TypedArray.prototype[3] = 42; TypedArray.prototype.bar = 42; -testWithTypedArrayConstructors(function(TA) { - var sample1 = new TA([42, 42, 42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample1 = new TA(N([42, 42, 42])); sample1[s1] = 42; sample1[s2] = 42; sample1.test262 = 42; diff --git a/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes-and-string-keys.js b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes-and-string-keys.js index b227ef6f2..5f933e570 100644 --- a/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes-and-string-keys.js +++ b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes-and-string-keys.js @@ -20,8 +20,8 @@ features: [Reflect, TypedArray] TypedArray.prototype[3] = 42; TypedArray.prototype.bar = 42; -testWithTypedArrayConstructors(function(TA) { - var sample1 = new TA([42, 42, 42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample1 = new TA(N([42, 42, 42])); sample1.test262 = 42; sample1.ecma262 = 42; var result1 = Reflect.ownKeys(sample1); diff --git a/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes.js b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes.js index 00e57de34..17c78ca5a 100644 --- a/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes.js +++ b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js, compareArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample1 = new TA([42, 42, 42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample1 = new TA(N([42, 42, 42])); var result1 = Reflect.ownKeys(sample1); assert(compareArray(result1, ["0", "1", "2"]), "result1"); diff --git a/test/built-ins/TypedArrays/internals/Set/detached-buffer-key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/Set/detached-buffer-key-is-not-numeric-index.js index 7382d626e..d802d2fd5 100644 --- a/test/built-ins/TypedArrays/internals/Set/detached-buffer-key-is-not-numeric-index.js +++ b/test/built-ins/TypedArrays/internals/Set/detached-buffer-key-is-not-numeric-index.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js, detachArrayBuffer.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); $DETACHBUFFER(sample.buffer); assert.sameValue(Reflect.set(sample, "foo", "test262"), true); diff --git a/test/built-ins/TypedArrays/internals/Set/detached-buffer-key-is-symbol.js b/test/built-ins/TypedArrays/internals/Set/detached-buffer-key-is-symbol.js index 1fbe1b60c..18869f683 100644 --- a/test/built-ins/TypedArrays/internals/Set/detached-buffer-key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/Set/detached-buffer-key-is-symbol.js @@ -17,8 +17,8 @@ features: [Symbol, Reflect, TypedArray] var s = Symbol("1"); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); $DETACHBUFFER(sample.buffer); assert.sameValue(Reflect.set(sample, s, "test262"), true); diff --git a/test/built-ins/TypedArrays/internals/Set/detached-buffer.js b/test/built-ins/TypedArrays/internals/Set/detached-buffer.js index a373f9fbe..186259cee 100644 --- a/test/built-ins/TypedArrays/internals/Set/detached-buffer.js +++ b/test/built-ins/TypedArrays/internals/Set/detached-buffer.js @@ -25,32 +25,32 @@ includes: [testTypedArray.js, detachArrayBuffer.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42])); $DETACHBUFFER(sample.buffer); assert.throws(TypeError, function() { - sample[0] = 1; + sample[0] = N(1); }, "valid numeric index"); assert.throws(TypeError, function() { - sample["1.1"] = 1; + sample["1.1"] = N(1); }, "detach buffer runs before checking for 1.1"); assert.throws(TypeError, function() { - sample["-0"] = 1; + sample["-0"] = N(1); }, "detach buffer runs before checking for -0"); assert.throws(TypeError, function() { - sample["-1"] = 1; + sample["-1"] = N(1); }, "detach buffer runs before checking for -1"); assert.throws(TypeError, function() { - sample["1"] = 1; + sample["1"] = N(1); }, "detach buffer runs before checking for key == length"); assert.throws(TypeError, function() { - sample["2"] = 1; + sample["2"] = N(1); }, "detach buffer runs before checking for key > length"); var obj = { diff --git a/test/built-ins/TypedArrays/internals/Set/indexed-value.js b/test/built-ins/TypedArrays/internals/Set/indexed-value.js index 2333d4c44..bb325d11c 100644 --- a/test/built-ins/TypedArrays/internals/Set/indexed-value.js +++ b/test/built-ins/TypedArrays/internals/Set/indexed-value.js @@ -32,12 +32,12 @@ var throwDesc = { Object.defineProperty(proto, "0", throwDesc); Object.defineProperty(proto, "1", throwDesc); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42, 43]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42, 43])); - assert.sameValue(Reflect.set(sample, "0", 1), true, "sample[0]"); - assert.sameValue(sample[0], 1, "sample[0] value is set"); + assert.sameValue(Reflect.set(sample, "0", N(1)), true, "sample[0]"); + assert.sameValue(sample[0], N(1), "sample[0] value is set"); - assert.sameValue(Reflect.set(sample, "1", 42), true, "sample[1]"); - assert.sameValue(sample[1], 42, "sample[1] value is set"); + assert.sameValue(Reflect.set(sample, "1", N(42)), true, "sample[1]"); + assert.sameValue(sample[1], N(42), "sample[1] value is set"); }); diff --git a/test/built-ins/TypedArrays/internals/Set/key-is-minus-zero.js b/test/built-ins/TypedArrays/internals/Set/key-is-minus-zero.js index a735e8baa..5946ebc7c 100644 --- a/test/built-ins/TypedArrays/internals/Set/key-is-minus-zero.js +++ b/test/built-ins/TypedArrays/internals/Set/key-is-minus-zero.js @@ -23,8 +23,8 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42])); assert.sameValue(Reflect.set(sample, "-0", 1), false, "-0"); assert.sameValue(sample.hasOwnProperty("-0"), false, "has no property [-0]"); diff --git a/test/built-ins/TypedArrays/internals/Set/key-is-not-canonical-index.js b/test/built-ins/TypedArrays/internals/Set/key-is-not-canonical-index.js index 1fb7a9ec6..d89a0f1fb 100644 --- a/test/built-ins/TypedArrays/internals/Set/key-is-not-canonical-index.js +++ b/test/built-ins/TypedArrays/internals/Set/key-is-not-canonical-index.js @@ -24,9 +24,9 @@ var keys = [ "0.0000001" ]; -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { keys.forEach(function(key) { - var sample = new TA([42]); + var sample = new TA(N([42])); assert.sameValue( Reflect.set(sample, key, "ecma262"), diff --git a/test/built-ins/TypedArrays/internals/Set/key-is-not-integer.js b/test/built-ins/TypedArrays/internals/Set/key-is-not-integer.js index 252220f61..c513faefe 100644 --- a/test/built-ins/TypedArrays/internals/Set/key-is-not-integer.js +++ b/test/built-ins/TypedArrays/internals/Set/key-is-not-integer.js @@ -23,8 +23,8 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42])); assert.sameValue(Reflect.set(sample, "1.1", 1), false, "1.1"); assert.sameValue(Reflect.set(sample, "0.0001", 1), false, "0.0001"); diff --git a/test/built-ins/TypedArrays/internals/Set/key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/Set/key-is-not-numeric-index.js index 462eb752d..03a181965 100644 --- a/test/built-ins/TypedArrays/internals/Set/key-is-not-numeric-index.js +++ b/test/built-ins/TypedArrays/internals/Set/key-is-not-numeric-index.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42])); assert.sameValue( Reflect.set(sample, "test262", "ecma262"), diff --git a/test/built-ins/TypedArrays/internals/Set/key-is-out-of-bounds.js b/test/built-ins/TypedArrays/internals/Set/key-is-out-of-bounds.js index e5a5d6da8..859bdee4f 100644 --- a/test/built-ins/TypedArrays/internals/Set/key-is-out-of-bounds.js +++ b/test/built-ins/TypedArrays/internals/Set/key-is-out-of-bounds.js @@ -24,8 +24,8 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42])); assert.sameValue(Reflect.set(sample, "-1", 1), false, "-1"); assert.sameValue(Reflect.set(sample, "1", 1), false, "1"); diff --git a/test/built-ins/TypedArrays/internals/Set/key-is-symbol.js b/test/built-ins/TypedArrays/internals/Set/key-is-symbol.js index 838ab74e0..e27d501c0 100644 --- a/test/built-ins/TypedArrays/internals/Set/key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/Set/key-is-symbol.js @@ -18,8 +18,8 @@ features: [Reflect, Symbol, TypedArray] var s1 = Symbol("1"); var s2 = Symbol("2"); -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42])); assert.sameValue( Reflect.set(sample, s1, "ecma262"), diff --git a/test/built-ins/TypedArrays/internals/Set/tonumber-value-throws.js b/test/built-ins/TypedArrays/internals/Set/tonumber-value-throws.js index 08131f4bf..e90eb4798 100644 --- a/test/built-ins/TypedArrays/internals/Set/tonumber-value-throws.js +++ b/test/built-ins/TypedArrays/internals/Set/tonumber-value-throws.js @@ -23,8 +23,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var sample = new TA([42]); +testWithTypedArrayConstructors(function(TA, N) { + var sample = new TA(N([42])); var obj = { valueOf: function() { diff --git a/test/built-ins/TypedArrays/length-arg-init-zeros.js b/test/built-ins/TypedArrays/length-arg-init-zeros.js index b36131709..384e2399b 100644 --- a/test/built-ins/TypedArrays/length-arg-init-zeros.js +++ b/test/built-ins/TypedArrays/length-arg-init-zeros.js @@ -40,16 +40,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var subject = new TA(9); - assert.sameValue(subject[0], 0, 'index 0'); - assert.sameValue(subject[1], 0, 'index 1'); - assert.sameValue(subject[2], 0, 'index 2'); - assert.sameValue(subject[3], 0, 'index 3'); - assert.sameValue(subject[4], 0, 'index 4'); - assert.sameValue(subject[5], 0, 'index 5'); - assert.sameValue(subject[6], 0, 'index 6'); - assert.sameValue(subject[7], 0, 'index 7'); - assert.sameValue(subject[8], 0, 'index 8'); + assert.sameValue(subject[0], N(0), 'index 0'); + assert.sameValue(subject[1], N(0), 'index 1'); + assert.sameValue(subject[2], N(0), 'index 2'); + assert.sameValue(subject[3], N(0), 'index 3'); + assert.sameValue(subject[4], N(0), 'index 4'); + assert.sameValue(subject[5], N(0), 'index 5'); + assert.sameValue(subject[6], N(0), 'index 6'); + assert.sameValue(subject[7], N(0), 'index 7'); + assert.sameValue(subject[8], N(0), 'index 8'); }); diff --git a/test/built-ins/TypedArrays/length-arg-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/length-arg-proto-from-ctor-realm.js index 77cef2616..f4effc208 100644 --- a/test/built-ins/TypedArrays/length-arg-proto-from-ctor-realm.js +++ b/test/built-ins/TypedArrays/length-arg-proto-from-ctor-realm.js @@ -29,7 +29,7 @@ var other = $262.createRealm().global; var C = new other.Function(); C.prototype = null; -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var ta = Reflect.construct(TA, [0], C); assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); diff --git a/test/built-ins/TypedArrays/object-arg-as-array-returns.js b/test/built-ins/TypedArrays/object-arg-as-array-returns.js index a5e3c3bbc..6e15b4ea4 100644 --- a/test/built-ins/TypedArrays/object-arg-as-array-returns.js +++ b/test/built-ins/TypedArrays/object-arg-as-array-returns.js @@ -18,11 +18,11 @@ features: [TypedArray] var obj = [7, 42]; -testWithTypedArrayConstructors(function(TA) { - var typedArray = new TA(obj); +testWithTypedArrayConstructors(function(TA, N) { + var typedArray = new TA(N(obj)); assert.sameValue(typedArray.length, 2); - assert.sameValue(typedArray[0], 7); - assert.sameValue(typedArray[1], 42); + assert.sameValue(typedArray[0], N(7)); + assert.sameValue(typedArray[1], N(42)); assert.sameValue(typedArray.constructor, TA); assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); }); diff --git a/test/built-ins/TypedArrays/object-arg-as-generator-iterable-returns.js b/test/built-ins/TypedArrays/object-arg-as-generator-iterable-returns.js index f9af0defe..7e2876294 100644 --- a/test/built-ins/TypedArrays/object-arg-as-generator-iterable-returns.js +++ b/test/built-ins/TypedArrays/object-arg-as-generator-iterable-returns.js @@ -16,15 +16,15 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var obj = (function *() { - yield 7; yield 42; + yield N(7); yield N(42); })(); var typedArray = new TA(obj); assert.sameValue(typedArray.length, 2); - assert.sameValue(typedArray[0], 7); - assert.sameValue(typedArray[1], 42); + assert.sameValue(typedArray[0], N(7)); + assert.sameValue(typedArray[1], N(42)); assert.sameValue(typedArray.constructor, TA); assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); }); diff --git a/test/built-ins/TypedArrays/object-arg-new-instance-extensibility.js b/test/built-ins/TypedArrays/object-arg-new-instance-extensibility.js index 86a2ac837..bd335774b 100644 --- a/test/built-ins/TypedArrays/object-arg-new-instance-extensibility.js +++ b/test/built-ins/TypedArrays/object-arg-new-instance-extensibility.js @@ -29,14 +29,14 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -var obj = { - "0": 0, - "1": 1, - "2": 2, - length: 3 -}; - -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { + var obj = { + "0": N(0), + "1": N(1), + "2": N(2), + length: 3 + }; + var sample = new TA(obj); assert(Object.isExtensible(sample)); diff --git a/test/built-ins/TypedArrays/object-arg-returns.js b/test/built-ins/TypedArrays/object-arg-returns.js index 57eec9720..cb06ba220 100644 --- a/test/built-ins/TypedArrays/object-arg-returns.js +++ b/test/built-ins/TypedArrays/object-arg-returns.js @@ -42,4 +42,6 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(typedArray[1], 0); assert.sameValue(typedArray[4], 0); } -}); +}, + // Cannot create Big*64Arrays from non-safe integers. + numericTypedArrayConstructors); diff --git a/test/built-ins/TypedArrays/object-arg-throws-from-property.js b/test/built-ins/TypedArrays/object-arg-throws-from-property.js index f9d384b5c..4a0d60825 100644 --- a/test/built-ins/TypedArrays/object-arg-throws-from-property.js +++ b/test/built-ins/TypedArrays/object-arg-throws-from-property.js @@ -31,7 +31,9 @@ Object.defineProperty(obj, "2", { } }); -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { + obj[0] = N(0); + obj[1] = N(0); assert.throws(Test262Error, function() { new TA(obj); }); diff --git a/test/built-ins/TypedArrays/object-arg-throws-setting-obj-to-primitive-typeerror.js b/test/built-ins/TypedArrays/object-arg-throws-setting-obj-to-primitive-typeerror.js index 215bf75fc..3aee05e56 100644 --- a/test/built-ins/TypedArrays/object-arg-throws-setting-obj-to-primitive-typeerror.js +++ b/test/built-ins/TypedArrays/object-arg-throws-setting-obj-to-primitive-typeerror.js @@ -54,7 +54,7 @@ includes: [testTypedArray.js] features: [Symbol.toPrimitive, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample = new Int8Array(1); var toPrimitive = 0; var valueOf = 0; @@ -69,7 +69,7 @@ testWithTypedArrayConstructors(function(TA) { }; assert.throws(TypeError, function() { - new TA([8, sample]); + new TA([N(8), sample]); }, "abrupt completion from sample @@toPrimitive"); assert.sameValue(toPrimitive, 1, "toPrimitive was called once"); diff --git a/test/built-ins/TypedArrays/object-arg-throws-setting-obj-to-primitive.js b/test/built-ins/TypedArrays/object-arg-throws-setting-obj-to-primitive.js index 7a7170b6f..516586863 100644 --- a/test/built-ins/TypedArrays/object-arg-throws-setting-obj-to-primitive.js +++ b/test/built-ins/TypedArrays/object-arg-throws-setting-obj-to-primitive.js @@ -52,7 +52,7 @@ includes: [testTypedArray.js] features: [Symbol.toPrimitive, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample = new Int8Array(1); var toPrimitive = 0; var valueOf = 0; @@ -67,7 +67,7 @@ testWithTypedArrayConstructors(function(TA) { }; assert.throws(Test262Error, function() { - new TA([8, sample]); + new TA([N(8), sample]); }, "abrupt completion from sample @@toPrimitive"); assert.sameValue(toPrimitive, 1, "toPrimitive was called once"); diff --git a/test/built-ins/TypedArrays/object-arg-throws-setting-obj-tostring.js b/test/built-ins/TypedArrays/object-arg-throws-setting-obj-tostring.js index 482e11595..3e2d84e75 100644 --- a/test/built-ins/TypedArrays/object-arg-throws-setting-obj-tostring.js +++ b/test/built-ins/TypedArrays/object-arg-throws-setting-obj-tostring.js @@ -64,7 +64,7 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample = new Int8Array(1); var valueOf = 0; var toString = 0; @@ -80,7 +80,7 @@ testWithTypedArrayConstructors(function(TA) { }; assert.throws(Test262Error, function() { - new TA([8, sample]); + new TA([N(8), sample]); }, "abrupt completion from ToNumber(sample)"); assert.sameValue(valueOf, 1, "valueOf called once"); diff --git a/test/built-ins/TypedArrays/object-arg-throws-setting-obj-valueof-typeerror.js b/test/built-ins/TypedArrays/object-arg-throws-setting-obj-valueof-typeerror.js index 767dd2182..c58fe2425 100644 --- a/test/built-ins/TypedArrays/object-arg-throws-setting-obj-valueof-typeerror.js +++ b/test/built-ins/TypedArrays/object-arg-throws-setting-obj-valueof-typeerror.js @@ -65,7 +65,7 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample = new Int8Array(1); var valueOf = 0; var toString = 0; @@ -81,7 +81,7 @@ testWithTypedArrayConstructors(function(TA) { }; assert.throws(TypeError, function() { - new TA([8, sample]); + new TA([N(8), sample]); }, "abrupt completion from ToNumber(sample)"); assert.sameValue(valueOf, 1, "valueOf called once"); diff --git a/test/built-ins/TypedArrays/object-arg-throws-setting-obj-valueof.js b/test/built-ins/TypedArrays/object-arg-throws-setting-obj-valueof.js index f9baf7758..ae4515f34 100644 --- a/test/built-ins/TypedArrays/object-arg-throws-setting-obj-valueof.js +++ b/test/built-ins/TypedArrays/object-arg-throws-setting-obj-valueof.js @@ -65,7 +65,7 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var sample = new Int8Array(1); var valueOf = 0; @@ -75,7 +75,7 @@ testWithTypedArrayConstructors(function(TA) { }; assert.throws(Test262Error, function() { - new TA([8, sample]); + new TA([N(8), sample]); }, "abrupt completion from ToNumber(sample)"); assert.sameValue(valueOf, 1, "valueOf called once"); diff --git a/test/built-ins/TypedArrays/object-arg-throws-setting-property.js b/test/built-ins/TypedArrays/object-arg-throws-setting-property.js index 93f85dc98..489234c90 100644 --- a/test/built-ins/TypedArrays/object-arg-throws-setting-property.js +++ b/test/built-ins/TypedArrays/object-arg-throws-setting-property.js @@ -31,7 +31,9 @@ var obj = { length: 4 }; -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { + obj[0] = N(0); + obj[1] = N(0); assert.throws(Test262Error, function() { new TA(obj); }); diff --git a/test/built-ins/TypedArrays/of/argument-number-value-throws.js b/test/built-ins/TypedArrays/of/argument-number-value-throws.js index bda57f8cd..3d8a49ded 100644 --- a/test/built-ins/TypedArrays/of/argument-number-value-throws.js +++ b/test/built-ins/TypedArrays/of/argument-number-value-throws.js @@ -16,23 +16,21 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -var lastValue; +testWithTypedArrayConstructors(function(TA, N) { + var lastValue = false; -var obj1 = { - valueOf() { - lastValue = "obj1"; - return 42; - } -}; -var obj2 = { - valueOf() { - lastValue = "obj2"; - throw new Test262Error(); - } -}; - -testWithTypedArrayConstructors(function(TA) { - lastValue = false; + var obj1 = { + valueOf() { + lastValue = "obj1"; + return N(42); + } + }; + var obj2 = { + valueOf() { + lastValue = "obj2"; + throw new Test262Error(); + } + }; assert.throws(Test262Error, function() { TA.of(obj1, obj2, obj1); diff --git a/test/built-ins/TypedArrays/of/custom-ctor-returns-other-instance.js b/test/built-ins/TypedArrays/of/custom-ctor-returns-other-instance.js index e116b1db7..6417c73d5 100644 --- a/test/built-ins/TypedArrays/of/custom-ctor-returns-other-instance.js +++ b/test/built-ins/TypedArrays/of/custom-ctor-returns-other-instance.js @@ -18,16 +18,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var result; var custom = new TA(3); var ctor = function() { return custom; }; - result = TypedArray.of.call(ctor, 1, 2, 3); + result = TypedArray.of.call(ctor, N(1), N(2), N(3)); assert.sameValue(result, custom, "using iterator, same length"); - result = TypedArray.of.call(ctor, 1, 2); + result = TypedArray.of.call(ctor, N(1), N(2)); assert.sameValue(result, custom, "using iterator, higher length"); }); diff --git a/test/built-ins/TypedArrays/of/new-instance-using-custom-ctor.js b/test/built-ins/TypedArrays/of/new-instance-using-custom-ctor.js index 7cc95230e..fbcc55b27 100644 --- a/test/built-ins/TypedArrays/of/new-instance-using-custom-ctor.js +++ b/test/built-ins/TypedArrays/of/new-instance-using-custom-ctor.js @@ -8,7 +8,7 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithTypedArrayConstructors(function(TA, N) { var called = 0; var ctor = function(len) { @@ -18,11 +18,11 @@ testWithTypedArrayConstructors(function(TA) { }; - var result = TA.of.call(ctor, 42, 43, 42); + var result = TA.of.call(ctor, N(42), N(43), N(42)); assert.sameValue(result.length, 3); - assert.sameValue(result[0], 42); - assert.sameValue(result[1], 43); - assert.sameValue(result[2], 42); + assert.sameValue(result[0], N(42)); + assert.sameValue(result[1], N(43)); + assert.sameValue(result[2], N(42)); assert.sameValue(result.constructor, TA); assert.sameValue(called, 1); }); diff --git a/test/built-ins/TypedArrays/of/new-instance.js b/test/built-ins/TypedArrays/of/new-instance.js index e83ad648d..a0fbe0150 100644 --- a/test/built-ins/TypedArrays/of/new-instance.js +++ b/test/built-ins/TypedArrays/of/new-instance.js @@ -23,12 +23,12 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { - var result = TA.of(42, 43, null); +testWithTypedArrayConstructors(function(TA, N) { + var result = TA.of(N(42), N(43), N(false)); assert.sameValue(result.length, 3); - assert.sameValue(result[0], 42); - assert.sameValue(result[1], 43); - assert.sameValue(result[2], 0); + assert.sameValue(result[0], N(42)); + assert.sameValue(result[1], N(43)); + assert.sameValue(result[2], N(0)); assert.sameValue(result.constructor, TA); assert.sameValue(Object.getPrototypeOf(result), TA.prototype); }); diff --git a/test/built-ins/TypedArrays/typedarray-arg-other-ctor-returns-new-typedarray.js b/test/built-ins/TypedArrays/typedarray-arg-other-ctor-returns-new-typedarray.js index 411248ffd..34cb4dee6 100644 --- a/test/built-ins/TypedArrays/typedarray-arg-other-ctor-returns-new-typedarray.js +++ b/test/built-ins/TypedArrays/typedarray-arg-other-ctor-returns-new-typedarray.js @@ -16,9 +16,13 @@ features: [TypedArray] var sample1 = new Int8Array(7); var sample2 = new Int16Array(7); +var sample3 = new BigInt64Array(7); +var sample4 = new BigUint64Array(7); testWithTypedArrayConstructors(function(TA) { - var sample = TA === Int8Array ? sample2 : sample1; + var sample = TA === Int8Array ? sample2 : + TA === BigInt64Array ? sample4 : + TA === BigUint64Array ? sample3 : sample1; var typedArray = new TA(sample); assert.sameValue(typedArray.length, 7); diff --git a/test/built-ins/TypedArrays/typedarray-arg-returns-new-instance.js b/test/built-ins/TypedArrays/typedarray-arg-returns-new-instance.js index 357730df5..128ec4021 100644 --- a/test/built-ins/TypedArrays/typedarray-arg-returns-new-instance.js +++ b/test/built-ins/TypedArrays/typedarray-arg-returns-new-instance.js @@ -28,4 +28,4 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(typedArray.length, len); assert.sameValue(typedArray.constructor, TA); assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); -}); +}, numericTypedArrayConstructors); diff --git a/test/built-ins/TypedArrays/typedarray-arg-use-custom-proto-if-object.js b/test/built-ins/TypedArrays/typedarray-arg-use-custom-proto-if-object.js index 8af612edc..2745fc5e2 100644 --- a/test/built-ins/TypedArrays/typedarray-arg-use-custom-proto-if-object.js +++ b/test/built-ins/TypedArrays/typedarray-arg-use-custom-proto-if-object.js @@ -45,4 +45,4 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(ta.constructor, Object); assert.sameValue(Object.getPrototypeOf(ta), proto); -}); +}, numericTypedArrayConstructors); diff --git a/test/built-ins/TypedArrays/typedarray-arg-use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/typedarray-arg-use-default-proto-if-custom-proto-is-not-object.js index b31bd96e4..ec1997e91 100644 --- a/test/built-ins/TypedArrays/typedarray-arg-use-default-proto-if-custom-proto-is-not-object.js +++ b/test/built-ins/TypedArrays/typedarray-arg-use-default-proto-if-custom-proto-is-not-object.js @@ -44,4 +44,4 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(ta.constructor, TA); assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); -}); +}, numericTypedArrayConstructors); diff --git a/test/harness/testTypedArray.js b/test/harness/testTypedArray.js index 066de8eb8..bb0016857 100644 --- a/test/harness/testTypedArray.js +++ b/test/harness/testTypedArray.js @@ -24,6 +24,12 @@ var TAConstructors = [ Uint8Array, Uint8ClampedArray ]; + +if (typeof BigInt !== "undefined") { + TAConstructors.push(BigInt64Array); + TAConstructors.push(BigUint64Array); +} + var length = TAConstructors.length; assert( -- cgit v1.2.1 From 5722ac494b89135cdcc406ec9ca3362920129346 Mon Sep 17 00:00:00 2001 From: Leo Balter Date: Fri, 9 Feb 2018 13:35:18 -0500 Subject: Move TypedArray ctors tests to a bigint specific folder --- ...teoffset-throws-from-modulo-element-size-sab.js | 38 --------- ...erbyteoffset-throws-from-modulo-element-size.js | 37 --------- ...buffer-arg-byteoffset-is-negative-throws-sab.js | 32 -------- .../buffer-arg-byteoffset-is-negative-throws.js | 31 -------- .../buffer-arg-byteoffset-is-negative-zero-sab.js | 23 ------ .../buffer-arg-byteoffset-is-negative-zero.js | 23 ------ .../buffer-arg-byteoffset-is-symbol-throws-sab.js | 29 ------- .../buffer-arg-byteoffset-is-symbol-throws.js | 28 ------- ...teoffset-throws-from-modulo-element-size-sab.js | 33 -------- ...g-byteoffset-throws-from-modulo-element-size.js | 32 -------- ...buffer-arg-byteoffset-to-number-detachbuffer.js | 21 ----- .../buffer-arg-byteoffset-to-number-throws-sab.js | 33 -------- .../buffer-arg-byteoffset-to-number-throws.js | 32 -------- .../buffer-arg-custom-proto-access-throws-sab.js | 48 ------------ .../buffer-arg-custom-proto-access-throws.js | 47 ------------ .../buffer-arg-defined-length-and-offset-sab.js | 33 -------- .../buffer-arg-defined-length-and-offset.js | 32 -------- .../TypedArrays/buffer-arg-defined-length-sab.js | 35 --------- .../TypedArrays/buffer-arg-defined-length.js | 34 --------- .../buffer-arg-defined-negative-length-sab.js | 29 ------- .../buffer-arg-defined-negative-length.js | 28 ------- .../TypedArrays/buffer-arg-defined-offset-sab.js | 33 -------- .../TypedArrays/buffer-arg-defined-offset.js | 32 -------- .../TypedArrays/buffer-arg-detachedbuffer.js | 21 ----- .../buffer-arg-excessive-length-throws-sab.js | 32 -------- .../buffer-arg-excessive-length-throws.js | 31 -------- .../buffer-arg-excessive-offset-throws-sab.js | 36 --------- .../buffer-arg-excessive-offset-throws.js | 35 --------- ...fer-arg-invoked-with-undefined-newtarget-sab.js | 27 ------- .../buffer-arg-invoked-with-undefined-newtarget.js | 26 ------- .../TypedArrays/buffer-arg-is-referenced-sab.js | 33 -------- .../TypedArrays/buffer-arg-is-referenced.js | 32 -------- .../buffer-arg-length-access-throws-sab.js | 34 --------- .../TypedArrays/buffer-arg-length-access-throws.js | 33 -------- .../buffer-arg-length-is-symbol-throws-sab.js | 30 -------- .../buffer-arg-length-is-symbol-throws.js | 29 ------- .../buffer-arg-length-to-number-detachbuffer.js | 21 ----- .../buffer-arg-new-instance-extensibility-sab.js | 38 --------- .../buffer-arg-new-instance-extensibility.js | 37 --------- .../buffer-arg-proto-from-ctor-realm-sab.js | 38 --------- .../buffer-arg-proto-from-ctor-realm.js | 37 --------- .../buffer-arg-returns-new-instance-sab.js | 34 --------- .../TypedArrays/buffer-arg-returns-new-instance.js | 33 -------- .../buffer-arg-toindex-bytelength-sab.js | 73 ------------------ .../TypedArrays/buffer-arg-toindex-bytelength.js | 72 ----------------- .../buffer-arg-toindex-byteoffset-sab.js | 87 --------------------- .../TypedArrays/buffer-arg-toindex-byteoffset.js | 86 --------------------- ...r-arg-typedarray-backed-by-sharedarraybuffer.js | 23 ------ .../buffer-arg-use-custom-proto-if-object-sab.js | 49 ------------ .../buffer-arg-use-custom-proto-if-object.js | 48 ------------ ...ault-proto-if-custom-proto-is-not-object-sab.js | 48 ------------ ...-default-proto-if-custom-proto-is-not-object.js | 47 ------------ ...teoffset-throws-from-modulo-element-size-sab.js | 38 +++++++++ ...erbyteoffset-throws-from-modulo-element-size.js | 37 +++++++++ ...buffer-arg-byteoffset-is-negative-throws-sab.js | 32 ++++++++ .../buffer-arg-byteoffset-is-negative-throws.js | 31 ++++++++ .../buffer-arg-byteoffset-is-negative-zero-sab.js | 23 ++++++ .../buffer-arg-byteoffset-is-negative-zero.js | 23 ++++++ .../buffer-arg-byteoffset-is-symbol-throws-sab.js | 29 +++++++ .../buffer-arg-byteoffset-is-symbol-throws.js | 28 +++++++ ...teoffset-throws-from-modulo-element-size-sab.js | 33 ++++++++ ...g-byteoffset-throws-from-modulo-element-size.js | 32 ++++++++ ...buffer-arg-byteoffset-to-number-detachbuffer.js | 21 +++++ .../buffer-arg-byteoffset-to-number-throws-sab.js | 33 ++++++++ .../buffer-arg-byteoffset-to-number-throws.js | 32 ++++++++ .../buffer-arg-custom-proto-access-throws-sab.js | 48 ++++++++++++ .../buffer-arg-custom-proto-access-throws.js | 47 ++++++++++++ .../buffer-arg-defined-length-and-offset-sab.js | 33 ++++++++ .../buffer-arg-defined-length-and-offset.js | 32 ++++++++ .../butter-arg/buffer-arg-defined-length-sab.js | 35 +++++++++ .../butter-arg/buffer-arg-defined-length.js | 34 +++++++++ .../buffer-arg-defined-negative-length-sab.js | 29 +++++++ .../buffer-arg-defined-negative-length.js | 28 +++++++ .../butter-arg/buffer-arg-defined-offset-sab.js | 33 ++++++++ .../butter-arg/buffer-arg-defined-offset.js | 32 ++++++++ .../butter-arg/buffer-arg-detachedbuffer.js | 21 +++++ .../buffer-arg-excessive-length-throws-sab.js | 32 ++++++++ .../buffer-arg-excessive-length-throws.js | 31 ++++++++ .../buffer-arg-excessive-offset-throws-sab.js | 36 +++++++++ .../buffer-arg-excessive-offset-throws.js | 35 +++++++++ ...fer-arg-invoked-with-undefined-newtarget-sab.js | 27 +++++++ .../buffer-arg-invoked-with-undefined-newtarget.js | 26 +++++++ .../butter-arg/buffer-arg-is-referenced-sab.js | 33 ++++++++ .../butter-arg/buffer-arg-is-referenced.js | 32 ++++++++ .../buffer-arg-length-access-throws-sab.js | 34 +++++++++ .../butter-arg/buffer-arg-length-access-throws.js | 33 ++++++++ .../buffer-arg-length-is-symbol-throws-sab.js | 30 ++++++++ .../buffer-arg-length-is-symbol-throws.js | 29 +++++++ .../buffer-arg-length-to-number-detachbuffer.js | 21 +++++ .../buffer-arg-new-instance-extensibility-sab.js | 38 +++++++++ .../buffer-arg-new-instance-extensibility.js | 37 +++++++++ .../buffer-arg-proto-from-ctor-realm-sab.js | 38 +++++++++ .../butter-arg/buffer-arg-proto-from-ctor-realm.js | 37 +++++++++ .../buffer-arg-returns-new-instance-sab.js | 34 +++++++++ .../butter-arg/buffer-arg-returns-new-instance.js | 33 ++++++++ .../buffer-arg-toindex-bytelength-sab.js | 73 ++++++++++++++++++ .../butter-arg/buffer-arg-toindex-bytelength.js | 72 +++++++++++++++++ .../buffer-arg-toindex-byteoffset-sab.js | 87 +++++++++++++++++++++ .../butter-arg/buffer-arg-toindex-byteoffset.js | 86 +++++++++++++++++++++ ...r-arg-typedarray-backed-by-sharedarraybuffer.js | 23 ++++++ .../buffer-arg-use-custom-proto-if-object-sab.js | 49 ++++++++++++ .../buffer-arg-use-custom-proto-if-object.js | 48 ++++++++++++ ...ault-proto-if-custom-proto-is-not-object-sab.js | 48 ++++++++++++ ...-default-proto-if-custom-proto-is-not-object.js | 47 ++++++++++++ .../length-arg-custom-proto-access-throws.js | 43 +++++++++++ .../length-arg/length-arg-init-zeros.js | 55 +++++++++++++ .../length-arg-is-infinity-throws-rangeerror.js | 27 +++++++ ...th-arg-is-negative-integer-throws-rangeerror.js | 37 +++++++++ .../length-arg/length-arg-is-symbol-throws.js | 26 +++++++ .../length-arg-new-instance-extensibility.js | 38 +++++++++ .../length-arg/length-arg-proto-from-ctor-realm.js | 36 +++++++++ .../length-arg/length-arg-returns-object.js | 33 ++++++++ .../length-arg/length-arg-toindex-length.js | 53 +++++++++++++ .../length-arg-undefined-newtarget-throws.js | 28 +++++++ .../length-arg-use-custom-proto-if-object.js | 44 +++++++++++ ...-default-proto-if-custom-proto-is-not-object.js | 43 +++++++++++ .../no-args/no-args-custom-proto-access-throws.js | 43 +++++++++++ .../no-args/no-args-new-instance-extensibility.js | 38 +++++++++ .../no-args/no-args-proto-from-ctor-realm.js | 36 +++++++++ .../ctors-bigint/no-args/no-args-returns-object.js | 32 ++++++++ .../no-args/no-args-undefined-newtarget-throws.js | 23 ++++++ .../no-args/no-args-use-custom-proto-if-object.js | 44 +++++++++++ ...-default-proto-if-custom-proto-is-not-object.js | 43 +++++++++++ .../object-arg/object-arg-as-array-returns.js | 28 +++++++ .../object-arg-as-generator-iterable-returns.js | 30 ++++++++ ...ject-arg-conversion-operation-consistent-nan.js | 60 +++++++++++++++ .../object-arg/object-arg-conversion-operation.js | 52 +++++++++++++ .../object-arg-custom-proto-access-throws.js | 48 ++++++++++++ .../object-arg/object-arg-iterating-throws.js | 31 ++++++++ .../object-arg-iterator-not-callable-throws.js | 39 ++++++++++ .../object-arg/object-arg-iterator-throws.js | 34 +++++++++ .../object-arg-length-excessive-throws.js | 30 ++++++++ .../object-arg-length-is-symbol-throws.js | 30 ++++++++ .../object-arg/object-arg-length-throws.js | 34 +++++++++ .../object-arg-new-instance-extensibility.js | 43 +++++++++++ .../object-arg/object-arg-proto-from-ctor-realm.js | 37 +++++++++ .../ctors-bigint/object-arg/object-arg-returns.js | 47 ++++++++++++ .../object-arg/object-arg-throws-from-property.js | 40 ++++++++++ ...rg-throws-setting-obj-to-primitive-typeerror.js | 77 +++++++++++++++++++ .../object-arg-throws-setting-obj-to-primitive.js | 75 ++++++++++++++++++ .../object-arg-throws-setting-obj-tostring.js | 88 +++++++++++++++++++++ ...ect-arg-throws-setting-obj-valueof-typeerror.js | 89 ++++++++++++++++++++++ .../object-arg-throws-setting-obj-valueof.js | 82 ++++++++++++++++++++ .../object-arg-throws-setting-property.js | 40 ++++++++++ .../object-arg-throws-setting-symbol-property.js | 34 +++++++++ .../object-arg-undefined-newtarget-throws.js | 30 ++++++++ .../object-arg-use-custom-proto-if-object.js | 47 ++++++++++++ ...-default-proto-if-custom-proto-is-not-object.js | 47 ++++++++++++ .../typedarray-arg-custom-proto-access-throws.js | 47 ++++++++++++ ...tached-when-species-retrieved-different-type.js | 61 +++++++++++++++ ...rg-detached-when-species-retrieved-same-type.js | 64 ++++++++++++++++ .../typedarray-arg-new-instance-extensibility.js | 46 +++++++++++ ...ray-arg-other-ctor-buffer-ctor-access-throws.js | 41 ++++++++++ ...er-ctor-custom-species-proto-from-ctor-realm.js | 59 ++++++++++++++ ...ay-arg-other-ctor-buffer-ctor-custom-species.js | 52 +++++++++++++ ...arg-other-ctor-buffer-ctor-not-object-throws.js | 61 +++++++++++++++ ...other-ctor-buffer-ctor-species-access-throws.js | 45 +++++++++++ ...her-ctor-buffer-ctor-species-not-ctor-throws.js | 47 ++++++++++++ ...rray-arg-other-ctor-buffer-ctor-species-null.js | 44 +++++++++++ ...er-ctor-buffer-ctor-species-prototype-throws.js | 59 ++++++++++++++ ...arg-other-ctor-buffer-ctor-species-undefined.js | 43 +++++++++++ ...darray-arg-other-ctor-returns-new-typedarray.js | 32 ++++++++ .../typedarray-arg-proto-from-ctor-realm.js | 37 +++++++++ .../typedarray-arg-returns-new-instance.js | 31 ++++++++ ...rray-arg-same-ctor-buffer-ctor-access-throws.js | 46 +++++++++++ ...er-ctor-species-custom-proto-from-ctor-realm.js | 68 +++++++++++++++++ ...ray-arg-same-ctor-buffer-ctor-species-custom.js | 60 +++++++++++++++ ...y-arg-same-ctor-buffer-ctor-species-not-ctor.js | 49 ++++++++++++ ...array-arg-same-ctor-buffer-ctor-species-null.js | 49 ++++++++++++ ...me-ctor-buffer-ctor-species-prototype-throws.js | 62 +++++++++++++++ ...ray-arg-same-ctor-buffer-ctor-species-throws.js | 49 ++++++++++++ ...-arg-same-ctor-buffer-ctor-species-undefined.js | 49 ++++++++++++ ...g-same-ctor-buffer-ctor-value-not-obj-throws.js | 65 ++++++++++++++++ ...-arg-same-ctor-returns-new-cloned-typedarray.js | 32 ++++++++ .../typedarray-arg-undefined-newtarget-throws.js | 27 +++++++ .../typedarray-arg-use-custom-proto-if-object.js | 48 ++++++++++++ ...-default-proto-if-custom-proto-is-not-object.js | 47 ++++++++++++ .../length-arg-custom-proto-access-throws.js | 43 ----------- .../built-ins/TypedArrays/length-arg-init-zeros.js | 55 ------------- .../length-arg-is-infinity-throws-rangeerror.js | 27 ------- ...th-arg-is-negative-integer-throws-rangeerror.js | 37 --------- .../TypedArrays/length-arg-is-symbol-throws.js | 26 ------- .../length-arg-new-instance-extensibility.js | 38 --------- .../length-arg-proto-from-ctor-realm.js | 36 --------- .../TypedArrays/length-arg-returns-object.js | 33 -------- .../TypedArrays/length-arg-toindex-length.js | 53 ------------- .../length-arg-undefined-newtarget-throws.js | 28 ------- .../length-arg-use-custom-proto-if-object.js | 44 ----------- ...-default-proto-if-custom-proto-is-not-object.js | 43 ----------- .../no-args-custom-proto-access-throws.js | 43 ----------- .../no-args-new-instance-extensibility.js | 38 --------- .../TypedArrays/no-args-proto-from-ctor-realm.js | 36 --------- .../TypedArrays/no-args-returns-object.js | 32 -------- .../no-args-undefined-newtarget-throws.js | 23 ------ .../no-args-use-custom-proto-if-object.js | 44 ----------- ...-default-proto-if-custom-proto-is-not-object.js | 43 ----------- .../TypedArrays/object-arg-as-array-returns.js | 28 ------- .../object-arg-as-generator-iterable-returns.js | 30 -------- ...ject-arg-conversion-operation-consistent-nan.js | 60 --------------- .../TypedArrays/object-arg-conversion-operation.js | 52 ------------- .../object-arg-custom-proto-access-throws.js | 48 ------------ .../TypedArrays/object-arg-iterating-throws.js | 31 -------- .../object-arg-iterator-not-callable-throws.js | 39 ---------- .../TypedArrays/object-arg-iterator-throws.js | 34 --------- .../object-arg-length-excessive-throws.js | 30 -------- .../object-arg-length-is-symbol-throws.js | 30 -------- .../TypedArrays/object-arg-length-throws.js | 34 --------- .../object-arg-new-instance-extensibility.js | 43 ----------- .../object-arg-proto-from-ctor-realm.js | 37 --------- test/built-ins/TypedArrays/object-arg-returns.js | 47 ------------ .../TypedArrays/object-arg-throws-from-property.js | 40 ---------- ...rg-throws-setting-obj-to-primitive-typeerror.js | 77 ------------------- .../object-arg-throws-setting-obj-to-primitive.js | 75 ------------------ .../object-arg-throws-setting-obj-tostring.js | 88 --------------------- ...ect-arg-throws-setting-obj-valueof-typeerror.js | 89 ---------------------- .../object-arg-throws-setting-obj-valueof.js | 82 -------------------- .../object-arg-throws-setting-property.js | 40 ---------- .../object-arg-throws-setting-symbol-property.js | 34 --------- .../object-arg-undefined-newtarget-throws.js | 30 -------- .../object-arg-use-custom-proto-if-object.js | 47 ------------ ...-default-proto-if-custom-proto-is-not-object.js | 47 ------------ .../typedarray-arg-custom-proto-access-throws.js | 47 ------------ ...tached-when-species-retrieved-different-type.js | 61 --------------- ...rg-detached-when-species-retrieved-same-type.js | 64 ---------------- .../typedarray-arg-new-instance-extensibility.js | 46 ----------- ...ray-arg-other-ctor-buffer-ctor-access-throws.js | 41 ---------- ...er-ctor-custom-species-proto-from-ctor-realm.js | 59 -------------- ...ay-arg-other-ctor-buffer-ctor-custom-species.js | 52 ------------- ...arg-other-ctor-buffer-ctor-not-object-throws.js | 61 --------------- ...other-ctor-buffer-ctor-species-access-throws.js | 45 ----------- ...her-ctor-buffer-ctor-species-not-ctor-throws.js | 47 ------------ ...rray-arg-other-ctor-buffer-ctor-species-null.js | 44 ----------- ...er-ctor-buffer-ctor-species-prototype-throws.js | 59 -------------- ...arg-other-ctor-buffer-ctor-species-undefined.js | 43 ----------- ...darray-arg-other-ctor-returns-new-typedarray.js | 32 -------- .../typedarray-arg-proto-from-ctor-realm.js | 37 --------- .../typedarray-arg-returns-new-instance.js | 31 -------- ...rray-arg-same-ctor-buffer-ctor-access-throws.js | 46 ----------- ...er-ctor-species-custom-proto-from-ctor-realm.js | 68 ----------------- ...ray-arg-same-ctor-buffer-ctor-species-custom.js | 60 --------------- ...y-arg-same-ctor-buffer-ctor-species-not-ctor.js | 49 ------------ ...array-arg-same-ctor-buffer-ctor-species-null.js | 49 ------------ ...me-ctor-buffer-ctor-species-prototype-throws.js | 62 --------------- ...ray-arg-same-ctor-buffer-ctor-species-throws.js | 49 ------------ ...-arg-same-ctor-buffer-ctor-species-undefined.js | 49 ------------ ...g-same-ctor-buffer-ctor-value-not-obj-throws.js | 65 ---------------- ...-arg-same-ctor-returns-new-cloned-typedarray.js | 32 -------- .../typedarray-arg-undefined-newtarget-throws.js | 27 ------- .../typedarray-arg-use-custom-proto-if-object.js | 48 ------------ ...-default-proto-if-custom-proto-is-not-object.js | 47 ------------ 250 files changed, 5247 insertions(+), 5247 deletions(-) delete mode 100644 test/built-ins/TypedArrays/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-byteoffset-is-negative-throws-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-byteoffset-is-negative-throws.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-byteoffset-is-negative-zero-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-byteoffset-is-negative-zero.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-byteoffset-is-symbol-throws-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-byteoffset-is-symbol-throws.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-byteoffset-throws-from-modulo-element-size-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-byteoffset-throws-from-modulo-element-size.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-byteoffset-to-number-detachbuffer.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-byteoffset-to-number-throws-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-byteoffset-to-number-throws.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-custom-proto-access-throws-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-custom-proto-access-throws.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-defined-length-and-offset-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-defined-length-and-offset.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-defined-length-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-defined-length.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-defined-negative-length-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-defined-negative-length.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-defined-offset-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-defined-offset.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-detachedbuffer.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-excessive-length-throws-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-excessive-length-throws.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-excessive-offset-throws-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-excessive-offset-throws.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-invoked-with-undefined-newtarget-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-invoked-with-undefined-newtarget.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-is-referenced-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-is-referenced.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-length-access-throws-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-length-access-throws.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-length-is-symbol-throws-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-length-is-symbol-throws.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-length-to-number-detachbuffer.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-new-instance-extensibility-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-new-instance-extensibility.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-proto-from-ctor-realm-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-proto-from-ctor-realm.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-returns-new-instance-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-returns-new-instance.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-toindex-bytelength-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-toindex-bytelength.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-toindex-byteoffset-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-toindex-byteoffset.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-typedarray-backed-by-sharedarraybuffer.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-use-custom-proto-if-object-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-use-custom-proto-if-object.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-use-default-proto-if-custom-proto-is-not-object-sab.js delete mode 100644 test/built-ins/TypedArrays/buffer-arg-use-default-proto-if-custom-proto-is-not-object.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-zero-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-zero.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-symbol-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-symbol-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-throws-from-modulo-element-size-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-throws-from-modulo-element-size.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-detachbuffer.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-custom-proto-access-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-custom-proto-access-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-and-offset-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-and-offset.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-negative-length-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-negative-length.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-offset-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-offset.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-detachedbuffer.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-length-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-length-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-offset-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-offset-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-invoked-with-undefined-newtarget-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-invoked-with-undefined-newtarget.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-is-referenced-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-is-referenced.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-access-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-access-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-is-symbol-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-is-symbol-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-to-number-detachbuffer.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-new-instance-extensibility-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-new-instance-extensibility.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-proto-from-ctor-realm-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-proto-from-ctor-realm.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-returns-new-instance-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-returns-new-instance.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-bytelength-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-bytelength.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-byteoffset-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-byteoffset.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-typedarray-backed-by-sharedarraybuffer.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-custom-proto-if-object-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-custom-proto-if-object.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-custom-proto-access-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-init-zeros.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-infinity-throws-rangeerror.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-negative-integer-throws-rangeerror.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-symbol-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-new-instance-extensibility.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-proto-from-ctor-realm.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-returns-object.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-toindex-length.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-undefined-newtarget-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-use-custom-proto-if-object.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-use-default-proto-if-custom-proto-is-not-object.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-custom-proto-access-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-new-instance-extensibility.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-proto-from-ctor-realm.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-returns-object.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-undefined-newtarget-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-use-custom-proto-if-object.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-use-default-proto-if-custom-proto-is-not-object.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-array-returns.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-generator-iterable-returns.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation-consistent-nan.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-custom-proto-access-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterating-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterator-not-callable-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterator-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-excessive-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-is-symbol-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-new-instance-extensibility.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-proto-from-ctor-realm.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-returns.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-from-property.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive-typeerror.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-tostring.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof-typeerror.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-property.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-symbol-property.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-undefined-newtarget-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-use-custom-proto-if-object.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-use-default-proto-if-custom-proto-is-not-object.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-custom-proto-access-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-detached-when-species-retrieved-different-type.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-detached-when-species-retrieved-same-type.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-new-instance-extensibility.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-access-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species-proto-from-ctor-realm.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-not-object-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-access-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-not-ctor-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-null.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-prototype-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-undefined.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-returns-new-typedarray.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-proto-from-ctor-realm.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-returns-new-instance.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-access-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom-proto-from-ctor-realm.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-not-ctor.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-null.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-prototype-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-undefined.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-value-not-obj-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-returns-new-cloned-typedarray.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-undefined-newtarget-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-use-custom-proto-if-object.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-use-default-proto-if-custom-proto-is-not-object.js delete mode 100644 test/built-ins/TypedArrays/length-arg-custom-proto-access-throws.js delete mode 100644 test/built-ins/TypedArrays/length-arg-init-zeros.js delete mode 100644 test/built-ins/TypedArrays/length-arg-is-infinity-throws-rangeerror.js delete mode 100644 test/built-ins/TypedArrays/length-arg-is-negative-integer-throws-rangeerror.js delete mode 100644 test/built-ins/TypedArrays/length-arg-is-symbol-throws.js delete mode 100644 test/built-ins/TypedArrays/length-arg-new-instance-extensibility.js delete mode 100644 test/built-ins/TypedArrays/length-arg-proto-from-ctor-realm.js delete mode 100644 test/built-ins/TypedArrays/length-arg-returns-object.js delete mode 100644 test/built-ins/TypedArrays/length-arg-toindex-length.js delete mode 100644 test/built-ins/TypedArrays/length-arg-undefined-newtarget-throws.js delete mode 100644 test/built-ins/TypedArrays/length-arg-use-custom-proto-if-object.js delete mode 100644 test/built-ins/TypedArrays/length-arg-use-default-proto-if-custom-proto-is-not-object.js delete mode 100644 test/built-ins/TypedArrays/no-args-custom-proto-access-throws.js delete mode 100644 test/built-ins/TypedArrays/no-args-new-instance-extensibility.js delete mode 100644 test/built-ins/TypedArrays/no-args-proto-from-ctor-realm.js delete mode 100644 test/built-ins/TypedArrays/no-args-returns-object.js delete mode 100644 test/built-ins/TypedArrays/no-args-undefined-newtarget-throws.js delete mode 100644 test/built-ins/TypedArrays/no-args-use-custom-proto-if-object.js delete mode 100644 test/built-ins/TypedArrays/no-args-use-default-proto-if-custom-proto-is-not-object.js delete mode 100644 test/built-ins/TypedArrays/object-arg-as-array-returns.js delete mode 100644 test/built-ins/TypedArrays/object-arg-as-generator-iterable-returns.js delete mode 100644 test/built-ins/TypedArrays/object-arg-conversion-operation-consistent-nan.js delete mode 100644 test/built-ins/TypedArrays/object-arg-conversion-operation.js delete mode 100644 test/built-ins/TypedArrays/object-arg-custom-proto-access-throws.js delete mode 100644 test/built-ins/TypedArrays/object-arg-iterating-throws.js delete mode 100644 test/built-ins/TypedArrays/object-arg-iterator-not-callable-throws.js delete mode 100644 test/built-ins/TypedArrays/object-arg-iterator-throws.js delete mode 100644 test/built-ins/TypedArrays/object-arg-length-excessive-throws.js delete mode 100644 test/built-ins/TypedArrays/object-arg-length-is-symbol-throws.js delete mode 100644 test/built-ins/TypedArrays/object-arg-length-throws.js delete mode 100644 test/built-ins/TypedArrays/object-arg-new-instance-extensibility.js delete mode 100644 test/built-ins/TypedArrays/object-arg-proto-from-ctor-realm.js delete mode 100644 test/built-ins/TypedArrays/object-arg-returns.js delete mode 100644 test/built-ins/TypedArrays/object-arg-throws-from-property.js delete mode 100644 test/built-ins/TypedArrays/object-arg-throws-setting-obj-to-primitive-typeerror.js delete mode 100644 test/built-ins/TypedArrays/object-arg-throws-setting-obj-to-primitive.js delete mode 100644 test/built-ins/TypedArrays/object-arg-throws-setting-obj-tostring.js delete mode 100644 test/built-ins/TypedArrays/object-arg-throws-setting-obj-valueof-typeerror.js delete mode 100644 test/built-ins/TypedArrays/object-arg-throws-setting-obj-valueof.js delete mode 100644 test/built-ins/TypedArrays/object-arg-throws-setting-property.js delete mode 100644 test/built-ins/TypedArrays/object-arg-throws-setting-symbol-property.js delete mode 100644 test/built-ins/TypedArrays/object-arg-undefined-newtarget-throws.js delete mode 100644 test/built-ins/TypedArrays/object-arg-use-custom-proto-if-object.js delete mode 100644 test/built-ins/TypedArrays/object-arg-use-default-proto-if-custom-proto-is-not-object.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-custom-proto-access-throws.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-detached-when-species-retrieved-different-type.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-detached-when-species-retrieved-same-type.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-new-instance-extensibility.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-access-throws.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-custom-species-proto-from-ctor-realm.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-custom-species.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-not-object-throws.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-species-access-throws.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-species-not-ctor-throws.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-species-null.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-species-prototype-throws.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-species-undefined.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-other-ctor-returns-new-typedarray.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-proto-from-ctor-realm.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-returns-new-instance.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-access-throws.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-custom-proto-from-ctor-realm.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-custom.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-not-ctor.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-null.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-prototype-throws.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-throws.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-undefined.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-value-not-obj-throws.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-same-ctor-returns-new-cloned-typedarray.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-undefined-newtarget-throws.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-use-custom-proto-if-object.js delete mode 100644 test/built-ins/TypedArrays/typedarray-arg-use-default-proto-if-custom-proto-is-not-object.js diff --git a/test/built-ins/TypedArrays/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size-sab.js b/test/built-ins/TypedArrays/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size-sab.js deleted file mode 100644 index 707aa00be..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size-sab.js +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a RangeError if bufferByteLength modulo elementSize ≠ 0 -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 13. If length is undefined, then - a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(1); - -testWithTypedArrayConstructors(function(TA) { - if (TA.BYTES_PER_ELEMENT === 1) { - // Impossible to trigger this step here. - return; - } - - assert.throws(RangeError, function() { - new TA(buffer); - }); - - assert.throws(RangeError, function() { - new TA(buffer, 0, undefined); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size.js b/test/built-ins/TypedArrays/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size.js deleted file mode 100644 index a886e5afd..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size.js +++ /dev/null @@ -1,37 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a RangeError if bufferByteLength modulo elementSize ≠ 0 -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 13. If length is undefined, then - a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var buffer = new ArrayBuffer(1); - -testWithTypedArrayConstructors(function(TA) { - if (TA.BYTES_PER_ELEMENT === 1) { - // Impossible to trigger this step here. - return; - } - - assert.throws(RangeError, function() { - new TA(buffer); - }); - - assert.throws(RangeError, function() { - new TA(buffer, 0, undefined); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-byteoffset-is-negative-throws-sab.js b/test/built-ins/TypedArrays/buffer-arg-byteoffset-is-negative-throws-sab.js deleted file mode 100644 index 89f58a1cd..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-byteoffset-is-negative-throws-sab.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a RangeError if ToInteger(byteOffset) is < 0 -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 7. Let offset be ? ToInteger(byteOffset). - 8. If offset < 0, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(8); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(RangeError, function() { - new TA(buffer, -1); - }); - assert.throws(RangeError, function() { - new TA(buffer, -Infinity); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-byteoffset-is-negative-throws.js b/test/built-ins/TypedArrays/buffer-arg-byteoffset-is-negative-throws.js deleted file mode 100644 index 058892465..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-byteoffset-is-negative-throws.js +++ /dev/null @@ -1,31 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a RangeError if ToInteger(byteOffset) is < 0 -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 7. Let offset be ? ToInteger(byteOffset). - 8. If offset < 0, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var buffer = new ArrayBuffer(8); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(RangeError, function() { - new TA(buffer, -1); - }); - assert.throws(RangeError, function() { - new TA(buffer, -Infinity); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-byteoffset-is-negative-zero-sab.js b/test/built-ins/TypedArrays/buffer-arg-byteoffset-is-negative-zero-sab.js deleted file mode 100644 index 1073b5af8..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-byteoffset-is-negative-zero-sab.js +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2015 André Bargull. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: pending -description: > - TypedArray's [[ByteOffset]] internal slot is always a positive number, test with negative zero. -info: | - %TypedArray% ( buffer [ , byteOffset [ , length ] ] ) - - ... - 6. Let offset be ? ToInteger(byteOffset). - 7. If offset < 0, throw a RangeError exception. - 8. If offset is -0, let offset be +0. - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TAConstructor) { - var typedArray = new TAConstructor(new SharedArrayBuffer(8), -0); - assert.sameValue(typedArray.byteOffset, +0); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-byteoffset-is-negative-zero.js b/test/built-ins/TypedArrays/buffer-arg-byteoffset-is-negative-zero.js deleted file mode 100644 index 13d0a3e14..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-byteoffset-is-negative-zero.js +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2015 André Bargull. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: pending -description: > - TypedArray's [[ByteOffset]] internal slot is always a positive number, test with negative zero. -info: | - %TypedArray% ( buffer [ , byteOffset [ , length ] ] ) - - ... - 6. Let offset be ? ToInteger(byteOffset). - 7. If offset < 0, throw a RangeError exception. - 8. If offset is -0, let offset be +0. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TAConstructor) { - var typedArray = new TAConstructor(new ArrayBuffer(8), -0); - assert.sameValue(typedArray.byteOffset, +0); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-byteoffset-is-symbol-throws-sab.js b/test/built-ins/TypedArrays/buffer-arg-byteoffset-is-symbol-throws-sab.js deleted file mode 100644 index b5fc270c9..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-byteoffset-is-symbol-throws-sab.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return abrupt from parsing integer value from byteOffset as a symbol -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 7. Let offset be ? ToInteger(byteOffset). - ... -includes: [testTypedArray.js] -features: [Symbol, SharedArrayBuffer, TypedArray] ----*/ - -var byteOffset = Symbol("1"); -var buffer = new SharedArrayBuffer(8); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(TypeError, function() { - new TA(buffer, byteOffset); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-byteoffset-is-symbol-throws.js b/test/built-ins/TypedArrays/buffer-arg-byteoffset-is-symbol-throws.js deleted file mode 100644 index 60039a1f5..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-byteoffset-is-symbol-throws.js +++ /dev/null @@ -1,28 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return abrupt from parsing integer value from byteOffset as a symbol -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 7. Let offset be ? ToInteger(byteOffset). - ... -includes: [testTypedArray.js] -features: [Symbol, TypedArray] ----*/ - -var byteOffset = Symbol("1"); -var buffer = new ArrayBuffer(8); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(TypeError, function() { - new TA(buffer, byteOffset); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-byteoffset-throws-from-modulo-element-size-sab.js b/test/built-ins/TypedArrays/buffer-arg-byteoffset-throws-from-modulo-element-size-sab.js deleted file mode 100644 index 79b398ccf..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-byteoffset-throws-from-modulo-element-size-sab.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a RangeError if ToInteger(byteOffset) modulo elementSize is not 0 -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 10. If offset modulo elementSize ≠ 0, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(8); - -testWithTypedArrayConstructors(function(TA) { - if (TA.BYTES_PER_ELEMENT === 1) { - // Impossible to trigger this step here. - return; - } - - assert.throws(RangeError, function() { - new TA(buffer, 7); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-byteoffset-throws-from-modulo-element-size.js b/test/built-ins/TypedArrays/buffer-arg-byteoffset-throws-from-modulo-element-size.js deleted file mode 100644 index 479f0d5dc..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-byteoffset-throws-from-modulo-element-size.js +++ /dev/null @@ -1,32 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a RangeError if ToInteger(byteOffset) modulo elementSize is not 0 -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 10. If offset modulo elementSize ≠ 0, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var buffer = new ArrayBuffer(8); - -testWithTypedArrayConstructors(function(TA) { - if (TA.BYTES_PER_ELEMENT === 1) { - // Impossible to trigger this step here. - return; - } - - assert.throws(RangeError, function() { - new TA(buffer, 7); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-byteoffset-to-number-detachbuffer.js b/test/built-ins/TypedArrays/buffer-arg-byteoffset-to-number-detachbuffer.js deleted file mode 100644 index b8936e8cd..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-byteoffset-to-number-detachbuffer.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2017 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: If TypedArray() is passed a detached buffer, throw -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - ... - 9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. - ... -includes: [testTypedArray.js, detachArrayBuffer.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var offset = TA.BYTES_PER_ELEMENT; - var buffer = new ArrayBuffer(3 * offset); - var byteOffset = { valueOf() { $DETACHBUFFER(buffer); return offset; } }; - assert.throws(TypeError, () => new TA(buffer, byteOffset)); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-byteoffset-to-number-throws-sab.js b/test/built-ins/TypedArrays/buffer-arg-byteoffset-to-number-throws-sab.js deleted file mode 100644 index e7b336c5e..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-byteoffset-to-number-throws-sab.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return abrupt from parsing integer value from byteOffset -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 7. Let offset be ? ToInteger(byteOffset). - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(8); -var byteOffset = { - valueOf: function() { - throw new Test262Error(); - } -}; - -testWithTypedArrayConstructors(function(TA) { - assert.throws(Test262Error, function() { - new TA(buffer, byteOffset); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-byteoffset-to-number-throws.js b/test/built-ins/TypedArrays/buffer-arg-byteoffset-to-number-throws.js deleted file mode 100644 index 20cd4b796..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-byteoffset-to-number-throws.js +++ /dev/null @@ -1,32 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return abrupt from parsing integer value from byteOffset -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 7. Let offset be ? ToInteger(byteOffset). - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var buffer = new ArrayBuffer(8); -var byteOffset = { - valueOf: function() { - throw new Test262Error(); - } -}; - -testWithTypedArrayConstructors(function(TA) { - assert.throws(Test262Error, function() { - new TA(buffer, byteOffset); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-custom-proto-access-throws-sab.js b/test/built-ins/TypedArrays/buffer-arg-custom-proto-access-throws-sab.js deleted file mode 100644 index b3ff8c56e..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-custom-proto-access-throws-sab.js +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return abrupt completion getting newTarget's prototype -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - ... - - 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) - - ... - 3. Let proto be ? Get(constructor, "prototype"). - ... -includes: [testTypedArray.js] -features: [Reflect, SharedArrayBuffer, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(8); - -var newTarget = function() {}.bind(null); -Object.defineProperty(newTarget, "prototype", { - get() { - throw new Test262Error(); - } -}); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(Test262Error, function() { - Reflect.construct(TA, [buffer], newTarget); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-custom-proto-access-throws.js b/test/built-ins/TypedArrays/buffer-arg-custom-proto-access-throws.js deleted file mode 100644 index a1b823317..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-custom-proto-access-throws.js +++ /dev/null @@ -1,47 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return abrupt completion getting newTarget's prototype -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - ... - - 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) - - ... - 3. Let proto be ? Get(constructor, "prototype"). - ... -includes: [testTypedArray.js] -features: [Reflect, TypedArray] ----*/ - -var buffer = new ArrayBuffer(8); - -var newTarget = function() {}.bind(null); -Object.defineProperty(newTarget, "prototype", { - get() { - throw new Test262Error(); - } -}); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(Test262Error, function() { - Reflect.construct(TA, [buffer], newTarget); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-defined-length-and-offset-sab.js b/test/built-ins/TypedArrays/buffer-arg-defined-length-and-offset-sab.js deleted file mode 100644 index 2107146b1..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-defined-length-and-offset-sab.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return new typedArray from defined length and offset -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var offset = TA.BYTES_PER_ELEMENT; - var buffer = new SharedArrayBuffer(3 * offset); - - var ta1 = new TA(buffer, offset, 2); - assert.sameValue(ta1.length, 2, "ta1.length"); - assert.sameValue(ta1.buffer, buffer, "ta1.buffer"); - assert.sameValue(ta1.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); - - var ta2 = new TA(buffer, offset, 0); - assert.sameValue(ta2.length, 0, "ta2.length"); - assert.sameValue(ta2.buffer, buffer, "ta2.buffer"); - assert.sameValue(ta2.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-defined-length-and-offset.js b/test/built-ins/TypedArrays/buffer-arg-defined-length-and-offset.js deleted file mode 100644 index aefd48b55..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-defined-length-and-offset.js +++ /dev/null @@ -1,32 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return new typedArray from defined length and offset -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var offset = TA.BYTES_PER_ELEMENT; - var buffer = new ArrayBuffer(3 * offset); - - var ta1 = new TA(buffer, offset, 2); - assert.sameValue(ta1.length, 2, "ta1.length"); - assert.sameValue(ta1.buffer, buffer, "ta1.buffer"); - assert.sameValue(ta1.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); - - var ta2 = new TA(buffer, offset, 0); - assert.sameValue(ta2.length, 0, "ta2.length"); - assert.sameValue(ta2.buffer, buffer, "ta2.buffer"); - assert.sameValue(ta2.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-defined-length-sab.js b/test/built-ins/TypedArrays/buffer-arg-defined-length-sab.js deleted file mode 100644 index a06e530d0..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-defined-length-sab.js +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return new typedArray from defined length -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - var length = 4; - var buffer = new SharedArrayBuffer(bpe * length * 4); - - var ta1 = new TA(buffer, 0, length); - assert.sameValue(ta1.length, length); - assert.sameValue(ta1.buffer, buffer); - assert.sameValue(ta1.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); - - var ta2 = new TA(buffer, 0, 0); - assert.sameValue(ta2.length, 0); - assert.sameValue(ta2.buffer, buffer); - assert.sameValue(ta2.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-defined-length.js b/test/built-ins/TypedArrays/buffer-arg-defined-length.js deleted file mode 100644 index 11fb1c4a4..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-defined-length.js +++ /dev/null @@ -1,34 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return new typedArray from defined length -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - var length = 4; - var buffer = new ArrayBuffer(bpe * length * 4); - - var ta1 = new TA(buffer, 0, length); - assert.sameValue(ta1.length, length); - assert.sameValue(ta1.buffer, buffer); - assert.sameValue(ta1.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); - - var ta2 = new TA(buffer, 0, 0); - assert.sameValue(ta2.length, 0); - assert.sameValue(ta2.buffer, buffer); - assert.sameValue(ta2.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-defined-negative-length-sab.js b/test/built-ins/TypedArrays/buffer-arg-defined-negative-length-sab.js deleted file mode 100644 index 4d1b1d29c..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-defined-negative-length-sab.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws RangeError for negative ToInteger(length) -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(16); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(RangeError, function() { - new TA(buffer, 0, -1); - }); - - assert.throws(RangeError, function() { - new TA(buffer, 0, -Infinity); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-defined-negative-length.js b/test/built-ins/TypedArrays/buffer-arg-defined-negative-length.js deleted file mode 100644 index d57d466d9..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-defined-negative-length.js +++ /dev/null @@ -1,28 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws RangeError for negative ToInteger(length) -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var buffer = new ArrayBuffer(16); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(RangeError, function() { - new TA(buffer, 0, -1); - }); - - assert.throws(RangeError, function() { - new TA(buffer, 0, -Infinity); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-defined-offset-sab.js b/test/built-ins/TypedArrays/buffer-arg-defined-offset-sab.js deleted file mode 100644 index 515d822c1..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-defined-offset-sab.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return new typedArray from defined offset -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - var buffer = new SharedArrayBuffer(bpe * 4); - - var ta1 = new TA(buffer, bpe * 2); - assert.sameValue(ta1.length, 2); - assert.sameValue(ta1.buffer, buffer); - assert.sameValue(ta1.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); - - var ta2 = new TA(buffer, 0); - assert.sameValue(ta2.length, 4); - assert.sameValue(ta2.buffer, buffer); - assert.sameValue(ta2.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-defined-offset.js b/test/built-ins/TypedArrays/buffer-arg-defined-offset.js deleted file mode 100644 index 89e290b52..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-defined-offset.js +++ /dev/null @@ -1,32 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return new typedArray from defined offset -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - var buffer = new ArrayBuffer(bpe * 4); - - var ta1 = new TA(buffer, bpe * 2); - assert.sameValue(ta1.length, 2); - assert.sameValue(ta1.buffer, buffer); - assert.sameValue(ta1.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); - - var ta2 = new TA(buffer, 0); - assert.sameValue(ta2.length, 4); - assert.sameValue(ta2.buffer, buffer); - assert.sameValue(ta2.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-detachedbuffer.js b/test/built-ins/TypedArrays/buffer-arg-detachedbuffer.js deleted file mode 100644 index b015d4c34..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-detachedbuffer.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2017 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: If TypedArray() is passed a detached buffer, throw -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - ... - 9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. - ... -includes: [testTypedArray.js, detachArrayBuffer.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var offset = TA.BYTES_PER_ELEMENT; - var buffer = new ArrayBuffer(3 * offset); - $DETACHBUFFER(buffer); - assert.throws(TypeError, () => new TA(buffer)); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-excessive-length-throws-sab.js b/test/built-ins/TypedArrays/buffer-arg-excessive-length-throws-sab.js deleted file mode 100644 index 2549e93fd..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-excessive-length-throws-sab.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - If offset + newByteLength > bufferByteLength, throw a RangeError exception. -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 14. Else, - a. Let newLength be ? ToLength(length). - b. Let newByteLength be newLength × elementSize. - c. If offset+newByteLength > bufferByteLength, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - var buffer = new SharedArrayBuffer(bpe); - - assert.throws(RangeError, function() { - new TA(buffer, 0, bpe * 2); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-excessive-length-throws.js b/test/built-ins/TypedArrays/buffer-arg-excessive-length-throws.js deleted file mode 100644 index 3ff3a6d61..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-excessive-length-throws.js +++ /dev/null @@ -1,31 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - If offset + newByteLength > bufferByteLength, throw a RangeError exception. -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 14. Else, - a. Let newLength be ? ToLength(length). - b. Let newByteLength be newLength × elementSize. - c. If offset+newByteLength > bufferByteLength, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - var buffer = new ArrayBuffer(bpe); - - assert.throws(RangeError, function() { - new TA(buffer, 0, bpe * 2); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-excessive-offset-throws-sab.js b/test/built-ins/TypedArrays/buffer-arg-excessive-offset-throws-sab.js deleted file mode 100644 index 62cf41145..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-excessive-offset-throws-sab.js +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a RangeError if bufferByteLength - ToInteger(byteOffset) < 0 -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 13. If length is undefined, then - a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception. - b. Let newByteLength be bufferByteLength - offset. - c. If newByteLength < 0, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - var buffer = new SharedArrayBuffer(bpe); - - assert.throws(RangeError, function() { - new TA(buffer, bpe * 2); - }); - - assert.throws(RangeError, function() { - new TA(buffer, bpe * 2, undefined); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-excessive-offset-throws.js b/test/built-ins/TypedArrays/buffer-arg-excessive-offset-throws.js deleted file mode 100644 index 5daf40ce7..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-excessive-offset-throws.js +++ /dev/null @@ -1,35 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a RangeError if bufferByteLength - ToInteger(byteOffset) < 0 -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 13. If length is undefined, then - a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception. - b. Let newByteLength be bufferByteLength - offset. - c. If newByteLength < 0, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - var buffer = new ArrayBuffer(bpe); - - assert.throws(RangeError, function() { - new TA(buffer, bpe * 2); - }); - - assert.throws(RangeError, function() { - new TA(buffer, bpe * 2, undefined); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-invoked-with-undefined-newtarget-sab.js b/test/built-ins/TypedArrays/buffer-arg-invoked-with-undefined-newtarget-sab.js deleted file mode 100644 index 24061049a..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-invoked-with-undefined-newtarget-sab.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a TypeError if NewTarget is undefined. -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 2. If NewTarget is undefined, throw a TypeError exception. - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var buffer = new SharedArrayBuffer(4); - assert.throws(TypeError, function() { - TA(buffer); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-invoked-with-undefined-newtarget.js b/test/built-ins/TypedArrays/buffer-arg-invoked-with-undefined-newtarget.js deleted file mode 100644 index 218b7c2c0..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-invoked-with-undefined-newtarget.js +++ /dev/null @@ -1,26 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a TypeError if NewTarget is undefined. -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 2. If NewTarget is undefined, throw a TypeError exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var buffer = new ArrayBuffer(4); - assert.throws(TypeError, function() { - TA(buffer); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-is-referenced-sab.js b/test/built-ins/TypedArrays/buffer-arg-is-referenced-sab.js deleted file mode 100644 index 44c29229c..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-is-referenced-sab.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Reuse buffer argument instead of making a new clone -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 15. Set O's [[ViewedArrayBuffer]] internal slot to buffer. - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - - var buffer = new SharedArrayBuffer(bpe); - - var ta1 = new TA(buffer); - var ta2 = new TA(buffer); - - assert.sameValue(ta1.buffer, buffer); - assert.sameValue(ta2.buffer, buffer); - assert.sameValue(ta1.buffer, ta2.buffer); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-is-referenced.js b/test/built-ins/TypedArrays/buffer-arg-is-referenced.js deleted file mode 100644 index 0154deaf4..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-is-referenced.js +++ /dev/null @@ -1,32 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Reuse buffer argument instead of making a new clone -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 15. Set O's [[ViewedArrayBuffer]] internal slot to buffer. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - - var buffer = new ArrayBuffer(bpe); - - var ta1 = new TA(buffer); - var ta2 = new TA(buffer); - - assert.sameValue(ta1.buffer, buffer); - assert.sameValue(ta2.buffer, buffer); - assert.sameValue(ta1.buffer, ta2.buffer); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-length-access-throws-sab.js b/test/built-ins/TypedArrays/buffer-arg-length-access-throws-sab.js deleted file mode 100644 index 16872f860..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-length-access-throws-sab.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Returns abrupt from ToLength(length) -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 14. Else, - a. Let newLength be ? ToLength(length). - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(8); -var len = { - valueOf() { - throw new Test262Error(); - } -}; - -testWithTypedArrayConstructors(function(TA) { - assert.throws(Test262Error, function() { - new TA(buffer, 0, len); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-length-access-throws.js b/test/built-ins/TypedArrays/buffer-arg-length-access-throws.js deleted file mode 100644 index ea99b8b40..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-length-access-throws.js +++ /dev/null @@ -1,33 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Returns abrupt from ToLength(length) -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 14. Else, - a. Let newLength be ? ToLength(length). - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var buffer = new ArrayBuffer(8); -var len = { - valueOf() { - throw new Test262Error(); - } -}; - -testWithTypedArrayConstructors(function(TA) { - assert.throws(Test262Error, function() { - new TA(buffer, 0, len); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-length-is-symbol-throws-sab.js b/test/built-ins/TypedArrays/buffer-arg-length-is-symbol-throws-sab.js deleted file mode 100644 index 8b77b806d..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-length-is-symbol-throws-sab.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a TypeError if length is a Symbol -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 14. Else, - a. Let newLength be ? ToLength(length). - ... -includes: [testTypedArray.js] -features: [Symbol, SharedArrayBuffer, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(8); -var s = Symbol("1"); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(TypeError, function() { - new TA(buffer, 0, s); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-length-is-symbol-throws.js b/test/built-ins/TypedArrays/buffer-arg-length-is-symbol-throws.js deleted file mode 100644 index db8ac8303..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-length-is-symbol-throws.js +++ /dev/null @@ -1,29 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a TypeError if length is a Symbol -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 14. Else, - a. Let newLength be ? ToLength(length). - ... -includes: [testTypedArray.js] -features: [Symbol, TypedArray] ----*/ - -var buffer = new ArrayBuffer(8); -var s = Symbol("1"); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(TypeError, function() { - new TA(buffer, 0, s); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-length-to-number-detachbuffer.js b/test/built-ins/TypedArrays/buffer-arg-length-to-number-detachbuffer.js deleted file mode 100644 index c8c3eb34b..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-length-to-number-detachbuffer.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2017 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: If TypedArray() is passed a detached buffer, throw -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - ... - 9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. - ... -includes: [testTypedArray.js, detachArrayBuffer.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var offset = TA.BYTES_PER_ELEMENT; - var buffer = new ArrayBuffer(3 * offset); - var length = { valueOf() { $DETACHBUFFER(buffer); return 1; } }; - assert.throws(TypeError, () => new TA(buffer, 0, length)); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-new-instance-extensibility-sab.js b/test/built-ins/TypedArrays/buffer-arg-new-instance-extensibility-sab.js deleted file mode 100644 index 2b765a78f..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-new-instance-extensibility-sab.js +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - The new typedArray instance from a buffer argument is extensible -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - ... - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - "%TypedArrayPrototype%"). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - ... - 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 11. Set the [[Extensible]] internal slot of A to true. - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var buffer = new SharedArrayBuffer(8); - var sample = new TA(buffer); - - assert(Object.isExtensible(sample)); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-new-instance-extensibility.js b/test/built-ins/TypedArrays/buffer-arg-new-instance-extensibility.js deleted file mode 100644 index 74336215f..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-new-instance-extensibility.js +++ /dev/null @@ -1,37 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - The new typedArray instance from a buffer argument is extensible -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - ... - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - "%TypedArrayPrototype%"). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - ... - 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 11. Set the [[Extensible]] internal slot of A to true. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var buffer = new ArrayBuffer(8); - var sample = new TA(buffer); - - assert(Object.isExtensible(sample)); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-proto-from-ctor-realm-sab.js b/test/built-ins/TypedArrays/buffer-arg-proto-from-ctor-realm-sab.js deleted file mode 100644 index 9cab95b47..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-proto-from-ctor-realm-sab.js +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: Default [[Prototype]] value derived from realm of the newTarget -info: | - [...] - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - "%TypedArrayPrototype%"). - [...] - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - [...] - - 9.1.14 GetPrototypeFromConstructor - - [...] - 3. Let proto be ? Get(constructor, "prototype"). - 4. If Type(proto) is not Object, then - a. Let realm be ? GetFunctionRealm(constructor). - b. Let proto be realm's intrinsic object named intrinsicDefaultProto. - 5. Return proto. -includes: [testTypedArray.js] -features: [cross-realm, SharedArrayBuffer, Reflect, TypedArray] ----*/ - -var other = $262.createRealm().global; -var C = new other.Function(); -C.prototype = null; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [new SharedArrayBuffer(8)], C); - - assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/buffer-arg-proto-from-ctor-realm.js deleted file mode 100644 index d93538db4..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-proto-from-ctor-realm.js +++ /dev/null @@ -1,37 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: Default [[Prototype]] value derived from realm of the newTarget -info: | - [...] - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - "%TypedArrayPrototype%"). - [...] - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - [...] - - 9.1.14 GetPrototypeFromConstructor - - [...] - 3. Let proto be ? Get(constructor, "prototype"). - 4. If Type(proto) is not Object, then - a. Let realm be ? GetFunctionRealm(constructor). - b. Let proto be realm's intrinsic object named intrinsicDefaultProto. - 5. Return proto. -includes: [testTypedArray.js] -features: [cross-realm, Reflect, TypedArray] ----*/ - -var other = $262.createRealm().global; -var C = new other.Function(); -C.prototype = null; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [new ArrayBuffer(8)], C); - - assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-returns-new-instance-sab.js b/test/built-ins/TypedArrays/buffer-arg-returns-new-instance-sab.js deleted file mode 100644 index 52de96252..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-returns-new-instance-sab.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return new typedArray from undefined offset and length -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - - var buffer1 = new SharedArrayBuffer(bpe * 4); - var ta1 = new TA(buffer1); - assert.sameValue(ta1.length, 4); - assert.sameValue(ta1.buffer, buffer1); - assert.sameValue(ta1.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); - - var buffer2 = new SharedArrayBuffer(0); - var ta2 = new TA(buffer2); - assert.sameValue(ta2.length, 0); - assert.sameValue(ta2.buffer, buffer2); - assert.sameValue(ta2.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-returns-new-instance.js b/test/built-ins/TypedArrays/buffer-arg-returns-new-instance.js deleted file mode 100644 index 4723e75f9..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-returns-new-instance.js +++ /dev/null @@ -1,33 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return new typedArray from undefined offset and length -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - - var buffer1 = new ArrayBuffer(bpe * 4); - var ta1 = new TA(buffer1); - assert.sameValue(ta1.length, 4); - assert.sameValue(ta1.buffer, buffer1); - assert.sameValue(ta1.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); - - var buffer2 = new ArrayBuffer(0); - var ta2 = new TA(buffer2); - assert.sameValue(ta2.length, 0); - assert.sameValue(ta2.buffer, buffer2); - assert.sameValue(ta2.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-toindex-bytelength-sab.js b/test/built-ins/TypedArrays/buffer-arg-toindex-bytelength-sab.js deleted file mode 100644 index 5fd87715f..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-toindex-bytelength-sab.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - ToIndex(length) operations -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 11. If length is either not present or undefined, then - ... - 12. Else, - a. Let newLength be ? ToIndex(length). - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(16); - -var obj1 = { - valueOf: function() { - return 1; - } -}; - -var obj2 = { - toString: function() { - return 1; - } -}; - -var items = [ - [-0, 0, "-0"], - [obj1, 1, "object's valueOf"], - [obj2, 1, "object's toString"], - ["", 0, "the Empty string"], - ["0", 0, "string '0'"], - ["1", 1, "string '1'"], - [false, 0, "false"], - [true, 1, "true"], - [NaN, 0, "NaN"], - [null, 0, "null"], - [0.1, 0, "0.1"], - [0.9, 0, "0.9"], - [1.1, 1, "1.1"], - [1.9, 1, "1.9"], - [-0.1, 0, "-0.1"], - [-0.99999, 0, "-0.99999"] -]; - -testWithTypedArrayConstructors(function(TA) { - items.forEach(function(item) { - var len = item[0]; - var expected = item[1]; - var name = item[2]; - - var typedArray = new TA(buffer, 0, len); - assert.sameValue(typedArray.length, expected, name + " length"); - assert.sameValue(typedArray.constructor, TA, name + " constructor"); - assert.sameValue( - Object.getPrototypeOf(typedArray), - TA.prototype, - name + " prototype" - ); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-toindex-bytelength.js b/test/built-ins/TypedArrays/buffer-arg-toindex-bytelength.js deleted file mode 100644 index ae660b820..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-toindex-bytelength.js +++ /dev/null @@ -1,72 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - ToIndex(length) operations -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 11. If length is either not present or undefined, then - ... - 12. Else, - a. Let newLength be ? ToIndex(length). - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var buffer = new ArrayBuffer(16); - -var obj1 = { - valueOf: function() { - return 1; - } -}; - -var obj2 = { - toString: function() { - return 1; - } -}; - -var items = [ - [-0, 0, "-0"], - [obj1, 1, "object's valueOf"], - [obj2, 1, "object's toString"], - ["", 0, "the Empty string"], - ["0", 0, "string '0'"], - ["1", 1, "string '1'"], - [false, 0, "false"], - [true, 1, "true"], - [NaN, 0, "NaN"], - [null, 0, "null"], - [0.1, 0, "0.1"], - [0.9, 0, "0.9"], - [1.1, 1, "1.1"], - [1.9, 1, "1.9"], - [-0.1, 0, "-0.1"], - [-0.99999, 0, "-0.99999"] -]; - -testWithTypedArrayConstructors(function(TA) { - items.forEach(function(item) { - var len = item[0]; - var expected = item[1]; - var name = item[2]; - - var typedArray = new TA(buffer, 0, len); - assert.sameValue(typedArray.length, expected, name + " length"); - assert.sameValue(typedArray.constructor, TA, name + " constructor"); - assert.sameValue( - Object.getPrototypeOf(typedArray), - TA.prototype, - name + " prototype" - ); - }); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-toindex-byteoffset-sab.js b/test/built-ins/TypedArrays/buffer-arg-toindex-byteoffset-sab.js deleted file mode 100644 index 43ae9f601..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-toindex-byteoffset-sab.js +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - ToIndex(byteOffset) operations -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 7. Let offset be ? ToIndex(byteOffset). - 8. If offset modulo elementSize ≠ 0, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(16); - -var obj1 = { - valueOf: function() { - return 8; - } -}; - -var obj2 = { - toString: function() { - return 8; - } -}; - -var items = [ - [-0, 0, "-0"], - [obj1, 8, "object's valueOf"], - [obj2, 8, "object's toString"], - ["", 0, "the Empty string"], - ["0", 0, "string '0'"], - ["8", 8, "string '8'"], - [false, 0, "false"], - [NaN, 0, "NaN"], - [null, 0, "null"], - [undefined, 0, "undefined"], - [0.1, 0, "0.1"], - [0.9, 0, "0.9"], - [8.1, 8, "8.1"], - [8.9, 8, "8.9"], - [-0.1, 0, "-0.1"], - [-0.99999, 0, "-0.99999"] -]; - -testWithTypedArrayConstructors(function(TA) { - items.forEach(function(item) { - var offset = item[0]; - var expected = item[1]; - var name = item[2]; - - var typedArray = new TA(buffer, offset); - assert.sameValue(typedArray.byteOffset, expected, name + " byteOffset"); - assert.sameValue(typedArray.constructor, TA, name + " constructor"); - assert.sameValue( - Object.getPrototypeOf(typedArray), - TA.prototype, - name + " prototype" - ); - }); - - // Testing `true`. See step 8 - if (TA.BYTES_PER_ELEMENT === 1) { - var typedArray = new TA(buffer, true); - assert.sameValue(typedArray.byteOffset, 1, "true => 1 byteOffset"); - assert.sameValue(typedArray.constructor, TA, "true => 1 constructor"); - assert.sameValue( - Object.getPrototypeOf(typedArray), - TA.prototype, - "true => 1 prototype" - ); - } else { - assert.throws(RangeError, function() { - new TA(buffer, true); - }, "1 modulo elementSize ≠ 0, throws a RangeError"); - } -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-toindex-byteoffset.js b/test/built-ins/TypedArrays/buffer-arg-toindex-byteoffset.js deleted file mode 100644 index 35a087aaf..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-toindex-byteoffset.js +++ /dev/null @@ -1,86 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - ToIndex(byteOffset) operations -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 7. Let offset be ? ToIndex(byteOffset). - 8. If offset modulo elementSize ≠ 0, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var buffer = new ArrayBuffer(16); - -var obj1 = { - valueOf: function() { - return 8; - } -}; - -var obj2 = { - toString: function() { - return 8; - } -}; - -var items = [ - [-0, 0, "-0"], - [obj1, 8, "object's valueOf"], - [obj2, 8, "object's toString"], - ["", 0, "the Empty string"], - ["0", 0, "string '0'"], - ["8", 8, "string '8'"], - [false, 0, "false"], - [NaN, 0, "NaN"], - [null, 0, "null"], - [undefined, 0, "undefined"], - [0.1, 0, "0.1"], - [0.9, 0, "0.9"], - [8.1, 8, "8.1"], - [8.9, 8, "8.9"], - [-0.1, 0, "-0.1"], - [-0.99999, 0, "-0.99999"] -]; - -testWithTypedArrayConstructors(function(TA) { - items.forEach(function(item) { - var offset = item[0]; - var expected = item[1]; - var name = item[2]; - - var typedArray = new TA(buffer, offset); - assert.sameValue(typedArray.byteOffset, expected, name + " byteOffset"); - assert.sameValue(typedArray.constructor, TA, name + " constructor"); - assert.sameValue( - Object.getPrototypeOf(typedArray), - TA.prototype, - name + " prototype" - ); - }); - - // Testing `true`. See step 8 - if (TA.BYTES_PER_ELEMENT === 1) { - var typedArray = new TA(buffer, true); - assert.sameValue(typedArray.byteOffset, 1, "true => 1 byteOffset"); - assert.sameValue(typedArray.constructor, TA, "true => 1 constructor"); - assert.sameValue( - Object.getPrototypeOf(typedArray), - TA.prototype, - "true => 1 prototype" - ); - } else { - assert.throws(RangeError, function() { - new TA(buffer, true); - }, "1 modulo elementSize ≠ 0, throws a RangeError"); - } -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-typedarray-backed-by-sharedarraybuffer.js b/test/built-ins/TypedArrays/buffer-arg-typedarray-backed-by-sharedarraybuffer.js deleted file mode 100644 index 739d1cdd2..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-typedarray-backed-by-sharedarraybuffer.js +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-typedarray-typedarray -description: > - Passing a SharedArrayBuffer-backed TypedArray to a TypedArray constructor - produces an ArrayBuffer-backed TypedArray. -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -var sab = new SharedArrayBuffer(4); -var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; - -testWithTypedArrayConstructors(function(View1) { - var ta1 = new View1(sab); - testWithTypedArrayConstructors(function(View2) { - var ta2 = new View2(ta1); - assert.sameValue(ta2.buffer.constructor, ArrayBuffer, - "TypedArray of SharedArrayBuffer-backed TypedArray is ArrayBuffer-backed"); - }, int_views); -}, int_views); diff --git a/test/built-ins/TypedArrays/buffer-arg-use-custom-proto-if-object-sab.js b/test/built-ins/TypedArrays/buffer-arg-use-custom-proto-if-object-sab.js deleted file mode 100644 index c963b6bb1..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-use-custom-proto-if-object-sab.js +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Use prototype from new target if it's an Object -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 10. Set the [[Prototype]] internal slot of A to prototype. - ... - 12. Return A. -includes: [testTypedArray.js] -features: [SharedArrayBuffer, Reflect, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(8); - -function newTarget() {} -var proto = {}; -newTarget.prototype = proto; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [buffer], newTarget); - - assert.sameValue(ta.constructor, Object); - assert.sameValue(Object.getPrototypeOf(ta), proto); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-use-custom-proto-if-object.js b/test/built-ins/TypedArrays/buffer-arg-use-custom-proto-if-object.js deleted file mode 100644 index 9eefdf56d..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-use-custom-proto-if-object.js +++ /dev/null @@ -1,48 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Use prototype from new target if it's an Object -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 10. Set the [[Prototype]] internal slot of A to prototype. - ... - 12. Return A. -includes: [testTypedArray.js] -features: [Reflect, TypedArray] ----*/ - -var buffer = new ArrayBuffer(8); - -function newTarget() {} -var proto = {}; -newTarget.prototype = proto; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [buffer], newTarget); - - assert.sameValue(ta.constructor, Object); - assert.sameValue(Object.getPrototypeOf(ta), proto); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-use-default-proto-if-custom-proto-is-not-object-sab.js b/test/built-ins/TypedArrays/buffer-arg-use-default-proto-if-custom-proto-is-not-object-sab.js deleted file mode 100644 index 8c91aa84d..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-use-default-proto-if-custom-proto-is-not-object-sab.js +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Use prototype from %TypedArray% if newTarget's prototype is not an Object -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 10. Set the [[Prototype]] internal slot of A to prototype. - ... - 12. Return A. -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(8); - -function newTarget() {} -newTarget.prototype = null; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [buffer], newTarget); - - assert.sameValue(ta.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/buffer-arg-use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/buffer-arg-use-default-proto-if-custom-proto-is-not-object.js deleted file mode 100644 index df4909dab..000000000 --- a/test/built-ins/TypedArrays/buffer-arg-use-default-proto-if-custom-proto-is-not-object.js +++ /dev/null @@ -1,47 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Use prototype from %TypedArray% if newTarget's prototype is not an Object -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 10. Set the [[Prototype]] internal slot of A to prototype. - ... - 12. Return A. -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var buffer = new ArrayBuffer(8); - -function newTarget() {} -newTarget.prototype = null; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [buffer], newTarget); - - assert.sameValue(ta.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size-sab.js new file mode 100644 index 000000000..707aa00be --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size-sab.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if bufferByteLength modulo elementSize ≠ 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 13. If length is undefined, then + a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(1); + +testWithTypedArrayConstructors(function(TA) { + if (TA.BYTES_PER_ELEMENT === 1) { + // Impossible to trigger this step here. + return; + } + + assert.throws(RangeError, function() { + new TA(buffer); + }); + + assert.throws(RangeError, function() { + new TA(buffer, 0, undefined); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size.js new file mode 100644 index 000000000..a886e5afd --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if bufferByteLength modulo elementSize ≠ 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 13. If length is undefined, then + a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var buffer = new ArrayBuffer(1); + +testWithTypedArrayConstructors(function(TA) { + if (TA.BYTES_PER_ELEMENT === 1) { + // Impossible to trigger this step here. + return; + } + + assert.throws(RangeError, function() { + new TA(buffer); + }); + + assert.throws(RangeError, function() { + new TA(buffer, 0, undefined); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-throws-sab.js new file mode 100644 index 000000000..89f58a1cd --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-throws-sab.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if ToInteger(byteOffset) is < 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToInteger(byteOffset). + 8. If offset < 0, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(RangeError, function() { + new TA(buffer, -1); + }); + assert.throws(RangeError, function() { + new TA(buffer, -Infinity); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-throws.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-throws.js new file mode 100644 index 000000000..058892465 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-throws.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if ToInteger(byteOffset) is < 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToInteger(byteOffset). + 8. If offset < 0, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(RangeError, function() { + new TA(buffer, -1); + }); + assert.throws(RangeError, function() { + new TA(buffer, -Infinity); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-zero-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-zero-sab.js new file mode 100644 index 000000000..1073b5af8 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-zero-sab.js @@ -0,0 +1,23 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + TypedArray's [[ByteOffset]] internal slot is always a positive number, test with negative zero. +info: | + %TypedArray% ( buffer [ , byteOffset [ , length ] ] ) + + ... + 6. Let offset be ? ToInteger(byteOffset). + 7. If offset < 0, throw a RangeError exception. + 8. If offset is -0, let offset be +0. + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TAConstructor) { + var typedArray = new TAConstructor(new SharedArrayBuffer(8), -0); + assert.sameValue(typedArray.byteOffset, +0); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-zero.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-zero.js new file mode 100644 index 000000000..13d0a3e14 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-zero.js @@ -0,0 +1,23 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + TypedArray's [[ByteOffset]] internal slot is always a positive number, test with negative zero. +info: | + %TypedArray% ( buffer [ , byteOffset [ , length ] ] ) + + ... + 6. Let offset be ? ToInteger(byteOffset). + 7. If offset < 0, throw a RangeError exception. + 8. If offset is -0, let offset be +0. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TAConstructor) { + var typedArray = new TAConstructor(new ArrayBuffer(8), -0); + assert.sameValue(typedArray.byteOffset, +0); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-symbol-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-symbol-throws-sab.js new file mode 100644 index 000000000..b5fc270c9 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-symbol-throws-sab.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return abrupt from parsing integer value from byteOffset as a symbol +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToInteger(byteOffset). + ... +includes: [testTypedArray.js] +features: [Symbol, SharedArrayBuffer, TypedArray] +---*/ + +var byteOffset = Symbol("1"); +var buffer = new SharedArrayBuffer(8); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + new TA(buffer, byteOffset); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-symbol-throws.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-symbol-throws.js new file mode 100644 index 000000000..60039a1f5 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-symbol-throws.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return abrupt from parsing integer value from byteOffset as a symbol +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToInteger(byteOffset). + ... +includes: [testTypedArray.js] +features: [Symbol, TypedArray] +---*/ + +var byteOffset = Symbol("1"); +var buffer = new ArrayBuffer(8); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + new TA(buffer, byteOffset); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-throws-from-modulo-element-size-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-throws-from-modulo-element-size-sab.js new file mode 100644 index 000000000..79b398ccf --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-throws-from-modulo-element-size-sab.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if ToInteger(byteOffset) modulo elementSize is not 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 10. If offset modulo elementSize ≠ 0, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); + +testWithTypedArrayConstructors(function(TA) { + if (TA.BYTES_PER_ELEMENT === 1) { + // Impossible to trigger this step here. + return; + } + + assert.throws(RangeError, function() { + new TA(buffer, 7); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-throws-from-modulo-element-size.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-throws-from-modulo-element-size.js new file mode 100644 index 000000000..479f0d5dc --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-throws-from-modulo-element-size.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if ToInteger(byteOffset) modulo elementSize is not 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 10. If offset modulo elementSize ≠ 0, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); + +testWithTypedArrayConstructors(function(TA) { + if (TA.BYTES_PER_ELEMENT === 1) { + // Impossible to trigger this step here. + return; + } + + assert.throws(RangeError, function() { + new TA(buffer, 7); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-detachbuffer.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-detachbuffer.js new file mode 100644 index 000000000..b8936e8cd --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-detachbuffer.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: If TypedArray() is passed a detached buffer, throw +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + ... + 9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testTypedArray.js, detachArrayBuffer.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var offset = TA.BYTES_PER_ELEMENT; + var buffer = new ArrayBuffer(3 * offset); + var byteOffset = { valueOf() { $DETACHBUFFER(buffer); return offset; } }; + assert.throws(TypeError, () => new TA(buffer, byteOffset)); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-throws-sab.js new file mode 100644 index 000000000..e7b336c5e --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-throws-sab.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return abrupt from parsing integer value from byteOffset +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToInteger(byteOffset). + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); +var byteOffset = { + valueOf: function() { + throw new Test262Error(); + } +}; + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + new TA(buffer, byteOffset); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-throws.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-throws.js new file mode 100644 index 000000000..20cd4b796 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-throws.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return abrupt from parsing integer value from byteOffset +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToInteger(byteOffset). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); +var byteOffset = { + valueOf: function() { + throw new Test262Error(); + } +}; + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + new TA(buffer, byteOffset); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-custom-proto-access-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-custom-proto-access-throws-sab.js new file mode 100644 index 000000000..b3ff8c56e --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-custom-proto-access-throws-sab.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return abrupt completion getting newTarget's prototype +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + ... + + 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) + + ... + 3. Let proto be ? Get(constructor, "prototype"). + ... +includes: [testTypedArray.js] +features: [Reflect, SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); + +var newTarget = function() {}.bind(null); +Object.defineProperty(newTarget, "prototype", { + get() { + throw new Test262Error(); + } +}); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + Reflect.construct(TA, [buffer], newTarget); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-custom-proto-access-throws.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-custom-proto-access-throws.js new file mode 100644 index 000000000..a1b823317 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-custom-proto-access-throws.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return abrupt completion getting newTarget's prototype +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + ... + + 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) + + ... + 3. Let proto be ? Get(constructor, "prototype"). + ... +includes: [testTypedArray.js] +features: [Reflect, TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); + +var newTarget = function() {}.bind(null); +Object.defineProperty(newTarget, "prototype", { + get() { + throw new Test262Error(); + } +}); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + Reflect.construct(TA, [buffer], newTarget); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-and-offset-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-and-offset-sab.js new file mode 100644 index 000000000..2107146b1 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-and-offset-sab.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from defined length and offset +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var offset = TA.BYTES_PER_ELEMENT; + var buffer = new SharedArrayBuffer(3 * offset); + + var ta1 = new TA(buffer, offset, 2); + assert.sameValue(ta1.length, 2, "ta1.length"); + assert.sameValue(ta1.buffer, buffer, "ta1.buffer"); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var ta2 = new TA(buffer, offset, 0); + assert.sameValue(ta2.length, 0, "ta2.length"); + assert.sameValue(ta2.buffer, buffer, "ta2.buffer"); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-and-offset.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-and-offset.js new file mode 100644 index 000000000..aefd48b55 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-and-offset.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from defined length and offset +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var offset = TA.BYTES_PER_ELEMENT; + var buffer = new ArrayBuffer(3 * offset); + + var ta1 = new TA(buffer, offset, 2); + assert.sameValue(ta1.length, 2, "ta1.length"); + assert.sameValue(ta1.buffer, buffer, "ta1.buffer"); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var ta2 = new TA(buffer, offset, 0); + assert.sameValue(ta2.length, 0, "ta2.length"); + assert.sameValue(ta2.buffer, buffer, "ta2.buffer"); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-sab.js new file mode 100644 index 000000000..a06e530d0 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-sab.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from defined length +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var length = 4; + var buffer = new SharedArrayBuffer(bpe * length * 4); + + var ta1 = new TA(buffer, 0, length); + assert.sameValue(ta1.length, length); + assert.sameValue(ta1.buffer, buffer); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var ta2 = new TA(buffer, 0, 0); + assert.sameValue(ta2.length, 0); + assert.sameValue(ta2.buffer, buffer); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length.js new file mode 100644 index 000000000..11fb1c4a4 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from defined length +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var length = 4; + var buffer = new ArrayBuffer(bpe * length * 4); + + var ta1 = new TA(buffer, 0, length); + assert.sameValue(ta1.length, length); + assert.sameValue(ta1.buffer, buffer); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var ta2 = new TA(buffer, 0, 0); + assert.sameValue(ta2.length, 0); + assert.sameValue(ta2.buffer, buffer); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-negative-length-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-negative-length-sab.js new file mode 100644 index 000000000..4d1b1d29c --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-negative-length-sab.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws RangeError for negative ToInteger(length) +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(16); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(RangeError, function() { + new TA(buffer, 0, -1); + }); + + assert.throws(RangeError, function() { + new TA(buffer, 0, -Infinity); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-negative-length.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-negative-length.js new file mode 100644 index 000000000..d57d466d9 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-negative-length.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws RangeError for negative ToInteger(length) +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var buffer = new ArrayBuffer(16); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(RangeError, function() { + new TA(buffer, 0, -1); + }); + + assert.throws(RangeError, function() { + new TA(buffer, 0, -Infinity); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-offset-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-offset-sab.js new file mode 100644 index 000000000..515d822c1 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-offset-sab.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from defined offset +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var buffer = new SharedArrayBuffer(bpe * 4); + + var ta1 = new TA(buffer, bpe * 2); + assert.sameValue(ta1.length, 2); + assert.sameValue(ta1.buffer, buffer); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var ta2 = new TA(buffer, 0); + assert.sameValue(ta2.length, 4); + assert.sameValue(ta2.buffer, buffer); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-offset.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-offset.js new file mode 100644 index 000000000..89e290b52 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-offset.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from defined offset +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var buffer = new ArrayBuffer(bpe * 4); + + var ta1 = new TA(buffer, bpe * 2); + assert.sameValue(ta1.length, 2); + assert.sameValue(ta1.buffer, buffer); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var ta2 = new TA(buffer, 0); + assert.sameValue(ta2.length, 4); + assert.sameValue(ta2.buffer, buffer); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-detachedbuffer.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-detachedbuffer.js new file mode 100644 index 000000000..b015d4c34 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-detachedbuffer.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: If TypedArray() is passed a detached buffer, throw +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + ... + 9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testTypedArray.js, detachArrayBuffer.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var offset = TA.BYTES_PER_ELEMENT; + var buffer = new ArrayBuffer(3 * offset); + $DETACHBUFFER(buffer); + assert.throws(TypeError, () => new TA(buffer)); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-length-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-length-throws-sab.js new file mode 100644 index 000000000..2549e93fd --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-length-throws-sab.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + If offset + newByteLength > bufferByteLength, throw a RangeError exception. +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 14. Else, + a. Let newLength be ? ToLength(length). + b. Let newByteLength be newLength × elementSize. + c. If offset+newByteLength > bufferByteLength, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var buffer = new SharedArrayBuffer(bpe); + + assert.throws(RangeError, function() { + new TA(buffer, 0, bpe * 2); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-length-throws.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-length-throws.js new file mode 100644 index 000000000..3ff3a6d61 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-length-throws.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + If offset + newByteLength > bufferByteLength, throw a RangeError exception. +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 14. Else, + a. Let newLength be ? ToLength(length). + b. Let newByteLength be newLength × elementSize. + c. If offset+newByteLength > bufferByteLength, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var buffer = new ArrayBuffer(bpe); + + assert.throws(RangeError, function() { + new TA(buffer, 0, bpe * 2); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-offset-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-offset-throws-sab.js new file mode 100644 index 000000000..62cf41145 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-offset-throws-sab.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if bufferByteLength - ToInteger(byteOffset) < 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 13. If length is undefined, then + a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception. + b. Let newByteLength be bufferByteLength - offset. + c. If newByteLength < 0, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var buffer = new SharedArrayBuffer(bpe); + + assert.throws(RangeError, function() { + new TA(buffer, bpe * 2); + }); + + assert.throws(RangeError, function() { + new TA(buffer, bpe * 2, undefined); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-offset-throws.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-offset-throws.js new file mode 100644 index 000000000..5daf40ce7 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-offset-throws.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if bufferByteLength - ToInteger(byteOffset) < 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 13. If length is undefined, then + a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception. + b. Let newByteLength be bufferByteLength - offset. + c. If newByteLength < 0, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var buffer = new ArrayBuffer(bpe); + + assert.throws(RangeError, function() { + new TA(buffer, bpe * 2); + }); + + assert.throws(RangeError, function() { + new TA(buffer, bpe * 2, undefined); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-invoked-with-undefined-newtarget-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-invoked-with-undefined-newtarget-sab.js new file mode 100644 index 000000000..24061049a --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-invoked-with-undefined-newtarget-sab.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a TypeError if NewTarget is undefined. +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 2. If NewTarget is undefined, throw a TypeError exception. + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var buffer = new SharedArrayBuffer(4); + assert.throws(TypeError, function() { + TA(buffer); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-invoked-with-undefined-newtarget.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-invoked-with-undefined-newtarget.js new file mode 100644 index 000000000..218b7c2c0 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-invoked-with-undefined-newtarget.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a TypeError if NewTarget is undefined. +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 2. If NewTarget is undefined, throw a TypeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var buffer = new ArrayBuffer(4); + assert.throws(TypeError, function() { + TA(buffer); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-is-referenced-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-is-referenced-sab.js new file mode 100644 index 000000000..44c29229c --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-is-referenced-sab.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Reuse buffer argument instead of making a new clone +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 15. Set O's [[ViewedArrayBuffer]] internal slot to buffer. + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + + var buffer = new SharedArrayBuffer(bpe); + + var ta1 = new TA(buffer); + var ta2 = new TA(buffer); + + assert.sameValue(ta1.buffer, buffer); + assert.sameValue(ta2.buffer, buffer); + assert.sameValue(ta1.buffer, ta2.buffer); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-is-referenced.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-is-referenced.js new file mode 100644 index 000000000..0154deaf4 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-is-referenced.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Reuse buffer argument instead of making a new clone +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 15. Set O's [[ViewedArrayBuffer]] internal slot to buffer. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + + var buffer = new ArrayBuffer(bpe); + + var ta1 = new TA(buffer); + var ta2 = new TA(buffer); + + assert.sameValue(ta1.buffer, buffer); + assert.sameValue(ta2.buffer, buffer); + assert.sameValue(ta1.buffer, ta2.buffer); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-access-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-access-throws-sab.js new file mode 100644 index 000000000..16872f860 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-access-throws-sab.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Returns abrupt from ToLength(length) +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 14. Else, + a. Let newLength be ? ToLength(length). + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); +var len = { + valueOf() { + throw new Test262Error(); + } +}; + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + new TA(buffer, 0, len); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-access-throws.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-access-throws.js new file mode 100644 index 000000000..ea99b8b40 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-access-throws.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Returns abrupt from ToLength(length) +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 14. Else, + a. Let newLength be ? ToLength(length). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); +var len = { + valueOf() { + throw new Test262Error(); + } +}; + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + new TA(buffer, 0, len); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-is-symbol-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-is-symbol-throws-sab.js new file mode 100644 index 000000000..8b77b806d --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-is-symbol-throws-sab.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a TypeError if length is a Symbol +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 14. Else, + a. Let newLength be ? ToLength(length). + ... +includes: [testTypedArray.js] +features: [Symbol, SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); +var s = Symbol("1"); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + new TA(buffer, 0, s); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-is-symbol-throws.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-is-symbol-throws.js new file mode 100644 index 000000000..db8ac8303 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-is-symbol-throws.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a TypeError if length is a Symbol +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 14. Else, + a. Let newLength be ? ToLength(length). + ... +includes: [testTypedArray.js] +features: [Symbol, TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); +var s = Symbol("1"); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + new TA(buffer, 0, s); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-to-number-detachbuffer.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-to-number-detachbuffer.js new file mode 100644 index 000000000..c8c3eb34b --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-to-number-detachbuffer.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: If TypedArray() is passed a detached buffer, throw +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + ... + 9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testTypedArray.js, detachArrayBuffer.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var offset = TA.BYTES_PER_ELEMENT; + var buffer = new ArrayBuffer(3 * offset); + var length = { valueOf() { $DETACHBUFFER(buffer); return 1; } }; + assert.throws(TypeError, () => new TA(buffer, 0, length)); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-new-instance-extensibility-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-new-instance-extensibility-sab.js new file mode 100644 index 000000000..2b765a78f --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-new-instance-extensibility-sab.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + The new typedArray instance from a buffer argument is extensible +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%"). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + ... + 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 11. Set the [[Extensible]] internal slot of A to true. + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var buffer = new SharedArrayBuffer(8); + var sample = new TA(buffer); + + assert(Object.isExtensible(sample)); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-new-instance-extensibility.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-new-instance-extensibility.js new file mode 100644 index 000000000..74336215f --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-new-instance-extensibility.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + The new typedArray instance from a buffer argument is extensible +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%"). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + ... + 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 11. Set the [[Extensible]] internal slot of A to true. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var buffer = new ArrayBuffer(8); + var sample = new TA(buffer); + + assert(Object.isExtensible(sample)); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-proto-from-ctor-realm-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-proto-from-ctor-realm-sab.js new file mode 100644 index 000000000..9cab95b47 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-proto-from-ctor-realm-sab.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: Default [[Prototype]] value derived from realm of the newTarget +info: | + [...] + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%"). + [...] + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + [...] + + 9.1.14 GetPrototypeFromConstructor + + [...] + 3. Let proto be ? Get(constructor, "prototype"). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Let proto be realm's intrinsic object named intrinsicDefaultProto. + 5. Return proto. +includes: [testTypedArray.js] +features: [cross-realm, SharedArrayBuffer, Reflect, TypedArray] +---*/ + +var other = $262.createRealm().global; +var C = new other.Function(); +C.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [new SharedArrayBuffer(8)], C); + + assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-proto-from-ctor-realm.js new file mode 100644 index 000000000..d93538db4 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-proto-from-ctor-realm.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: Default [[Prototype]] value derived from realm of the newTarget +info: | + [...] + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%"). + [...] + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + [...] + + 9.1.14 GetPrototypeFromConstructor + + [...] + 3. Let proto be ? Get(constructor, "prototype"). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Let proto be realm's intrinsic object named intrinsicDefaultProto. + 5. Return proto. +includes: [testTypedArray.js] +features: [cross-realm, Reflect, TypedArray] +---*/ + +var other = $262.createRealm().global; +var C = new other.Function(); +C.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [new ArrayBuffer(8)], C); + + assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-returns-new-instance-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-returns-new-instance-sab.js new file mode 100644 index 000000000..52de96252 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-returns-new-instance-sab.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from undefined offset and length +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + + var buffer1 = new SharedArrayBuffer(bpe * 4); + var ta1 = new TA(buffer1); + assert.sameValue(ta1.length, 4); + assert.sameValue(ta1.buffer, buffer1); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var buffer2 = new SharedArrayBuffer(0); + var ta2 = new TA(buffer2); + assert.sameValue(ta2.length, 0); + assert.sameValue(ta2.buffer, buffer2); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-returns-new-instance.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-returns-new-instance.js new file mode 100644 index 000000000..4723e75f9 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-returns-new-instance.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from undefined offset and length +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + + var buffer1 = new ArrayBuffer(bpe * 4); + var ta1 = new TA(buffer1); + assert.sameValue(ta1.length, 4); + assert.sameValue(ta1.buffer, buffer1); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var buffer2 = new ArrayBuffer(0); + var ta2 = new TA(buffer2); + assert.sameValue(ta2.length, 0); + assert.sameValue(ta2.buffer, buffer2); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-bytelength-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-bytelength-sab.js new file mode 100644 index 000000000..5fd87715f --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-bytelength-sab.js @@ -0,0 +1,73 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + ToIndex(length) operations +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 11. If length is either not present or undefined, then + ... + 12. Else, + a. Let newLength be ? ToIndex(length). + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(16); + +var obj1 = { + valueOf: function() { + return 1; + } +}; + +var obj2 = { + toString: function() { + return 1; + } +}; + +var items = [ + [-0, 0, "-0"], + [obj1, 1, "object's valueOf"], + [obj2, 1, "object's toString"], + ["", 0, "the Empty string"], + ["0", 0, "string '0'"], + ["1", 1, "string '1'"], + [false, 0, "false"], + [true, 1, "true"], + [NaN, 0, "NaN"], + [null, 0, "null"], + [0.1, 0, "0.1"], + [0.9, 0, "0.9"], + [1.1, 1, "1.1"], + [1.9, 1, "1.9"], + [-0.1, 0, "-0.1"], + [-0.99999, 0, "-0.99999"] +]; + +testWithTypedArrayConstructors(function(TA) { + items.forEach(function(item) { + var len = item[0]; + var expected = item[1]; + var name = item[2]; + + var typedArray = new TA(buffer, 0, len); + assert.sameValue(typedArray.length, expected, name + " length"); + assert.sameValue(typedArray.constructor, TA, name + " constructor"); + assert.sameValue( + Object.getPrototypeOf(typedArray), + TA.prototype, + name + " prototype" + ); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-bytelength.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-bytelength.js new file mode 100644 index 000000000..ae660b820 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-bytelength.js @@ -0,0 +1,72 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + ToIndex(length) operations +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 11. If length is either not present or undefined, then + ... + 12. Else, + a. Let newLength be ? ToIndex(length). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var buffer = new ArrayBuffer(16); + +var obj1 = { + valueOf: function() { + return 1; + } +}; + +var obj2 = { + toString: function() { + return 1; + } +}; + +var items = [ + [-0, 0, "-0"], + [obj1, 1, "object's valueOf"], + [obj2, 1, "object's toString"], + ["", 0, "the Empty string"], + ["0", 0, "string '0'"], + ["1", 1, "string '1'"], + [false, 0, "false"], + [true, 1, "true"], + [NaN, 0, "NaN"], + [null, 0, "null"], + [0.1, 0, "0.1"], + [0.9, 0, "0.9"], + [1.1, 1, "1.1"], + [1.9, 1, "1.9"], + [-0.1, 0, "-0.1"], + [-0.99999, 0, "-0.99999"] +]; + +testWithTypedArrayConstructors(function(TA) { + items.forEach(function(item) { + var len = item[0]; + var expected = item[1]; + var name = item[2]; + + var typedArray = new TA(buffer, 0, len); + assert.sameValue(typedArray.length, expected, name + " length"); + assert.sameValue(typedArray.constructor, TA, name + " constructor"); + assert.sameValue( + Object.getPrototypeOf(typedArray), + TA.prototype, + name + " prototype" + ); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-byteoffset-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-byteoffset-sab.js new file mode 100644 index 000000000..43ae9f601 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-byteoffset-sab.js @@ -0,0 +1,87 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + ToIndex(byteOffset) operations +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToIndex(byteOffset). + 8. If offset modulo elementSize ≠ 0, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(16); + +var obj1 = { + valueOf: function() { + return 8; + } +}; + +var obj2 = { + toString: function() { + return 8; + } +}; + +var items = [ + [-0, 0, "-0"], + [obj1, 8, "object's valueOf"], + [obj2, 8, "object's toString"], + ["", 0, "the Empty string"], + ["0", 0, "string '0'"], + ["8", 8, "string '8'"], + [false, 0, "false"], + [NaN, 0, "NaN"], + [null, 0, "null"], + [undefined, 0, "undefined"], + [0.1, 0, "0.1"], + [0.9, 0, "0.9"], + [8.1, 8, "8.1"], + [8.9, 8, "8.9"], + [-0.1, 0, "-0.1"], + [-0.99999, 0, "-0.99999"] +]; + +testWithTypedArrayConstructors(function(TA) { + items.forEach(function(item) { + var offset = item[0]; + var expected = item[1]; + var name = item[2]; + + var typedArray = new TA(buffer, offset); + assert.sameValue(typedArray.byteOffset, expected, name + " byteOffset"); + assert.sameValue(typedArray.constructor, TA, name + " constructor"); + assert.sameValue( + Object.getPrototypeOf(typedArray), + TA.prototype, + name + " prototype" + ); + }); + + // Testing `true`. See step 8 + if (TA.BYTES_PER_ELEMENT === 1) { + var typedArray = new TA(buffer, true); + assert.sameValue(typedArray.byteOffset, 1, "true => 1 byteOffset"); + assert.sameValue(typedArray.constructor, TA, "true => 1 constructor"); + assert.sameValue( + Object.getPrototypeOf(typedArray), + TA.prototype, + "true => 1 prototype" + ); + } else { + assert.throws(RangeError, function() { + new TA(buffer, true); + }, "1 modulo elementSize ≠ 0, throws a RangeError"); + } +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-byteoffset.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-byteoffset.js new file mode 100644 index 000000000..35a087aaf --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-byteoffset.js @@ -0,0 +1,86 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + ToIndex(byteOffset) operations +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToIndex(byteOffset). + 8. If offset modulo elementSize ≠ 0, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var buffer = new ArrayBuffer(16); + +var obj1 = { + valueOf: function() { + return 8; + } +}; + +var obj2 = { + toString: function() { + return 8; + } +}; + +var items = [ + [-0, 0, "-0"], + [obj1, 8, "object's valueOf"], + [obj2, 8, "object's toString"], + ["", 0, "the Empty string"], + ["0", 0, "string '0'"], + ["8", 8, "string '8'"], + [false, 0, "false"], + [NaN, 0, "NaN"], + [null, 0, "null"], + [undefined, 0, "undefined"], + [0.1, 0, "0.1"], + [0.9, 0, "0.9"], + [8.1, 8, "8.1"], + [8.9, 8, "8.9"], + [-0.1, 0, "-0.1"], + [-0.99999, 0, "-0.99999"] +]; + +testWithTypedArrayConstructors(function(TA) { + items.forEach(function(item) { + var offset = item[0]; + var expected = item[1]; + var name = item[2]; + + var typedArray = new TA(buffer, offset); + assert.sameValue(typedArray.byteOffset, expected, name + " byteOffset"); + assert.sameValue(typedArray.constructor, TA, name + " constructor"); + assert.sameValue( + Object.getPrototypeOf(typedArray), + TA.prototype, + name + " prototype" + ); + }); + + // Testing `true`. See step 8 + if (TA.BYTES_PER_ELEMENT === 1) { + var typedArray = new TA(buffer, true); + assert.sameValue(typedArray.byteOffset, 1, "true => 1 byteOffset"); + assert.sameValue(typedArray.constructor, TA, "true => 1 constructor"); + assert.sameValue( + Object.getPrototypeOf(typedArray), + TA.prototype, + "true => 1 prototype" + ); + } else { + assert.throws(RangeError, function() { + new TA(buffer, true); + }, "1 modulo elementSize ≠ 0, throws a RangeError"); + } +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-typedarray-backed-by-sharedarraybuffer.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-typedarray-backed-by-sharedarraybuffer.js new file mode 100644 index 000000000..739d1cdd2 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-typedarray-backed-by-sharedarraybuffer.js @@ -0,0 +1,23 @@ +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-typedarray-typedarray +description: > + Passing a SharedArrayBuffer-backed TypedArray to a TypedArray constructor + produces an ArrayBuffer-backed TypedArray. +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +var sab = new SharedArrayBuffer(4); +var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; + +testWithTypedArrayConstructors(function(View1) { + var ta1 = new View1(sab); + testWithTypedArrayConstructors(function(View2) { + var ta2 = new View2(ta1); + assert.sameValue(ta2.buffer.constructor, ArrayBuffer, + "TypedArray of SharedArrayBuffer-backed TypedArray is ArrayBuffer-backed"); + }, int_views); +}, int_views); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-custom-proto-if-object-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-custom-proto-if-object-sab.js new file mode 100644 index 000000000..c963b6bb1 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-custom-proto-if-object-sab.js @@ -0,0 +1,49 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Use prototype from new target if it's an Object +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [SharedArrayBuffer, Reflect, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); + +function newTarget() {} +var proto = {}; +newTarget.prototype = proto; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [buffer], newTarget); + + assert.sameValue(ta.constructor, Object); + assert.sameValue(Object.getPrototypeOf(ta), proto); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-custom-proto-if-object.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-custom-proto-if-object.js new file mode 100644 index 000000000..9eefdf56d --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-custom-proto-if-object.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Use prototype from new target if it's an Object +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [Reflect, TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); + +function newTarget() {} +var proto = {}; +newTarget.prototype = proto; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [buffer], newTarget); + + assert.sameValue(ta.constructor, Object); + assert.sameValue(Object.getPrototypeOf(ta), proto); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object-sab.js new file mode 100644 index 000000000..8c91aa84d --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object-sab.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Use prototype from %TypedArray% if newTarget's prototype is not an Object +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); + +function newTarget() {} +newTarget.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [buffer], newTarget); + + assert.sameValue(ta.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object.js new file mode 100644 index 000000000..df4909dab --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Use prototype from %TypedArray% if newTarget's prototype is not an Object +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); + +function newTarget() {} +newTarget.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [buffer], newTarget); + + assert.sameValue(ta.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-custom-proto-access-throws.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-custom-proto-access-throws.js new file mode 100644 index 000000000..6ad49fdab --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-custom-proto-access-throws.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + Return abrupt completion getting newTarget's prototype +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 8. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, elementLength). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + ... + + 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) + + ... + 3. Let proto be ? Get(constructor, "prototype"). + ... +includes: [testTypedArray.js] +features: [Reflect, TypedArray] +---*/ + +var newTarget = function() {}.bind(null); +Object.defineProperty(newTarget, "prototype", { + get() { + throw new Test262Error(); + } +}); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + Reflect.construct(TA, [1], newTarget); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-init-zeros.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-init-zeros.js new file mode 100644 index 000000000..384e2399b --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-init-zeros.js @@ -0,0 +1,55 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: All bytes are initialized to zero +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 8. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, elementLength). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 5. If length was not passed, then + ... + 6. Else, + a. Perform ? AllocateTypedArrayBuffer(obj, length). + + 22.2.4.2.2 Runtime Semantics: AllocateTypedArrayBuffer + + 7. Let data be ? AllocateArrayBuffer(%ArrayBuffer%, byteLength). + + 24.1.1.1 AllocateArrayBuffer + + 3. Let block be ? CreateByteDataBlock(byteLength). + + 6.2.6.1 CreateByteDataBlock + + 1. Assert: size≥0. + 2. Let db be a new Data Block value consisting of size bytes. If it is + impossible to create such a Data Block, throw a RangeError exception. + 3. Set all of the bytes of db to 0. + 4. Return db. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA, N) { + var subject = new TA(9); + + assert.sameValue(subject[0], N(0), 'index 0'); + assert.sameValue(subject[1], N(0), 'index 1'); + assert.sameValue(subject[2], N(0), 'index 2'); + assert.sameValue(subject[3], N(0), 'index 3'); + assert.sameValue(subject[4], N(0), 'index 4'); + assert.sameValue(subject[5], N(0), 'index 5'); + assert.sameValue(subject[6], N(0), 'index 6'); + assert.sameValue(subject[7], N(0), 'index 7'); + assert.sameValue(subject[8], N(0), 'index 8'); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-infinity-throws-rangeerror.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-infinity-throws-rangeerror.js new file mode 100644 index 000000000..0084d5d6a --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-infinity-throws-rangeerror.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + Throws a RangeError if length is a Infinity value +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 4. Let numberLength be ? ToNumber(length). + 5. Let elementLength be ToLength(numberLength). + 6. If SameValueZero(numberLength, elementLength) is false, throw a RangeError + exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.throws(RangeError, function() { + new TA(Infinity); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-negative-integer-throws-rangeerror.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-negative-integer-throws-rangeerror.js new file mode 100644 index 000000000..0ff5d5a3f --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-negative-integer-throws-rangeerror.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + Throws a RangeError if ToInteger(length) is a negative value +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 3. Let elementLength be ? ToIndex(length). + ... + + 7.1.17 ToIndex ( value ) + + 1. If value is undefined, then + ... + 2. Else, + a. Let integerIndex be ? ToInteger(value). + b. If integerIndex < 0, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.throws(RangeError, function() { + new TA(-1); + }); + + assert.throws(RangeError, function() { + new TA(-Infinity); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-symbol-throws.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-symbol-throws.js new file mode 100644 index 000000000..797dd4922 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-symbol-throws.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + If length is a Symbol, throw a TypeError exception. +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 4. Let numberLength be ? ToNumber(length). + ... +includes: [testTypedArray.js] +features: [Symbol, TypedArray] +---*/ + +var s = Symbol('1'); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + new TA(s); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-new-instance-extensibility.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-new-instance-extensibility.js new file mode 100644 index 000000000..d9b03deca --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-new-instance-extensibility.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + The new typedArray instance from a length argument is extensible +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 8. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, elementLength). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + ... + 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 11. Set the [[Extensible]] internal slot of A to true. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(4); + + assert(Object.isExtensible(sample)); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-proto-from-ctor-realm.js new file mode 100644 index 000000000..f4effc208 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-proto-from-ctor-realm.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: Default [[Prototype]] value derived from realm of the newTarget +info: | + [...] + 8. Return ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%", elementLength). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + [...] + + 9.1.14 GetPrototypeFromConstructor + + [...] + 3. Let proto be ? Get(constructor, "prototype"). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Let proto be realm's intrinsic object named intrinsicDefaultProto. + 5. Return proto. +includes: [testTypedArray.js] +features: [cross-realm, Reflect, TypedArray] +---*/ + +var other = $262.createRealm().global; +var C = new other.Function(); +C.prototype = null; + +testWithTypedArrayConstructors(function(TA, N) { + var ta = Reflect.construct(TA, [0], C); + + assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-returns-object.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-returns-object.js new file mode 100644 index 000000000..8a9121d88 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-returns-object.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + Return a TypedArray object +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 8. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, elementLength). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + ... + 7. Return obj +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var typedArray = new TA(4); + var length = typedArray.length; + + assert.sameValue(length, 4, "length"); + assert.sameValue(typedArray.constructor, TA); + assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-toindex-length.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-toindex-length.js new file mode 100644 index 000000000..4d16ff711 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-toindex-length.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + ToIndex(length) operations +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 3. Let elementLength be ? ToIndex(length). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var items = [ + [-0, 0, "-0"], + ["", 0, "the Empty string"], + ["0", 0, "string '0'"], + ["1", 1, "string '1'"], + [true, 1, "true"], + [false, 0, "false"], + [NaN, 0, "NaN"], + [null, 0, "null"], + [undefined, 0, "undefined"], + [0.1, 0, "0.1"], + [0.9, 0, "0.9"], + [1.1, 1, "1.1"], + [1.9, 1, "1.9"], + [-0.1, 0, "-0.1"], + [-0.99999, 0, "-0.99999"] +]; + +testWithTypedArrayConstructors(function(TA) { + items.forEach(function(item) { + var len = item[0]; + var expected = item[1]; + var name = item[2]; + + var typedArray = new TA(len); + assert.sameValue(typedArray.length, expected, name + " length"); + assert.sameValue(typedArray.constructor, TA, name + " constructor"); + assert.sameValue( + Object.getPrototypeOf(typedArray), + TA.prototype, + name + " prototype" + ); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-undefined-newtarget-throws.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-undefined-newtarget-throws.js new file mode 100644 index 000000000..6a238255e --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-undefined-newtarget-throws.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + Throws a TypeError if NewTarget is undefined. +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 2. If NewTarget is undefined, throw a TypeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + TA(0); + }); + + assert.throws(TypeError, function() { + TA(Infinity); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-use-custom-proto-if-object.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-use-custom-proto-if-object.js new file mode 100644 index 000000000..b36ff7014 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-use-custom-proto-if-object.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + Use prototype from new target if it's an Object +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 8. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, elementLength). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [Reflect, TypedArray] +---*/ + +function newTarget() {} +var proto = {}; +newTarget.prototype = proto; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [1], newTarget); + + assert.sameValue(ta.constructor, Object); + assert.sameValue(Object.getPrototypeOf(ta), proto); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-use-default-proto-if-custom-proto-is-not-object.js new file mode 100644 index 000000000..e5fc367c0 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-use-default-proto-if-custom-proto-is-not-object.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + Use prototype from %TypedArray% if newTarget's prototype is not an Object +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 8. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, elementLength). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +function newTarget() {} +newTarget.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [1], newTarget); + + assert.sameValue(ta.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-custom-proto-access-throws.js b/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-custom-proto-access-throws.js new file mode 100644 index 000000000..6b383e32e --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-custom-proto-access-throws.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray +description: > + Return abrupt completion getting newTarget's prototype +info: | + 22.2.4.1 TypedArray( ) + + This description applies only if the TypedArray function is called with no + arguments. + + ... + 3. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, 0). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + ... + + 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) + + ... + 3. Let proto be ? Get(constructor, "prototype"). + ... +includes: [testTypedArray.js] +features: [Reflect, TypedArray] +---*/ + +var newTarget = function() {}.bind(null); +Object.defineProperty(newTarget, "prototype", { + get() { + throw new Test262Error(); + } +}); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + Reflect.construct(TA, [], newTarget); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-new-instance-extensibility.js b/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-new-instance-extensibility.js new file mode 100644 index 000000000..cced58d2e --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-new-instance-extensibility.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray +description: > + The new typedArray instance is extensible +info: | + 22.2.4.1 TypedArray( ) + + This description applies only if the TypedArray function is called with no + arguments. + + ... + 3. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, 0). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + ... + 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 11. Set the [[Extensible]] internal slot of A to true. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(); + + assert(Object.isExtensible(sample)); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-proto-from-ctor-realm.js new file mode 100644 index 000000000..c69922185 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-proto-from-ctor-realm.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray +description: Default [[Prototype]] value derived from realm of the newTarget +info: | + [...] + 3. Return ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%", 0). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + [...] + + 9.1.14 GetPrototypeFromConstructor + + [...] + 3. Let proto be ? Get(constructor, "prototype"). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Let proto be realm's intrinsic object named intrinsicDefaultProto. + 5. Return proto. +includes: [testTypedArray.js] +features: [cross-realm, Reflect, TypedArray] +---*/ + +var other = $262.createRealm().global; +var C = new other.Function(); +C.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [], C); + + assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-returns-object.js b/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-returns-object.js new file mode 100644 index 000000000..c7274e5f9 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-returns-object.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray +description: > + Return a TypedArray object +info: | + 22.2.4.1 TypedArray( ) + + This description applies only if the TypedArray function is called with no + arguments. + + ... + 3. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, 0). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + ... + 7. Return obj +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var typedArray = new TA(); + + assert.sameValue(typedArray.length, 0); + assert.sameValue(typedArray.constructor, TA); + assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-undefined-newtarget-throws.js b/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-undefined-newtarget-throws.js new file mode 100644 index 000000000..a06139865 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-undefined-newtarget-throws.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray +description: > + Throws a TypeError if NewTarget is undefined. +info: | + 22.2.4.1 TypedArray( ) + + This description applies only if the TypedArray function is called with no + arguments. + + 1. If NewTarget is undefined, throw a TypeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + TA(); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-use-custom-proto-if-object.js b/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-use-custom-proto-if-object.js new file mode 100644 index 000000000..4266724f0 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-use-custom-proto-if-object.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray +description: > + Use prototype from new target if it's an Object +info: | + 22.2.4.1 TypedArray( ) + + This description applies only if the TypedArray function is called with no + arguments. + + ... + 3. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, 0). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [Reflect, TypedArray] +---*/ + +function newTarget() {} +var proto = {}; +newTarget.prototype = proto; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [], newTarget); + + assert.sameValue(ta.constructor, Object); + assert.sameValue(Object.getPrototypeOf(ta), proto); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-use-default-proto-if-custom-proto-is-not-object.js new file mode 100644 index 000000000..e76ef585e --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-use-default-proto-if-custom-proto-is-not-object.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray +description: > + Use prototype from %TypedArray% if newTarget's prototype is not an Object +info: | + 22.2.4.1 TypedArray( ) + + This description applies only if the TypedArray function is called with no + arguments. + + ... + 3. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, 0). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +function newTarget() {} +newTarget.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [], newTarget); + + assert.sameValue(ta.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-array-returns.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-array-returns.js new file mode 100644 index 000000000..6e15b4ea4 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-array-returns.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return typedArray from array argument +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var obj = [7, 42]; + +testWithTypedArrayConstructors(function(TA, N) { + var typedArray = new TA(N(obj)); + assert.sameValue(typedArray.length, 2); + assert.sameValue(typedArray[0], N(7)); + assert.sameValue(typedArray[1], N(42)); + assert.sameValue(typedArray.constructor, TA); + assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-generator-iterable-returns.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-generator-iterable-returns.js new file mode 100644 index 000000000..7e2876294 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-generator-iterable-returns.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. +/*--- +esid: sec-typedarray-object +description: > + Return typedArray from iterable argument +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA, N) { + var obj = (function *() { + yield N(7); yield N(42); + })(); + + var typedArray = new TA(obj); + assert.sameValue(typedArray.length, 2); + assert.sameValue(typedArray[0], N(7)); + assert.sameValue(typedArray[1], N(42)); + assert.sameValue(typedArray.constructor, TA); + assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation-consistent-nan.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation-consistent-nan.js new file mode 100644 index 000000000..a81d4c504 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation-consistent-nan.js @@ -0,0 +1,60 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: Consistent canonicalization of NaN values +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 9. Repeat, while k < len + ... + c. Perform ? Set(O, Pk, kValue, true). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). + ... + + 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , + isLittleEndian ] ) + + ... + 8. If type is "Float32", then + a. Set rawBytes to a List containing the 4 bytes that are the result + of converting value to IEEE 754-2008 binary32 format using “Round to + nearest, ties to even” rounding mode. If isLittleEndian is false, the + bytes are arranged in big endian order. Otherwise, the bytes are + arranged in little endian order. If value is NaN, rawValue may be set + to any implementation chosen IEEE 754-2008 binary64 format Not-a-Number + encoding. An implementation must always choose the same encoding for + each implementation distinguishable NaN value. + 9. Else, if type is "Float64", then + a. Set rawBytes to a List containing the 8 bytes that are the IEEE + 754-2008 binary64 format encoding of value. If isLittleEndian is false, + the bytes are arranged in big endian order. Otherwise, the bytes are + arranged in little endian order. If value is NaN, rawValue may be set + to any implementation chosen IEEE 754-2008 binary32 format Not-a-Number + encoding. An implementation must always choose the same encoding for + each implementation distinguishable NaN value. + ... +includes: [nans.js, testTypedArray.js, compareArray.js] +---*/ + +function body(FloatArray) { + var first = new FloatArray(distinctNaNs); + var second = new FloatArray(distinctNaNs); + var firstBytes = new Uint8Array(first.buffer); + var secondBytes = new Uint8Array(second.buffer); + + assert(compareArray(firstBytes, secondBytes)); +} + +testWithTypedArrayConstructors(body, [Float32Array, Float64Array]); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation.js new file mode 100644 index 000000000..d14a14023 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation.js @@ -0,0 +1,52 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-typedarray-object +description: > + Verify conversion values on returned instance +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 9. Repeat, while k < len + ... + c. Perform ? Set(O, Pk, kValue, true). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). + ... + + 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , + isLittleEndian ] ) + + ... + 8. If type is "Float32", then + ... + 9. Else, if type is "Float64", then + ... + 10. Else, + ... + b. Let convOp be the abstract operation named in the Conversion Operation + column in Table 50 for Element Type type. + c. Let intValue be convOp(value). + d. If intValue ≥ 0, then + ... + e. Else, + ... +includes: [byteConversionValues.js, testTypedArray.js] +---*/ + +testTypedArrayConversions(byteConversionValues, function(TA, value, expected) { + var sample = new TA([value]); + + assert.sameValue(sample[0], expected, value + " converts to " + expected); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-custom-proto-access-throws.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-custom-proto-access-throws.js new file mode 100644 index 000000000..f5ced4ea4 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-custom-proto-access-throws.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt completion getting newTarget's prototype +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 3. Let O be ? AllocateTypedArray(TypedArray.[[TypedArrayConstructorName]], + NewTarget, "%TypedArrayPrototype%"). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + ... + + 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) + + ... + 3. Let proto be ? Get(constructor, "prototype"). + ... +includes: [testTypedArray.js] +features: [Reflect, TypedArray] +---*/ + +var newTarget = function() {}.bind(null); +Object.defineProperty(newTarget, "prototype", { + get() { + throw new Test262Error(); + } +}); + +var o = {}; + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + Reflect.construct(TA, [o], newTarget); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterating-throws.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterating-throws.js new file mode 100644 index 000000000..41fc55509 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterating-throws.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt from iterating object argument +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 4. Let arrayLike be ? IterableToArrayLike(object). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var obj = (function *() { + yield 0; + throw new Test262Error(); + })(); + + assert.throws(Test262Error, function() { + new TA(obj); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterator-not-callable-throws.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterator-not-callable-throws.js new file mode 100644 index 000000000..ad6db0877 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterator-not-callable-throws.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt when object @@iterator is not callable +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 4. Let arrayLike be ? IterableToArrayLike(object). + ... +includes: [testTypedArray.js] +features: [Symbol.iterator, TypedArray] +---*/ + +var obj = function () {}; + +testWithTypedArrayConstructors(function(TA) { + obj[Symbol.iterator] = {}; + assert.throws(TypeError, function() { + new TA(obj); + }); + + obj[Symbol.iterator] = true; + assert.throws(TypeError, function() { + new TA(obj); + }); + + obj[Symbol.iterator] = 42; + assert.throws(TypeError, function() { + new TA(obj); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterator-throws.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterator-throws.js new file mode 100644 index 000000000..571ad77ad --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterator-throws.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt from getting object @@iterator +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 4. Let arrayLike be ? IterableToArrayLike(object). + ... +includes: [testTypedArray.js] +features: [Symbol.iterator, TypedArray] +---*/ + +var obj = function () {}; + +Object.defineProperty(obj, Symbol.iterator, { + get() { + throw new Test262Error(); + } +}); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + new TA(obj); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-excessive-throws.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-excessive-throws.js new file mode 100644 index 000000000..f8279f50a --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-excessive-throws.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. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt from allocating array buffer with excessive length +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 6. Perform ? AllocateTypedArrayBuffer(O, len). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var obj = { + length: Math.pow(2, 53) +}; + +testWithTypedArrayConstructors(function(TA) { + assert.throws(RangeError, function() { + new TA(obj); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-is-symbol-throws.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-is-symbol-throws.js new file mode 100644 index 000000000..b452dea03 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-is-symbol-throws.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. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt from length property as a Symbol on the object argument +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 5. Let len be ? ToLength(? Get(arrayLike, "length")). + ... +includes: [testTypedArray.js] +features: [Symbol, TypedArray] +---*/ + +var obj = { + length: Symbol("1") +}; + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + new TA(obj); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-throws.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-throws.js new file mode 100644 index 000000000..08f8cd130 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-throws.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt from getting length property on the object argument +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 5. Let len be ? ToLength(? Get(arrayLike, "length")). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var obj = {}; + +Object.defineProperty(obj, "length", { + get() { + throw new Test262Error(); + } +}); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + new TA(obj); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-new-instance-extensibility.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-new-instance-extensibility.js new file mode 100644 index 000000000..bd335774b --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-new-instance-extensibility.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + The new typedArray instance from an object argument is extensible +info: | + 22.2.4.4 TypedArray ( object ) + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%"). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + ... + 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 11. Set the [[Extensible]] internal slot of A to true. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA, N) { + var obj = { + "0": N(0), + "1": N(1), + "2": N(2), + length: 3 + }; + + var sample = new TA(obj); + + assert(Object.isExtensible(sample)); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-proto-from-ctor-realm.js new file mode 100644 index 000000000..a92ceee00 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-proto-from-ctor-realm.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: Default [[Prototype]] value derived from realm of the newTarget +info: | + [...] + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%"). + [...] + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + [...] + + 9.1.14 GetPrototypeFromConstructor + + [...] + 3. Let proto be ? Get(constructor, "prototype"). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Let proto be realm's intrinsic object named intrinsicDefaultProto. + 5. Return proto. +includes: [testTypedArray.js] +features: [cross-realm, Reflect, TypedArray] +---*/ + +var other = $262.createRealm().global; +var C = new other.Function(); +C.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [{}], C); + + assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-returns.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-returns.js new file mode 100644 index 000000000..cb06ba220 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-returns.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return typedArray from object argument +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + +includes: [testTypedArray.js] +features: [Symbol, TypedArray] +---*/ + +var obj = { + "0": null, + "2": 42, + "3": "7", + "4": NaN, + "5": Symbol("1"), + length: 5 +}; + +testWithTypedArrayConstructors(function(TA) { + var typedArray = new TA(obj); + assert.sameValue(typedArray.length, 5); + assert.sameValue(typedArray[0], 0); + assert.sameValue(typedArray[2], 42); + assert.sameValue(typedArray[3], 7); + assert.sameValue(typedArray[5], undefined); + assert.sameValue(typedArray.constructor, TA); + assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); + + if (TA === Float32Array || TA === Float64Array) { + assert.sameValue(typedArray[1], NaN); + assert.sameValue(typedArray[4], NaN); + } else { + assert.sameValue(typedArray[1], 0); + assert.sameValue(typedArray[4], 0); + } +}, + // Cannot create Big*64Arrays from non-safe integers. + numericTypedArrayConstructors); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-from-property.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-from-property.js new file mode 100644 index 000000000..4a0d60825 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-from-property.js @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt from getting object property +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 8. Repeat, while k < len + ... + b. Let kValue be ? Get(arrayLike, Pk). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var obj = { + length: 4 +}; + +Object.defineProperty(obj, "2", { + get() { + throw new Test262Error(); + } +}); + +testWithTypedArrayConstructors(function(TA, N) { + obj[0] = N(0); + obj[1] = N(0); + assert.throws(Test262Error, function() { + new TA(obj); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive-typeerror.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive-typeerror.js new file mode 100644 index 000000000..3aee05e56 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive-typeerror.js @@ -0,0 +1,77 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Throw TypeError from @@toPrimitive returning an Object when setting a property +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 8. Repeat, while k < len + ... + b. Let kValue be ? Get(arrayLike, Pk). + c. Perform ? Set(O, Pk, kValue, true). + ... + + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String and if SameValue(O, Receiver) is true, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 3. Let numValue be ? ToNumber(value). + ... + + 7.1.3 ToNumber ( argument ) + + Object, Apply the following steps: + + 1. Let primValue be ? ToPrimitive(argument, hint Number). + 2. Return ? ToNumber(primValue). + + 7.1.1 ToPrimitive ( input [ , PreferredType ] ) + + ... + 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive). + 5. If exoticToPrim is not undefined, then + a. Let result be ? Call(exoticToPrim, input, « hint »). + b. If Type(result) is not Object, return result. + c. Throw a TypeError exception. + ... +includes: [testTypedArray.js] +features: [Symbol.toPrimitive, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA, N) { + var sample = new Int8Array(1); + var toPrimitive = 0; + var valueOf = 0; + + sample[Symbol.toPrimitive] = function() { + toPrimitive++; + return {}; + }; + + sample.valueOf = function() { + valueOf++; + }; + + assert.throws(TypeError, function() { + new TA([N(8), sample]); + }, "abrupt completion from sample @@toPrimitive"); + + assert.sameValue(toPrimitive, 1, "toPrimitive was called once"); + assert.sameValue(valueOf, 0, "sample.valueOf is not called"); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive.js new file mode 100644 index 000000000..516586863 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive.js @@ -0,0 +1,75 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt from @@toPrimitive when setting a property +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 8. Repeat, while k < len + ... + b. Let kValue be ? Get(arrayLike, Pk). + c. Perform ? Set(O, Pk, kValue, true). + ... + + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String and if SameValue(O, Receiver) is true, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 3. Let numValue be ? ToNumber(value). + ... + + 7.1.3 ToNumber ( argument ) + + Object, Apply the following steps: + + 1. Let primValue be ? ToPrimitive(argument, hint Number). + 2. Return ? ToNumber(primValue). + + 7.1.1 ToPrimitive ( input [ , PreferredType ] ) + + ... + 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive). + 5. If exoticToPrim is not undefined, then + a. Let result be ? Call(exoticToPrim, input, « hint »). + ... +includes: [testTypedArray.js] +features: [Symbol.toPrimitive, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA, N) { + var sample = new Int8Array(1); + var toPrimitive = 0; + var valueOf = 0; + + sample[Symbol.toPrimitive] = function() { + toPrimitive++; + throw new Test262Error(); + }; + + sample.valueOf = function() { + valueOf++; + }; + + assert.throws(Test262Error, function() { + new TA([N(8), sample]); + }, "abrupt completion from sample @@toPrimitive"); + + assert.sameValue(toPrimitive, 1, "toPrimitive was called once"); + assert.sameValue(valueOf, 0, "it does not call sample.valueOf"); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-tostring.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-tostring.js new file mode 100644 index 000000000..3e2d84e75 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-tostring.js @@ -0,0 +1,88 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt from toString() when setting a property +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 8. Repeat, while k < len + ... + b. Let kValue be ? Get(arrayLike, Pk). + c. Perform ? Set(O, Pk, kValue, true). + ... + + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String and if SameValue(O, Receiver) is true, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 3. Let numValue be ? ToNumber(value). + ... + + 7.1.3 ToNumber ( argument ) + + Object, Apply the following steps: + + 1. Let primValue be ? ToPrimitive(argument, hint Number). + 2. Return ? ToNumber(primValue). + + 7.1.1 ToPrimitive ( input [ , PreferredType ] ) + + ... + 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive). + 5. If exoticToPrim is not undefined, then + a. Let result be ? Call(exoticToPrim, input, « hint »). + b. If Type(result) is not Object, return result. + c. Throw a TypeError exception. + ... + 7. Return ? OrdinaryToPrimitive(input, hint). + + OrdinaryToPrimitive + + ... + 5. For each name in methodNames in List order, do + a. Let method be ? Get(O, name). + b. If IsCallable(method) is true, then + i. Let result be ? Call(method, O). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA, N) { + var sample = new Int8Array(1); + var valueOf = 0; + var toString = 0; + + sample.valueOf = function() { + valueOf++; + return {}; + }; + + sample.toString = function() { + toString++; + throw new Test262Error(); + }; + + assert.throws(Test262Error, function() { + new TA([N(8), sample]); + }, "abrupt completion from ToNumber(sample)"); + + assert.sameValue(valueOf, 1, "valueOf called once"); + assert.sameValue(toString, 1, "toString called once"); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof-typeerror.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof-typeerror.js new file mode 100644 index 000000000..c58fe2425 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof-typeerror.js @@ -0,0 +1,89 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Throw TypeError from OrdinaryToPrimitive when setting a property +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 8. Repeat, while k < len + ... + b. Let kValue be ? Get(arrayLike, Pk). + c. Perform ? Set(O, Pk, kValue, true). + ... + + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String and if SameValue(O, Receiver) is true, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 3. Let numValue be ? ToNumber(value). + ... + + 7.1.3 ToNumber ( argument ) + + Object, Apply the following steps: + + 1. Let primValue be ? ToPrimitive(argument, hint Number). + 2. Return ? ToNumber(primValue). + + 7.1.1 ToPrimitive ( input [ , PreferredType ] ) + + ... + 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive). + 5. If exoticToPrim is not undefined, then + a. Let result be ? Call(exoticToPrim, input, « hint »). + b. If Type(result) is not Object, return result. + c. Throw a TypeError exception. + ... + 7. Return ? OrdinaryToPrimitive(input, hint). + + OrdinaryToPrimitive + + ... + 5. For each name in methodNames in List order, do + a. Let method be ? Get(O, name). + b. If IsCallable(method) is true, then + i. Let result be ? Call(method, O). + ii. If Type(result) is not Object, return result. + 6. Throw a TypeError exception. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA, N) { + var sample = new Int8Array(1); + var valueOf = 0; + var toString = 0; + + sample.valueOf = function() { + valueOf++; + return {}; + }; + + sample.toString = function() { + toString++; + return {}; + }; + + assert.throws(TypeError, function() { + new TA([N(8), sample]); + }, "abrupt completion from ToNumber(sample)"); + + assert.sameValue(valueOf, 1, "valueOf called once"); + assert.sameValue(toString, 1, "toString called once"); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof.js new file mode 100644 index 000000000..ae4515f34 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof.js @@ -0,0 +1,82 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt from valueOf() when setting a property +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 8. Repeat, while k < len + ... + b. Let kValue be ? Get(arrayLike, Pk). + c. Perform ? Set(O, Pk, kValue, true). + ... + + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String and if SameValue(O, Receiver) is true, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 3. Let numValue be ? ToNumber(value). + ... + + 7.1.3 ToNumber ( argument ) + + Object, Apply the following steps: + + 1. Let primValue be ? ToPrimitive(argument, hint Number). + 2. Return ? ToNumber(primValue). + + 7.1.1 ToPrimitive ( input [ , PreferredType ] ) + + ... + 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive). + 5. If exoticToPrim is not undefined, then + a. Let result be ? Call(exoticToPrim, input, « hint »). + b. If Type(result) is not Object, return result. + c. Throw a TypeError exception. + ... + 7. Return ? OrdinaryToPrimitive(input, hint). + + OrdinaryToPrimitive + + ... + 5. For each name in methodNames in List order, do + a. Let method be ? Get(O, name). + b. If IsCallable(method) is true, then + i. Let result be ? Call(method, O). + ii. If Type(result) is not Object, return result. + 6. Throw a TypeError exception. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA, N) { + var sample = new Int8Array(1); + var valueOf = 0; + + sample.valueOf = function() { + valueOf++; + throw new Test262Error(); + }; + + assert.throws(Test262Error, function() { + new TA([N(8), sample]); + }, "abrupt completion from ToNumber(sample)"); + + assert.sameValue(valueOf, 1, "valueOf called once"); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-property.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-property.js new file mode 100644 index 000000000..489234c90 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-property.js @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt from setting property +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 8. Repeat, while k < len + ... + b. Let kValue be ? Get(arrayLike, Pk). + c. Perform ? Set(O, Pk, kValue, true). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var obj = { + "2": { + valueOf() { + throw new Test262Error(); + } + }, + length: 4 +}; + +testWithTypedArrayConstructors(function(TA, N) { + obj[0] = N(0); + obj[1] = N(0); + assert.throws(Test262Error, function() { + new TA(obj); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-symbol-property.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-symbol-property.js new file mode 100644 index 000000000..42b4a54b8 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-symbol-property.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt from setting property +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 8. Repeat, while k < len + ... + b. Let kValue be ? Get(arrayLike, Pk). + c. Perform ? Set(O, Pk, kValue, true). + ... +includes: [testTypedArray.js] +features: [Symbol, TypedArray] +---*/ + +var obj = { + "2": Symbol("1"), + length: 4 +}; + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + new TA(obj); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-undefined-newtarget-throws.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-undefined-newtarget-throws.js new file mode 100644 index 000000000..36f68493a --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-undefined-newtarget-throws.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. +/*--- +esid: sec-typedarray-object +description: > + Throws a TypeError if NewTarget is undefined. +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 2. If NewTarget is undefined, throw a TypeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + TA({}); + }); + + assert.throws(TypeError, function() { + TA([]); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-use-custom-proto-if-object.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-use-custom-proto-if-object.js new file mode 100644 index 000000000..bb5754a9c --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-use-custom-proto-if-object.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Use prototype from new target if it's an Object +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 3. Let O be ? AllocateTypedArray(TypedArray.[[TypedArrayConstructorName]], + NewTarget, "%TypedArrayPrototype%"). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [Reflect, TypedArray] +---*/ + +function newTarget() {} +var proto = {}; +newTarget.prototype = proto; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [], newTarget); + + assert.sameValue(ta.constructor, Object); + assert.sameValue(Object.getPrototypeOf(ta), proto); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-use-default-proto-if-custom-proto-is-not-object.js new file mode 100644 index 000000000..6aba187c2 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-use-default-proto-if-custom-proto-is-not-object.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Use prototype from %TypedArray% if newTarget's prototype is not an Object +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 3. Let O be ? AllocateTypedArray(TypedArray.[[TypedArrayConstructorName]], + NewTarget, "%TypedArrayPrototype%"). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +function newTarget() {} +newTarget.prototype = null; +var o = []; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [o], newTarget); + + assert.sameValue(ta.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-custom-proto-access-throws.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-custom-proto-access-throws.js new file mode 100644 index 000000000..281d09353 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-custom-proto-access-throws.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt completion getting newTarget's prototype +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + ... + + 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) + + ... + 3. Let proto be ? Get(constructor, "prototype"). + ... +includes: [testTypedArray.js] +features: [Reflect, TypedArray] +---*/ + +var newTarget = function() {}.bind(null); +Object.defineProperty(newTarget, "prototype", { + get() { + throw new Test262Error(); + } +}); + +var sample = new Int8Array(); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + Reflect.construct(TA, [sample], newTarget); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-detached-when-species-retrieved-different-type.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-detached-when-species-retrieved-different-type.js new file mode 100644 index 000000000..8ee2fba54 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-detached-when-species-retrieved-different-type.js @@ -0,0 +1,61 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-typedarray-typedarray +description: > + When a TypedArray is created from another TypedArray with a different element-type + and SpeciesConstructor detaches the source buffer, AllocateArrayBuffer is still + executed. +info: | + 22.2.4.3 TypedArray ( typedArray ) + + ... + 16. If IsSharedArrayBuffer(srcData) is false, then + a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). + ... + 18. If SameValue(elementType, srcType) is true, then + ... + 19. Else, + a. Let data be ? AllocateArrayBuffer(bufferConstructor, byteLength). + b. If IsDetachedBuffer(srcData) is true, throw a TypeError exception. + ... + + 24.1.1.1 AllocateArrayBuffer ( constructor, byteLength ) + + 1. Let obj be ? OrdinaryCreateFromConstructor(constructor, "%ArrayBufferPrototype%", + « [[ArrayBufferData]], [[ArrayBufferByteLength]] »). + ... +includes: [testTypedArray.js, detachArrayBuffer.js] +features: [TypedArray, Symbol.species] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var speciesCallCount = 0; + var bufferConstructor = Object.defineProperty({}, Symbol.species, { + get: function() { + speciesCallCount += 1; + $DETACHBUFFER(ta.buffer); + return speciesConstructor; + } + }); + + var prototypeCallCount = 0; + var speciesConstructor = Object.defineProperty(function(){}.bind(), "prototype", { + get: function() { + prototypeCallCount += 1; + return null; + } + }); + + var ta = new TA(0); + ta.buffer.constructor = bufferConstructor; + + assert.throws(TypeError, function() { + var targetType = TA !== Int32Array ? Int32Array : Uint32Array; + new targetType(ta); + }, "TypeError thrown for detached source buffer"); + + assert.sameValue(speciesCallCount, 1, "@@species getter called once"); + assert.sameValue(prototypeCallCount, 1, "prototype getter called once"); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-detached-when-species-retrieved-same-type.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-detached-when-species-retrieved-same-type.js new file mode 100644 index 000000000..978f42af6 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-detached-when-species-retrieved-same-type.js @@ -0,0 +1,64 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-typedarray-typedarray +description: > + When a TypedArray is created from another TypedArray with the same element-type + and SpeciesConstructor detaches the source buffer, AllocateArrayBuffer is still + executed. +info: | + 22.2.4.3 TypedArray ( typedArray ) + + ... + 16. If IsSharedArrayBuffer(srcData) is false, then + a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). + ... + 18. If SameValue(elementType, srcType) is true, then + a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset, byteLength, bufferConstructor). + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset, srcLength, cloneConstructor ) + + ... + 3. Let targetBuffer be ? AllocateArrayBuffer(cloneConstructor, srcLength). + 4. If IsDetachedBuffer(srcBuffer) is true, throw a TypeError exception. + ... + + 24.1.1.1 AllocateArrayBuffer ( constructor, byteLength ) + + 1. Let obj be ? OrdinaryCreateFromConstructor(constructor, "%ArrayBufferPrototype%", + « [[ArrayBufferData]], [[ArrayBufferByteLength]] »). + ... +includes: [testTypedArray.js, detachArrayBuffer.js] +features: [TypedArray, Symbol.species] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var speciesCallCount = 0; + var bufferConstructor = Object.defineProperty({}, Symbol.species, { + get: function() { + speciesCallCount += 1; + $DETACHBUFFER(ta.buffer); + return speciesConstructor; + } + }); + + var prototypeCallCount = 0; + var speciesConstructor = Object.defineProperty(function(){}.bind(), "prototype", { + get: function() { + prototypeCallCount += 1; + return null; + } + }); + + var ta = new TA(0); + ta.buffer.constructor = bufferConstructor; + + assert.throws(TypeError, function() { + new TA(ta); + }, "TypeError thrown for detached source buffer"); + + assert.sameValue(speciesCallCount, 1, "@@species getter called once"); + assert.sameValue(prototypeCallCount, 1, "prototype getter called once"); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-new-instance-extensibility.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-new-instance-extensibility.js new file mode 100644 index 000000000..d29848bf8 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-new-instance-extensibility.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + The new typedArray instance from a typedArray argument is extensible +info: | + 22.2.4.3 TypedArray ( typedArray ) + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%"). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + ... + 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 11. Set the [[Extensible]] internal slot of A to true. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var typedArraySample1 = new Int8Array(); +var typedArraySample2 = new Int8Array(); +Object.preventExtensions(typedArraySample2); + +testWithTypedArrayConstructors(function(TA) { + var sample1 = new TA(typedArraySample1); + + assert(Object.isExtensible(sample1), "new instance is extensible"); + + var sample2 = new TA(typedArraySample2); + assert( + Object.isExtensible(sample2), + "new instance does not inherit extensibility from typedarray argument" + ); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-access-throws.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-access-throws.js new file mode 100644 index 000000000..b8976d696 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-access-throws.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt completion from getting typedArray argument's buffer.constructor +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 18. Else, + a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 2. Let C be ? Get(O, "constructor"). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var OtherCtor = TA === Int8Array ? Int16Array : Int8Array; + var sample = new OtherCtor(); + + Object.defineProperty(sample.buffer, "constructor", { + get() { + throw new Test262Error(); + } + }); + + assert.throws(Test262Error, function() { + new TA(sample); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species-proto-from-ctor-realm.js new file mode 100644 index 000000000..03860d1a7 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species-proto-from-ctor-realm.js @@ -0,0 +1,59 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Derive the ArrayBuffer prototype from the realm of the species constructor +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 18. Else, + a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). + b. Let data be ? AllocateArrayBuffer(bufferConstructor, byteLength). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + 7. If IsConstructor(S) is true, return S. + ... + + 9.1.14 GetPrototypeFromConstructor + + ... + 3. Let proto be ? Get(constructor, "prototype"). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Let proto be realm's intrinsic object named intrinsicDefaultProto. + ... +includes: [testTypedArray.js] +features: [cross-realm, Symbol.species, TypedArray] +---*/ + +var sample1 = new Int8Array(); +var sample2 = new Int16Array(); +var other = $262.createRealm().global; +var C = new other.Function(); +C.prototype = null; + + +testWithTypedArrayConstructors(function(TA) { + var sample = TA === Int8Array ? sample2 : sample1; + var ctor = {}; + + sample.buffer.constructor = ctor; + + ctor[Symbol.species] = C; + + var typedArray = new TA(sample); + assert.sameValue( + Object.getPrototypeOf(typedArray.buffer), other.ArrayBuffer.prototype + ); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species.js new file mode 100644 index 000000000..a510d7806 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species.js @@ -0,0 +1,52 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Use default ArrayBuffer constructor on undefined buffer.constructor.@@species +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 18. Else, + a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). + b. Let data be ? AllocateArrayBuffer(bufferConstructor, byteLength). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + 7. If IsConstructor(S) is true, return S. + ... + +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +var sample1 = new Int8Array(); +var sample2 = new Int16Array(); + +testWithTypedArrayConstructors(function(TA) { + var sample = TA === Int8Array ? sample2 : sample1; + var ctor = {}; + var called = 0; + var custom = {}; + + sample.buffer.constructor = ctor; + + ctor[Symbol.species] = function() { + called++; + }; + + ctor[Symbol.species].prototype = custom; + + var typedArray = new TA(sample); + assert.sameValue(Object.getPrototypeOf(typedArray.buffer), custom); + assert.sameValue(called, 0); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-not-object-throws.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-not-object-throws.js new file mode 100644 index 000000000..cfb79f1a9 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-not-object-throws.js @@ -0,0 +1,61 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt completion from typedArray argument's buffer.constructor's value +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 18. Else, + a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 2. Let C be ? Get(O, "constructor"). + ... + 4. If Type(C) is not Object, throw a TypeError exception. + ... +includes: [testTypedArray.js] +features: [Symbol, TypedArray] +---*/ + +var sample1 = new Int8Array(); +var sample2 = new Int16Array(); + +testWithTypedArrayConstructors(function(TA) { + var sample = TA === Int8Array ? sample2 : sample1; + + sample.buffer.constructor = 1; + assert.throws(TypeError, function() { + new TA(sample); + }); + + sample.buffer.constructor = true; + assert.throws(TypeError, function() { + new TA(sample); + }); + + sample.buffer.constructor = ""; + assert.throws(TypeError, function() { + new TA(sample); + }); + + sample.buffer.constructor = null; + assert.throws(TypeError, function() { + new TA(sample); + }); + + var s = Symbol("1"); + sample.buffer.constructor = s; + assert.throws(TypeError, function() { + new TA(sample); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-access-throws.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-access-throws.js new file mode 100644 index 000000000..4b0b19aca --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-access-throws.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt from getting typedArray argument's buffer.constructor.@@species +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 18. Else, + a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + ... +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +var sample1 = new Int8Array(); +var sample2 = new Int16Array(); + +testWithTypedArrayConstructors(function(TA) { + var sample = TA === Int8Array ? sample2 : sample1; + var ctor = {}; + + sample.buffer.constructor = ctor; + Object.defineProperty(ctor, Symbol.species, { + get: function() { + throw new Test262Error(); + } + }); + + assert.throws(Test262Error, function() { + new TA(sample); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-not-ctor-throws.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-not-ctor-throws.js new file mode 100644 index 000000000..c485cae13 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-not-ctor-throws.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt from buffer.constructor.@@species.prototype +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 18. Else, + a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + 7. If IsConstructor(S) is true, return S. + 8. Throw a TypeError exception. +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +var sample1 = new Int8Array(); +var sample2 = new Int16Array(); + +var ctor = function() { + throw new Test262Error(); +}; +var m = { m() {} }.m; +ctor[Symbol.species] = m; + +testWithTypedArrayConstructors(function(TA) { + var sample = TA === Int8Array ? sample2 : sample1; + + sample.buffer.constructor = ctor; + + assert.throws(TypeError, function() { + new TA(sample); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-null.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-null.js new file mode 100644 index 000000000..96ba9009d --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-null.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Use default ArrayBuffer constructor on null buffer.constructor.@@species +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 18. Else, + a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + ... +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var OtherCtor = TA === Int8Array ? Int16Array : Int8Array; + var sample = new OtherCtor(); + var ctor = {}; + + sample.buffer.constructor = ctor; + + ctor[Symbol.species] = null; + var typedArray = new TA(sample); + + assert.sameValue( + Object.getPrototypeOf(typedArray.buffer), + ArrayBuffer.prototype, + "buffer ctor is not called when species is null" + ); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-prototype-throws.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-prototype-throws.js new file mode 100644 index 000000000..135634646 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-prototype-throws.js @@ -0,0 +1,59 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt from buffer.constructor.@@species.prototype +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 18. Else, + a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). + b. Let data be ? AllocateArrayBuffer(bufferConstructor, byteLength). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + 7. If IsConstructor(S) is true, return S. + ... + + 24.1.1.1 AllocateArrayBuffer ( constructor, byteLength ) + + ... + 1. Let obj be ? OrdinaryCreateFromConstructor(constructor, + "%ArrayBufferPrototype%", « [[ArrayBufferData]], [[ArrayBufferByteLength]] » ) + ... +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +var sample1 = new Int8Array(); +var sample2 = new Int16Array(); + +testWithTypedArrayConstructors(function(TA) { + var sample = TA === Int8Array ? sample2 : sample1; + var ctor = {}; + var called = 0; + + sample.buffer.constructor = ctor; + + ctor[Symbol.species] = function() {called++;}.bind(null); + Object.defineProperty(ctor[Symbol.species], "prototype", { + get: function() { + throw new Test262Error(); + } + }); + + assert.throws(Test262Error, function() { + new TA(sample); + }); + assert.sameValue(called, 0); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-undefined.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-undefined.js new file mode 100644 index 000000000..32e78a37d --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-undefined.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Use default ArrayBuffer constructor on undefined buffer.constructor.@@species +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 18. Else, + a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + ... +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var OtherCtor = TA === Int8Array ? Int16Array : Int8Array; + var sample = new OtherCtor(); + var ctor = {}; + + sample.buffer.constructor = ctor; + + ctor[Symbol.species] = undefined; + var a = new TA(sample); + assert.sameValue( + Object.getPrototypeOf(a.buffer), + ArrayBuffer.prototype, + "buffer ctor is not called when species is undefined" + ); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-returns-new-typedarray.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-returns-new-typedarray.js new file mode 100644 index 000000000..34cb4dee6 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-returns-new-typedarray.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt from getting typedArray argument's buffer.constructor.@@species +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var sample1 = new Int8Array(7); +var sample2 = new Int16Array(7); +var sample3 = new BigInt64Array(7); +var sample4 = new BigUint64Array(7); + +testWithTypedArrayConstructors(function(TA) { + var sample = TA === Int8Array ? sample2 : + TA === BigInt64Array ? sample4 : + TA === BigUint64Array ? sample3 : sample1; + var typedArray = new TA(sample); + + assert.sameValue(typedArray.length, 7); + assert.notSameValue(typedArray, sample); + assert.sameValue(typedArray.constructor, TA); + assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-proto-from-ctor-realm.js new file mode 100644 index 000000000..6e58746cd --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-proto-from-ctor-realm.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: Default [[Prototype]] value derived from realm of the newTarget +info: | + [...] + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%"). + [...] + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + [...] + + 9.1.14 GetPrototypeFromConstructor + + [...] + 3. Let proto be ? Get(constructor, "prototype"). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Let proto be realm's intrinsic object named intrinsicDefaultProto. + 5. Return proto. +includes: [testTypedArray.js] +features: [cross-realm, Reflect, TypedArray] +---*/ + +var other = $262.createRealm().global; +var C = new other.Function(); +C.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [new TA()], C); + + assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-returns-new-instance.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-returns-new-instance.js new file mode 100644 index 000000000..128ec4021 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-returns-new-instance.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return a TypedArray object +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 20. Return O. + +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var len = 10; +var typedArraySample = new Int8Array(len); + +testWithTypedArrayConstructors(function(TA) { + var typedArray = new TA(typedArraySample); + + assert.notSameValue(typedArray, typedArraySample); + assert.sameValue(typedArray.length, len); + assert.sameValue(typedArray.constructor, TA); + assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); +}, numericTypedArrayConstructors); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-access-throws.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-access-throws.js new file mode 100644 index 000000000..f8e75d209 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-access-throws.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt completion from getting typedArray argument's buffer.constructor +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 17. If SameValue(elementType, srcType) is true, then + a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) + + ... + 2. If cloneConstructor is not present, then + a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 2. Let C be ? Get(O, "constructor"). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(); + Object.defineProperty(sample.buffer, "constructor", { + get: function() { + throw new Test262Error(); + } + }); + + assert.throws(Test262Error, function() { + new TA(sample); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom-proto-from-ctor-realm.js new file mode 100644 index 000000000..43743b956 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom-proto-from-ctor-realm.js @@ -0,0 +1,68 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Derive the ArrayBuffer prototype from the realm of the species constructor +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 17. If SameValue(elementType, srcType) is true, then + a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) + + ... + 2. If cloneConstructor is not present, then + a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + 7. If IsConstructor(S) is true, return S. + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) + + ... + 8. Let targetBuffer be ? AllocateArrayBuffer(cloneConstructor, cloneLength). + ... + + 9.1.14 GetPrototypeFromConstructor + + ... + 3. Let proto be ? Get(constructor, "prototype"). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Let proto be realm's intrinsic object named intrinsicDefaultProto. + ... +includes: [testTypedArray.js] +features: [cross-realm, Symbol.species, TypedArray] +---*/ + +var other = $262.createRealm().global; +var C = new other.Function(); +C.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(); + var ctor = {}; + + sample.buffer.constructor = ctor; + + ctor[Symbol.species] = C; + + var typedArray = new TA(sample); + assert.sameValue( + Object.getPrototypeOf(typedArray.buffer), other.ArrayBuffer.prototype + ); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom.js new file mode 100644 index 000000000..7ed3aca0d --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom.js @@ -0,0 +1,60 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Use default ArrayBuffer constructor on undefined buffer.constructor.@@species +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 17. If SameValue(elementType, srcType) is true, then + a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) + + ... + 2. If cloneConstructor is not present, then + a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + 7. If IsConstructor(S) is true, return S. + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) + + ... + 8. Let targetBuffer be ? AllocateArrayBuffer(cloneConstructor, cloneLength). + ... +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(); + var ctor = {}; + var called = 0; + var custom = {}; + + sample.buffer.constructor = ctor; + + ctor[Symbol.species] = function() { + called++; + }; + + ctor[Symbol.species].prototype = custom; + + var typedArray = new TA(sample); + assert.sameValue(Object.getPrototypeOf(typedArray.buffer), custom); + assert.sameValue(called, 0); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-not-ctor.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-not-ctor.js new file mode 100644 index 000000000..2072aa96d --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-not-ctor.js @@ -0,0 +1,49 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt from buffer.constructor.@@species.prototype +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 17. If SameValue(elementType, srcType) is true, then + a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) + + ... + 2. If cloneConstructor is not present, then + a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + 7. If IsConstructor(S) is true, return S. + 8. Throw a TypeError exception. +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(); + var ctor = {}; + var m = { m() {} }; + + sample.buffer.constructor = ctor; + + ctor[Symbol.species] = m; + + assert.throws(TypeError, function() { + new TA(sample); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-null.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-null.js new file mode 100644 index 000000000..e42780610 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-null.js @@ -0,0 +1,49 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Use default ArrayBuffer constructor on null buffer.constructor.@@species +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 17. If SameValue(elementType, srcType) is true, then + a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) + + ... + 2. If cloneConstructor is not present, then + a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + ... +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(4); + var ctor = {}; + + sample.buffer.constructor = ctor; + + ctor[Symbol.species] = null; + var typedArray = new TA(sample); + assert.sameValue( + Object.getPrototypeOf(typedArray.buffer), + ArrayBuffer.prototype, + "buffer ctor is not called when species is null" + ); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-prototype-throws.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-prototype-throws.js new file mode 100644 index 000000000..b171826cf --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-prototype-throws.js @@ -0,0 +1,62 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt from buffer.constructor.@@species.prototype +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 17. If SameValue(elementType, srcType) is true, then + a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) + + ... + 2. If cloneConstructor is not present, then + a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). + ... + 8. Let targetBuffer be ? AllocateArrayBuffer(cloneConstructor, cloneLength). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + 7. If IsConstructor(S) is true, return S. + ... + + 24.1.1.1 AllocateArrayBuffer ( constructor, byteLength ) + + ... + 1. Let obj be ? OrdinaryCreateFromConstructor(constructor, + "%ArrayBufferPrototype%", « [[ArrayBufferData]], [[ArrayBufferByteLength]] » ) + ... +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(); + var ctor = {}; + + sample.buffer.constructor = ctor; + + ctor[Symbol.species] = function(){}.bind(null); + Object.defineProperty(ctor[Symbol.species], "prototype", { + get() { + throw new Test262Error(); + } + }); + + assert.throws(Test262Error, function() { + new TA(sample); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-throws.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-throws.js new file mode 100644 index 000000000..ec2aaf3c1 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-throws.js @@ -0,0 +1,49 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt from getting typedArray argument's buffer.constructor.@@species +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 17. If SameValue(elementType, srcType) is true, then + a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) + + ... + 2. If cloneConstructor is not present, then + a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + ... +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(); + var ctor = {}; + + sample.buffer.constructor = ctor; + Object.defineProperty(ctor, Symbol.species, { + get() { + throw new Test262Error(); + } + }); + + assert.throws(Test262Error, function() { + new TA(sample); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-undefined.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-undefined.js new file mode 100644 index 000000000..339d3041b --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-undefined.js @@ -0,0 +1,49 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Use default ArrayBuffer constructor on undefined buffer.constructor.@@species +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 17. If SameValue(elementType, srcType) is true, then + a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) + + ... + 2. If cloneConstructor is not present, then + a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + ... +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(4); + var ctor = {}; + + sample.buffer.constructor = ctor; + + ctor[Symbol.species] = undefined; + var typedArray = new TA(sample); + assert.sameValue( + Object.getPrototypeOf(typedArray.buffer), + ArrayBuffer.prototype, + "buffer ctor is not called when species is undefined" + ); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-value-not-obj-throws.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-value-not-obj-throws.js new file mode 100644 index 000000000..ef9709749 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-value-not-obj-throws.js @@ -0,0 +1,65 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt completion from typedArray argument's buffer.constructor's value +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 17. If SameValue(elementType, srcType) is true, then + a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) + + ... + 2. If cloneConstructor is not present, then + a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 2. Let C be ? Get(O, "constructor"). + ... + 4. If Type(C) is not Object, throw a TypeError exception. + ... +includes: [testTypedArray.js] +features: [Symbol, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(); + + sample.buffer.constructor = 1; + assert.throws(TypeError, function() { + new TA(sample); + }); + + sample.buffer.constructor = true; + assert.throws(TypeError, function() { + new TA(sample); + }); + + sample.buffer.constructor = ''; + assert.throws(TypeError, function() { + new TA(sample); + }); + + sample.buffer.constructor = null; + assert.throws(TypeError, function() { + new TA(sample); + }); + + var s = Symbol('1'); + sample.buffer.constructor = s; + assert.throws(TypeError, function() { + new TA(sample); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-returns-new-cloned-typedarray.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-returns-new-cloned-typedarray.js new file mode 100644 index 000000000..4d9b442c9 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-returns-new-cloned-typedarray.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Same typedArray ctor argument returns a new cloned typedArray +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 17. If SameValue(elementType, srcType) is true, then + a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). + ... + 23. Return O. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(7); + var typedArray = new TA(sample); + + assert.sameValue(typedArray.length, 7); + assert.notSameValue(typedArray, sample); + assert.notSameValue(typedArray.buffer, sample.buffer); + assert.sameValue(typedArray.constructor, TA); + assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-undefined-newtarget-throws.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-undefined-newtarget-throws.js new file mode 100644 index 000000000..12839b2d7 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-undefined-newtarget-throws.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Throws a TypeError if NewTarget is undefined. +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 2. If NewTarget is undefined, throw a TypeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var typedArray = new TA(4); + + assert.throws(TypeError, function() { + TA(typedArray); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-use-custom-proto-if-object.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-use-custom-proto-if-object.js new file mode 100644 index 000000000..2745fc5e2 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-use-custom-proto-if-object.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Use prototype from new target if it's an Object +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [Reflect, TypedArray] +---*/ + +function newTarget() {} +var proto = {}; +newTarget.prototype = proto; + +var sample = new Int8Array(8); + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [sample], newTarget); + + assert.sameValue(ta.constructor, Object); + assert.sameValue(Object.getPrototypeOf(ta), proto); +}, numericTypedArrayConstructors); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-use-default-proto-if-custom-proto-is-not-object.js new file mode 100644 index 000000000..ec1997e91 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-use-default-proto-if-custom-proto-is-not-object.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Use prototype from %TypedArray% if newTarget's prototype is not an Object +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +function newTarget() {} +newTarget.prototype = null; + +var sample = new Int8Array(8); + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [sample], newTarget); + + assert.sameValue(ta.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); +}, numericTypedArrayConstructors); diff --git a/test/built-ins/TypedArrays/length-arg-custom-proto-access-throws.js b/test/built-ins/TypedArrays/length-arg-custom-proto-access-throws.js deleted file mode 100644 index 6ad49fdab..000000000 --- a/test/built-ins/TypedArrays/length-arg-custom-proto-access-throws.js +++ /dev/null @@ -1,43 +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. -/*--- -esid: sec-typedarray-length -description: > - Return abrupt completion getting newTarget's prototype -info: | - 22.2.4.2 TypedArray ( length ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is not Object. - - ... - 8. Return ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%, elementLength). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - ... - - 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) - - ... - 3. Let proto be ? Get(constructor, "prototype"). - ... -includes: [testTypedArray.js] -features: [Reflect, TypedArray] ----*/ - -var newTarget = function() {}.bind(null); -Object.defineProperty(newTarget, "prototype", { - get() { - throw new Test262Error(); - } -}); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(Test262Error, function() { - Reflect.construct(TA, [1], newTarget); - }); -}); diff --git a/test/built-ins/TypedArrays/length-arg-init-zeros.js b/test/built-ins/TypedArrays/length-arg-init-zeros.js deleted file mode 100644 index 384e2399b..000000000 --- a/test/built-ins/TypedArrays/length-arg-init-zeros.js +++ /dev/null @@ -1,55 +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. -/*--- -esid: sec-typedarray-length -description: All bytes are initialized to zero -info: | - 22.2.4.2 TypedArray ( length ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is not Object. - - ... - 8. Return ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%, elementLength). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 5. If length was not passed, then - ... - 6. Else, - a. Perform ? AllocateTypedArrayBuffer(obj, length). - - 22.2.4.2.2 Runtime Semantics: AllocateTypedArrayBuffer - - 7. Let data be ? AllocateArrayBuffer(%ArrayBuffer%, byteLength). - - 24.1.1.1 AllocateArrayBuffer - - 3. Let block be ? CreateByteDataBlock(byteLength). - - 6.2.6.1 CreateByteDataBlock - - 1. Assert: size≥0. - 2. Let db be a new Data Block value consisting of size bytes. If it is - impossible to create such a Data Block, throw a RangeError exception. - 3. Set all of the bytes of db to 0. - 4. Return db. -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA, N) { - var subject = new TA(9); - - assert.sameValue(subject[0], N(0), 'index 0'); - assert.sameValue(subject[1], N(0), 'index 1'); - assert.sameValue(subject[2], N(0), 'index 2'); - assert.sameValue(subject[3], N(0), 'index 3'); - assert.sameValue(subject[4], N(0), 'index 4'); - assert.sameValue(subject[5], N(0), 'index 5'); - assert.sameValue(subject[6], N(0), 'index 6'); - assert.sameValue(subject[7], N(0), 'index 7'); - assert.sameValue(subject[8], N(0), 'index 8'); -}); diff --git a/test/built-ins/TypedArrays/length-arg-is-infinity-throws-rangeerror.js b/test/built-ins/TypedArrays/length-arg-is-infinity-throws-rangeerror.js deleted file mode 100644 index 0084d5d6a..000000000 --- a/test/built-ins/TypedArrays/length-arg-is-infinity-throws-rangeerror.js +++ /dev/null @@ -1,27 +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. -/*--- -esid: sec-typedarray-length -description: > - Throws a RangeError if length is a Infinity value -info: | - 22.2.4.2 TypedArray ( length ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is not Object. - - ... - 4. Let numberLength be ? ToNumber(length). - 5. Let elementLength be ToLength(numberLength). - 6. If SameValueZero(numberLength, elementLength) is false, throw a RangeError - exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - assert.throws(RangeError, function() { - new TA(Infinity); - }); -}); diff --git a/test/built-ins/TypedArrays/length-arg-is-negative-integer-throws-rangeerror.js b/test/built-ins/TypedArrays/length-arg-is-negative-integer-throws-rangeerror.js deleted file mode 100644 index 0ff5d5a3f..000000000 --- a/test/built-ins/TypedArrays/length-arg-is-negative-integer-throws-rangeerror.js +++ /dev/null @@ -1,37 +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. -/*--- -esid: sec-typedarray-length -description: > - Throws a RangeError if ToInteger(length) is a negative value -info: | - 22.2.4.2 TypedArray ( length ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is not Object. - - ... - 3. Let elementLength be ? ToIndex(length). - ... - - 7.1.17 ToIndex ( value ) - - 1. If value is undefined, then - ... - 2. Else, - a. Let integerIndex be ? ToInteger(value). - b. If integerIndex < 0, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - assert.throws(RangeError, function() { - new TA(-1); - }); - - assert.throws(RangeError, function() { - new TA(-Infinity); - }); -}); diff --git a/test/built-ins/TypedArrays/length-arg-is-symbol-throws.js b/test/built-ins/TypedArrays/length-arg-is-symbol-throws.js deleted file mode 100644 index 797dd4922..000000000 --- a/test/built-ins/TypedArrays/length-arg-is-symbol-throws.js +++ /dev/null @@ -1,26 +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. -/*--- -esid: sec-typedarray-length -description: > - If length is a Symbol, throw a TypeError exception. -info: | - 22.2.4.2 TypedArray ( length ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is not Object. - - ... - 4. Let numberLength be ? ToNumber(length). - ... -includes: [testTypedArray.js] -features: [Symbol, TypedArray] ----*/ - -var s = Symbol('1'); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(TypeError, function() { - new TA(s); - }); -}); diff --git a/test/built-ins/TypedArrays/length-arg-new-instance-extensibility.js b/test/built-ins/TypedArrays/length-arg-new-instance-extensibility.js deleted file mode 100644 index d9b03deca..000000000 --- a/test/built-ins/TypedArrays/length-arg-new-instance-extensibility.js +++ /dev/null @@ -1,38 +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. -/*--- -esid: sec-typedarray-length -description: > - The new typedArray instance from a length argument is extensible -info: | - 22.2.4.2 TypedArray ( length ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is not Object. - - ... - 8. Return ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%, elementLength). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - ... - 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 11. Set the [[Extensible]] internal slot of A to true. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var sample = new TA(4); - - assert(Object.isExtensible(sample)); -}); diff --git a/test/built-ins/TypedArrays/length-arg-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/length-arg-proto-from-ctor-realm.js deleted file mode 100644 index f4effc208..000000000 --- a/test/built-ins/TypedArrays/length-arg-proto-from-ctor-realm.js +++ /dev/null @@ -1,36 +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. -/*--- -esid: sec-typedarray-length -description: Default [[Prototype]] value derived from realm of the newTarget -info: | - [...] - 8. Return ? AllocateTypedArray(constructorName, NewTarget, - "%TypedArrayPrototype%", elementLength). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - [...] - - 9.1.14 GetPrototypeFromConstructor - - [...] - 3. Let proto be ? Get(constructor, "prototype"). - 4. If Type(proto) is not Object, then - a. Let realm be ? GetFunctionRealm(constructor). - b. Let proto be realm's intrinsic object named intrinsicDefaultProto. - 5. Return proto. -includes: [testTypedArray.js] -features: [cross-realm, Reflect, TypedArray] ----*/ - -var other = $262.createRealm().global; -var C = new other.Function(); -C.prototype = null; - -testWithTypedArrayConstructors(function(TA, N) { - var ta = Reflect.construct(TA, [0], C); - - assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); -}); diff --git a/test/built-ins/TypedArrays/length-arg-returns-object.js b/test/built-ins/TypedArrays/length-arg-returns-object.js deleted file mode 100644 index 8a9121d88..000000000 --- a/test/built-ins/TypedArrays/length-arg-returns-object.js +++ /dev/null @@ -1,33 +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. -/*--- -esid: sec-typedarray-length -description: > - Return a TypedArray object -info: | - 22.2.4.2 TypedArray ( length ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is not Object. - - ... - 8. Return ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%, elementLength). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - ... - 7. Return obj -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var typedArray = new TA(4); - var length = typedArray.length; - - assert.sameValue(length, 4, "length"); - assert.sameValue(typedArray.constructor, TA); - assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/length-arg-toindex-length.js b/test/built-ins/TypedArrays/length-arg-toindex-length.js deleted file mode 100644 index 4d16ff711..000000000 --- a/test/built-ins/TypedArrays/length-arg-toindex-length.js +++ /dev/null @@ -1,53 +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. -/*--- -esid: sec-typedarray-length -description: > - ToIndex(length) operations -info: | - 22.2.4.2 TypedArray ( length ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is not Object. - - ... - 3. Let elementLength be ? ToIndex(length). - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var items = [ - [-0, 0, "-0"], - ["", 0, "the Empty string"], - ["0", 0, "string '0'"], - ["1", 1, "string '1'"], - [true, 1, "true"], - [false, 0, "false"], - [NaN, 0, "NaN"], - [null, 0, "null"], - [undefined, 0, "undefined"], - [0.1, 0, "0.1"], - [0.9, 0, "0.9"], - [1.1, 1, "1.1"], - [1.9, 1, "1.9"], - [-0.1, 0, "-0.1"], - [-0.99999, 0, "-0.99999"] -]; - -testWithTypedArrayConstructors(function(TA) { - items.forEach(function(item) { - var len = item[0]; - var expected = item[1]; - var name = item[2]; - - var typedArray = new TA(len); - assert.sameValue(typedArray.length, expected, name + " length"); - assert.sameValue(typedArray.constructor, TA, name + " constructor"); - assert.sameValue( - Object.getPrototypeOf(typedArray), - TA.prototype, - name + " prototype" - ); - }); -}); diff --git a/test/built-ins/TypedArrays/length-arg-undefined-newtarget-throws.js b/test/built-ins/TypedArrays/length-arg-undefined-newtarget-throws.js deleted file mode 100644 index 6a238255e..000000000 --- a/test/built-ins/TypedArrays/length-arg-undefined-newtarget-throws.js +++ /dev/null @@ -1,28 +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. -/*--- -esid: sec-typedarray-length -description: > - Throws a TypeError if NewTarget is undefined. -info: | - 22.2.4.2 TypedArray ( length ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is not Object. - - ... - 2. If NewTarget is undefined, throw a TypeError exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - assert.throws(TypeError, function() { - TA(0); - }); - - assert.throws(TypeError, function() { - TA(Infinity); - }); -}); diff --git a/test/built-ins/TypedArrays/length-arg-use-custom-proto-if-object.js b/test/built-ins/TypedArrays/length-arg-use-custom-proto-if-object.js deleted file mode 100644 index b36ff7014..000000000 --- a/test/built-ins/TypedArrays/length-arg-use-custom-proto-if-object.js +++ /dev/null @@ -1,44 +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. -/*--- -esid: sec-typedarray-length -description: > - Use prototype from new target if it's an Object -info: | - 22.2.4.2 TypedArray ( length ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is not Object. - - ... - 8. Return ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%, elementLength). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 10. Set the [[Prototype]] internal slot of A to prototype. - ... - 12. Return A. -includes: [testTypedArray.js] -features: [Reflect, TypedArray] ----*/ - -function newTarget() {} -var proto = {}; -newTarget.prototype = proto; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [1], newTarget); - - assert.sameValue(ta.constructor, Object); - assert.sameValue(Object.getPrototypeOf(ta), proto); -}); diff --git a/test/built-ins/TypedArrays/length-arg-use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/length-arg-use-default-proto-if-custom-proto-is-not-object.js deleted file mode 100644 index e5fc367c0..000000000 --- a/test/built-ins/TypedArrays/length-arg-use-default-proto-if-custom-proto-is-not-object.js +++ /dev/null @@ -1,43 +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. -/*--- -esid: sec-typedarray-length -description: > - Use prototype from %TypedArray% if newTarget's prototype is not an Object -info: | - 22.2.4.2 TypedArray ( length ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is not Object. - - ... - 8. Return ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%, elementLength). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 10. Set the [[Prototype]] internal slot of A to prototype. - ... - 12. Return A. -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -function newTarget() {} -newTarget.prototype = null; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [1], newTarget); - - assert.sameValue(ta.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/no-args-custom-proto-access-throws.js b/test/built-ins/TypedArrays/no-args-custom-proto-access-throws.js deleted file mode 100644 index 6b383e32e..000000000 --- a/test/built-ins/TypedArrays/no-args-custom-proto-access-throws.js +++ /dev/null @@ -1,43 +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. -/*--- -esid: sec-typedarray -description: > - Return abrupt completion getting newTarget's prototype -info: | - 22.2.4.1 TypedArray( ) - - This description applies only if the TypedArray function is called with no - arguments. - - ... - 3. Return ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%, 0). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - ... - - 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) - - ... - 3. Let proto be ? Get(constructor, "prototype"). - ... -includes: [testTypedArray.js] -features: [Reflect, TypedArray] ----*/ - -var newTarget = function() {}.bind(null); -Object.defineProperty(newTarget, "prototype", { - get() { - throw new Test262Error(); - } -}); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(Test262Error, function() { - Reflect.construct(TA, [], newTarget); - }); -}); diff --git a/test/built-ins/TypedArrays/no-args-new-instance-extensibility.js b/test/built-ins/TypedArrays/no-args-new-instance-extensibility.js deleted file mode 100644 index cced58d2e..000000000 --- a/test/built-ins/TypedArrays/no-args-new-instance-extensibility.js +++ /dev/null @@ -1,38 +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. -/*--- -esid: sec-typedarray -description: > - The new typedArray instance is extensible -info: | - 22.2.4.1 TypedArray( ) - - This description applies only if the TypedArray function is called with no - arguments. - - ... - 3. Return ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%, 0). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - ... - 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 11. Set the [[Extensible]] internal slot of A to true. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var sample = new TA(); - - assert(Object.isExtensible(sample)); -}); diff --git a/test/built-ins/TypedArrays/no-args-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/no-args-proto-from-ctor-realm.js deleted file mode 100644 index c69922185..000000000 --- a/test/built-ins/TypedArrays/no-args-proto-from-ctor-realm.js +++ /dev/null @@ -1,36 +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. -/*--- -esid: sec-typedarray -description: Default [[Prototype]] value derived from realm of the newTarget -info: | - [...] - 3. Return ? AllocateTypedArray(constructorName, NewTarget, - "%TypedArrayPrototype%", 0). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - [...] - - 9.1.14 GetPrototypeFromConstructor - - [...] - 3. Let proto be ? Get(constructor, "prototype"). - 4. If Type(proto) is not Object, then - a. Let realm be ? GetFunctionRealm(constructor). - b. Let proto be realm's intrinsic object named intrinsicDefaultProto. - 5. Return proto. -includes: [testTypedArray.js] -features: [cross-realm, Reflect, TypedArray] ----*/ - -var other = $262.createRealm().global; -var C = new other.Function(); -C.prototype = null; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [], C); - - assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); -}); diff --git a/test/built-ins/TypedArrays/no-args-returns-object.js b/test/built-ins/TypedArrays/no-args-returns-object.js deleted file mode 100644 index c7274e5f9..000000000 --- a/test/built-ins/TypedArrays/no-args-returns-object.js +++ /dev/null @@ -1,32 +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. -/*--- -esid: sec-typedarray -description: > - Return a TypedArray object -info: | - 22.2.4.1 TypedArray( ) - - This description applies only if the TypedArray function is called with no - arguments. - - ... - 3. Return ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%, 0). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - ... - 7. Return obj -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var typedArray = new TA(); - - assert.sameValue(typedArray.length, 0); - assert.sameValue(typedArray.constructor, TA); - assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/no-args-undefined-newtarget-throws.js b/test/built-ins/TypedArrays/no-args-undefined-newtarget-throws.js deleted file mode 100644 index a06139865..000000000 --- a/test/built-ins/TypedArrays/no-args-undefined-newtarget-throws.js +++ /dev/null @@ -1,23 +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. -/*--- -esid: sec-typedarray -description: > - Throws a TypeError if NewTarget is undefined. -info: | - 22.2.4.1 TypedArray( ) - - This description applies only if the TypedArray function is called with no - arguments. - - 1. If NewTarget is undefined, throw a TypeError exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - assert.throws(TypeError, function() { - TA(); - }); -}); diff --git a/test/built-ins/TypedArrays/no-args-use-custom-proto-if-object.js b/test/built-ins/TypedArrays/no-args-use-custom-proto-if-object.js deleted file mode 100644 index 4266724f0..000000000 --- a/test/built-ins/TypedArrays/no-args-use-custom-proto-if-object.js +++ /dev/null @@ -1,44 +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. -/*--- -esid: sec-typedarray -description: > - Use prototype from new target if it's an Object -info: | - 22.2.4.1 TypedArray( ) - - This description applies only if the TypedArray function is called with no - arguments. - - ... - 3. Return ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%, 0). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 10. Set the [[Prototype]] internal slot of A to prototype. - ... - 12. Return A. -includes: [testTypedArray.js] -features: [Reflect, TypedArray] ----*/ - -function newTarget() {} -var proto = {}; -newTarget.prototype = proto; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [], newTarget); - - assert.sameValue(ta.constructor, Object); - assert.sameValue(Object.getPrototypeOf(ta), proto); -}); diff --git a/test/built-ins/TypedArrays/no-args-use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/no-args-use-default-proto-if-custom-proto-is-not-object.js deleted file mode 100644 index e76ef585e..000000000 --- a/test/built-ins/TypedArrays/no-args-use-default-proto-if-custom-proto-is-not-object.js +++ /dev/null @@ -1,43 +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. -/*--- -esid: sec-typedarray -description: > - Use prototype from %TypedArray% if newTarget's prototype is not an Object -info: | - 22.2.4.1 TypedArray( ) - - This description applies only if the TypedArray function is called with no - arguments. - - ... - 3. Return ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%, 0). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 10. Set the [[Prototype]] internal slot of A to prototype. - ... - 12. Return A. -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -function newTarget() {} -newTarget.prototype = null; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [], newTarget); - - assert.sameValue(ta.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/object-arg-as-array-returns.js b/test/built-ins/TypedArrays/object-arg-as-array-returns.js deleted file mode 100644 index 6e15b4ea4..000000000 --- a/test/built-ins/TypedArrays/object-arg-as-array-returns.js +++ /dev/null @@ -1,28 +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. -/*--- -esid: sec-typedarray-object -description: > - Return typedArray from array argument -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var obj = [7, 42]; - -testWithTypedArrayConstructors(function(TA, N) { - var typedArray = new TA(N(obj)); - assert.sameValue(typedArray.length, 2); - assert.sameValue(typedArray[0], N(7)); - assert.sameValue(typedArray[1], N(42)); - assert.sameValue(typedArray.constructor, TA); - assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/object-arg-as-generator-iterable-returns.js b/test/built-ins/TypedArrays/object-arg-as-generator-iterable-returns.js deleted file mode 100644 index 7e2876294..000000000 --- a/test/built-ins/TypedArrays/object-arg-as-generator-iterable-returns.js +++ /dev/null @@ -1,30 +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. -/*--- -esid: sec-typedarray-object -description: > - Return typedArray from iterable argument -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA, N) { - var obj = (function *() { - yield N(7); yield N(42); - })(); - - var typedArray = new TA(obj); - assert.sameValue(typedArray.length, 2); - assert.sameValue(typedArray[0], N(7)); - assert.sameValue(typedArray[1], N(42)); - assert.sameValue(typedArray.constructor, TA); - assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/object-arg-conversion-operation-consistent-nan.js b/test/built-ins/TypedArrays/object-arg-conversion-operation-consistent-nan.js deleted file mode 100644 index a81d4c504..000000000 --- a/test/built-ins/TypedArrays/object-arg-conversion-operation-consistent-nan.js +++ /dev/null @@ -1,60 +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. -/*--- -esid: sec-typedarray-object -description: Consistent canonicalization of NaN values -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - - ... - 9. Repeat, while k < len - ... - c. Perform ? Set(O, Pk, kValue, true). - ... - - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) - - ... - 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). - ... - - 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , - isLittleEndian ] ) - - ... - 8. If type is "Float32", then - a. Set rawBytes to a List containing the 4 bytes that are the result - of converting value to IEEE 754-2008 binary32 format using “Round to - nearest, ties to even” rounding mode. If isLittleEndian is false, the - bytes are arranged in big endian order. Otherwise, the bytes are - arranged in little endian order. If value is NaN, rawValue may be set - to any implementation chosen IEEE 754-2008 binary64 format Not-a-Number - encoding. An implementation must always choose the same encoding for - each implementation distinguishable NaN value. - 9. Else, if type is "Float64", then - a. Set rawBytes to a List containing the 8 bytes that are the IEEE - 754-2008 binary64 format encoding of value. If isLittleEndian is false, - the bytes are arranged in big endian order. Otherwise, the bytes are - arranged in little endian order. If value is NaN, rawValue may be set - to any implementation chosen IEEE 754-2008 binary32 format Not-a-Number - encoding. An implementation must always choose the same encoding for - each implementation distinguishable NaN value. - ... -includes: [nans.js, testTypedArray.js, compareArray.js] ----*/ - -function body(FloatArray) { - var first = new FloatArray(distinctNaNs); - var second = new FloatArray(distinctNaNs); - var firstBytes = new Uint8Array(first.buffer); - var secondBytes = new Uint8Array(second.buffer); - - assert(compareArray(firstBytes, secondBytes)); -} - -testWithTypedArrayConstructors(body, [Float32Array, Float64Array]); diff --git a/test/built-ins/TypedArrays/object-arg-conversion-operation.js b/test/built-ins/TypedArrays/object-arg-conversion-operation.js deleted file mode 100644 index d14a14023..000000000 --- a/test/built-ins/TypedArrays/object-arg-conversion-operation.js +++ /dev/null @@ -1,52 +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. - -/*--- -esid: sec-typedarray-object -description: > - Verify conversion values on returned instance -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - - ... - 9. Repeat, while k < len - ... - c. Perform ? Set(O, Pk, kValue, true). - ... - - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) - - ... - 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). - ... - - 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , - isLittleEndian ] ) - - ... - 8. If type is "Float32", then - ... - 9. Else, if type is "Float64", then - ... - 10. Else, - ... - b. Let convOp be the abstract operation named in the Conversion Operation - column in Table 50 for Element Type type. - c. Let intValue be convOp(value). - d. If intValue ≥ 0, then - ... - e. Else, - ... -includes: [byteConversionValues.js, testTypedArray.js] ----*/ - -testTypedArrayConversions(byteConversionValues, function(TA, value, expected) { - var sample = new TA([value]); - - assert.sameValue(sample[0], expected, value + " converts to " + expected); -}); diff --git a/test/built-ins/TypedArrays/object-arg-custom-proto-access-throws.js b/test/built-ins/TypedArrays/object-arg-custom-proto-access-throws.js deleted file mode 100644 index f5ced4ea4..000000000 --- a/test/built-ins/TypedArrays/object-arg-custom-proto-access-throws.js +++ /dev/null @@ -1,48 +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. -/*--- -esid: sec-typedarray-object -description: > - Return abrupt completion getting newTarget's prototype -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - - ... - 3. Let O be ? AllocateTypedArray(TypedArray.[[TypedArrayConstructorName]], - NewTarget, "%TypedArrayPrototype%"). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - ... - - 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) - - ... - 3. Let proto be ? Get(constructor, "prototype"). - ... -includes: [testTypedArray.js] -features: [Reflect, TypedArray] ----*/ - -var newTarget = function() {}.bind(null); -Object.defineProperty(newTarget, "prototype", { - get() { - throw new Test262Error(); - } -}); - -var o = {}; - -testWithTypedArrayConstructors(function(TA) { - assert.throws(Test262Error, function() { - Reflect.construct(TA, [o], newTarget); - }); -}); diff --git a/test/built-ins/TypedArrays/object-arg-iterating-throws.js b/test/built-ins/TypedArrays/object-arg-iterating-throws.js deleted file mode 100644 index 41fc55509..000000000 --- a/test/built-ins/TypedArrays/object-arg-iterating-throws.js +++ /dev/null @@ -1,31 +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. -/*--- -esid: sec-typedarray-object -description: > - Return abrupt from iterating object argument -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - - ... - 4. Let arrayLike be ? IterableToArrayLike(object). - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var obj = (function *() { - yield 0; - throw new Test262Error(); - })(); - - assert.throws(Test262Error, function() { - new TA(obj); - }); -}); diff --git a/test/built-ins/TypedArrays/object-arg-iterator-not-callable-throws.js b/test/built-ins/TypedArrays/object-arg-iterator-not-callable-throws.js deleted file mode 100644 index ad6db0877..000000000 --- a/test/built-ins/TypedArrays/object-arg-iterator-not-callable-throws.js +++ /dev/null @@ -1,39 +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. -/*--- -esid: sec-typedarray-object -description: > - Return abrupt when object @@iterator is not callable -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - - ... - 4. Let arrayLike be ? IterableToArrayLike(object). - ... -includes: [testTypedArray.js] -features: [Symbol.iterator, TypedArray] ----*/ - -var obj = function () {}; - -testWithTypedArrayConstructors(function(TA) { - obj[Symbol.iterator] = {}; - assert.throws(TypeError, function() { - new TA(obj); - }); - - obj[Symbol.iterator] = true; - assert.throws(TypeError, function() { - new TA(obj); - }); - - obj[Symbol.iterator] = 42; - assert.throws(TypeError, function() { - new TA(obj); - }); -}); diff --git a/test/built-ins/TypedArrays/object-arg-iterator-throws.js b/test/built-ins/TypedArrays/object-arg-iterator-throws.js deleted file mode 100644 index 571ad77ad..000000000 --- a/test/built-ins/TypedArrays/object-arg-iterator-throws.js +++ /dev/null @@ -1,34 +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. -/*--- -esid: sec-typedarray-object -description: > - Return abrupt from getting object @@iterator -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - - ... - 4. Let arrayLike be ? IterableToArrayLike(object). - ... -includes: [testTypedArray.js] -features: [Symbol.iterator, TypedArray] ----*/ - -var obj = function () {}; - -Object.defineProperty(obj, Symbol.iterator, { - get() { - throw new Test262Error(); - } -}); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(Test262Error, function() { - new TA(obj); - }); -}); diff --git a/test/built-ins/TypedArrays/object-arg-length-excessive-throws.js b/test/built-ins/TypedArrays/object-arg-length-excessive-throws.js deleted file mode 100644 index f8279f50a..000000000 --- a/test/built-ins/TypedArrays/object-arg-length-excessive-throws.js +++ /dev/null @@ -1,30 +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. -/*--- -esid: sec-typedarray-object -description: > - Return abrupt from allocating array buffer with excessive length -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - - ... - 6. Perform ? AllocateTypedArrayBuffer(O, len). - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var obj = { - length: Math.pow(2, 53) -}; - -testWithTypedArrayConstructors(function(TA) { - assert.throws(RangeError, function() { - new TA(obj); - }); -}); diff --git a/test/built-ins/TypedArrays/object-arg-length-is-symbol-throws.js b/test/built-ins/TypedArrays/object-arg-length-is-symbol-throws.js deleted file mode 100644 index b452dea03..000000000 --- a/test/built-ins/TypedArrays/object-arg-length-is-symbol-throws.js +++ /dev/null @@ -1,30 +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. -/*--- -esid: sec-typedarray-object -description: > - Return abrupt from length property as a Symbol on the object argument -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - - ... - 5. Let len be ? ToLength(? Get(arrayLike, "length")). - ... -includes: [testTypedArray.js] -features: [Symbol, TypedArray] ----*/ - -var obj = { - length: Symbol("1") -}; - -testWithTypedArrayConstructors(function(TA) { - assert.throws(TypeError, function() { - new TA(obj); - }); -}); diff --git a/test/built-ins/TypedArrays/object-arg-length-throws.js b/test/built-ins/TypedArrays/object-arg-length-throws.js deleted file mode 100644 index 08f8cd130..000000000 --- a/test/built-ins/TypedArrays/object-arg-length-throws.js +++ /dev/null @@ -1,34 +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. -/*--- -esid: sec-typedarray-object -description: > - Return abrupt from getting length property on the object argument -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - - ... - 5. Let len be ? ToLength(? Get(arrayLike, "length")). - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var obj = {}; - -Object.defineProperty(obj, "length", { - get() { - throw new Test262Error(); - } -}); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(Test262Error, function() { - new TA(obj); - }); -}); diff --git a/test/built-ins/TypedArrays/object-arg-new-instance-extensibility.js b/test/built-ins/TypedArrays/object-arg-new-instance-extensibility.js deleted file mode 100644 index bd335774b..000000000 --- a/test/built-ins/TypedArrays/object-arg-new-instance-extensibility.js +++ /dev/null @@ -1,43 +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. -/*--- -esid: sec-typedarray-object -description: > - The new typedArray instance from an object argument is extensible -info: | - 22.2.4.4 TypedArray ( object ) - - ... - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - "%TypedArrayPrototype%"). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - ... - 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 11. Set the [[Extensible]] internal slot of A to true. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA, N) { - var obj = { - "0": N(0), - "1": N(1), - "2": N(2), - length: 3 - }; - - var sample = new TA(obj); - - assert(Object.isExtensible(sample)); -}); diff --git a/test/built-ins/TypedArrays/object-arg-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/object-arg-proto-from-ctor-realm.js deleted file mode 100644 index a92ceee00..000000000 --- a/test/built-ins/TypedArrays/object-arg-proto-from-ctor-realm.js +++ /dev/null @@ -1,37 +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. -/*--- -esid: sec-typedarray-object -description: Default [[Prototype]] value derived from realm of the newTarget -info: | - [...] - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - "%TypedArrayPrototype%"). - [...] - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - [...] - - 9.1.14 GetPrototypeFromConstructor - - [...] - 3. Let proto be ? Get(constructor, "prototype"). - 4. If Type(proto) is not Object, then - a. Let realm be ? GetFunctionRealm(constructor). - b. Let proto be realm's intrinsic object named intrinsicDefaultProto. - 5. Return proto. -includes: [testTypedArray.js] -features: [cross-realm, Reflect, TypedArray] ----*/ - -var other = $262.createRealm().global; -var C = new other.Function(); -C.prototype = null; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [{}], C); - - assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); -}); diff --git a/test/built-ins/TypedArrays/object-arg-returns.js b/test/built-ins/TypedArrays/object-arg-returns.js deleted file mode 100644 index cb06ba220..000000000 --- a/test/built-ins/TypedArrays/object-arg-returns.js +++ /dev/null @@ -1,47 +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. -/*--- -esid: sec-typedarray-object -description: > - Return typedArray from object argument -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - -includes: [testTypedArray.js] -features: [Symbol, TypedArray] ----*/ - -var obj = { - "0": null, - "2": 42, - "3": "7", - "4": NaN, - "5": Symbol("1"), - length: 5 -}; - -testWithTypedArrayConstructors(function(TA) { - var typedArray = new TA(obj); - assert.sameValue(typedArray.length, 5); - assert.sameValue(typedArray[0], 0); - assert.sameValue(typedArray[2], 42); - assert.sameValue(typedArray[3], 7); - assert.sameValue(typedArray[5], undefined); - assert.sameValue(typedArray.constructor, TA); - assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); - - if (TA === Float32Array || TA === Float64Array) { - assert.sameValue(typedArray[1], NaN); - assert.sameValue(typedArray[4], NaN); - } else { - assert.sameValue(typedArray[1], 0); - assert.sameValue(typedArray[4], 0); - } -}, - // Cannot create Big*64Arrays from non-safe integers. - numericTypedArrayConstructors); diff --git a/test/built-ins/TypedArrays/object-arg-throws-from-property.js b/test/built-ins/TypedArrays/object-arg-throws-from-property.js deleted file mode 100644 index 4a0d60825..000000000 --- a/test/built-ins/TypedArrays/object-arg-throws-from-property.js +++ /dev/null @@ -1,40 +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. -/*--- -esid: sec-typedarray-object -description: > - Return abrupt from getting object property -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - - ... - 8. Repeat, while k < len - ... - b. Let kValue be ? Get(arrayLike, Pk). - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var obj = { - length: 4 -}; - -Object.defineProperty(obj, "2", { - get() { - throw new Test262Error(); - } -}); - -testWithTypedArrayConstructors(function(TA, N) { - obj[0] = N(0); - obj[1] = N(0); - assert.throws(Test262Error, function() { - new TA(obj); - }); -}); diff --git a/test/built-ins/TypedArrays/object-arg-throws-setting-obj-to-primitive-typeerror.js b/test/built-ins/TypedArrays/object-arg-throws-setting-obj-to-primitive-typeerror.js deleted file mode 100644 index 3aee05e56..000000000 --- a/test/built-ins/TypedArrays/object-arg-throws-setting-obj-to-primitive-typeerror.js +++ /dev/null @@ -1,77 +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. -/*--- -esid: sec-typedarray-object -description: > - Throw TypeError from @@toPrimitive returning an Object when setting a property -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - - ... - 8. Repeat, while k < len - ... - b. Let kValue be ? Get(arrayLike, Pk). - c. Perform ? Set(O, Pk, kValue, true). - ... - - 9.4.5.5 [[Set]] ( P, V, Receiver) - - ... - 2. If Type(P) is String and if SameValue(O, Receiver) is true, then - a. Let numericIndex be ! CanonicalNumericIndexString(P). - b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). - ... - - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) - - ... - 3. Let numValue be ? ToNumber(value). - ... - - 7.1.3 ToNumber ( argument ) - - Object, Apply the following steps: - - 1. Let primValue be ? ToPrimitive(argument, hint Number). - 2. Return ? ToNumber(primValue). - - 7.1.1 ToPrimitive ( input [ , PreferredType ] ) - - ... - 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive). - 5. If exoticToPrim is not undefined, then - a. Let result be ? Call(exoticToPrim, input, « hint »). - b. If Type(result) is not Object, return result. - c. Throw a TypeError exception. - ... -includes: [testTypedArray.js] -features: [Symbol.toPrimitive, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA, N) { - var sample = new Int8Array(1); - var toPrimitive = 0; - var valueOf = 0; - - sample[Symbol.toPrimitive] = function() { - toPrimitive++; - return {}; - }; - - sample.valueOf = function() { - valueOf++; - }; - - assert.throws(TypeError, function() { - new TA([N(8), sample]); - }, "abrupt completion from sample @@toPrimitive"); - - assert.sameValue(toPrimitive, 1, "toPrimitive was called once"); - assert.sameValue(valueOf, 0, "sample.valueOf is not called"); -}); diff --git a/test/built-ins/TypedArrays/object-arg-throws-setting-obj-to-primitive.js b/test/built-ins/TypedArrays/object-arg-throws-setting-obj-to-primitive.js deleted file mode 100644 index 516586863..000000000 --- a/test/built-ins/TypedArrays/object-arg-throws-setting-obj-to-primitive.js +++ /dev/null @@ -1,75 +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. -/*--- -esid: sec-typedarray-object -description: > - Return abrupt from @@toPrimitive when setting a property -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - - ... - 8. Repeat, while k < len - ... - b. Let kValue be ? Get(arrayLike, Pk). - c. Perform ? Set(O, Pk, kValue, true). - ... - - 9.4.5.5 [[Set]] ( P, V, Receiver) - - ... - 2. If Type(P) is String and if SameValue(O, Receiver) is true, then - a. Let numericIndex be ! CanonicalNumericIndexString(P). - b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). - ... - - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) - - ... - 3. Let numValue be ? ToNumber(value). - ... - - 7.1.3 ToNumber ( argument ) - - Object, Apply the following steps: - - 1. Let primValue be ? ToPrimitive(argument, hint Number). - 2. Return ? ToNumber(primValue). - - 7.1.1 ToPrimitive ( input [ , PreferredType ] ) - - ... - 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive). - 5. If exoticToPrim is not undefined, then - a. Let result be ? Call(exoticToPrim, input, « hint »). - ... -includes: [testTypedArray.js] -features: [Symbol.toPrimitive, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA, N) { - var sample = new Int8Array(1); - var toPrimitive = 0; - var valueOf = 0; - - sample[Symbol.toPrimitive] = function() { - toPrimitive++; - throw new Test262Error(); - }; - - sample.valueOf = function() { - valueOf++; - }; - - assert.throws(Test262Error, function() { - new TA([N(8), sample]); - }, "abrupt completion from sample @@toPrimitive"); - - assert.sameValue(toPrimitive, 1, "toPrimitive was called once"); - assert.sameValue(valueOf, 0, "it does not call sample.valueOf"); -}); diff --git a/test/built-ins/TypedArrays/object-arg-throws-setting-obj-tostring.js b/test/built-ins/TypedArrays/object-arg-throws-setting-obj-tostring.js deleted file mode 100644 index 3e2d84e75..000000000 --- a/test/built-ins/TypedArrays/object-arg-throws-setting-obj-tostring.js +++ /dev/null @@ -1,88 +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. -/*--- -esid: sec-typedarray-object -description: > - Return abrupt from toString() when setting a property -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - - ... - 8. Repeat, while k < len - ... - b. Let kValue be ? Get(arrayLike, Pk). - c. Perform ? Set(O, Pk, kValue, true). - ... - - 9.4.5.5 [[Set]] ( P, V, Receiver) - - ... - 2. If Type(P) is String and if SameValue(O, Receiver) is true, then - a. Let numericIndex be ! CanonicalNumericIndexString(P). - b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). - ... - - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) - - ... - 3. Let numValue be ? ToNumber(value). - ... - - 7.1.3 ToNumber ( argument ) - - Object, Apply the following steps: - - 1. Let primValue be ? ToPrimitive(argument, hint Number). - 2. Return ? ToNumber(primValue). - - 7.1.1 ToPrimitive ( input [ , PreferredType ] ) - - ... - 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive). - 5. If exoticToPrim is not undefined, then - a. Let result be ? Call(exoticToPrim, input, « hint »). - b. If Type(result) is not Object, return result. - c. Throw a TypeError exception. - ... - 7. Return ? OrdinaryToPrimitive(input, hint). - - OrdinaryToPrimitive - - ... - 5. For each name in methodNames in List order, do - a. Let method be ? Get(O, name). - b. If IsCallable(method) is true, then - i. Let result be ? Call(method, O). - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA, N) { - var sample = new Int8Array(1); - var valueOf = 0; - var toString = 0; - - sample.valueOf = function() { - valueOf++; - return {}; - }; - - sample.toString = function() { - toString++; - throw new Test262Error(); - }; - - assert.throws(Test262Error, function() { - new TA([N(8), sample]); - }, "abrupt completion from ToNumber(sample)"); - - assert.sameValue(valueOf, 1, "valueOf called once"); - assert.sameValue(toString, 1, "toString called once"); -}); diff --git a/test/built-ins/TypedArrays/object-arg-throws-setting-obj-valueof-typeerror.js b/test/built-ins/TypedArrays/object-arg-throws-setting-obj-valueof-typeerror.js deleted file mode 100644 index c58fe2425..000000000 --- a/test/built-ins/TypedArrays/object-arg-throws-setting-obj-valueof-typeerror.js +++ /dev/null @@ -1,89 +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. -/*--- -esid: sec-typedarray-object -description: > - Throw TypeError from OrdinaryToPrimitive when setting a property -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - - ... - 8. Repeat, while k < len - ... - b. Let kValue be ? Get(arrayLike, Pk). - c. Perform ? Set(O, Pk, kValue, true). - ... - - 9.4.5.5 [[Set]] ( P, V, Receiver) - - ... - 2. If Type(P) is String and if SameValue(O, Receiver) is true, then - a. Let numericIndex be ! CanonicalNumericIndexString(P). - b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). - ... - - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) - - ... - 3. Let numValue be ? ToNumber(value). - ... - - 7.1.3 ToNumber ( argument ) - - Object, Apply the following steps: - - 1. Let primValue be ? ToPrimitive(argument, hint Number). - 2. Return ? ToNumber(primValue). - - 7.1.1 ToPrimitive ( input [ , PreferredType ] ) - - ... - 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive). - 5. If exoticToPrim is not undefined, then - a. Let result be ? Call(exoticToPrim, input, « hint »). - b. If Type(result) is not Object, return result. - c. Throw a TypeError exception. - ... - 7. Return ? OrdinaryToPrimitive(input, hint). - - OrdinaryToPrimitive - - ... - 5. For each name in methodNames in List order, do - a. Let method be ? Get(O, name). - b. If IsCallable(method) is true, then - i. Let result be ? Call(method, O). - ii. If Type(result) is not Object, return result. - 6. Throw a TypeError exception. -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA, N) { - var sample = new Int8Array(1); - var valueOf = 0; - var toString = 0; - - sample.valueOf = function() { - valueOf++; - return {}; - }; - - sample.toString = function() { - toString++; - return {}; - }; - - assert.throws(TypeError, function() { - new TA([N(8), sample]); - }, "abrupt completion from ToNumber(sample)"); - - assert.sameValue(valueOf, 1, "valueOf called once"); - assert.sameValue(toString, 1, "toString called once"); -}); diff --git a/test/built-ins/TypedArrays/object-arg-throws-setting-obj-valueof.js b/test/built-ins/TypedArrays/object-arg-throws-setting-obj-valueof.js deleted file mode 100644 index ae4515f34..000000000 --- a/test/built-ins/TypedArrays/object-arg-throws-setting-obj-valueof.js +++ /dev/null @@ -1,82 +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. -/*--- -esid: sec-typedarray-object -description: > - Return abrupt from valueOf() when setting a property -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - - ... - 8. Repeat, while k < len - ... - b. Let kValue be ? Get(arrayLike, Pk). - c. Perform ? Set(O, Pk, kValue, true). - ... - - 9.4.5.5 [[Set]] ( P, V, Receiver) - - ... - 2. If Type(P) is String and if SameValue(O, Receiver) is true, then - a. Let numericIndex be ! CanonicalNumericIndexString(P). - b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). - ... - - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) - - ... - 3. Let numValue be ? ToNumber(value). - ... - - 7.1.3 ToNumber ( argument ) - - Object, Apply the following steps: - - 1. Let primValue be ? ToPrimitive(argument, hint Number). - 2. Return ? ToNumber(primValue). - - 7.1.1 ToPrimitive ( input [ , PreferredType ] ) - - ... - 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive). - 5. If exoticToPrim is not undefined, then - a. Let result be ? Call(exoticToPrim, input, « hint »). - b. If Type(result) is not Object, return result. - c. Throw a TypeError exception. - ... - 7. Return ? OrdinaryToPrimitive(input, hint). - - OrdinaryToPrimitive - - ... - 5. For each name in methodNames in List order, do - a. Let method be ? Get(O, name). - b. If IsCallable(method) is true, then - i. Let result be ? Call(method, O). - ii. If Type(result) is not Object, return result. - 6. Throw a TypeError exception. -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA, N) { - var sample = new Int8Array(1); - var valueOf = 0; - - sample.valueOf = function() { - valueOf++; - throw new Test262Error(); - }; - - assert.throws(Test262Error, function() { - new TA([N(8), sample]); - }, "abrupt completion from ToNumber(sample)"); - - assert.sameValue(valueOf, 1, "valueOf called once"); -}); diff --git a/test/built-ins/TypedArrays/object-arg-throws-setting-property.js b/test/built-ins/TypedArrays/object-arg-throws-setting-property.js deleted file mode 100644 index 489234c90..000000000 --- a/test/built-ins/TypedArrays/object-arg-throws-setting-property.js +++ /dev/null @@ -1,40 +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. -/*--- -esid: sec-typedarray-object -description: > - Return abrupt from setting property -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - - ... - 8. Repeat, while k < len - ... - b. Let kValue be ? Get(arrayLike, Pk). - c. Perform ? Set(O, Pk, kValue, true). - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var obj = { - "2": { - valueOf() { - throw new Test262Error(); - } - }, - length: 4 -}; - -testWithTypedArrayConstructors(function(TA, N) { - obj[0] = N(0); - obj[1] = N(0); - assert.throws(Test262Error, function() { - new TA(obj); - }); -}); diff --git a/test/built-ins/TypedArrays/object-arg-throws-setting-symbol-property.js b/test/built-ins/TypedArrays/object-arg-throws-setting-symbol-property.js deleted file mode 100644 index 42b4a54b8..000000000 --- a/test/built-ins/TypedArrays/object-arg-throws-setting-symbol-property.js +++ /dev/null @@ -1,34 +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. -/*--- -esid: sec-typedarray-object -description: > - Return abrupt from setting property -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - - ... - 8. Repeat, while k < len - ... - b. Let kValue be ? Get(arrayLike, Pk). - c. Perform ? Set(O, Pk, kValue, true). - ... -includes: [testTypedArray.js] -features: [Symbol, TypedArray] ----*/ - -var obj = { - "2": Symbol("1"), - length: 4 -}; - -testWithTypedArrayConstructors(function(TA) { - assert.throws(TypeError, function() { - new TA(obj); - }); -}); diff --git a/test/built-ins/TypedArrays/object-arg-undefined-newtarget-throws.js b/test/built-ins/TypedArrays/object-arg-undefined-newtarget-throws.js deleted file mode 100644 index 36f68493a..000000000 --- a/test/built-ins/TypedArrays/object-arg-undefined-newtarget-throws.js +++ /dev/null @@ -1,30 +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. -/*--- -esid: sec-typedarray-object -description: > - Throws a TypeError if NewTarget is undefined. -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - - ... - 2. If NewTarget is undefined, throw a TypeError exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - assert.throws(TypeError, function() { - TA({}); - }); - - assert.throws(TypeError, function() { - TA([]); - }); -}); diff --git a/test/built-ins/TypedArrays/object-arg-use-custom-proto-if-object.js b/test/built-ins/TypedArrays/object-arg-use-custom-proto-if-object.js deleted file mode 100644 index bb5754a9c..000000000 --- a/test/built-ins/TypedArrays/object-arg-use-custom-proto-if-object.js +++ /dev/null @@ -1,47 +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. -/*--- -esid: sec-typedarray-object -description: > - Use prototype from new target if it's an Object -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - - ... - 3. Let O be ? AllocateTypedArray(TypedArray.[[TypedArrayConstructorName]], - NewTarget, "%TypedArrayPrototype%"). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 10. Set the [[Prototype]] internal slot of A to prototype. - ... - 12. Return A. -includes: [testTypedArray.js] -features: [Reflect, TypedArray] ----*/ - -function newTarget() {} -var proto = {}; -newTarget.prototype = proto; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [], newTarget); - - assert.sameValue(ta.constructor, Object); - assert.sameValue(Object.getPrototypeOf(ta), proto); -}); diff --git a/test/built-ins/TypedArrays/object-arg-use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/object-arg-use-default-proto-if-custom-proto-is-not-object.js deleted file mode 100644 index 6aba187c2..000000000 --- a/test/built-ins/TypedArrays/object-arg-use-default-proto-if-custom-proto-is-not-object.js +++ /dev/null @@ -1,47 +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. -/*--- -esid: sec-typedarray-object -description: > - Use prototype from %TypedArray% if newTarget's prototype is not an Object -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - - ... - 3. Let O be ? AllocateTypedArray(TypedArray.[[TypedArrayConstructorName]], - NewTarget, "%TypedArrayPrototype%"). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 10. Set the [[Prototype]] internal slot of A to prototype. - ... - 12. Return A. -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -function newTarget() {} -newTarget.prototype = null; -var o = []; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [o], newTarget); - - assert.sameValue(ta.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-custom-proto-access-throws.js b/test/built-ins/TypedArrays/typedarray-arg-custom-proto-access-throws.js deleted file mode 100644 index 281d09353..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-custom-proto-access-throws.js +++ /dev/null @@ -1,47 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Return abrupt completion getting newTarget's prototype -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - ... - - 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) - - ... - 3. Let proto be ? Get(constructor, "prototype"). - ... -includes: [testTypedArray.js] -features: [Reflect, TypedArray] ----*/ - -var newTarget = function() {}.bind(null); -Object.defineProperty(newTarget, "prototype", { - get() { - throw new Test262Error(); - } -}); - -var sample = new Int8Array(); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(Test262Error, function() { - Reflect.construct(TA, [sample], newTarget); - }); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-detached-when-species-retrieved-different-type.js b/test/built-ins/TypedArrays/typedarray-arg-detached-when-species-retrieved-different-type.js deleted file mode 100644 index 8ee2fba54..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-detached-when-species-retrieved-different-type.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (C) 2017 André Bargull. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-typedarray-typedarray -description: > - When a TypedArray is created from another TypedArray with a different element-type - and SpeciesConstructor detaches the source buffer, AllocateArrayBuffer is still - executed. -info: | - 22.2.4.3 TypedArray ( typedArray ) - - ... - 16. If IsSharedArrayBuffer(srcData) is false, then - a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). - ... - 18. If SameValue(elementType, srcType) is true, then - ... - 19. Else, - a. Let data be ? AllocateArrayBuffer(bufferConstructor, byteLength). - b. If IsDetachedBuffer(srcData) is true, throw a TypeError exception. - ... - - 24.1.1.1 AllocateArrayBuffer ( constructor, byteLength ) - - 1. Let obj be ? OrdinaryCreateFromConstructor(constructor, "%ArrayBufferPrototype%", - « [[ArrayBufferData]], [[ArrayBufferByteLength]] »). - ... -includes: [testTypedArray.js, detachArrayBuffer.js] -features: [TypedArray, Symbol.species] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var speciesCallCount = 0; - var bufferConstructor = Object.defineProperty({}, Symbol.species, { - get: function() { - speciesCallCount += 1; - $DETACHBUFFER(ta.buffer); - return speciesConstructor; - } - }); - - var prototypeCallCount = 0; - var speciesConstructor = Object.defineProperty(function(){}.bind(), "prototype", { - get: function() { - prototypeCallCount += 1; - return null; - } - }); - - var ta = new TA(0); - ta.buffer.constructor = bufferConstructor; - - assert.throws(TypeError, function() { - var targetType = TA !== Int32Array ? Int32Array : Uint32Array; - new targetType(ta); - }, "TypeError thrown for detached source buffer"); - - assert.sameValue(speciesCallCount, 1, "@@species getter called once"); - assert.sameValue(prototypeCallCount, 1, "prototype getter called once"); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-detached-when-species-retrieved-same-type.js b/test/built-ins/TypedArrays/typedarray-arg-detached-when-species-retrieved-same-type.js deleted file mode 100644 index 978f42af6..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-detached-when-species-retrieved-same-type.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (C) 2017 André Bargull. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-typedarray-typedarray -description: > - When a TypedArray is created from another TypedArray with the same element-type - and SpeciesConstructor detaches the source buffer, AllocateArrayBuffer is still - executed. -info: | - 22.2.4.3 TypedArray ( typedArray ) - - ... - 16. If IsSharedArrayBuffer(srcData) is false, then - a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). - ... - 18. If SameValue(elementType, srcType) is true, then - a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset, byteLength, bufferConstructor). - ... - - 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset, srcLength, cloneConstructor ) - - ... - 3. Let targetBuffer be ? AllocateArrayBuffer(cloneConstructor, srcLength). - 4. If IsDetachedBuffer(srcBuffer) is true, throw a TypeError exception. - ... - - 24.1.1.1 AllocateArrayBuffer ( constructor, byteLength ) - - 1. Let obj be ? OrdinaryCreateFromConstructor(constructor, "%ArrayBufferPrototype%", - « [[ArrayBufferData]], [[ArrayBufferByteLength]] »). - ... -includes: [testTypedArray.js, detachArrayBuffer.js] -features: [TypedArray, Symbol.species] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var speciesCallCount = 0; - var bufferConstructor = Object.defineProperty({}, Symbol.species, { - get: function() { - speciesCallCount += 1; - $DETACHBUFFER(ta.buffer); - return speciesConstructor; - } - }); - - var prototypeCallCount = 0; - var speciesConstructor = Object.defineProperty(function(){}.bind(), "prototype", { - get: function() { - prototypeCallCount += 1; - return null; - } - }); - - var ta = new TA(0); - ta.buffer.constructor = bufferConstructor; - - assert.throws(TypeError, function() { - new TA(ta); - }, "TypeError thrown for detached source buffer"); - - assert.sameValue(speciesCallCount, 1, "@@species getter called once"); - assert.sameValue(prototypeCallCount, 1, "prototype getter called once"); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-new-instance-extensibility.js b/test/built-ins/TypedArrays/typedarray-arg-new-instance-extensibility.js deleted file mode 100644 index d29848bf8..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-new-instance-extensibility.js +++ /dev/null @@ -1,46 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - The new typedArray instance from a typedArray argument is extensible -info: | - 22.2.4.3 TypedArray ( typedArray ) - - ... - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - "%TypedArrayPrototype%"). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - ... - 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 11. Set the [[Extensible]] internal slot of A to true. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var typedArraySample1 = new Int8Array(); -var typedArraySample2 = new Int8Array(); -Object.preventExtensions(typedArraySample2); - -testWithTypedArrayConstructors(function(TA) { - var sample1 = new TA(typedArraySample1); - - assert(Object.isExtensible(sample1), "new instance is extensible"); - - var sample2 = new TA(typedArraySample2); - assert( - Object.isExtensible(sample2), - "new instance does not inherit extensibility from typedarray argument" - ); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-access-throws.js b/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-access-throws.js deleted file mode 100644 index b8976d696..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-access-throws.js +++ /dev/null @@ -1,41 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Return abrupt completion from getting typedArray argument's buffer.constructor -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 18. Else, - a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). - ... - - 7.3.20 SpeciesConstructor ( O, defaultConstructor ) - - ... - 2. Let C be ? Get(O, "constructor"). - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var OtherCtor = TA === Int8Array ? Int16Array : Int8Array; - var sample = new OtherCtor(); - - Object.defineProperty(sample.buffer, "constructor", { - get() { - throw new Test262Error(); - } - }); - - assert.throws(Test262Error, function() { - new TA(sample); - }); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-custom-species-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-custom-species-proto-from-ctor-realm.js deleted file mode 100644 index 03860d1a7..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-custom-species-proto-from-ctor-realm.js +++ /dev/null @@ -1,59 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Derive the ArrayBuffer prototype from the realm of the species constructor -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 18. Else, - a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). - b. Let data be ? AllocateArrayBuffer(bufferConstructor, byteLength). - ... - - 7.3.20 SpeciesConstructor ( O, defaultConstructor ) - - ... - 5. Let S be ? Get(C, @@species). - 6. If S is either undefined or null, return defaultConstructor. - 7. If IsConstructor(S) is true, return S. - ... - - 9.1.14 GetPrototypeFromConstructor - - ... - 3. Let proto be ? Get(constructor, "prototype"). - 4. If Type(proto) is not Object, then - a. Let realm be ? GetFunctionRealm(constructor). - b. Let proto be realm's intrinsic object named intrinsicDefaultProto. - ... -includes: [testTypedArray.js] -features: [cross-realm, Symbol.species, TypedArray] ----*/ - -var sample1 = new Int8Array(); -var sample2 = new Int16Array(); -var other = $262.createRealm().global; -var C = new other.Function(); -C.prototype = null; - - -testWithTypedArrayConstructors(function(TA) { - var sample = TA === Int8Array ? sample2 : sample1; - var ctor = {}; - - sample.buffer.constructor = ctor; - - ctor[Symbol.species] = C; - - var typedArray = new TA(sample); - assert.sameValue( - Object.getPrototypeOf(typedArray.buffer), other.ArrayBuffer.prototype - ); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-custom-species.js b/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-custom-species.js deleted file mode 100644 index a510d7806..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-custom-species.js +++ /dev/null @@ -1,52 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Use default ArrayBuffer constructor on undefined buffer.constructor.@@species -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 18. Else, - a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). - b. Let data be ? AllocateArrayBuffer(bufferConstructor, byteLength). - ... - - 7.3.20 SpeciesConstructor ( O, defaultConstructor ) - - ... - 5. Let S be ? Get(C, @@species). - 6. If S is either undefined or null, return defaultConstructor. - 7. If IsConstructor(S) is true, return S. - ... - -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] ----*/ - -var sample1 = new Int8Array(); -var sample2 = new Int16Array(); - -testWithTypedArrayConstructors(function(TA) { - var sample = TA === Int8Array ? sample2 : sample1; - var ctor = {}; - var called = 0; - var custom = {}; - - sample.buffer.constructor = ctor; - - ctor[Symbol.species] = function() { - called++; - }; - - ctor[Symbol.species].prototype = custom; - - var typedArray = new TA(sample); - assert.sameValue(Object.getPrototypeOf(typedArray.buffer), custom); - assert.sameValue(called, 0); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-not-object-throws.js b/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-not-object-throws.js deleted file mode 100644 index cfb79f1a9..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-not-object-throws.js +++ /dev/null @@ -1,61 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Return abrupt completion from typedArray argument's buffer.constructor's value -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 18. Else, - a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). - ... - - 7.3.20 SpeciesConstructor ( O, defaultConstructor ) - - ... - 2. Let C be ? Get(O, "constructor"). - ... - 4. If Type(C) is not Object, throw a TypeError exception. - ... -includes: [testTypedArray.js] -features: [Symbol, TypedArray] ----*/ - -var sample1 = new Int8Array(); -var sample2 = new Int16Array(); - -testWithTypedArrayConstructors(function(TA) { - var sample = TA === Int8Array ? sample2 : sample1; - - sample.buffer.constructor = 1; - assert.throws(TypeError, function() { - new TA(sample); - }); - - sample.buffer.constructor = true; - assert.throws(TypeError, function() { - new TA(sample); - }); - - sample.buffer.constructor = ""; - assert.throws(TypeError, function() { - new TA(sample); - }); - - sample.buffer.constructor = null; - assert.throws(TypeError, function() { - new TA(sample); - }); - - var s = Symbol("1"); - sample.buffer.constructor = s; - assert.throws(TypeError, function() { - new TA(sample); - }); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-species-access-throws.js b/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-species-access-throws.js deleted file mode 100644 index 4b0b19aca..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-species-access-throws.js +++ /dev/null @@ -1,45 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Return abrupt from getting typedArray argument's buffer.constructor.@@species -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 18. Else, - a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). - ... - - 7.3.20 SpeciesConstructor ( O, defaultConstructor ) - - ... - 5. Let S be ? Get(C, @@species). - ... -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] ----*/ - -var sample1 = new Int8Array(); -var sample2 = new Int16Array(); - -testWithTypedArrayConstructors(function(TA) { - var sample = TA === Int8Array ? sample2 : sample1; - var ctor = {}; - - sample.buffer.constructor = ctor; - Object.defineProperty(ctor, Symbol.species, { - get: function() { - throw new Test262Error(); - } - }); - - assert.throws(Test262Error, function() { - new TA(sample); - }); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-species-not-ctor-throws.js b/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-species-not-ctor-throws.js deleted file mode 100644 index c485cae13..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-species-not-ctor-throws.js +++ /dev/null @@ -1,47 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Return abrupt from buffer.constructor.@@species.prototype -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 18. Else, - a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). - ... - - 7.3.20 SpeciesConstructor ( O, defaultConstructor ) - - ... - 5. Let S be ? Get(C, @@species). - 6. If S is either undefined or null, return defaultConstructor. - 7. If IsConstructor(S) is true, return S. - 8. Throw a TypeError exception. -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] ----*/ - -var sample1 = new Int8Array(); -var sample2 = new Int16Array(); - -var ctor = function() { - throw new Test262Error(); -}; -var m = { m() {} }.m; -ctor[Symbol.species] = m; - -testWithTypedArrayConstructors(function(TA) { - var sample = TA === Int8Array ? sample2 : sample1; - - sample.buffer.constructor = ctor; - - assert.throws(TypeError, function() { - new TA(sample); - }); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-species-null.js b/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-species-null.js deleted file mode 100644 index 96ba9009d..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-species-null.js +++ /dev/null @@ -1,44 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Use default ArrayBuffer constructor on null buffer.constructor.@@species -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 18. Else, - a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). - ... - - 7.3.20 SpeciesConstructor ( O, defaultConstructor ) - - ... - 5. Let S be ? Get(C, @@species). - 6. If S is either undefined or null, return defaultConstructor. - ... -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var OtherCtor = TA === Int8Array ? Int16Array : Int8Array; - var sample = new OtherCtor(); - var ctor = {}; - - sample.buffer.constructor = ctor; - - ctor[Symbol.species] = null; - var typedArray = new TA(sample); - - assert.sameValue( - Object.getPrototypeOf(typedArray.buffer), - ArrayBuffer.prototype, - "buffer ctor is not called when species is null" - ); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-species-prototype-throws.js b/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-species-prototype-throws.js deleted file mode 100644 index 135634646..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-species-prototype-throws.js +++ /dev/null @@ -1,59 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Return abrupt from buffer.constructor.@@species.prototype -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 18. Else, - a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). - b. Let data be ? AllocateArrayBuffer(bufferConstructor, byteLength). - ... - - 7.3.20 SpeciesConstructor ( O, defaultConstructor ) - - ... - 5. Let S be ? Get(C, @@species). - 6. If S is either undefined or null, return defaultConstructor. - 7. If IsConstructor(S) is true, return S. - ... - - 24.1.1.1 AllocateArrayBuffer ( constructor, byteLength ) - - ... - 1. Let obj be ? OrdinaryCreateFromConstructor(constructor, - "%ArrayBufferPrototype%", « [[ArrayBufferData]], [[ArrayBufferByteLength]] » ) - ... -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] ----*/ - -var sample1 = new Int8Array(); -var sample2 = new Int16Array(); - -testWithTypedArrayConstructors(function(TA) { - var sample = TA === Int8Array ? sample2 : sample1; - var ctor = {}; - var called = 0; - - sample.buffer.constructor = ctor; - - ctor[Symbol.species] = function() {called++;}.bind(null); - Object.defineProperty(ctor[Symbol.species], "prototype", { - get: function() { - throw new Test262Error(); - } - }); - - assert.throws(Test262Error, function() { - new TA(sample); - }); - assert.sameValue(called, 0); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-species-undefined.js b/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-species-undefined.js deleted file mode 100644 index 32e78a37d..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-species-undefined.js +++ /dev/null @@ -1,43 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Use default ArrayBuffer constructor on undefined buffer.constructor.@@species -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 18. Else, - a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). - ... - - 7.3.20 SpeciesConstructor ( O, defaultConstructor ) - - ... - 5. Let S be ? Get(C, @@species). - 6. If S is either undefined or null, return defaultConstructor. - ... -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var OtherCtor = TA === Int8Array ? Int16Array : Int8Array; - var sample = new OtherCtor(); - var ctor = {}; - - sample.buffer.constructor = ctor; - - ctor[Symbol.species] = undefined; - var a = new TA(sample); - assert.sameValue( - Object.getPrototypeOf(a.buffer), - ArrayBuffer.prototype, - "buffer ctor is not called when species is undefined" - ); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-other-ctor-returns-new-typedarray.js b/test/built-ins/TypedArrays/typedarray-arg-other-ctor-returns-new-typedarray.js deleted file mode 100644 index 34cb4dee6..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-other-ctor-returns-new-typedarray.js +++ /dev/null @@ -1,32 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Return abrupt from getting typedArray argument's buffer.constructor.@@species -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var sample1 = new Int8Array(7); -var sample2 = new Int16Array(7); -var sample3 = new BigInt64Array(7); -var sample4 = new BigUint64Array(7); - -testWithTypedArrayConstructors(function(TA) { - var sample = TA === Int8Array ? sample2 : - TA === BigInt64Array ? sample4 : - TA === BigUint64Array ? sample3 : sample1; - var typedArray = new TA(sample); - - assert.sameValue(typedArray.length, 7); - assert.notSameValue(typedArray, sample); - assert.sameValue(typedArray.constructor, TA); - assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/typedarray-arg-proto-from-ctor-realm.js deleted file mode 100644 index 6e58746cd..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-proto-from-ctor-realm.js +++ /dev/null @@ -1,37 +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. -/*--- -esid: sec-typedarray-typedarray -description: Default [[Prototype]] value derived from realm of the newTarget -info: | - [...] - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - "%TypedArrayPrototype%"). - [...] - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - [...] - - 9.1.14 GetPrototypeFromConstructor - - [...] - 3. Let proto be ? Get(constructor, "prototype"). - 4. If Type(proto) is not Object, then - a. Let realm be ? GetFunctionRealm(constructor). - b. Let proto be realm's intrinsic object named intrinsicDefaultProto. - 5. Return proto. -includes: [testTypedArray.js] -features: [cross-realm, Reflect, TypedArray] ----*/ - -var other = $262.createRealm().global; -var C = new other.Function(); -C.prototype = null; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [new TA()], C); - - assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-returns-new-instance.js b/test/built-ins/TypedArrays/typedarray-arg-returns-new-instance.js deleted file mode 100644 index 128ec4021..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-returns-new-instance.js +++ /dev/null @@ -1,31 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Return a TypedArray object -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 20. Return O. - -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var len = 10; -var typedArraySample = new Int8Array(len); - -testWithTypedArrayConstructors(function(TA) { - var typedArray = new TA(typedArraySample); - - assert.notSameValue(typedArray, typedArraySample); - assert.sameValue(typedArray.length, len); - assert.sameValue(typedArray.constructor, TA); - assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); -}, numericTypedArrayConstructors); diff --git a/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-access-throws.js b/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-access-throws.js deleted file mode 100644 index f8e75d209..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-access-throws.js +++ /dev/null @@ -1,46 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Return abrupt completion from getting typedArray argument's buffer.constructor -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 17. If SameValue(elementType, srcType) is true, then - a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). - ... - - 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) - - ... - 2. If cloneConstructor is not present, then - a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). - ... - - 7.3.20 SpeciesConstructor ( O, defaultConstructor ) - - ... - 2. Let C be ? Get(O, "constructor"). - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var sample = new TA(); - Object.defineProperty(sample.buffer, "constructor", { - get: function() { - throw new Test262Error(); - } - }); - - assert.throws(Test262Error, function() { - new TA(sample); - }); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-custom-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-custom-proto-from-ctor-realm.js deleted file mode 100644 index 43743b956..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-custom-proto-from-ctor-realm.js +++ /dev/null @@ -1,68 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Derive the ArrayBuffer prototype from the realm of the species constructor -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 17. If SameValue(elementType, srcType) is true, then - a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). - ... - - 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) - - ... - 2. If cloneConstructor is not present, then - a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). - ... - - 7.3.20 SpeciesConstructor ( O, defaultConstructor ) - - ... - 5. Let S be ? Get(C, @@species). - 6. If S is either undefined or null, return defaultConstructor. - 7. If IsConstructor(S) is true, return S. - ... - - 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) - - ... - 8. Let targetBuffer be ? AllocateArrayBuffer(cloneConstructor, cloneLength). - ... - - 9.1.14 GetPrototypeFromConstructor - - ... - 3. Let proto be ? Get(constructor, "prototype"). - 4. If Type(proto) is not Object, then - a. Let realm be ? GetFunctionRealm(constructor). - b. Let proto be realm's intrinsic object named intrinsicDefaultProto. - ... -includes: [testTypedArray.js] -features: [cross-realm, Symbol.species, TypedArray] ----*/ - -var other = $262.createRealm().global; -var C = new other.Function(); -C.prototype = null; - -testWithTypedArrayConstructors(function(TA) { - var sample = new TA(); - var ctor = {}; - - sample.buffer.constructor = ctor; - - ctor[Symbol.species] = C; - - var typedArray = new TA(sample); - assert.sameValue( - Object.getPrototypeOf(typedArray.buffer), other.ArrayBuffer.prototype - ); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-custom.js b/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-custom.js deleted file mode 100644 index 7ed3aca0d..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-custom.js +++ /dev/null @@ -1,60 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Use default ArrayBuffer constructor on undefined buffer.constructor.@@species -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 17. If SameValue(elementType, srcType) is true, then - a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). - ... - - 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) - - ... - 2. If cloneConstructor is not present, then - a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). - ... - - 7.3.20 SpeciesConstructor ( O, defaultConstructor ) - - ... - 5. Let S be ? Get(C, @@species). - 6. If S is either undefined or null, return defaultConstructor. - 7. If IsConstructor(S) is true, return S. - ... - - 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) - - ... - 8. Let targetBuffer be ? AllocateArrayBuffer(cloneConstructor, cloneLength). - ... -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var sample = new TA(); - var ctor = {}; - var called = 0; - var custom = {}; - - sample.buffer.constructor = ctor; - - ctor[Symbol.species] = function() { - called++; - }; - - ctor[Symbol.species].prototype = custom; - - var typedArray = new TA(sample); - assert.sameValue(Object.getPrototypeOf(typedArray.buffer), custom); - assert.sameValue(called, 0); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-not-ctor.js b/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-not-ctor.js deleted file mode 100644 index 2072aa96d..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-not-ctor.js +++ /dev/null @@ -1,49 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Return abrupt from buffer.constructor.@@species.prototype -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 17. If SameValue(elementType, srcType) is true, then - a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). - ... - - 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) - - ... - 2. If cloneConstructor is not present, then - a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). - ... - - 7.3.20 SpeciesConstructor ( O, defaultConstructor ) - - ... - 5. Let S be ? Get(C, @@species). - 6. If S is either undefined or null, return defaultConstructor. - 7. If IsConstructor(S) is true, return S. - 8. Throw a TypeError exception. -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var sample = new TA(); - var ctor = {}; - var m = { m() {} }; - - sample.buffer.constructor = ctor; - - ctor[Symbol.species] = m; - - assert.throws(TypeError, function() { - new TA(sample); - }); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-null.js b/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-null.js deleted file mode 100644 index e42780610..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-null.js +++ /dev/null @@ -1,49 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Use default ArrayBuffer constructor on null buffer.constructor.@@species -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 17. If SameValue(elementType, srcType) is true, then - a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). - ... - - 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) - - ... - 2. If cloneConstructor is not present, then - a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). - ... - - 7.3.20 SpeciesConstructor ( O, defaultConstructor ) - - ... - 5. Let S be ? Get(C, @@species). - 6. If S is either undefined or null, return defaultConstructor. - ... -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var sample = new TA(4); - var ctor = {}; - - sample.buffer.constructor = ctor; - - ctor[Symbol.species] = null; - var typedArray = new TA(sample); - assert.sameValue( - Object.getPrototypeOf(typedArray.buffer), - ArrayBuffer.prototype, - "buffer ctor is not called when species is null" - ); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-prototype-throws.js b/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-prototype-throws.js deleted file mode 100644 index b171826cf..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-prototype-throws.js +++ /dev/null @@ -1,62 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Return abrupt from buffer.constructor.@@species.prototype -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 17. If SameValue(elementType, srcType) is true, then - a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). - ... - - 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) - - ... - 2. If cloneConstructor is not present, then - a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). - ... - 8. Let targetBuffer be ? AllocateArrayBuffer(cloneConstructor, cloneLength). - ... - - 7.3.20 SpeciesConstructor ( O, defaultConstructor ) - - ... - 5. Let S be ? Get(C, @@species). - 6. If S is either undefined or null, return defaultConstructor. - 7. If IsConstructor(S) is true, return S. - ... - - 24.1.1.1 AllocateArrayBuffer ( constructor, byteLength ) - - ... - 1. Let obj be ? OrdinaryCreateFromConstructor(constructor, - "%ArrayBufferPrototype%", « [[ArrayBufferData]], [[ArrayBufferByteLength]] » ) - ... -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var sample = new TA(); - var ctor = {}; - - sample.buffer.constructor = ctor; - - ctor[Symbol.species] = function(){}.bind(null); - Object.defineProperty(ctor[Symbol.species], "prototype", { - get() { - throw new Test262Error(); - } - }); - - assert.throws(Test262Error, function() { - new TA(sample); - }); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-throws.js b/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-throws.js deleted file mode 100644 index ec2aaf3c1..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-throws.js +++ /dev/null @@ -1,49 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Return abrupt from getting typedArray argument's buffer.constructor.@@species -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 17. If SameValue(elementType, srcType) is true, then - a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). - ... - - 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) - - ... - 2. If cloneConstructor is not present, then - a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). - ... - - 7.3.20 SpeciesConstructor ( O, defaultConstructor ) - - ... - 5. Let S be ? Get(C, @@species). - ... -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var sample = new TA(); - var ctor = {}; - - sample.buffer.constructor = ctor; - Object.defineProperty(ctor, Symbol.species, { - get() { - throw new Test262Error(); - } - }); - - assert.throws(Test262Error, function() { - new TA(sample); - }); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-undefined.js b/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-undefined.js deleted file mode 100644 index 339d3041b..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-undefined.js +++ /dev/null @@ -1,49 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Use default ArrayBuffer constructor on undefined buffer.constructor.@@species -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 17. If SameValue(elementType, srcType) is true, then - a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). - ... - - 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) - - ... - 2. If cloneConstructor is not present, then - a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). - ... - - 7.3.20 SpeciesConstructor ( O, defaultConstructor ) - - ... - 5. Let S be ? Get(C, @@species). - 6. If S is either undefined or null, return defaultConstructor. - ... -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var sample = new TA(4); - var ctor = {}; - - sample.buffer.constructor = ctor; - - ctor[Symbol.species] = undefined; - var typedArray = new TA(sample); - assert.sameValue( - Object.getPrototypeOf(typedArray.buffer), - ArrayBuffer.prototype, - "buffer ctor is not called when species is undefined" - ); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-value-not-obj-throws.js b/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-value-not-obj-throws.js deleted file mode 100644 index ef9709749..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-value-not-obj-throws.js +++ /dev/null @@ -1,65 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Return abrupt completion from typedArray argument's buffer.constructor's value -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 17. If SameValue(elementType, srcType) is true, then - a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). - ... - - 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) - - ... - 2. If cloneConstructor is not present, then - a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). - ... - - 7.3.20 SpeciesConstructor ( O, defaultConstructor ) - - ... - 2. Let C be ? Get(O, "constructor"). - ... - 4. If Type(C) is not Object, throw a TypeError exception. - ... -includes: [testTypedArray.js] -features: [Symbol, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var sample = new TA(); - - sample.buffer.constructor = 1; - assert.throws(TypeError, function() { - new TA(sample); - }); - - sample.buffer.constructor = true; - assert.throws(TypeError, function() { - new TA(sample); - }); - - sample.buffer.constructor = ''; - assert.throws(TypeError, function() { - new TA(sample); - }); - - sample.buffer.constructor = null; - assert.throws(TypeError, function() { - new TA(sample); - }); - - var s = Symbol('1'); - sample.buffer.constructor = s; - assert.throws(TypeError, function() { - new TA(sample); - }); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-same-ctor-returns-new-cloned-typedarray.js b/test/built-ins/TypedArrays/typedarray-arg-same-ctor-returns-new-cloned-typedarray.js deleted file mode 100644 index 4d9b442c9..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-same-ctor-returns-new-cloned-typedarray.js +++ /dev/null @@ -1,32 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Same typedArray ctor argument returns a new cloned typedArray -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 17. If SameValue(elementType, srcType) is true, then - a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). - ... - 23. Return O. -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var sample = new TA(7); - var typedArray = new TA(sample); - - assert.sameValue(typedArray.length, 7); - assert.notSameValue(typedArray, sample); - assert.notSameValue(typedArray.buffer, sample.buffer); - assert.sameValue(typedArray.constructor, TA); - assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-undefined-newtarget-throws.js b/test/built-ins/TypedArrays/typedarray-arg-undefined-newtarget-throws.js deleted file mode 100644 index 12839b2d7..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-undefined-newtarget-throws.js +++ /dev/null @@ -1,27 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Throws a TypeError if NewTarget is undefined. -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 2. If NewTarget is undefined, throw a TypeError exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var typedArray = new TA(4); - - assert.throws(TypeError, function() { - TA(typedArray); - }); -}); diff --git a/test/built-ins/TypedArrays/typedarray-arg-use-custom-proto-if-object.js b/test/built-ins/TypedArrays/typedarray-arg-use-custom-proto-if-object.js deleted file mode 100644 index 2745fc5e2..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-use-custom-proto-if-object.js +++ /dev/null @@ -1,48 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Use prototype from new target if it's an Object -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 10. Set the [[Prototype]] internal slot of A to prototype. - ... - 12. Return A. -includes: [testTypedArray.js] -features: [Reflect, TypedArray] ----*/ - -function newTarget() {} -var proto = {}; -newTarget.prototype = proto; - -var sample = new Int8Array(8); - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [sample], newTarget); - - assert.sameValue(ta.constructor, Object); - assert.sameValue(Object.getPrototypeOf(ta), proto); -}, numericTypedArrayConstructors); diff --git a/test/built-ins/TypedArrays/typedarray-arg-use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/typedarray-arg-use-default-proto-if-custom-proto-is-not-object.js deleted file mode 100644 index ec1997e91..000000000 --- a/test/built-ins/TypedArrays/typedarray-arg-use-default-proto-if-custom-proto-is-not-object.js +++ /dev/null @@ -1,47 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Use prototype from %TypedArray% if newTarget's prototype is not an Object -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 10. Set the [[Prototype]] internal slot of A to prototype. - ... - 12. Return A. -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -function newTarget() {} -newTarget.prototype = null; - -var sample = new Int8Array(8); - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [sample], newTarget); - - assert.sameValue(ta.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); -}, numericTypedArrayConstructors); -- cgit v1.2.1 From c1bc43b1b10ec9d7c83ebee2af1837b78b784e52 Mon Sep 17 00:00:00 2001 From: Leo Balter Date: Fri, 9 Feb 2018 13:39:06 -0500 Subject: Restore original tests for TypedArrays and optimize files - optimize file names - BigInt folder for TAs.from and of - copy tests preparing for bigint - copy ta prototype methods for bigint - Use an exclusive harness for bigint typedarrays - add features - use proper harness - use preper harness - Restore original tests for TypedArrays - final fixes - fix includes --- harness/testBigIntTypedArray.js | 77 ++++++++++++ harness/testTypedArray.js | 16 +-- .../Symbol.toStringTag/BigInt/detached-buffer.js | 21 ++++ .../BigInt/invoked-as-accessor.js | 20 +++ .../Symbol.toStringTag/BigInt/invoked-as-func.js | 21 ++++ .../prototype/Symbol.toStringTag/BigInt/length.js | 32 +++++ .../prototype/Symbol.toStringTag/BigInt/name.js | 29 +++++ .../Symbol.toStringTag/BigInt/prop-desc.js | 28 +++++ .../BigInt/return-typedarrayname.js | 21 ++++ .../BigInt/this-has-no-typedarrayname-internal.js | 29 +++++ .../BigInt/this-is-not-object.js | 27 +++++ .../prototype/buffer/BigInt/detached-buffer.js | 21 ++++ .../prototype/buffer/BigInt/return-buffer.js | 22 ++++ .../prototype/byteLength/BigInt/detached-buffer.js | 21 ++++ .../byteLength/BigInt/return-bytelength.js | 24 ++++ .../prototype/byteOffset/BigInt/detached-buffer.js | 22 ++++ .../byteOffset/BigInt/return-byteoffset.js | 31 +++++ .../copyWithin/BigInt/coerced-values-end.js | 77 ++++++++++++ .../copyWithin/BigInt/coerced-values-start.js | 92 ++++++++++++++ .../copyWithin/BigInt/coerced-values-target.js | 92 ++++++++++++++ .../prototype/copyWithin/BigInt/detached-buffer.js | 34 ++++++ .../BigInt/get-length-ignores-length-prop.js | 50 ++++++++ .../prototype/copyWithin/BigInt/invoked-as-func.js | 29 +++++ .../copyWithin/BigInt/invoked-as-method.js | 29 +++++ .../prototype/copyWithin/BigInt/length.js | 29 +++++ .../TypedArray/prototype/copyWithin/BigInt/name.js | 26 ++++ .../prototype/copyWithin/BigInt/negative-end.js | 95 +++++++++++++++ .../BigInt/negative-out-of-bounds-end.js | 111 +++++++++++++++++ .../BigInt/negative-out-of-bounds-start.js | 93 ++++++++++++++ .../BigInt/negative-out-of-bounds-target.js | 61 ++++++++++ .../prototype/copyWithin/BigInt/negative-start.js | 77 ++++++++++++ .../prototype/copyWithin/BigInt/negative-target.js | 53 ++++++++ .../BigInt/non-negative-out-of-bounds-end.js | 54 +++++++++ .../non-negative-out-of-bounds-target-and-start.js | 74 ++++++++++++ .../BigInt/non-negative-target-and-start.js | 50 ++++++++ .../BigInt/non-negative-target-start-and-end.js | 73 +++++++++++ .../prototype/copyWithin/BigInt/prop-desc.js | 18 +++ .../BigInt/return-abrupt-from-end-is-symbol.js | 37 ++++++ .../copyWithin/BigInt/return-abrupt-from-end.js | 40 ++++++ .../BigInt/return-abrupt-from-start-is-symbol.js | 36 ++++++ .../copyWithin/BigInt/return-abrupt-from-start.js | 46 +++++++ .../BigInt/return-abrupt-from-target-is-symbol.js | 36 ++++++ .../copyWithin/BigInt/return-abrupt-from-target.js | 40 ++++++ .../prototype/copyWithin/BigInt/return-this.js | 37 ++++++ .../copyWithin/BigInt/this-is-not-object.js | 50 ++++++++ .../BigInt/this-is-not-typedarray-instance.js | 42 +++++++ .../prototype/copyWithin/BigInt/undefined-end.js | 45 +++++++ .../prototype/entries/BigInt/detached-buffer.js | 27 +++++ .../prototype/entries/BigInt/iter-prototype.js | 25 ++++ .../prototype/entries/BigInt/return-itor.js | 37 ++++++ .../BigInt/callbackfn-arguments-with-thisarg.js | 56 +++++++++ .../BigInt/callbackfn-arguments-without-thisarg.js | 54 +++++++++ .../every/BigInt/callbackfn-detachbuffer.js | 43 +++++++ .../callbackfn-no-interaction-over-non-integer.js | 41 +++++++ .../every/BigInt/callbackfn-not-callable-throws.js | 69 +++++++++++ .../every/BigInt/callbackfn-not-called-on-empty.js | 36 ++++++ .../callbackfn-return-does-not-change-instance.js | 38 ++++++ .../every/BigInt/callbackfn-returns-abrupt.js | 35 ++++++ .../callbackfn-set-value-during-interaction.js | 58 +++++++++ .../prototype/every/BigInt/callbackfn-this.js | 59 +++++++++ .../prototype/every/BigInt/detached-buffer.js | 32 +++++ .../BigInt/get-length-uses-internal-arraylength.js | 47 ++++++++ .../prototype/every/BigInt/invoked-as-func.js | 29 +++++ .../prototype/every/BigInt/invoked-as-method.js | 29 +++++ .../TypedArray/prototype/every/BigInt/length.js | 29 +++++ .../TypedArray/prototype/every/BigInt/name.js | 26 ++++ .../TypedArray/prototype/every/BigInt/prop-desc.js | 18 +++ .../returns-false-if-any-cb-returns-false.js | 46 +++++++ .../returns-true-if-every-cb-returns-true.js | 46 +++++++ .../prototype/every/BigInt/this-is-not-object.js | 51 ++++++++ .../BigInt/this-is-not-typedarray-instance.js | 43 +++++++ .../every/BigInt/values-are-not-cached.js | 42 +++++++ .../prototype/fill/BigInt/coerced-indexes.js | 104 ++++++++++++++++ .../prototype/fill/BigInt/detached-buffer.js | 34 ++++++ .../fill/BigInt/fill-values-conversion-once.js | 27 +++++ ...-values-conversion-operations-consistent-nan.js | 70 +++++++++++ .../BigInt/fill-values-conversion-operations.js | 56 +++++++++ .../BigInt/fill-values-custom-start-and-end.js | 42 +++++++ .../fill/BigInt/fill-values-non-numeric.js | 73 +++++++++++ .../fill/BigInt/fill-values-relative-end.js | 53 ++++++++ .../fill/BigInt/fill-values-relative-start.js | 51 ++++++++ .../fill/BigInt/fill-values-symbol-throws.js | 48 ++++++++ .../prototype/fill/BigInt/fill-values.js | 44 +++++++ .../fill/BigInt/get-length-ignores-length-prop.js | 52 ++++++++ .../prototype/fill/BigInt/invoked-as-func.js | 29 +++++ .../prototype/fill/BigInt/invoked-as-method.js | 29 +++++ .../TypedArray/prototype/fill/BigInt/length.js | 29 +++++ .../TypedArray/prototype/fill/BigInt/name.js | 26 ++++ .../TypedArray/prototype/fill/BigInt/prop-desc.js | 18 +++ .../BigInt/return-abrupt-from-end-as-symbol.js | 39 ++++++ .../fill/BigInt/return-abrupt-from-end.js | 43 +++++++ .../fill/BigInt/return-abrupt-from-set-value.js | 51 ++++++++ .../BigInt/return-abrupt-from-start-as-symbol.js | 38 ++++++ .../fill/BigInt/return-abrupt-from-start.js | 42 +++++++ .../prototype/fill/BigInt/return-this.js | 21 ++++ .../prototype/fill/BigInt/this-is-not-object.js | 50 ++++++++ .../fill/BigInt/this-is-not-typedarray-instance.js | 42 +++++++ .../prototype/fill/fill-values-non-numeric.js | 8 +- .../filter/BigInt/arraylength-internal.js | 39 ++++++ .../BigInt/callbackfn-arguments-with-thisarg.js | 46 +++++++ .../BigInt/callbackfn-arguments-without-thisarg.js | 44 +++++++ .../filter/BigInt/callbackfn-called-before-ctor.js | 39 ++++++ .../BigInt/callbackfn-called-before-species.js | 39 ++++++ .../filter/BigInt/callbackfn-detachbuffer.js | 34 ++++++ .../callbackfn-no-iteration-over-non-integer.js | 38 ++++++ .../BigInt/callbackfn-not-callable-throws.js | 58 +++++++++ .../BigInt/callbackfn-not-called-on-empty.js | 27 +++++ .../callbackfn-return-does-not-change-instance.js | 23 ++++ .../filter/BigInt/callbackfn-returns-abrupt.js | 27 +++++ .../callbackfn-set-value-during-iteration.js | 47 ++++++++ .../prototype/filter/BigInt/callbackfn-this.js | 48 ++++++++ .../prototype/filter/BigInt/detached-buffer.js | 32 +++++ .../prototype/filter/BigInt/invoked-as-func.js | 30 +++++ .../prototype/filter/BigInt/invoked-as-method.js | 30 +++++ .../TypedArray/prototype/filter/BigInt/length.js | 29 +++++ .../TypedArray/prototype/filter/BigInt/name.js | 26 ++++ .../prototype/filter/BigInt/prop-desc.js | 18 +++ .../filter/BigInt/result-does-not-share-buffer.js | 27 +++++ .../result-empty-callbackfn-returns-false.js | 36 ++++++ .../BigInt/result-full-callbackfn-returns-true.js | 38 ++++++ .../filter/BigInt/speciesctor-get-ctor-abrupt.js | 43 +++++++ .../BigInt/speciesctor-get-ctor-inherited.js | 64 ++++++++++ .../BigInt/speciesctor-get-ctor-returns-throws.js | 65 ++++++++++ .../filter/BigInt/speciesctor-get-ctor.js | 54 +++++++++ .../BigInt/speciesctor-get-species-abrupt.js | 45 +++++++ ...eciesctor-get-species-custom-ctor-invocation.js | 59 +++++++++ ...esctor-get-species-custom-ctor-length-throws.js | 41 +++++++ .../speciesctor-get-species-custom-ctor-length.js | 46 +++++++ ...species-custom-ctor-returns-another-instance.js | 54 +++++++++ .../speciesctor-get-species-custom-ctor-throws.js | 46 +++++++ .../BigInt/speciesctor-get-species-custom-ctor.js | 56 +++++++++ .../speciesctor-get-species-returns-throws.js | 66 ++++++++++ .../speciesctor-get-species-use-default-ctor.js | 54 +++++++++ .../filter/BigInt/speciesctor-get-species.js | 46 +++++++ .../prototype/filter/BigInt/this-is-not-object.js | 53 ++++++++ .../BigInt/this-is-not-typedarray-instance.js | 45 +++++++ .../filter/BigInt/values-are-not-cached.js | 31 +++++ .../prototype/filter/BigInt/values-are-set.js | 30 +++++ .../prototype/find/BigInt/detached-buffer.js | 32 +++++ .../find/BigInt/get-length-ignores-length-prop.js | 55 +++++++++ .../prototype/find/BigInt/invoked-as-func.js | 29 +++++ .../prototype/find/BigInt/invoked-as-method.js | 29 +++++ .../TypedArray/prototype/find/BigInt/length.js | 29 +++++ .../TypedArray/prototype/find/BigInt/name.js | 26 ++++ .../find/BigInt/predicate-call-changes-value.js | 78 ++++++++++++ .../find/BigInt/predicate-call-parameters.js | 63 ++++++++++ .../find/BigInt/predicate-call-this-non-strict.js | 60 +++++++++ .../find/BigInt/predicate-call-this-strict.js | 54 +++++++++ .../BigInt/predicate-is-not-callable-throws.js | 67 +++++++++++ .../find/BigInt/predicate-may-detach-buffer.js | 59 +++++++++ .../BigInt/predicate-not-called-on-empty-array.js | 50 ++++++++ .../TypedArray/prototype/find/BigInt/prop-desc.js | 18 +++ .../BigInt/return-abrupt-from-predicate-call.js | 41 +++++++ .../return-found-value-predicate-result-is-true.js | 66 ++++++++++ ...n-undefined-if-predicate-returns-false-value.js | 61 ++++++++++ .../prototype/find/BigInt/this-is-not-object.js | 51 ++++++++ .../find/BigInt/this-is-not-typedarray-instance.js | 43 +++++++ .../prototype/findIndex/BigInt/detached-buffer.js | 32 +++++ .../BigInt/get-length-ignores-length-prop.js | 53 ++++++++ .../prototype/findIndex/BigInt/invoked-as-func.js | 29 +++++ .../findIndex/BigInt/invoked-as-method.js | 29 +++++ .../prototype/findIndex/BigInt/length.js | 29 +++++ .../TypedArray/prototype/findIndex/BigInt/name.js | 26 ++++ .../BigInt/predicate-call-changes-value.js | 67 +++++++++++ .../findIndex/BigInt/predicate-call-parameters.js | 61 ++++++++++ .../BigInt/predicate-call-this-non-strict.js | 58 +++++++++ .../findIndex/BigInt/predicate-call-this-strict.js | 52 ++++++++ .../BigInt/predicate-is-not-callable-throws.js | 65 ++++++++++ .../BigInt/predicate-may-detach-buffer.js | 52 ++++++++ .../BigInt/predicate-not-called-on-empty-array.js | 49 ++++++++ .../prototype/findIndex/BigInt/prop-desc.js | 18 +++ .../BigInt/return-abrupt-from-predicate-call.js | 39 ++++++ .../return-index-predicate-result-is-true.js | 66 ++++++++++ ...egative-one-if-predicate-returns-false-value.js | 59 +++++++++ .../findIndex/BigInt/this-is-not-object.js | 51 ++++++++ .../BigInt/this-is-not-typedarray-instance.js | 43 +++++++ .../forEach/BigInt/arraylength-internal.js | 47 ++++++++ .../BigInt/callbackfn-arguments-with-thisarg.js | 55 +++++++++ .../BigInt/callbackfn-arguments-without-thisarg.js | 53 ++++++++ .../forEach/BigInt/callbackfn-detachbuffer.js | 42 +++++++ .../forEach/BigInt/callbackfn-is-not-callable.js | 54 +++++++++ .../callbackfn-no-interaction-over-non-integer.js | 41 +++++++ .../BigInt/callbackfn-not-called-on-empty.js | 36 ++++++ .../callbackfn-return-does-not-change-instance.js | 30 +++++ .../forEach/BigInt/callbackfn-returns-abrupt.js | 36 ++++++ .../callbackfn-set-value-during-interaction.js | 47 ++++++++ .../prototype/forEach/BigInt/callbackfn-this.js | 57 +++++++++ .../prototype/forEach/BigInt/detached-buffer.js | 32 +++++ .../prototype/forEach/BigInt/invoked-as-func.js | 29 +++++ .../prototype/forEach/BigInt/invoked-as-method.js | 29 +++++ .../TypedArray/prototype/forEach/BigInt/length.js | 29 +++++ .../TypedArray/prototype/forEach/BigInt/name.js | 26 ++++ .../prototype/forEach/BigInt/prop-desc.js | 18 +++ .../prototype/forEach/BigInt/returns-undefined.js | 33 +++++ .../prototype/forEach/BigInt/this-is-not-object.js | 51 ++++++++ .../BigInt/this-is-not-typedarray-instance.js | 43 +++++++ .../forEach/BigInt/values-are-not-cached.js | 31 +++++ .../prototype/includes/BigInt/detached-buffer.js | 28 +++++ ...mIndex-equal-or-greater-length-returns-false.js | 36 ++++++ .../includes/BigInt/fromIndex-infinity.js | 44 +++++++ .../includes/BigInt/fromIndex-minus-zero.js | 34 ++++++ .../BigInt/get-length-uses-internal-arraylength.js | 33 +++++ .../prototype/includes/BigInt/invoked-as-func.js | 29 +++++ .../prototype/includes/BigInt/invoked-as-method.js | 29 +++++ .../includes/BigInt/length-zero-returns-false.js | 39 ++++++ .../TypedArray/prototype/includes/BigInt/length.js | 29 +++++ .../TypedArray/prototype/includes/BigInt/name.js | 26 ++++ .../prototype/includes/BigInt/prop-desc.js | 18 +++ .../return-abrupt-tointeger-fromindex-symbol.js | 33 +++++ .../BigInt/return-abrupt-tointeger-fromindex.js | 37 ++++++ .../includes/BigInt/search-found-returns-true.js | 44 +++++++ .../BigInt/search-not-found-returns-false.js | 42 +++++++ .../includes/BigInt/this-is-not-object.js | 51 ++++++++ .../BigInt/this-is-not-typedarray-instance.js | 42 +++++++ .../includes/BigInt/tointeger-fromindex.js | 65 ++++++++++ .../TypedArray/prototype/includes/samevaluezero.js | 4 +- .../prototype/indexOf/BigInt/detached-buffer.js | 28 +++++ ...ex-equal-or-greater-length-returns-minus-one.js | 30 +++++ .../prototype/indexOf/BigInt/fromIndex-infinity.js | 39 ++++++ .../indexOf/BigInt/fromIndex-minus-zero.js | 30 +++++ .../BigInt/get-length-uses-internal-arraylength.js | 32 +++++ .../prototype/indexOf/BigInt/invoked-as-func.js | 29 +++++ .../prototype/indexOf/BigInt/invoked-as-method.js | 29 +++++ .../BigInt/length-zero-returns-minus-one.js | 37 ++++++ .../TypedArray/prototype/indexOf/BigInt/length.js | 29 +++++ .../TypedArray/prototype/indexOf/BigInt/name.js | 26 ++++ .../prototype/indexOf/BigInt/prop-desc.js | 18 +++ .../return-abrupt-tointeger-fromindex-symbol.js | 32 +++++ .../BigInt/return-abrupt-tointeger-fromindex.js | 36 ++++++ .../indexOf/BigInt/search-found-returns-index.js | 46 +++++++ .../BigInt/search-not-found-returns-minus-one.js | 38 ++++++ .../prototype/indexOf/BigInt/this-is-not-object.js | 50 ++++++++ .../BigInt/this-is-not-typedarray-instance.js | 42 +++++++ .../indexOf/BigInt/tointeger-fromindex.js | 57 +++++++++ .../prototype/indexOf/strict-comparison.js | 4 +- ...or-result-from-tostring-on-each-simple-value.js | 78 ++++++++++++ .../prototype/join/BigInt/detached-buffer.js | 34 ++++++ .../join/BigInt/empty-instance-empty-string.js | 29 +++++ .../BigInt/get-length-uses-internal-arraylength.js | 45 +++++++ .../prototype/join/BigInt/invoked-as-func.js | 29 +++++ .../prototype/join/BigInt/invoked-as-method.js | 29 +++++ .../TypedArray/prototype/join/BigInt/length.js | 29 +++++ .../TypedArray/prototype/join/BigInt/name.js | 26 ++++ .../TypedArray/prototype/join/BigInt/prop-desc.js | 18 +++ .../result-from-tostring-on-each-simple-value.js | 37 ++++++ .../BigInt/return-abrupt-from-separator-symbol.js | 32 +++++ .../join/BigInt/return-abrupt-from-separator.js | 36 ++++++ .../prototype/join/BigInt/this-is-not-object.js | 50 ++++++++ .../join/BigInt/this-is-not-typedarray-instance.js | 42 +++++++ ...separator-result-from-tostring-on-each-value.js | 4 +- .../join/result-from-tostring-on-each-value.js | 4 +- .../prototype/keys/BigInt/detached-buffer.js | 27 +++++ .../prototype/keys/BigInt/invoked-as-func.js | 30 +++++ .../prototype/keys/BigInt/invoked-as-method.js | 30 +++++ .../prototype/keys/BigInt/iter-prototype.js | 25 ++++ .../TypedArray/prototype/keys/BigInt/length.js | 29 +++++ .../TypedArray/prototype/keys/BigInt/name.js | 26 ++++ .../TypedArray/prototype/keys/BigInt/prop-desc.js | 18 +++ .../prototype/keys/BigInt/return-itor.js | 37 ++++++ .../prototype/keys/BigInt/this-is-not-object.js | 52 ++++++++ .../keys/BigInt/this-is-not-typedarray-instance.js | 44 +++++++ .../lastIndexOf/BigInt/detached-buffer.js | 28 +++++ .../lastIndexOf/BigInt/fromIndex-infinity.js | 32 +++++ .../lastIndexOf/BigInt/fromIndex-minus-zero.js | 30 +++++ .../BigInt/get-length-uses-internal-arraylength.js | 32 +++++ .../lastIndexOf/BigInt/invoked-as-func.js | 29 +++++ .../lastIndexOf/BigInt/invoked-as-method.js | 29 +++++ .../BigInt/length-zero-returns-minus-one.js | 37 ++++++ .../prototype/lastIndexOf/BigInt/length.js | 29 +++++ .../prototype/lastIndexOf/BigInt/name.js | 26 ++++ .../prototype/lastIndexOf/BigInt/prop-desc.js | 18 +++ .../return-abrupt-tointeger-fromindex-symbol.js | 32 +++++ .../BigInt/return-abrupt-tointeger-fromindex.js | 36 ++++++ .../BigInt/search-found-returns-index.js | 57 +++++++++ .../BigInt/search-not-found-returns-minus-one.js | 42 +++++++ .../lastIndexOf/BigInt/this-is-not-object.js | 50 ++++++++ .../BigInt/this-is-not-typedarray-instance.js | 42 +++++++ .../lastIndexOf/BigInt/tointeger-fromindex.js | 57 +++++++++ .../prototype/lastIndexOf/strict-comparison.js | 4 +- .../prototype/length/BigInt/detached-buffer.js | 21 ++++ .../prototype/length/BigInt/invoked-as-accessor.js | 23 ++++ .../prototype/length/BigInt/invoked-as-func.js | 23 ++++ .../TypedArray/prototype/length/BigInt/length.js | 31 +++++ .../TypedArray/prototype/length/BigInt/name.js | 28 +++++ .../prototype/length/BigInt/prop-desc.js | 23 ++++ .../prototype/length/BigInt/return-length.js | 28 +++++ .../BigInt/this-has-no-typedarrayname-internal.js | 41 +++++++ .../prototype/length/BigInt/this-is-not-object.js | 49 ++++++++ .../prototype/map/BigInt/arraylength-internal.js | 45 +++++++ .../BigInt/callbackfn-arguments-with-thisarg.js | 48 ++++++++ .../BigInt/callbackfn-arguments-without-thisarg.js | 46 +++++++ .../map/BigInt/callbackfn-detachbuffer.js | 35 ++++++ .../map/BigInt/callbackfn-is-not-callable.js | 47 ++++++++ ...n-no-interaction-over-non-integer-properties.js | 41 +++++++ .../map/BigInt/callbackfn-not-called-on-empty.js | 28 +++++ .../callbackfn-return-affects-returned-object.js | 31 +++++ .../callbackfn-return-does-not-change-instance.js | 25 ++++ ...-return-does-not-copy-non-integer-properties.js | 42 +++++++ .../map/BigInt/callbackfn-returns-abrupt.js | 22 ++++ .../callbackfn-set-value-during-interaction.js | 43 +++++++ .../prototype/map/BigInt/callbackfn-this.js | 50 ++++++++ .../prototype/map/BigInt/detached-buffer.js | 32 +++++ .../prototype/map/BigInt/invoked-as-func.js | 30 +++++ .../prototype/map/BigInt/invoked-as-method.js | 30 +++++ .../TypedArray/prototype/map/BigInt/length.js | 29 +++++ .../TypedArray/prototype/map/BigInt/name.js | 26 ++++ .../TypedArray/prototype/map/BigInt/prop-desc.js | 18 +++ ...pedarray-conversion-operation-consistent-nan.js | 61 ++++++++++ .../return-new-typedarray-conversion-operation.js | 51 ++++++++ .../return-new-typedarray-from-empty-length.js | 38 ++++++ .../return-new-typedarray-from-positive-length.js | 34 ++++++ .../prototype/map/BigInt/this-is-not-object.js | 51 ++++++++ .../map/BigInt/this-is-not-typedarray-instance.js | 43 +++++++ .../prototype/map/BigInt/values-are-not-cached.js | 28 +++++ .../callbackfn-arguments-custom-accumulator.js | 58 +++++++++ .../callbackfn-arguments-default-accumulator.js | 59 +++++++++ .../reduce/BigInt/callbackfn-detachbuffer.js | 43 +++++++ .../BigInt/callbackfn-is-not-callable-throws.js | 67 +++++++++++ ...kfn-no-iteration-over-non-integer-properties.js | 48 ++++++++ .../BigInt/callbackfn-not-called-on-empty.js | 39 ++++++ .../callbackfn-return-does-not-change-instance.js | 21 ++++ .../reduce/BigInt/callbackfn-returns-abrupt.js | 43 +++++++ .../callbackfn-set-value-during-iteration.js | 49 ++++++++ .../prototype/reduce/BigInt/callbackfn-this.js | 44 +++++++ .../prototype/reduce/BigInt/detached-buffer.js | 32 +++++ .../BigInt/empty-instance-return-initialvalue.js | 41 +++++++ .../empty-instance-with-no-initialvalue-throws.js | 34 ++++++ .../BigInt/get-length-uses-internal-arraylength.js | 46 +++++++ .../prototype/reduce/BigInt/invoked-as-func.js | 30 +++++ .../prototype/reduce/BigInt/invoked-as-method.js | 30 +++++ .../TypedArray/prototype/reduce/BigInt/length.js | 29 +++++ .../TypedArray/prototype/reduce/BigInt/name.js | 26 ++++ .../prototype/reduce/BigInt/prop-desc.js | 18 +++ .../BigInt/result-is-last-callbackfn-return.js | 59 +++++++++ .../prototype/reduce/BigInt/result-of-any-type.js | 67 +++++++++++ .../return-first-value-without-callbackfn.js | 42 +++++++ .../prototype/reduce/BigInt/this-is-not-object.js | 51 ++++++++ .../BigInt/this-is-not-typedarray-instance.js | 43 +++++++ .../reduce/BigInt/values-are-not-cached.js | 41 +++++++ .../callbackfn-arguments-custom-accumulator.js | 59 +++++++++ .../callbackfn-arguments-default-accumulator.js | 62 ++++++++++ .../reduceRight/BigInt/callbackfn-detachbuffer.js | 43 +++++++ .../BigInt/callbackfn-is-not-callable-throws.js | 67 +++++++++++ ...kfn-no-iteration-over-non-integer-properties.js | 49 ++++++++ .../BigInt/callbackfn-not-called-on-empty.js | 40 ++++++ .../callbackfn-return-does-not-change-instance.js | 21 ++++ .../BigInt/callbackfn-returns-abrupt.js | 43 +++++++ .../callbackfn-set-value-during-iteration.js | 49 ++++++++ .../reduceRight/BigInt/callbackfn-this.js | 45 +++++++ .../reduceRight/BigInt/detached-buffer.js | 32 +++++ .../BigInt/empty-instance-return-initialvalue.js | 42 +++++++ .../empty-instance-with-no-initialvalue-throws.js | 34 ++++++ .../BigInt/get-length-uses-internal-arraylength.js | 46 +++++++ .../reduceRight/BigInt/invoked-as-func.js | 30 +++++ .../reduceRight/BigInt/invoked-as-method.js | 30 +++++ .../prototype/reduceRight/BigInt/length.js | 29 +++++ .../prototype/reduceRight/BigInt/name.js | 26 ++++ .../prototype/reduceRight/BigInt/prop-desc.js | 18 +++ .../BigInt/result-is-last-callbackfn-return.js | 61 ++++++++++ .../reduceRight/BigInt/result-of-any-type.js | 69 +++++++++++ .../return-first-value-without-callbackfn.js | 43 +++++++ .../reduceRight/BigInt/this-is-not-object.js | 51 ++++++++ .../BigInt/this-is-not-typedarray-instance.js | 43 +++++++ .../reduceRight/BigInt/values-are-not-cached.js | 42 +++++++ .../prototype/reverse/BigInt/detached-buffer.js | 28 +++++ .../BigInt/get-length-uses-internal-arraylength.js | 42 +++++++ .../prototype/reverse/BigInt/invoked-as-func.js | 30 +++++ .../prototype/reverse/BigInt/invoked-as-method.js | 30 +++++ .../TypedArray/prototype/reverse/BigInt/length.js | 29 +++++ .../TypedArray/prototype/reverse/BigInt/name.js | 26 ++++ .../BigInt/preserves-non-numeric-properties.js | 35 ++++++ .../prototype/reverse/BigInt/prop-desc.js | 18 +++ .../reverse/BigInt/returns-original-object.js | 39 ++++++ .../TypedArray/prototype/reverse/BigInt/reverts.js | 57 +++++++++ .../prototype/reverse/BigInt/this-is-not-object.js | 50 ++++++++ .../BigInt/this-is-not-typedarray-instance.js | 42 +++++++ .../array-arg-negative-integer-offset-throws.js | 35 ++++++ .../set/BigInt/array-arg-offset-tointeger.js | 95 +++++++++++++++ .../array-arg-return-abrupt-from-src-get-length.js | 33 +++++ .../array-arg-return-abrupt-from-src-get-value.js | 48 ++++++++ ...ray-arg-return-abrupt-from-src-length-symbol.js | 30 +++++ .../array-arg-return-abrupt-from-src-length.js | 46 +++++++ ...return-abrupt-from-src-tonumber-value-symbol.js | 44 +++++++ ...ay-arg-return-abrupt-from-src-tonumber-value.js | 48 ++++++++ ...g-return-abrupt-from-tointeger-offset-symbol.js | 27 +++++ ...rray-arg-return-abrupt-from-tointeger-offset.js | 41 +++++++ ...array-arg-return-abrupt-from-toobject-offset.js | 30 +++++ .../set/BigInt/array-arg-set-values-in-order.js | 72 +++++++++++ .../prototype/set/BigInt/array-arg-set-values.js | 63 ++++++++++ .../array-arg-src-tonumber-value-conversions.js | 30 +++++ ...rray-arg-src-tonumber-value-type-conversions.js | 50 ++++++++ .../BigInt/array-arg-src-values-are-not-cached.js | 47 ++++++++ .../array-arg-target-arraylength-internal.js | 41 +++++++ ...argetbuffer-detached-on-get-src-value-throws.js | 45 +++++++ ...etbuffer-detached-on-tointeger-offset-throws.js | 39 ++++++ .../array-arg-targetbuffer-detached-throws.js | 43 +++++++ .../prototype/set/BigInt/bit-precision.js | 35 ++++++ .../prototype/set/BigInt/invoked-as-func.js | 21 ++++ .../prototype/set/BigInt/invoked-as-method.js | 21 ++++ .../TypedArray/prototype/set/BigInt/length.js | 29 +++++ .../TypedArray/prototype/set/BigInt/name.js | 26 ++++ .../TypedArray/prototype/set/BigInt/prop-desc.js | 18 +++ .../prototype/set/BigInt/this-is-not-object.js | 75 ++++++++++++ .../set/BigInt/this-is-not-typedarray-instance.js | 56 +++++++++ ...ypedarray-arg-negative-integer-offset-throws.js | 33 +++++ .../set/BigInt/typedarray-arg-offset-tointeger.js | 93 ++++++++++++++ ...g-return-abrupt-from-tointeger-offset-symbol.js | 26 ++++ ...rray-arg-return-abrupt-from-tointeger-offset.js | 40 ++++++ ...alues-diff-buffer-other-type-conversions-sab.js | 51 ++++++++ ...et-values-diff-buffer-other-type-conversions.js | 37 ++++++ ...ay-arg-set-values-diff-buffer-other-type-sab.js | 107 ++++++++++++++++ ...darray-arg-set-values-diff-buffer-other-type.js | 48 ++++++++ ...ray-arg-set-values-diff-buffer-same-type-sab.js | 107 ++++++++++++++++ ...edarray-arg-set-values-diff-buffer-same-type.js | 50 ++++++++ ...ray-arg-set-values-same-buffer-same-type-sab.js | 51 ++++++++ ...edarray-arg-set-values-same-buffer-same-type.js | 53 ++++++++ .../typedarray-arg-src-arraylength-internal.js | 41 +++++++ .../typedarray-arg-src-byteoffset-internal.js | 45 +++++++ ...range-greather-than-target-throws-rangeerror.js | 51 ++++++++ ...ffer-detached-during-tointeger-offset-throws.js | 39 ++++++ .../typedarray-arg-target-arraylength-internal.js | 42 +++++++ .../typedarray-arg-target-byteoffset-internal.js | 44 +++++++ ...ffer-detached-during-tointeger-offset-throws.js | 39 ++++++ ...darray-arg-set-values-same-buffer-other-type.js | 2 +- .../prototype/slice/BigInt/arraylength-internal.js | 38 ++++++ .../prototype/slice/BigInt/bit-precision.js | 39 ++++++ ...detached-buffer-custom-ctor-other-targettype.js | 38 ++++++ .../detached-buffer-custom-ctor-same-targettype.js | 34 ++++++ .../slice/BigInt/detached-buffer-get-ctor.js | 33 +++++ ...r-speciesctor-get-species-custom-ctor-throws.js | 43 +++++++ ...ffer-zero-count-custom-ctor-other-targettype.js | 48 ++++++++ ...uffer-zero-count-custom-ctor-same-targettype.js | 45 +++++++ .../prototype/slice/BigInt/detached-buffer.js | 33 +++++ .../TypedArray/prototype/slice/BigInt/infinity.js | 29 +++++ .../prototype/slice/BigInt/invoked-as-func.js | 30 +++++ .../prototype/slice/BigInt/invoked-as-method.js | 30 +++++ .../TypedArray/prototype/slice/BigInt/length.js | 29 +++++ .../prototype/slice/BigInt/minus-zero.js | 31 +++++ .../TypedArray/prototype/slice/BigInt/name.js | 26 ++++ .../TypedArray/prototype/slice/BigInt/prop-desc.js | 18 +++ .../result-does-not-copy-ordinary-properties.js | 22 ++++ .../slice/BigInt/results-with-different-length.js | 53 ++++++++ .../slice/BigInt/results-with-empty-length.js | 52 ++++++++ .../slice/BigInt/results-with-same-length.js | 32 +++++ .../slice/BigInt/return-abrupt-from-end-symbol.js | 25 ++++ .../slice/BigInt/return-abrupt-from-end.js | 39 ++++++ .../BigInt/return-abrupt-from-start-symbol.js | 24 ++++ .../slice/BigInt/return-abrupt-from-start.js | 38 ++++++ .../BigInt/set-values-from-different-ctor-type.js | 47 ++++++++ .../slice/BigInt/speciesctor-get-ctor-abrupt.js | 41 +++++++ .../slice/BigInt/speciesctor-get-ctor-inherited.js | 62 ++++++++++ .../BigInt/speciesctor-get-ctor-returns-throws.js | 63 ++++++++++ .../prototype/slice/BigInt/speciesctor-get-ctor.js | 54 +++++++++ .../slice/BigInt/speciesctor-get-species-abrupt.js | 45 +++++++ ...eciesctor-get-species-custom-ctor-invocation.js | 59 +++++++++ ...esctor-get-species-custom-ctor-length-throws.js | 41 +++++++ .../speciesctor-get-species-custom-ctor-length.js | 46 +++++++ ...species-custom-ctor-returns-another-instance.js | 53 ++++++++ .../speciesctor-get-species-custom-ctor-throws.js | 47 ++++++++ .../BigInt/speciesctor-get-species-custom-ctor.js | 54 +++++++++ .../speciesctor-get-species-returns-throws.js | 66 ++++++++++ .../speciesctor-get-species-use-default-ctor.js | 54 +++++++++ .../slice/BigInt/speciesctor-get-species.js | 46 +++++++ .../prototype/slice/BigInt/this-is-not-object.js | 52 ++++++++ .../BigInt/this-is-not-typedarray-instance.js | 44 +++++++ .../prototype/slice/BigInt/tointeger-end.js | 48 ++++++++ .../prototype/slice/BigInt/tointeger-start.js | 48 ++++++++ .../BigInt/callbackfn-arguments-with-thisarg.js | 57 +++++++++ .../BigInt/callbackfn-arguments-without-thisarg.js | 55 +++++++++ .../some/BigInt/callbackfn-detachbuffer.js | 42 +++++++ .../callbackfn-no-interaction-over-non-integer.js | 40 ++++++ .../some/BigInt/callbackfn-not-callable-throws.js | 69 +++++++++++ .../some/BigInt/callbackfn-not-called-on-empty.js | 36 ++++++ .../callbackfn-return-does-not-change-instance.js | 38 ++++++ .../some/BigInt/callbackfn-returns-abrupt.js | 35 ++++++ .../callbackfn-set-value-during-interaction.js | 56 +++++++++ .../prototype/some/BigInt/callbackfn-this.js | 57 +++++++++ .../prototype/some/BigInt/detached-buffer.js | 32 +++++ .../BigInt/get-length-uses-internal-arraylength.js | 46 +++++++ .../prototype/some/BigInt/invoked-as-func.js | 29 +++++ .../prototype/some/BigInt/invoked-as-method.js | 29 +++++ .../TypedArray/prototype/some/BigInt/length.js | 29 +++++ .../TypedArray/prototype/some/BigInt/name.js | 26 ++++ .../TypedArray/prototype/some/BigInt/prop-desc.js | 18 +++ .../returns-false-if-every-cb-returns-false.js | 43 +++++++ .../BigInt/returns-true-if-any-cb-returns-true.js | 59 +++++++++ .../prototype/some/BigInt/this-is-not-object.js | 51 ++++++++ .../some/BigInt/this-is-not-typedarray-instance.js | 43 +++++++ .../prototype/some/BigInt/values-are-not-cached.js | 40 ++++++ .../prototype/sort/BigInt/arraylength-internal.js | 39 ++++++ .../prototype/sort/BigInt/comparefn-call-throws.js | 42 +++++++ .../prototype/sort/BigInt/comparefn-calls.js | 42 +++++++ .../BigInt/comparefn-nonfunction-call-throws.js | 55 +++++++++ .../sort/BigInt/detached-buffer-comparefn.js | 38 ++++++ .../prototype/sort/BigInt/detached-buffer.js | 31 +++++ .../prototype/sort/BigInt/invoked-as-func.js | 35 ++++++ .../prototype/sort/BigInt/invoked-as-method.js | 35 ++++++ .../TypedArray/prototype/sort/BigInt/length.js | 29 +++++ .../TypedArray/prototype/sort/BigInt/name.js | 26 ++++ .../TypedArray/prototype/sort/BigInt/prop-desc.js | 18 +++ .../prototype/sort/BigInt/return-same-instance.js | 25 ++++ .../sort/BigInt/sortcompare-with-no-tostring.js | 27 +++++ .../prototype/sort/BigInt/sorted-values-nan.js | 38 ++++++ .../prototype/sort/BigInt/sorted-values.js | 53 ++++++++ .../prototype/sort/BigInt/this-is-not-object.js | 51 ++++++++ .../sort/BigInt/this-is-not-typedarray-instance.js | 43 +++++++ .../prototype/subarray/BigInt/detached-buffer.js | 65 ++++++++++ .../prototype/subarray/BigInt/infinity.js | 31 +++++ .../prototype/subarray/BigInt/invoked-as-func.js | 24 ++++ .../prototype/subarray/BigInt/invoked-as-method.js | 24 ++++ .../TypedArray/prototype/subarray/BigInt/length.js | 29 +++++ .../prototype/subarray/BigInt/minus-zero.js | 31 +++++ .../TypedArray/prototype/subarray/BigInt/name.js | 26 ++++ .../prototype/subarray/BigInt/prop-desc.js | 18 +++ .../result-does-not-copy-ordinary-properties.js | 27 +++++ .../result-is-new-instance-from-same-ctor.js | 31 +++++ .../result-is-new-instance-with-shared-buffer.js | 35 ++++++ .../BigInt/results-with-different-length.js | 58 +++++++++ .../subarray/BigInt/results-with-empty-length.js | 57 +++++++++ .../subarray/BigInt/results-with-same-length.js | 37 ++++++ .../BigInt/return-abrupt-from-begin-symbol.js | 24 ++++ .../subarray/BigInt/return-abrupt-from-begin.js | 38 ++++++ .../BigInt/return-abrupt-from-end-symbol.js | 25 ++++ .../subarray/BigInt/return-abrupt-from-end.js | 39 ++++++ .../subarray/BigInt/speciesctor-get-ctor-abrupt.js | 40 ++++++ .../BigInt/speciesctor-get-ctor-inherited.js | 61 ++++++++++ .../BigInt/speciesctor-get-ctor-returns-throws.js | 62 ++++++++++ .../subarray/BigInt/speciesctor-get-ctor.js | 53 ++++++++ .../BigInt/speciesctor-get-species-abrupt.js | 44 +++++++ ...eciesctor-get-species-custom-ctor-invocation.js | 61 ++++++++++ ...species-custom-ctor-returns-another-instance.js | 52 ++++++++ .../speciesctor-get-species-custom-ctor-throws.js | 46 +++++++ .../BigInt/speciesctor-get-species-custom-ctor.js | 53 ++++++++ .../speciesctor-get-species-returns-throws.js | 65 ++++++++++ .../speciesctor-get-species-use-default-ctor.js | 53 ++++++++ .../subarray/BigInt/speciesctor-get-species.js | 45 +++++++ .../subarray/BigInt/this-is-not-object.js | 47 ++++++++ .../BigInt/this-is-not-typedarray-instance.js | 39 ++++++ .../prototype/subarray/BigInt/tointeger-begin.js | 48 ++++++++ .../prototype/subarray/BigInt/tointeger-end.js | 48 ++++++++ .../BigInt/calls-tolocalestring-from-each-value.js | 53 ++++++++ .../BigInt/calls-tostring-from-each-value.js | 58 +++++++++ .../BigInt/calls-valueof-from-each-value.js | 56 +++++++++ .../toLocaleString/BigInt/detached-buffer.js | 28 +++++ .../BigInt/empty-instance-returns-empty-string.js | 26 ++++ .../BigInt/get-length-uses-internal-arraylength.js | 42 +++++++ .../toLocaleString/BigInt/invoked-as-func.js | 31 +++++ .../toLocaleString/BigInt/invoked-as-method.js | 31 +++++ .../prototype/toLocaleString/BigInt/length.js | 29 +++++ .../prototype/toLocaleString/BigInt/name.js | 26 ++++ .../prototype/toLocaleString/BigInt/prop-desc.js | 18 +++ ...turn-abrupt-from-firstelement-tolocalestring.js | 43 +++++++ .../return-abrupt-from-firstelement-tostring.js | 55 +++++++++ .../return-abrupt-from-firstelement-valueof.js | 56 +++++++++ ...eturn-abrupt-from-nextelement-tolocalestring.js | 46 +++++++ .../return-abrupt-from-nextelement-tostring.js | 57 +++++++++ .../return-abrupt-from-nextelement-valueof.js | 58 +++++++++ .../toLocaleString/BigInt/return-result.js | 47 ++++++++ .../toLocaleString/BigInt/this-is-not-object.js | 50 ++++++++ .../BigInt/this-is-not-typedarray-instance.js | 42 +++++++ .../prototype/toString/BigInt/detached-buffer.js | 32 +++++ .../prototype/values/BigInt/detached-buffer.js | 27 +++++ .../prototype/values/BigInt/invoked-as-func.js | 30 +++++ .../prototype/values/BigInt/invoked-as-method.js | 30 +++++ .../prototype/values/BigInt/iter-prototype.js | 25 ++++ .../TypedArray/prototype/values/BigInt/length.js | 29 +++++ .../TypedArray/prototype/values/BigInt/name.js | 26 ++++ .../prototype/values/BigInt/prop-desc.js | 18 +++ .../prototype/values/BigInt/return-itor.js | 37 ++++++ .../prototype/values/BigInt/this-is-not-object.js | 52 ++++++++ .../BigInt/this-is-not-typedarray-instance.js | 44 +++++++ ...teoffset-throws-from-modulo-element-size-sab.js | 38 ++++++ ...erbyteoffset-throws-from-modulo-element-size.js | 37 ++++++ .../byteoffset-is-negative-throws-sab.js | 32 +++++ .../buffer-arg/byteoffset-is-negative-throws.js | 31 +++++ .../buffer-arg/byteoffset-is-negative-zero-sab.js | 23 ++++ .../buffer-arg/byteoffset-is-negative-zero.js | 23 ++++ .../buffer-arg/byteoffset-is-symbol-throws-sab.js | 29 +++++ .../buffer-arg/byteoffset-is-symbol-throws.js | 28 +++++ ...teoffset-throws-from-modulo-element-size-sab.js | 33 +++++ .../byteoffset-throws-from-modulo-element-size.js | 32 +++++ .../byteoffset-to-number-detachbuffer.js | 21 ++++ .../buffer-arg/byteoffset-to-number-throws-sab.js | 33 +++++ .../buffer-arg/byteoffset-to-number-throws.js | 32 +++++ .../buffer-arg/custom-proto-access-throws-sab.js | 48 ++++++++ .../buffer-arg/custom-proto-access-throws.js | 47 ++++++++ .../buffer-arg/defined-length-and-offset-sab.js | 33 +++++ .../buffer-arg/defined-length-and-offset.js | 32 +++++ .../ctors-bigint/buffer-arg/defined-length-sab.js | 35 ++++++ .../ctors-bigint/buffer-arg/defined-length.js | 34 ++++++ .../buffer-arg/defined-negative-length-sab.js | 29 +++++ .../buffer-arg/defined-negative-length.js | 28 +++++ .../ctors-bigint/buffer-arg/defined-offset-sab.js | 33 +++++ .../ctors-bigint/buffer-arg/defined-offset.js | 32 +++++ .../ctors-bigint/buffer-arg/detachedbuffer.js | 21 ++++ .../buffer-arg/excessive-length-throws-sab.js | 32 +++++ .../buffer-arg/excessive-length-throws.js | 31 +++++ .../buffer-arg/excessive-offset-throws-sab.js | 36 ++++++ .../buffer-arg/excessive-offset-throws.js | 35 ++++++ .../invoked-with-undefined-newtarget-sab.js | 27 +++++ .../buffer-arg/invoked-with-undefined-newtarget.js | 26 ++++ .../ctors-bigint/buffer-arg/is-referenced-sab.js | 33 +++++ .../ctors-bigint/buffer-arg/is-referenced.js | 32 +++++ .../buffer-arg/length-access-throws-sab.js | 34 ++++++ .../buffer-arg/length-access-throws.js | 33 +++++ .../buffer-arg/length-is-symbol-throws-sab.js | 30 +++++ .../buffer-arg/length-is-symbol-throws.js | 29 +++++ .../buffer-arg/length-to-number-detachbuffer.js | 21 ++++ .../buffer-arg/new-instance-extensibility-sab.js | 38 ++++++ .../buffer-arg/new-instance-extensibility.js | 37 ++++++ .../buffer-arg/proto-from-ctor-realm-sab.js | 38 ++++++ .../buffer-arg/proto-from-ctor-realm.js | 37 ++++++ .../buffer-arg/returns-new-instance-sab.js | 34 ++++++ .../buffer-arg/returns-new-instance.js | 33 +++++ .../buffer-arg/toindex-bytelength-sab.js | 73 +++++++++++ .../ctors-bigint/buffer-arg/toindex-bytelength.js | 72 +++++++++++ .../buffer-arg/toindex-byteoffset-sab.js | 87 +++++++++++++ .../ctors-bigint/buffer-arg/toindex-byteoffset.js | 86 +++++++++++++ .../typedarray-backed-by-sharedarraybuffer.js | 23 ++++ .../buffer-arg/use-custom-proto-if-object-sab.js | 49 ++++++++ .../buffer-arg/use-custom-proto-if-object.js | 48 ++++++++ ...ault-proto-if-custom-proto-is-not-object-sab.js | 48 ++++++++ ...-default-proto-if-custom-proto-is-not-object.js | 47 ++++++++ ...teoffset-throws-from-modulo-element-size-sab.js | 38 ------ ...erbyteoffset-throws-from-modulo-element-size.js | 37 ------ ...buffer-arg-byteoffset-is-negative-throws-sab.js | 32 ----- .../buffer-arg-byteoffset-is-negative-throws.js | 31 ----- .../buffer-arg-byteoffset-is-negative-zero-sab.js | 23 ---- .../buffer-arg-byteoffset-is-negative-zero.js | 23 ---- .../buffer-arg-byteoffset-is-symbol-throws-sab.js | 29 ----- .../buffer-arg-byteoffset-is-symbol-throws.js | 28 ----- ...teoffset-throws-from-modulo-element-size-sab.js | 33 ----- ...g-byteoffset-throws-from-modulo-element-size.js | 32 ----- ...buffer-arg-byteoffset-to-number-detachbuffer.js | 21 ---- .../buffer-arg-byteoffset-to-number-throws-sab.js | 33 ----- .../buffer-arg-byteoffset-to-number-throws.js | 32 ----- .../buffer-arg-custom-proto-access-throws-sab.js | 48 -------- .../buffer-arg-custom-proto-access-throws.js | 47 -------- .../buffer-arg-defined-length-and-offset-sab.js | 33 ----- .../buffer-arg-defined-length-and-offset.js | 32 ----- .../butter-arg/buffer-arg-defined-length-sab.js | 35 ------ .../butter-arg/buffer-arg-defined-length.js | 34 ------ .../buffer-arg-defined-negative-length-sab.js | 29 ----- .../buffer-arg-defined-negative-length.js | 28 ----- .../butter-arg/buffer-arg-defined-offset-sab.js | 33 ----- .../butter-arg/buffer-arg-defined-offset.js | 32 ----- .../butter-arg/buffer-arg-detachedbuffer.js | 21 ---- .../buffer-arg-excessive-length-throws-sab.js | 32 ----- .../buffer-arg-excessive-length-throws.js | 31 ----- .../buffer-arg-excessive-offset-throws-sab.js | 36 ------ .../buffer-arg-excessive-offset-throws.js | 35 ------ ...fer-arg-invoked-with-undefined-newtarget-sab.js | 27 ----- .../buffer-arg-invoked-with-undefined-newtarget.js | 26 ---- .../butter-arg/buffer-arg-is-referenced-sab.js | 33 ----- .../butter-arg/buffer-arg-is-referenced.js | 32 ----- .../buffer-arg-length-access-throws-sab.js | 34 ------ .../butter-arg/buffer-arg-length-access-throws.js | 33 ----- .../buffer-arg-length-is-symbol-throws-sab.js | 30 ----- .../buffer-arg-length-is-symbol-throws.js | 29 ----- .../buffer-arg-length-to-number-detachbuffer.js | 21 ---- .../buffer-arg-new-instance-extensibility-sab.js | 38 ------ .../buffer-arg-new-instance-extensibility.js | 37 ------ .../buffer-arg-proto-from-ctor-realm-sab.js | 38 ------ .../butter-arg/buffer-arg-proto-from-ctor-realm.js | 37 ------ .../buffer-arg-returns-new-instance-sab.js | 34 ------ .../butter-arg/buffer-arg-returns-new-instance.js | 33 ----- .../buffer-arg-toindex-bytelength-sab.js | 73 ----------- .../butter-arg/buffer-arg-toindex-bytelength.js | 72 ----------- .../buffer-arg-toindex-byteoffset-sab.js | 87 ------------- .../butter-arg/buffer-arg-toindex-byteoffset.js | 86 ------------- ...r-arg-typedarray-backed-by-sharedarraybuffer.js | 23 ---- .../buffer-arg-use-custom-proto-if-object-sab.js | 49 -------- .../buffer-arg-use-custom-proto-if-object.js | 48 -------- ...ault-proto-if-custom-proto-is-not-object-sab.js | 48 -------- ...-default-proto-if-custom-proto-is-not-object.js | 47 -------- .../length-arg/custom-proto-access-throws.js | 43 +++++++ .../ctors-bigint/length-arg/init-zeros.js | 55 +++++++++ .../length-arg/is-infinity-throws-rangeerror.js | 27 +++++ .../is-negative-integer-throws-rangeerror.js | 37 ++++++ .../ctors-bigint/length-arg/is-symbol-throws.js | 26 ++++ .../length-arg-custom-proto-access-throws.js | 43 ------- .../length-arg/length-arg-init-zeros.js | 55 --------- .../length-arg-is-infinity-throws-rangeerror.js | 27 ----- ...th-arg-is-negative-integer-throws-rangeerror.js | 37 ------ .../length-arg/length-arg-is-symbol-throws.js | 26 ---- .../length-arg-new-instance-extensibility.js | 38 ------ .../length-arg/length-arg-proto-from-ctor-realm.js | 36 ------ .../length-arg/length-arg-returns-object.js | 33 ----- .../length-arg/length-arg-toindex-length.js | 53 -------- .../length-arg-undefined-newtarget-throws.js | 28 ----- .../length-arg-use-custom-proto-if-object.js | 44 ------- ...-default-proto-if-custom-proto-is-not-object.js | 43 ------- .../length-arg/new-instance-extensibility.js | 38 ++++++ .../length-arg/proto-from-ctor-realm.js | 36 ++++++ .../ctors-bigint/length-arg/returns-object.js | 33 +++++ .../ctors-bigint/length-arg/toindex-length.js | 53 ++++++++ .../length-arg/undefined-newtarget-throws.js | 28 +++++ .../length-arg/use-custom-proto-if-object.js | 44 +++++++ ...-default-proto-if-custom-proto-is-not-object.js | 43 +++++++ .../no-args/custom-proto-access-throws.js | 43 +++++++ .../no-args/new-instance-extensibility.js | 38 ++++++ .../no-args/no-args-custom-proto-access-throws.js | 43 ------- .../no-args/no-args-new-instance-extensibility.js | 38 ------ .../no-args/no-args-proto-from-ctor-realm.js | 36 ------ .../ctors-bigint/no-args/no-args-returns-object.js | 32 ----- .../no-args/no-args-undefined-newtarget-throws.js | 23 ---- .../no-args/no-args-use-custom-proto-if-object.js | 44 ------- ...-default-proto-if-custom-proto-is-not-object.js | 43 ------- .../ctors-bigint/no-args/proto-from-ctor-realm.js | 36 ++++++ .../ctors-bigint/no-args/returns-object.js | 32 +++++ .../no-args/undefined-newtarget-throws.js | 23 ++++ .../no-args/use-custom-proto-if-object.js | 44 +++++++ ...-default-proto-if-custom-proto-is-not-object.js | 43 +++++++ .../object-arg/object-arg-as-array-returns.js | 12 +- .../object-arg-as-generator-iterable-returns.js | 12 +- ...ject-arg-conversion-operation-consistent-nan.js | 2 +- .../object-arg/object-arg-conversion-operation.js | 2 +- .../object-arg-custom-proto-access-throws.js | 4 +- .../object-arg/object-arg-iterating-throws.js | 4 +- .../object-arg-iterator-not-callable-throws.js | 4 +- .../object-arg/object-arg-iterator-throws.js | 4 +- .../object-arg-length-excessive-throws.js | 4 +- .../object-arg-length-is-symbol-throws.js | 4 +- .../object-arg/object-arg-length-throws.js | 4 +- .../object-arg-new-instance-extensibility.js | 12 +- .../object-arg/object-arg-proto-from-ctor-realm.js | 4 +- .../ctors-bigint/object-arg/object-arg-returns.js | 47 -------- .../object-arg/object-arg-throws-from-property.js | 10 +- ...rg-throws-setting-obj-to-primitive-typeerror.js | 8 +- .../object-arg-throws-setting-obj-to-primitive.js | 8 +- .../object-arg-throws-setting-obj-tostring.js | 8 +- ...ect-arg-throws-setting-obj-valueof-typeerror.js | 8 +- .../object-arg-throws-setting-obj-valueof.js | 8 +- .../object-arg-throws-setting-property.js | 10 +- .../object-arg-throws-setting-symbol-property.js | 4 +- .../object-arg-undefined-newtarget-throws.js | 4 +- .../object-arg-use-custom-proto-if-object.js | 4 +- ...-default-proto-if-custom-proto-is-not-object.js | 4 +- .../typedarray-arg-custom-proto-access-throws.js | 4 +- ...tached-when-species-retrieved-different-type.js | 4 +- ...rg-detached-when-species-retrieved-same-type.js | 4 +- .../typedarray-arg-new-instance-extensibility.js | 4 +- ...ray-arg-other-ctor-buffer-ctor-access-throws.js | 4 +- ...er-ctor-custom-species-proto-from-ctor-realm.js | 4 +- ...ay-arg-other-ctor-buffer-ctor-custom-species.js | 4 +- ...arg-other-ctor-buffer-ctor-not-object-throws.js | 4 +- ...other-ctor-buffer-ctor-species-access-throws.js | 4 +- ...her-ctor-buffer-ctor-species-not-ctor-throws.js | 4 +- ...rray-arg-other-ctor-buffer-ctor-species-null.js | 4 +- ...er-ctor-buffer-ctor-species-prototype-throws.js | 4 +- ...arg-other-ctor-buffer-ctor-species-undefined.js | 4 +- ...darray-arg-other-ctor-returns-new-typedarray.js | 4 +- .../typedarray-arg-proto-from-ctor-realm.js | 4 +- .../typedarray-arg-returns-new-instance.js | 31 ----- ...rray-arg-same-ctor-buffer-ctor-access-throws.js | 4 +- ...er-ctor-species-custom-proto-from-ctor-realm.js | 4 +- ...ray-arg-same-ctor-buffer-ctor-species-custom.js | 4 +- ...y-arg-same-ctor-buffer-ctor-species-not-ctor.js | 4 +- ...array-arg-same-ctor-buffer-ctor-species-null.js | 4 +- ...me-ctor-buffer-ctor-species-prototype-throws.js | 4 +- ...ray-arg-same-ctor-buffer-ctor-species-throws.js | 4 +- ...-arg-same-ctor-buffer-ctor-species-undefined.js | 4 +- ...g-same-ctor-buffer-ctor-value-not-obj-throws.js | 4 +- ...-arg-same-ctor-returns-new-cloned-typedarray.js | 4 +- .../typedarray-arg-undefined-newtarget-throws.js | 4 +- .../typedarray-arg-use-custom-proto-if-object.js | 48 -------- ...-default-proto-if-custom-proto-is-not-object.js | 47 -------- ...teoffset-throws-from-modulo-element-size-sab.js | 38 ++++++ ...erbyteoffset-throws-from-modulo-element-size.js | 37 ++++++ ...buffer-arg-byteoffset-is-negative-throws-sab.js | 32 +++++ .../buffer-arg-byteoffset-is-negative-throws.js | 31 +++++ .../buffer-arg-byteoffset-is-negative-zero-sab.js | 23 ++++ .../buffer-arg-byteoffset-is-negative-zero.js | 23 ++++ .../buffer-arg-byteoffset-is-symbol-throws-sab.js | 29 +++++ .../buffer-arg-byteoffset-is-symbol-throws.js | 28 +++++ ...teoffset-throws-from-modulo-element-size-sab.js | 33 +++++ ...g-byteoffset-throws-from-modulo-element-size.js | 32 +++++ ...buffer-arg-byteoffset-to-number-detachbuffer.js | 21 ++++ .../buffer-arg-byteoffset-to-number-throws-sab.js | 33 +++++ .../buffer-arg-byteoffset-to-number-throws.js | 32 +++++ .../buffer-arg-custom-proto-access-throws-sab.js | 48 ++++++++ .../buffer-arg-custom-proto-access-throws.js | 47 ++++++++ .../buffer-arg-defined-length-and-offset-sab.js | 33 +++++ .../buffer-arg-defined-length-and-offset.js | 32 +++++ .../buffer-arg/buffer-arg-defined-length-sab.js | 35 ++++++ .../ctors/buffer-arg/buffer-arg-defined-length.js | 34 ++++++ .../buffer-arg-defined-negative-length-sab.js | 29 +++++ .../buffer-arg-defined-negative-length.js | 28 +++++ .../buffer-arg/buffer-arg-defined-offset-sab.js | 33 +++++ .../ctors/buffer-arg/buffer-arg-defined-offset.js | 32 +++++ .../ctors/buffer-arg/buffer-arg-detachedbuffer.js | 21 ++++ .../buffer-arg-excessive-length-throws-sab.js | 32 +++++ .../buffer-arg-excessive-length-throws.js | 31 +++++ .../buffer-arg-excessive-offset-throws-sab.js | 36 ++++++ .../buffer-arg-excessive-offset-throws.js | 35 ++++++ ...fer-arg-invoked-with-undefined-newtarget-sab.js | 27 +++++ .../buffer-arg-invoked-with-undefined-newtarget.js | 26 ++++ .../buffer-arg/buffer-arg-is-referenced-sab.js | 33 +++++ .../ctors/buffer-arg/buffer-arg-is-referenced.js | 32 +++++ .../buffer-arg-length-access-throws-sab.js | 34 ++++++ .../buffer-arg/buffer-arg-length-access-throws.js | 33 +++++ .../buffer-arg-length-is-symbol-throws-sab.js | 30 +++++ .../buffer-arg-length-is-symbol-throws.js | 29 +++++ .../buffer-arg-length-to-number-detachbuffer.js | 21 ++++ .../buffer-arg-new-instance-extensibility-sab.js | 38 ++++++ .../buffer-arg-new-instance-extensibility.js | 37 ++++++ .../buffer-arg-proto-from-ctor-realm-sab.js | 38 ++++++ .../buffer-arg/buffer-arg-proto-from-ctor-realm.js | 37 ++++++ .../buffer-arg-returns-new-instance-sab.js | 34 ++++++ .../buffer-arg/buffer-arg-returns-new-instance.js | 33 +++++ .../buffer-arg-toindex-bytelength-sab.js | 73 +++++++++++ .../buffer-arg/buffer-arg-toindex-bytelength.js | 72 +++++++++++ .../buffer-arg-toindex-byteoffset-sab.js | 87 +++++++++++++ .../buffer-arg/buffer-arg-toindex-byteoffset.js | 86 +++++++++++++ ...r-arg-typedarray-backed-by-sharedarraybuffer.js | 23 ++++ .../buffer-arg-use-custom-proto-if-object-sab.js | 49 ++++++++ .../buffer-arg-use-custom-proto-if-object.js | 48 ++++++++ ...ault-proto-if-custom-proto-is-not-object-sab.js | 48 ++++++++ ...-default-proto-if-custom-proto-is-not-object.js | 47 ++++++++ .../length-arg-custom-proto-access-throws.js | 43 +++++++ .../ctors/length-arg/length-arg-init-zeros.js | 55 +++++++++ .../length-arg-is-infinity-throws-rangeerror.js | 27 +++++ ...th-arg-is-negative-integer-throws-rangeerror.js | 37 ++++++ .../length-arg/length-arg-is-symbol-throws.js | 26 ++++ .../length-arg-new-instance-extensibility.js | 38 ++++++ .../length-arg/length-arg-proto-from-ctor-realm.js | 36 ++++++ .../ctors/length-arg/length-arg-returns-object.js | 33 +++++ .../ctors/length-arg/length-arg-toindex-length.js | 53 ++++++++ .../length-arg-undefined-newtarget-throws.js | 28 +++++ .../length-arg-use-custom-proto-if-object.js | 44 +++++++ ...-default-proto-if-custom-proto-is-not-object.js | 43 +++++++ .../no-args/no-args-custom-proto-access-throws.js | 43 +++++++ .../no-args/no-args-new-instance-extensibility.js | 38 ++++++ .../ctors/no-args/no-args-proto-from-ctor-realm.js | 36 ++++++ .../ctors/no-args/no-args-returns-object.js | 32 +++++ .../no-args/no-args-undefined-newtarget-throws.js | 23 ++++ .../no-args/no-args-use-custom-proto-if-object.js | 44 +++++++ ...-default-proto-if-custom-proto-is-not-object.js | 43 +++++++ .../object-arg/object-arg-as-array-returns.js | 28 +++++ .../object-arg-as-generator-iterable-returns.js | 30 +++++ ...ject-arg-conversion-operation-consistent-nan.js | 60 +++++++++ .../object-arg/object-arg-conversion-operation.js | 52 ++++++++ .../object-arg-custom-proto-access-throws.js | 48 ++++++++ .../object-arg/object-arg-iterating-throws.js | 31 +++++ .../object-arg-iterator-not-callable-throws.js | 39 ++++++ .../ctors/object-arg/object-arg-iterator-throws.js | 34 ++++++ .../object-arg-length-excessive-throws.js | 30 +++++ .../object-arg-length-is-symbol-throws.js | 30 +++++ .../ctors/object-arg/object-arg-length-throws.js | 34 ++++++ .../object-arg-new-instance-extensibility.js | 43 +++++++ .../object-arg/object-arg-proto-from-ctor-realm.js | 37 ++++++ .../ctors/object-arg/object-arg-returns.js | 45 +++++++ .../object-arg/object-arg-throws-from-property.js | 38 ++++++ ...rg-throws-setting-obj-to-primitive-typeerror.js | 77 ++++++++++++ .../object-arg-throws-setting-obj-to-primitive.js | 75 ++++++++++++ .../object-arg-throws-setting-obj-tostring.js | 88 ++++++++++++++ ...ect-arg-throws-setting-obj-valueof-typeerror.js | 89 ++++++++++++++ .../object-arg-throws-setting-obj-valueof.js | 82 +++++++++++++ .../object-arg-throws-setting-property.js | 38 ++++++ .../object-arg-throws-setting-symbol-property.js | 34 ++++++ .../object-arg-undefined-newtarget-throws.js | 30 +++++ .../object-arg-use-custom-proto-if-object.js | 47 ++++++++ ...-default-proto-if-custom-proto-is-not-object.js | 47 ++++++++ .../typedarray-arg-custom-proto-access-throws.js | 47 ++++++++ ...tached-when-species-retrieved-different-type.js | 61 ++++++++++ ...rg-detached-when-species-retrieved-same-type.js | 64 ++++++++++ .../typedarray-arg-new-instance-extensibility.js | 46 +++++++ ...ray-arg-other-ctor-buffer-ctor-access-throws.js | 41 +++++++ ...er-ctor-custom-species-proto-from-ctor-realm.js | 59 +++++++++ ...ay-arg-other-ctor-buffer-ctor-custom-species.js | 52 ++++++++ ...arg-other-ctor-buffer-ctor-not-object-throws.js | 61 ++++++++++ ...other-ctor-buffer-ctor-species-access-throws.js | 45 +++++++ ...her-ctor-buffer-ctor-species-not-ctor-throws.js | 47 ++++++++ ...rray-arg-other-ctor-buffer-ctor-species-null.js | 44 +++++++ ...er-ctor-buffer-ctor-species-prototype-throws.js | 59 +++++++++ ...arg-other-ctor-buffer-ctor-species-undefined.js | 43 +++++++ ...darray-arg-other-ctor-returns-new-typedarray.js | 28 +++++ .../typedarray-arg-proto-from-ctor-realm.js | 37 ++++++ .../typedarray-arg-returns-new-instance.js | 31 +++++ ...rray-arg-same-ctor-buffer-ctor-access-throws.js | 46 +++++++ ...er-ctor-species-custom-proto-from-ctor-realm.js | 68 +++++++++++ ...ray-arg-same-ctor-buffer-ctor-species-custom.js | 60 +++++++++ ...y-arg-same-ctor-buffer-ctor-species-not-ctor.js | 49 ++++++++ ...array-arg-same-ctor-buffer-ctor-species-null.js | 49 ++++++++ ...me-ctor-buffer-ctor-species-prototype-throws.js | 62 ++++++++++ ...ray-arg-same-ctor-buffer-ctor-species-throws.js | 49 ++++++++ ...-arg-same-ctor-buffer-ctor-species-undefined.js | 49 ++++++++ ...g-same-ctor-buffer-ctor-value-not-obj-throws.js | 65 ++++++++++ ...-arg-same-ctor-returns-new-cloned-typedarray.js | 32 +++++ .../typedarray-arg-undefined-newtarget-throws.js | 27 +++++ .../typedarray-arg-use-custom-proto-if-object.js | 48 ++++++++ ...-default-proto-if-custom-proto-is-not-object.js | 47 ++++++++ .../from/BigInt/arylk-get-length-error.js | 28 +++++ .../from/BigInt/arylk-to-length-error.js | 28 +++++ .../custom-ctor-does-not-instantiate-ta-throws.js | 29 +++++ .../BigInt/custom-ctor-returns-other-instance.js | 53 ++++++++ .../custom-ctor-returns-smaller-instance-throws.js | 41 +++++++ .../TypedArrays/from/BigInt/custom-ctor.js | 34 ++++++ .../built-ins/TypedArrays/from/BigInt/inherited.js | 25 ++++ .../TypedArrays/from/BigInt/invoked-as-func.js | 23 ++++ .../TypedArrays/from/BigInt/iter-access-error.js | 32 +++++ .../TypedArrays/from/BigInt/iter-invoke-error.js | 32 +++++ .../TypedArrays/from/BigInt/iter-next-error.js | 31 +++++ .../from/BigInt/iter-next-value-error.js | 40 ++++++ .../from/BigInt/mapfn-abrupt-completion.js | 32 +++++ .../TypedArrays/from/BigInt/mapfn-arguments.js | 48 ++++++++ .../from/BigInt/mapfn-is-not-callable.js | 59 +++++++++ .../from/BigInt/mapfn-this-with-thisarg.js | 37 ++++++ .../mapfn-this-without-thisarg-non-strict.js | 38 ++++++ .../BigInt/mapfn-this-without-thisarg-strict.js | 37 ++++++ .../TypedArrays/from/BigInt/nan-conversion.js | 50 ++++++++ .../TypedArrays/from/BigInt/new-instance-empty.js | 17 +++ .../BigInt/new-instance-from-ordinary-object.js | 53 ++++++++ .../from/BigInt/new-instance-from-sparse-array.js | 53 ++++++++ .../from/BigInt/new-instance-from-zero.js | 40 ++++++ .../from/BigInt/new-instance-using-custom-ctor.js | 30 +++++ .../from/BigInt/new-instance-with-mapfn.js | 25 ++++ .../from/BigInt/new-instance-without-mapfn.js | 21 ++++ .../from/BigInt/property-abrupt-completion.js | 32 +++++ .../from/BigInt/set-value-abrupt-completion.js | 45 +++++++ .../from/BigInt/source-value-is-symbol-throws.js | 23 ++++ .../from/BigInt/this-is-not-constructor.js | 23 ++++ .../from/custom-ctor-returns-other-instance.js | 12 +- test/built-ins/TypedArrays/from/mapfn-arguments.js | 3 +- .../TypedArrays/from/mapfn-this-with-thisarg.js | 3 +- .../from/mapfn-this-without-thisarg-non-strict.js | 7 +- .../from/mapfn-this-without-thisarg-strict.js | 3 +- .../from/new-instance-using-custom-ctor.js | 10 +- .../TypedArrays/from/new-instance-with-mapfn.js | 10 +- .../TypedArrays/from/new-instance-without-mapfn.js | 10 +- .../from/set-value-abrupt-completion.js | 5 +- .../BigInt/conversion-operation.js | 53 ++++++++ .../DefineOwnProperty/BigInt/desc-value-throws.js | 40 ++++++ .../BigInt/detached-buffer-realm.js | 47 ++++++++ .../DefineOwnProperty/BigInt/detached-buffer.js | 134 +++++++++++++++++++++ .../BigInt/key-is-greater-than-last-index.js | 47 ++++++++ .../BigInt/key-is-lower-than-zero.js | 34 ++++++ .../DefineOwnProperty/BigInt/key-is-minus-zero.js | 36 ++++++ .../BigInt/key-is-not-canonical-index.js | 98 +++++++++++++++ .../DefineOwnProperty/BigInt/key-is-not-integer.js | 124 +++++++++++++++++++ .../BigInt/key-is-not-numeric-index.js | 52 ++++++++ .../BigInt/key-is-numericindex-accessor-desc.js | 58 +++++++++ .../key-is-numericindex-desc-configurable.js | 35 ++++++ .../key-is-numericindex-desc-not-enumerable.js | 35 ++++++ .../key-is-numericindex-desc-not-writable.js | 35 ++++++ .../BigInt/key-is-numericindex.js | 42 +++++++ .../DefineOwnProperty/BigInt/key-is-symbol.js | 54 +++++++++ .../BigInt/non-extensible-new-key.js | 44 +++++++ .../BigInt/non-extensible-redefine-key.js | 57 +++++++++ .../DefineOwnProperty/BigInt/set-value.js | 45 +++++++ .../BigInt/this-is-not-extensible.js | 31 +++++ .../BigInt/tonumber-value-detached-buffer.js | 55 +++++++++ .../DefineOwnProperty/desc-value-throws.js | 4 +- .../key-is-greater-than-last-index.js | 4 +- .../DefineOwnProperty/key-is-lower-than-zero.js | 4 +- .../DefineOwnProperty/key-is-minus-zero.js | 4 +- .../key-is-not-canonical-index.js | 16 +-- .../DefineOwnProperty/key-is-not-integer.js | 16 +-- .../DefineOwnProperty/key-is-not-numeric-index.js | 4 +- .../key-is-numericindex-accessor-desc.js | 8 +- .../key-is-numericindex-desc-configurable.js | 4 +- .../key-is-numericindex-desc-not-enumerable.js | 4 +- .../key-is-numericindex-desc-not-writable.js | 4 +- .../DefineOwnProperty/key-is-numericindex.js | 10 +- .../internals/DefineOwnProperty/key-is-symbol.js | 4 +- .../DefineOwnProperty/non-extensible-new-key.js | 4 +- .../non-extensible-redefine-key.js | 4 +- .../internals/DefineOwnProperty/set-value.js | 12 +- .../DefineOwnProperty/this-is-not-extensible.js | 4 +- .../detached-buffer-key-is-not-numeric-index.js | 28 +++++ .../Get/BigInt/detached-buffer-key-is-symbol.js | 28 +++++ .../internals/Get/BigInt/detached-buffer-realm.js | 32 +++++ .../internals/Get/BigInt/detached-buffer.js | 47 ++++++++ .../internals/Get/BigInt/indexed-value-sab.js | 28 +++++ .../internals/Get/BigInt/indexed-value.js | 34 ++++++ .../Get/BigInt/infinity-detached-buffer.js | 40 ++++++ .../Get/BigInt/key-is-not-canonical-index.js | 61 ++++++++++ .../internals/Get/BigInt/key-is-not-integer.js | 37 ++++++ .../internals/Get/BigInt/key-is-not-minus-zero.js | 37 ++++++ .../BigInt/key-is-not-numeric-index-get-throws.js | 38 ++++++ .../Get/BigInt/key-is-not-numeric-index.js | 39 ++++++ .../internals/Get/BigInt/key-is-out-of-bounds.js | 43 +++++++ .../internals/Get/BigInt/key-is-symbol.js | 40 ++++++ .../detached-buffer-key-is-not-numeric-index.js | 4 +- .../internals/Get/detached-buffer-key-is-symbol.js | 4 +- .../TypedArrays/internals/Get/detached-buffer.js | 4 +- .../TypedArrays/internals/Get/indexed-value-sab.js | 8 +- .../TypedArrays/internals/Get/indexed-value.js | 8 +- .../internals/Get/key-is-not-integer.js | 4 +- .../internals/Get/key-is-not-minus-zero.js | 4 +- .../internals/Get/key-is-not-numeric-index.js | 4 +- .../internals/Get/key-is-out-of-bounds.js | 4 +- .../TypedArrays/internals/Get/key-is-symbol.js | 4 +- .../BigInt/detached-buffer-key-is-not-number.js | 38 ++++++ .../BigInt/detached-buffer-key-is-symbol.js | 31 +++++ .../GetOwnProperty/BigInt/detached-buffer-realm.js | 39 ++++++ .../GetOwnProperty/BigInt/detached-buffer.js | 33 +++++ .../BigInt/enumerate-detached-buffer.js | 42 +++++++ .../GetOwnProperty/BigInt/index-prop-desc.js | 36 ++++++ .../GetOwnProperty/BigInt/key-is-minus-zero.js | 37 ++++++ .../BigInt/key-is-not-canonical-index.js | 48 ++++++++ .../GetOwnProperty/BigInt/key-is-not-integer.js | 31 +++++ .../BigInt/key-is-not-numeric-index.js | 38 ++++++ .../GetOwnProperty/BigInt/key-is-out-of-bounds.js | 34 ++++++ .../GetOwnProperty/BigInt/key-is-symbol.js | 31 +++++ .../detached-buffer-key-is-not-number.js | 4 +- .../detached-buffer-key-is-symbol.js | 4 +- .../internals/GetOwnProperty/index-prop-desc.js | 8 +- .../internals/GetOwnProperty/key-is-minus-zero.js | 4 +- .../GetOwnProperty/key-is-not-canonical-index.js | 4 +- .../internals/GetOwnProperty/key-is-not-integer.js | 4 +- .../GetOwnProperty/key-is-not-numeric-index.js | 4 +- .../GetOwnProperty/key-is-out-of-bounds.js | 4 +- .../internals/GetOwnProperty/key-is-symbol.js | 4 +- .../abrupt-from-ordinary-has-parent-hasproperty.js | 63 ++++++++++ .../BigInt/detached-buffer-key-is-not-number.js | 29 +++++ .../BigInt/detached-buffer-key-is-symbol.js | 31 +++++ .../HasProperty/BigInt/detached-buffer-realm.js | 33 +++++ .../HasProperty/BigInt/detached-buffer.js | 35 ++++++ .../internals/HasProperty/BigInt/indexed-value.js | 32 +++++ .../BigInt/infinity-with-detached-buffer.js | 36 ++++++ .../HasProperty/BigInt/inherited-property.js | 35 ++++++ .../BigInt/key-is-greater-than-last-index.js | 28 +++++ .../HasProperty/BigInt/key-is-lower-than-zero.js | 28 +++++ .../HasProperty/BigInt/key-is-minus-zero.js | 28 +++++ .../BigInt/key-is-not-canonical-index.js | 53 ++++++++ .../HasProperty/BigInt/key-is-not-integer.js | 30 +++++ .../HasProperty/BigInt/key-is-not-numeric-index.js | 29 +++++ .../internals/HasProperty/BigInt/key-is-symbol.js | 28 +++++ .../detached-buffer-key-is-not-number.js | 4 +- .../HasProperty/detached-buffer-key-is-symbol.js | 4 +- .../internals/HasProperty/indexed-value.js | 4 +- .../HasProperty/key-is-not-canonical-index.js | 4 +- .../integer-indexes-and-string-and-symbol-keys-.js | 48 ++++++++ .../BigInt/integer-indexes-and-string-keys.js | 41 +++++++ .../OwnPropertyKeys/BigInt/integer-indexes.js | 36 ++++++ .../OwnPropertyKeys/BigInt/not-enumerable-keys.js | 35 ++++++ .../integer-indexes-and-string-and-symbol-keys-.js | 4 +- .../integer-indexes-and-string-keys.js | 4 +- .../internals/OwnPropertyKeys/integer-indexes.js | 4 +- .../internals/Set/BigInt/conversion-operation.js | 50 ++++++++ .../detached-buffer-key-is-not-numeric-index.js | 26 ++++ .../Set/BigInt/detached-buffer-key-is-symbol.js | 26 ++++ .../internals/Set/BigInt/detached-buffer-realm.js | 40 ++++++ .../internals/Set/BigInt/detached-buffer.js | 65 ++++++++++ .../internals/Set/BigInt/indexed-value.js | 43 +++++++ .../internals/Set/BigInt/key-is-minus-zero.js | 31 +++++ .../Set/BigInt/key-is-not-canonical-index.js | 58 +++++++++ .../internals/Set/BigInt/key-is-not-integer.js | 38 ++++++ .../BigInt/key-is-not-numeric-index-set-throws.js | 40 ++++++ .../Set/BigInt/key-is-not-numeric-index.js | 47 ++++++++ .../internals/Set/BigInt/key-is-out-of-bounds.js | 37 ++++++ .../internals/Set/BigInt/key-is-symbol.js | 48 ++++++++ .../Set/BigInt/tonumber-value-detached-buffer.js | 46 +++++++ .../internals/Set/BigInt/tonumber-value-throws.js | 58 +++++++++ .../detached-buffer-key-is-not-numeric-index.js | 4 +- .../internals/Set/detached-buffer-key-is-symbol.js | 4 +- .../TypedArrays/internals/Set/detached-buffer.js | 16 +-- .../TypedArrays/internals/Set/indexed-value.js | 12 +- .../TypedArrays/internals/Set/key-is-minus-zero.js | 4 +- .../internals/Set/key-is-not-canonical-index.js | 4 +- .../internals/Set/key-is-not-integer.js | 4 +- .../internals/Set/key-is-not-numeric-index.js | 4 +- .../internals/Set/key-is-out-of-bounds.js | 4 +- .../TypedArrays/internals/Set/key-is-symbol.js | 4 +- .../internals/Set/tonumber-value-throws.js | 4 +- .../of/BigInt/argument-is-symbol-throws.js | 23 ++++ .../of/BigInt/argument-number-value-throws.js | 41 +++++++ .../custom-ctor-does-not-instantiate-ta-throws.js | 29 +++++ .../BigInt/custom-ctor-returns-other-instance.js | 33 +++++ .../custom-ctor-returns-smaller-instance-throws.js | 28 +++++ .../built-ins/TypedArrays/of/BigInt/custom-ctor.js | 35 ++++++ test/built-ins/TypedArrays/of/BigInt/inherited.js | 25 ++++ .../TypedArrays/of/BigInt/invoked-as-func.js | 25 ++++ .../TypedArrays/of/BigInt/nan-conversion.js | 50 ++++++++ .../TypedArrays/of/BigInt/new-instance-empty.js | 16 +++ .../of/BigInt/new-instance-from-zero.js | 40 ++++++ .../of/BigInt/new-instance-using-custom-ctor.js | 28 +++++ .../TypedArrays/of/BigInt/new-instance.js | 34 ++++++ .../of/BigInt/this-is-not-constructor.js | 24 ++++ .../TypedArrays/of/argument-number-value-throws.js | 30 ++--- .../of/custom-ctor-returns-other-instance.js | 6 +- .../of/new-instance-using-custom-ctor.js | 10 +- test/built-ins/TypedArrays/of/new-instance.js | 10 +- .../Symbol.toStringTag/bigint-inherited.js | 14 +++ .../prototype/bigint-Symbol.iterator.js | 13 ++ .../prototype/buffer/bigint-inherited.js | 13 ++ .../prototype/byteLength/bigint-inherited.js | 13 ++ .../prototype/byteOffset/bigint-inherited.js | 13 ++ .../prototype/copyWithin/bigint-inherited.js | 13 ++ .../prototype/entries/bigint-inherited.js | 13 ++ .../prototype/every/bigint-inherited.js | 13 ++ .../TypedArrays/prototype/fill/bigint-inherited.js | 13 ++ .../prototype/filter/bigint-inherited.js | 13 ++ .../TypedArrays/prototype/find/bigint-inherited.js | 13 ++ .../prototype/findIndex/bigint-inherited.js | 13 ++ .../prototype/forEach/bigint-inherited.js | 13 ++ .../prototype/indexOf/bigint-inherited.js | 13 ++ .../TypedArrays/prototype/join/bigint-inherited.js | 13 ++ .../TypedArrays/prototype/keys/bigint-inherited.js | 13 ++ .../prototype/lastIndexOf/bigint-inherited.js | 13 ++ .../prototype/length/bigint-inherited.js | 13 ++ .../TypedArrays/prototype/map/bigint-inherited.js | 13 ++ .../prototype/reduce/bigint-inherited.js | 13 ++ .../prototype/reduceRight/bigint-inherited.js | 13 ++ .../prototype/reverse/bigint-inherited.js | 13 ++ .../TypedArrays/prototype/set/bigint-inherited.js | 13 ++ .../prototype/slice/bigint-inherited.js | 13 ++ .../TypedArrays/prototype/some/bigint-inherited.js | 13 ++ .../TypedArrays/prototype/sort/bigint-inherited.js | 13 ++ .../prototype/subarray/bigint-inherited.js | 13 ++ .../prototype/toLocaleString/bigint-inherited.js | 13 ++ .../prototype/toString/bigint-inherited.js | 13 ++ .../prototype/values/bigint-inherited.js | 13 ++ 1114 files changed, 36734 insertions(+), 3176 deletions(-) create mode 100644 harness/testBigIntTypedArray.js create mode 100644 test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-accessor.js create mode 100644 test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/return-typedarrayname.js create mode 100644 test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-has-no-typedarrayname-internal.js create mode 100644 test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/buffer/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/buffer/BigInt/return-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/byteLength/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/byteLength/BigInt/return-bytelength.js create mode 100644 test/built-ins/TypedArray/prototype/byteOffset/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/byteOffset/BigInt/return-byteoffset.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/get-length-ignores-length-prop.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end-is-symbol.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start-is-symbol.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target-is-symbol.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-typedarray-instance.js create mode 100644 test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js create mode 100644 test/built-ins/TypedArray/prototype/entries/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/entries/BigInt/iter-prototype.js create mode 100644 test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js create mode 100644 test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-with-thisarg.js create mode 100644 test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-without-thisarg.js create mode 100644 test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-detachbuffer.js create mode 100644 test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-no-interaction-over-non-integer.js create mode 100644 test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-not-callable-throws.js create mode 100644 test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-not-called-on-empty.js create mode 100644 test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-return-does-not-change-instance.js create mode 100644 test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-returns-abrupt.js create mode 100644 test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-set-value-during-interaction.js create mode 100644 test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-this.js create mode 100644 test/built-ins/TypedArray/prototype/every/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/every/BigInt/get-length-uses-internal-arraylength.js create mode 100644 test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/every/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/every/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/every/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/every/BigInt/returns-false-if-any-cb-returns-false.js create mode 100644 test/built-ins/TypedArray/prototype/every/BigInt/returns-true-if-every-cb-returns-true.js create mode 100644 test/built-ins/TypedArray/prototype/every/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/every/BigInt/this-is-not-typedarray-instance.js create mode 100644 test/built-ins/TypedArray/prototype/every/BigInt/values-are-not-cached.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-once.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations-consistent-nan.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-symbol-throws.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/get-length-ignores-length-prop.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end-as-symbol.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start-as-symbol.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/return-this.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/fill/BigInt/this-is-not-typedarray-instance.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/arraylength-internal.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-with-thisarg.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-without-thisarg.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-called-before-ctor.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-called-before-species.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-no-iteration-over-non-integer.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-not-callable-throws.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-not-called-on-empty.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-return-does-not-change-instance.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-returns-abrupt.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-set-value-during-iteration.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-this.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/result-does-not-share-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/result-empty-callbackfn-returns-false.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/result-full-callbackfn-returns-true.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-abrupt.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-inherited.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-returns-throws.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-abrupt.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-invocation.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-length-throws.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-length.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-throws.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-returns-throws.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-use-default-ctor.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/this-is-not-typedarray-instance.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/values-are-not-cached.js create mode 100644 test/built-ins/TypedArray/prototype/filter/BigInt/values-are-set.js create mode 100644 test/built-ins/TypedArray/prototype/find/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/find/BigInt/get-length-ignores-length-prop.js create mode 100644 test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/find/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/find/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js create mode 100644 test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-parameters.js create mode 100644 test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-non-strict.js create mode 100644 test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-strict.js create mode 100644 test/built-ins/TypedArray/prototype/find/BigInt/predicate-is-not-callable-throws.js create mode 100644 test/built-ins/TypedArray/prototype/find/BigInt/predicate-may-detach-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/find/BigInt/predicate-not-called-on-empty-array.js create mode 100644 test/built-ins/TypedArray/prototype/find/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/find/BigInt/return-abrupt-from-predicate-call.js create mode 100644 test/built-ins/TypedArray/prototype/find/BigInt/return-found-value-predicate-result-is-true.js create mode 100644 test/built-ins/TypedArray/prototype/find/BigInt/return-undefined-if-predicate-returns-false-value.js create mode 100644 test/built-ins/TypedArray/prototype/find/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/find/BigInt/this-is-not-typedarray-instance.js create mode 100644 test/built-ins/TypedArray/prototype/findIndex/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/findIndex/BigInt/get-length-ignores-length-prop.js create mode 100644 test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/findIndex/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/findIndex/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js create mode 100644 test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-parameters.js create mode 100644 test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-non-strict.js create mode 100644 test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-strict.js create mode 100644 test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-is-not-callable-throws.js create mode 100644 test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-may-detach-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-not-called-on-empty-array.js create mode 100644 test/built-ins/TypedArray/prototype/findIndex/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/findIndex/BigInt/return-abrupt-from-predicate-call.js create mode 100644 test/built-ins/TypedArray/prototype/findIndex/BigInt/return-index-predicate-result-is-true.js create mode 100644 test/built-ins/TypedArray/prototype/findIndex/BigInt/return-negative-one-if-predicate-returns-false-value.js create mode 100644 test/built-ins/TypedArray/prototype/findIndex/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/findIndex/BigInt/this-is-not-typedarray-instance.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/BigInt/arraylength-internal.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-with-thisarg.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-without-thisarg.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-detachbuffer.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-is-not-callable.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-no-interaction-over-non-integer.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-not-called-on-empty.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-return-does-not-change-instance.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-returns-abrupt.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-set-value-during-interaction.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-this.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/BigInt/returns-undefined.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/BigInt/this-is-not-typedarray-instance.js create mode 100644 test/built-ins/TypedArray/prototype/forEach/BigInt/values-are-not-cached.js create mode 100644 test/built-ins/TypedArray/prototype/includes/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-equal-or-greater-length-returns-false.js create mode 100644 test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-infinity.js create mode 100644 test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-minus-zero.js create mode 100644 test/built-ins/TypedArray/prototype/includes/BigInt/get-length-uses-internal-arraylength.js create mode 100644 test/built-ins/TypedArray/prototype/includes/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/includes/BigInt/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/includes/BigInt/length-zero-returns-false.js create mode 100644 test/built-ins/TypedArray/prototype/includes/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/includes/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/includes/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex-symbol.js create mode 100644 test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex.js create mode 100644 test/built-ins/TypedArray/prototype/includes/BigInt/search-found-returns-true.js create mode 100644 test/built-ins/TypedArray/prototype/includes/BigInt/search-not-found-returns-false.js create mode 100644 test/built-ins/TypedArray/prototype/includes/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/includes/BigInt/this-is-not-typedarray-instance.js create mode 100644 test/built-ins/TypedArray/prototype/includes/BigInt/tointeger-fromindex.js create mode 100644 test/built-ins/TypedArray/prototype/indexOf/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-equal-or-greater-length-returns-minus-one.js create mode 100644 test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-infinity.js create mode 100644 test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-minus-zero.js create mode 100644 test/built-ins/TypedArray/prototype/indexOf/BigInt/get-length-uses-internal-arraylength.js create mode 100644 test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/indexOf/BigInt/length-zero-returns-minus-one.js create mode 100644 test/built-ins/TypedArray/prototype/indexOf/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/indexOf/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/indexOf/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/indexOf/BigInt/return-abrupt-tointeger-fromindex-symbol.js create mode 100644 test/built-ins/TypedArray/prototype/indexOf/BigInt/return-abrupt-tointeger-fromindex.js create mode 100644 test/built-ins/TypedArray/prototype/indexOf/BigInt/search-found-returns-index.js create mode 100644 test/built-ins/TypedArray/prototype/indexOf/BigInt/search-not-found-returns-minus-one.js create mode 100644 test/built-ins/TypedArray/prototype/indexOf/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/indexOf/BigInt/this-is-not-typedarray-instance.js create mode 100644 test/built-ins/TypedArray/prototype/indexOf/BigInt/tointeger-fromindex.js create mode 100644 test/built-ins/TypedArray/prototype/join/BigInt/custom-separator-result-from-tostring-on-each-simple-value.js create mode 100644 test/built-ins/TypedArray/prototype/join/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/join/BigInt/empty-instance-empty-string.js create mode 100644 test/built-ins/TypedArray/prototype/join/BigInt/get-length-uses-internal-arraylength.js create mode 100644 test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/join/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/join/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/join/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/join/BigInt/result-from-tostring-on-each-simple-value.js create mode 100644 test/built-ins/TypedArray/prototype/join/BigInt/return-abrupt-from-separator-symbol.js create mode 100644 test/built-ins/TypedArray/prototype/join/BigInt/return-abrupt-from-separator.js create mode 100644 test/built-ins/TypedArray/prototype/join/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/join/BigInt/this-is-not-typedarray-instance.js create mode 100644 test/built-ins/TypedArray/prototype/keys/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/keys/BigInt/iter-prototype.js create mode 100644 test/built-ins/TypedArray/prototype/keys/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/keys/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/keys/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/keys/BigInt/return-itor.js create mode 100644 test/built-ins/TypedArray/prototype/keys/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/keys/BigInt/this-is-not-typedarray-instance.js create mode 100644 test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-infinity.js create mode 100644 test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-minus-zero.js create mode 100644 test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/get-length-uses-internal-arraylength.js create mode 100644 test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length-zero-returns-minus-one.js create mode 100644 test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/return-abrupt-tointeger-fromindex-symbol.js create mode 100644 test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/return-abrupt-tointeger-fromindex.js create mode 100644 test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-found-returns-index.js create mode 100644 test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-not-found-returns-minus-one.js create mode 100644 test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/this-is-not-typedarray-instance.js create mode 100644 test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/tointeger-fromindex.js create mode 100644 test/built-ins/TypedArray/prototype/length/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-accessor.js create mode 100644 test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/length/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/length/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/length/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/length/BigInt/return-length.js create mode 100644 test/built-ins/TypedArray/prototype/length/BigInt/this-has-no-typedarrayname-internal.js create mode 100644 test/built-ins/TypedArray/prototype/length/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/arraylength-internal.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-with-thisarg.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-without-thisarg.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-detachbuffer.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-is-not-callable.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-no-interaction-over-non-integer-properties.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-not-called-on-empty.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-affects-returned-object.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-change-instance.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-copy-non-integer-properties.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-returns-abrupt.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-set-value-during-interaction.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-this.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation-consistent-nan.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-from-empty-length.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-from-positive-length.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/this-is-not-typedarray-instance.js create mode 100644 test/built-ins/TypedArray/prototype/map/BigInt/values-are-not-cached.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-custom-accumulator.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-default-accumulator.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-detachbuffer.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-is-not-callable-throws.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-no-iteration-over-non-integer-properties.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-not-called-on-empty.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-return-does-not-change-instance.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-returns-abrupt.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-set-value-during-iteration.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-this.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/empty-instance-return-initialvalue.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/empty-instance-with-no-initialvalue-throws.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/get-length-uses-internal-arraylength.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/result-is-last-callbackfn-return.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/result-of-any-type.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/return-first-value-without-callbackfn.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/this-is-not-typedarray-instance.js create mode 100644 test/built-ins/TypedArray/prototype/reduce/BigInt/values-are-not-cached.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-custom-accumulator.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-default-accumulator.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-detachbuffer.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-is-not-callable-throws.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-no-iteration-over-non-integer-properties.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-not-called-on-empty.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-return-does-not-change-instance.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-returns-abrupt.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-set-value-during-iteration.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-this.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/empty-instance-return-initialvalue.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/empty-instance-with-no-initialvalue-throws.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/get-length-uses-internal-arraylength.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-is-last-callbackfn-return.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-of-any-type.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/return-first-value-without-callbackfn.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/this-is-not-typedarray-instance.js create mode 100644 test/built-ins/TypedArray/prototype/reduceRight/BigInt/values-are-not-cached.js create mode 100644 test/built-ins/TypedArray/prototype/reverse/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/reverse/BigInt/get-length-uses-internal-arraylength.js create mode 100644 test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/reverse/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/reverse/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/reverse/BigInt/preserves-non-numeric-properties.js create mode 100644 test/built-ins/TypedArray/prototype/reverse/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/reverse/BigInt/returns-original-object.js create mode 100644 test/built-ins/TypedArray/prototype/reverse/BigInt/reverts.js create mode 100644 test/built-ins/TypedArray/prototype/reverse/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/reverse/BigInt/this-is-not-typedarray-instance.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/array-arg-negative-integer-offset-throws.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/array-arg-offset-tointeger.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-length.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-value.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length-symbol.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value-symbol.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-tointeger-offset-symbol.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-tointeger-offset.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-toobject-offset.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values-in-order.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-conversions.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-type-conversions.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-values-are-not-cached.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/array-arg-target-arraylength-internal.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-on-get-src-value-throws.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-on-tointeger-offset-throws.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-throws.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/this-is-not-typedarray-instance.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-negative-integer-offset-throws.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-offset-tointeger.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-return-abrupt-from-tointeger-offset-symbol.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-return-abrupt-from-tointeger-offset.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions-sab.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-sab.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type-sab.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type-sab.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-arraylength-internal.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-byteoffset-internal.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-range-greather-than-target-throws-rangeerror.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-srcbuffer-detached-during-tointeger-offset-throws.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-arraylength-internal.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-byteoffset-internal.js create mode 100644 test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-targetbuffer-detached-during-tointeger-offset-throws.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/arraylength-internal.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/bit-precision.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-custom-ctor-other-targettype.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-custom-ctor-same-targettype.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-get-ctor.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-speciesctor-get-species-custom-ctor-throws.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-zero-count-custom-ctor-other-targettype.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-zero-count-custom-ctor-same-targettype.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/infinity.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/minus-zero.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/result-does-not-copy-ordinary-properties.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/results-with-different-length.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/results-with-empty-length.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/results-with-same-length.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-end-symbol.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-end.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-start-symbol.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-start.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/set-values-from-different-ctor-type.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-abrupt.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-inherited.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-returns-throws.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-abrupt.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-invocation.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-length-throws.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-length.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-throws.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-returns-throws.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-use-default-ctor.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/this-is-not-typedarray-instance.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-end.js create mode 100644 test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-start.js create mode 100644 test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-with-thisarg.js create mode 100644 test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-without-thisarg.js create mode 100644 test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-detachbuffer.js create mode 100644 test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-no-interaction-over-non-integer.js create mode 100644 test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-not-callable-throws.js create mode 100644 test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-not-called-on-empty.js create mode 100644 test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-return-does-not-change-instance.js create mode 100644 test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-returns-abrupt.js create mode 100644 test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-set-value-during-interaction.js create mode 100644 test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-this.js create mode 100644 test/built-ins/TypedArray/prototype/some/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/some/BigInt/get-length-uses-internal-arraylength.js create mode 100644 test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/some/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/some/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/some/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/some/BigInt/returns-false-if-every-cb-returns-false.js create mode 100644 test/built-ins/TypedArray/prototype/some/BigInt/returns-true-if-any-cb-returns-true.js create mode 100644 test/built-ins/TypedArray/prototype/some/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/some/BigInt/this-is-not-typedarray-instance.js create mode 100644 test/built-ins/TypedArray/prototype/some/BigInt/values-are-not-cached.js create mode 100644 test/built-ins/TypedArray/prototype/sort/BigInt/arraylength-internal.js create mode 100644 test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-call-throws.js create mode 100644 test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-calls.js create mode 100644 test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-nonfunction-call-throws.js create mode 100644 test/built-ins/TypedArray/prototype/sort/BigInt/detached-buffer-comparefn.js create mode 100644 test/built-ins/TypedArray/prototype/sort/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/sort/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/sort/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/sort/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/sort/BigInt/return-same-instance.js create mode 100644 test/built-ins/TypedArray/prototype/sort/BigInt/sortcompare-with-no-tostring.js create mode 100644 test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values-nan.js create mode 100644 test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js create mode 100644 test/built-ins/TypedArray/prototype/sort/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/sort/BigInt/this-is-not-typedarray-instance.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/infinity.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/minus-zero.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/result-does-not-copy-ordinary-properties.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-from-same-ctor.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-with-shared-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-different-length.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-empty-length.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-same-length.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-begin-symbol.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-begin.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-end-symbol.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-end.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-abrupt.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-inherited.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-returns-throws.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-abrupt.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-invocation.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-throws.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-returns-throws.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-use-default-ctor.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/this-is-not-typedarray-instance.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-begin.js create mode 100644 test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-end.js create mode 100644 test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tolocalestring-from-each-value.js create mode 100644 test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tostring-from-each-value.js create mode 100644 test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-valueof-from-each-value.js create mode 100644 test/built-ins/TypedArray/prototype/toLocaleString/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/toLocaleString/BigInt/empty-instance-returns-empty-string.js create mode 100644 test/built-ins/TypedArray/prototype/toLocaleString/BigInt/get-length-uses-internal-arraylength.js create mode 100644 test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/toLocaleString/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/toLocaleString/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/toLocaleString/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tolocalestring.js create mode 100644 test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tostring.js create mode 100644 test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-valueof.js create mode 100644 test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tolocalestring.js create mode 100644 test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tostring.js create mode 100644 test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-valueof.js create mode 100644 test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-result.js create mode 100644 test/built-ins/TypedArray/prototype/toLocaleString/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/toLocaleString/BigInt/this-is-not-typedarray-instance.js create mode 100644 test/built-ins/TypedArray/prototype/toString/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/values/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-method.js create mode 100644 test/built-ins/TypedArray/prototype/values/BigInt/iter-prototype.js create mode 100644 test/built-ins/TypedArray/prototype/values/BigInt/length.js create mode 100644 test/built-ins/TypedArray/prototype/values/BigInt/name.js create mode 100644 test/built-ins/TypedArray/prototype/values/BigInt/prop-desc.js create mode 100644 test/built-ins/TypedArray/prototype/values/BigInt/return-itor.js create mode 100644 test/built-ins/TypedArray/prototype/values/BigInt/this-is-not-object.js create mode 100644 test/built-ins/TypedArray/prototype/values/BigInt/this-is-not-typedarray-instance.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/bufferbyteoffset-throws-from-modulo-element-size-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/bufferbyteoffset-throws-from-modulo-element-size.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-negative-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-negative-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-negative-zero-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-negative-zero.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-symbol-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-symbol-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-throws-from-modulo-element-size-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-throws-from-modulo-element-size.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-to-number-detachbuffer.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-to-number-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-to-number-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/custom-proto-access-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/custom-proto-access-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-length-and-offset-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-length-and-offset.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-length-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-length.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-negative-length-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-negative-length.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-offset-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-offset.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/detachedbuffer.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/excessive-length-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/excessive-length-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/excessive-offset-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/excessive-offset-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/invoked-with-undefined-newtarget-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/invoked-with-undefined-newtarget.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/is-referenced-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/is-referenced.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/length-access-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/length-access-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/length-is-symbol-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/length-is-symbol-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/length-to-number-detachbuffer.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/new-instance-extensibility-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/new-instance-extensibility.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/proto-from-ctor-realm-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/proto-from-ctor-realm.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/returns-new-instance-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/returns-new-instance.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/toindex-bytelength-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/toindex-bytelength.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/toindex-byteoffset-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/toindex-byteoffset.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/typedarray-backed-by-sharedarraybuffer.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/use-custom-proto-if-object-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/use-custom-proto-if-object.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/use-default-proto-if-custom-proto-is-not-object-sab.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/buffer-arg/use-default-proto-if-custom-proto-is-not-object.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-throws-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-throws.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-zero-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-zero.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-symbol-throws-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-symbol-throws.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-throws-from-modulo-element-size-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-throws-from-modulo-element-size.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-detachbuffer.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-throws-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-throws.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-custom-proto-access-throws-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-custom-proto-access-throws.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-and-offset-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-and-offset.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-negative-length-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-negative-length.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-offset-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-offset.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-detachedbuffer.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-length-throws-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-length-throws.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-offset-throws-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-offset-throws.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-invoked-with-undefined-newtarget-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-invoked-with-undefined-newtarget.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-is-referenced-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-is-referenced.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-access-throws-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-access-throws.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-is-symbol-throws-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-is-symbol-throws.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-to-number-detachbuffer.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-new-instance-extensibility-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-new-instance-extensibility.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-proto-from-ctor-realm-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-proto-from-ctor-realm.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-returns-new-instance-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-returns-new-instance.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-bytelength-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-bytelength.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-byteoffset-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-byteoffset.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-typedarray-backed-by-sharedarraybuffer.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-custom-proto-if-object-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-custom-proto-if-object.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object-sab.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/custom-proto-access-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/init-zeros.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/is-infinity-throws-rangeerror.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/is-negative-integer-throws-rangeerror.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/is-symbol-throws.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-custom-proto-access-throws.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-init-zeros.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-infinity-throws-rangeerror.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-negative-integer-throws-rangeerror.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-symbol-throws.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-new-instance-extensibility.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-proto-from-ctor-realm.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-returns-object.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-toindex-length.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-undefined-newtarget-throws.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-use-custom-proto-if-object.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-use-default-proto-if-custom-proto-is-not-object.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/new-instance-extensibility.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/proto-from-ctor-realm.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/returns-object.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/toindex-length.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/undefined-newtarget-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/use-custom-proto-if-object.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/length-arg/use-default-proto-if-custom-proto-is-not-object.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/no-args/custom-proto-access-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/no-args/new-instance-extensibility.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-custom-proto-access-throws.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-new-instance-extensibility.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-proto-from-ctor-realm.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-returns-object.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-undefined-newtarget-throws.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-use-custom-proto-if-object.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-use-default-proto-if-custom-proto-is-not-object.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/no-args/proto-from-ctor-realm.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/no-args/returns-object.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/no-args/undefined-newtarget-throws.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/no-args/use-custom-proto-if-object.js create mode 100644 test/built-ins/TypedArrays/ctors-bigint/no-args/use-default-proto-if-custom-proto-is-not-object.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-returns.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-returns-new-instance.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-use-custom-proto-if-object.js delete mode 100644 test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-use-default-proto-if-custom-proto-is-not-object.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-negative-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-negative-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-negative-zero-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-negative-zero.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-symbol-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-symbol-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-throws-from-modulo-element-size-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-throws-from-modulo-element-size.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-to-number-detachbuffer.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-to-number-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-to-number-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-custom-proto-access-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-custom-proto-access-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-length-and-offset-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-length-and-offset.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-length-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-length.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-negative-length-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-negative-length.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-offset-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-offset.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-detachedbuffer.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-excessive-length-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-excessive-length-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-excessive-offset-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-excessive-offset-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-invoked-with-undefined-newtarget-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-invoked-with-undefined-newtarget.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-is-referenced-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-is-referenced.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-length-access-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-length-access-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-length-is-symbol-throws-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-length-is-symbol-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-length-to-number-detachbuffer.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-new-instance-extensibility-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-new-instance-extensibility.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-proto-from-ctor-realm-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-proto-from-ctor-realm.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-returns-new-instance-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-returns-new-instance.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-toindex-bytelength-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-toindex-bytelength.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-toindex-byteoffset-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-toindex-byteoffset.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-typedarray-backed-by-sharedarraybuffer.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-use-custom-proto-if-object-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-use-custom-proto-if-object.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object-sab.js create mode 100644 test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object.js create mode 100644 test/built-ins/TypedArrays/ctors/length-arg/length-arg-custom-proto-access-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/length-arg/length-arg-init-zeros.js create mode 100644 test/built-ins/TypedArrays/ctors/length-arg/length-arg-is-infinity-throws-rangeerror.js create mode 100644 test/built-ins/TypedArrays/ctors/length-arg/length-arg-is-negative-integer-throws-rangeerror.js create mode 100644 test/built-ins/TypedArrays/ctors/length-arg/length-arg-is-symbol-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/length-arg/length-arg-new-instance-extensibility.js create mode 100644 test/built-ins/TypedArrays/ctors/length-arg/length-arg-proto-from-ctor-realm.js create mode 100644 test/built-ins/TypedArrays/ctors/length-arg/length-arg-returns-object.js create mode 100644 test/built-ins/TypedArrays/ctors/length-arg/length-arg-toindex-length.js create mode 100644 test/built-ins/TypedArrays/ctors/length-arg/length-arg-undefined-newtarget-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/length-arg/length-arg-use-custom-proto-if-object.js create mode 100644 test/built-ins/TypedArrays/ctors/length-arg/length-arg-use-default-proto-if-custom-proto-is-not-object.js create mode 100644 test/built-ins/TypedArrays/ctors/no-args/no-args-custom-proto-access-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/no-args/no-args-new-instance-extensibility.js create mode 100644 test/built-ins/TypedArrays/ctors/no-args/no-args-proto-from-ctor-realm.js create mode 100644 test/built-ins/TypedArrays/ctors/no-args/no-args-returns-object.js create mode 100644 test/built-ins/TypedArrays/ctors/no-args/no-args-undefined-newtarget-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/no-args/no-args-use-custom-proto-if-object.js create mode 100644 test/built-ins/TypedArrays/ctors/no-args/no-args-use-default-proto-if-custom-proto-is-not-object.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-as-array-returns.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-as-generator-iterable-returns.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-conversion-operation-consistent-nan.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-conversion-operation.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-custom-proto-access-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-iterating-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-iterator-not-callable-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-iterator-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-length-excessive-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-length-is-symbol-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-length-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-new-instance-extensibility.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-proto-from-ctor-realm.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-returns.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-from-property.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-obj-to-primitive-typeerror.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-obj-to-primitive.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-obj-tostring.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-obj-valueof-typeerror.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-obj-valueof.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-property.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-symbol-property.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-undefined-newtarget-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-use-custom-proto-if-object.js create mode 100644 test/built-ins/TypedArrays/ctors/object-arg/object-arg-use-default-proto-if-custom-proto-is-not-object.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-custom-proto-access-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-detached-when-species-retrieved-different-type.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-detached-when-species-retrieved-same-type.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-new-instance-extensibility.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-access-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species-proto-from-ctor-realm.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-not-object-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-access-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-not-ctor-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-null.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-prototype-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-undefined.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-returns-new-typedarray.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-proto-from-ctor-realm.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-returns-new-instance.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-access-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom-proto-from-ctor-realm.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-not-ctor.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-null.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-prototype-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-undefined.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-value-not-obj-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-returns-new-cloned-typedarray.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-undefined-newtarget-throws.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-use-custom-proto-if-object.js create mode 100644 test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-use-default-proto-if-custom-proto-is-not-object.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/arylk-get-length-error.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/arylk-to-length-error.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/custom-ctor-does-not-instantiate-ta-throws.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/custom-ctor-returns-other-instance.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/custom-ctor-returns-smaller-instance-throws.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/custom-ctor.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/inherited.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/iter-access-error.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/iter-invoke-error.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/iter-next-error.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/iter-next-value-error.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/mapfn-abrupt-completion.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/mapfn-arguments.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/mapfn-is-not-callable.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/mapfn-this-with-thisarg.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/mapfn-this-without-thisarg-non-strict.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/mapfn-this-without-thisarg-strict.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/nan-conversion.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/new-instance-empty.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/new-instance-from-ordinary-object.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/new-instance-from-sparse-array.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/new-instance-from-zero.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/new-instance-using-custom-ctor.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/new-instance-with-mapfn.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/new-instance-without-mapfn.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/property-abrupt-completion.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/set-value-abrupt-completion.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/source-value-is-symbol-throws.js create mode 100644 test/built-ins/TypedArrays/from/BigInt/this-is-not-constructor.js create mode 100644 test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/conversion-operation.js create mode 100644 test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/desc-value-throws.js create mode 100644 test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/detached-buffer-realm.js create mode 100644 test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-greater-than-last-index.js create mode 100644 test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-lower-than-zero.js create mode 100644 test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-minus-zero.js create mode 100644 test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-canonical-index.js create mode 100644 test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-integer.js create mode 100644 test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-numeric-index.js create mode 100644 test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-accessor-desc.js create mode 100644 test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-configurable.js create mode 100644 test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-not-enumerable.js create mode 100644 test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-not-writable.js create mode 100644 test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex.js create mode 100644 test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-symbol.js create mode 100644 test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/non-extensible-new-key.js create mode 100644 test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/non-extensible-redefine-key.js create mode 100644 test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/set-value.js create mode 100644 test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/this-is-not-extensible.js create mode 100644 test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/tonumber-value-detached-buffer.js create mode 100644 test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer-key-is-not-numeric-index.js create mode 100644 test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer-key-is-symbol.js create mode 100644 test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer-realm.js create mode 100644 test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArrays/internals/Get/BigInt/indexed-value-sab.js create mode 100644 test/built-ins/TypedArrays/internals/Get/BigInt/indexed-value.js create mode 100644 test/built-ins/TypedArrays/internals/Get/BigInt/infinity-detached-buffer.js create mode 100644 test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-canonical-index.js create mode 100644 test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-integer.js create mode 100644 test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-minus-zero.js create mode 100644 test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-numeric-index-get-throws.js create mode 100644 test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-numeric-index.js create mode 100644 test/built-ins/TypedArrays/internals/Get/BigInt/key-is-out-of-bounds.js create mode 100644 test/built-ins/TypedArrays/internals/Get/BigInt/key-is-symbol.js create mode 100644 test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer-key-is-not-number.js create mode 100644 test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer-key-is-symbol.js create mode 100644 test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer-realm.js create mode 100644 test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/enumerate-detached-buffer.js create mode 100644 test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/index-prop-desc.js create mode 100644 test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-minus-zero.js create mode 100644 test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-canonical-index.js create mode 100644 test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-integer.js create mode 100644 test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-numeric-index.js create mode 100644 test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-out-of-bounds.js create mode 100644 test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-symbol.js create mode 100644 test/built-ins/TypedArrays/internals/HasProperty/BigInt/abrupt-from-ordinary-has-parent-hasproperty.js create mode 100644 test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer-key-is-not-number.js create mode 100644 test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer-key-is-symbol.js create mode 100644 test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer-realm.js create mode 100644 test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArrays/internals/HasProperty/BigInt/indexed-value.js create mode 100644 test/built-ins/TypedArrays/internals/HasProperty/BigInt/infinity-with-detached-buffer.js create mode 100644 test/built-ins/TypedArrays/internals/HasProperty/BigInt/inherited-property.js create mode 100644 test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-greater-than-last-index.js create mode 100644 test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-lower-than-zero.js create mode 100644 test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-minus-zero.js create mode 100644 test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-not-canonical-index.js create mode 100644 test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-not-integer.js create mode 100644 test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-not-numeric-index.js create mode 100644 test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-symbol.js create mode 100644 test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-and-symbol-keys-.js create mode 100644 test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-keys.js create mode 100644 test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes.js create mode 100644 test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/not-enumerable-keys.js create mode 100644 test/built-ins/TypedArrays/internals/Set/BigInt/conversion-operation.js create mode 100644 test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer-key-is-not-numeric-index.js create mode 100644 test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer-key-is-symbol.js create mode 100644 test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer-realm.js create mode 100644 test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer.js create mode 100644 test/built-ins/TypedArrays/internals/Set/BigInt/indexed-value.js create mode 100644 test/built-ins/TypedArrays/internals/Set/BigInt/key-is-minus-zero.js create mode 100644 test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-canonical-index.js create mode 100644 test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-integer.js create mode 100644 test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-numeric-index-set-throws.js create mode 100644 test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-numeric-index.js create mode 100644 test/built-ins/TypedArrays/internals/Set/BigInt/key-is-out-of-bounds.js create mode 100644 test/built-ins/TypedArrays/internals/Set/BigInt/key-is-symbol.js create mode 100644 test/built-ins/TypedArrays/internals/Set/BigInt/tonumber-value-detached-buffer.js create mode 100644 test/built-ins/TypedArrays/internals/Set/BigInt/tonumber-value-throws.js create mode 100644 test/built-ins/TypedArrays/of/BigInt/argument-is-symbol-throws.js create mode 100644 test/built-ins/TypedArrays/of/BigInt/argument-number-value-throws.js create mode 100644 test/built-ins/TypedArrays/of/BigInt/custom-ctor-does-not-instantiate-ta-throws.js create mode 100644 test/built-ins/TypedArrays/of/BigInt/custom-ctor-returns-other-instance.js create mode 100644 test/built-ins/TypedArrays/of/BigInt/custom-ctor-returns-smaller-instance-throws.js create mode 100644 test/built-ins/TypedArrays/of/BigInt/custom-ctor.js create mode 100644 test/built-ins/TypedArrays/of/BigInt/inherited.js create mode 100644 test/built-ins/TypedArrays/of/BigInt/invoked-as-func.js create mode 100644 test/built-ins/TypedArrays/of/BigInt/nan-conversion.js create mode 100644 test/built-ins/TypedArrays/of/BigInt/new-instance-empty.js create mode 100644 test/built-ins/TypedArrays/of/BigInt/new-instance-from-zero.js create mode 100644 test/built-ins/TypedArrays/of/BigInt/new-instance-using-custom-ctor.js create mode 100644 test/built-ins/TypedArrays/of/BigInt/new-instance.js create mode 100644 test/built-ins/TypedArrays/of/BigInt/this-is-not-constructor.js create mode 100644 test/built-ins/TypedArrays/prototype/Symbol.toStringTag/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/bigint-Symbol.iterator.js create mode 100644 test/built-ins/TypedArrays/prototype/buffer/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/byteLength/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/byteOffset/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/copyWithin/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/entries/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/every/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/fill/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/filter/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/find/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/findIndex/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/forEach/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/indexOf/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/join/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/keys/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/lastIndexOf/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/length/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/map/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/reduce/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/reduceRight/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/reverse/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/set/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/slice/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/some/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/sort/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/subarray/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/toLocaleString/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/toString/bigint-inherited.js create mode 100644 test/built-ins/TypedArrays/prototype/values/bigint-inherited.js diff --git a/harness/testBigIntTypedArray.js b/harness/testBigIntTypedArray.js new file mode 100644 index 000000000..90bb3aee4 --- /dev/null +++ b/harness/testBigIntTypedArray.js @@ -0,0 +1,77 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: | + Collection of functions used to assert the correctness of BigInt TypedArray objects. +---*/ + +/** + * Array containing every typed array constructor. + */ +var BigIntTypedArrayConstructors = [ + BigInt64Array, + BigUint64Array +]; + +/** + * The %TypedArray% intrinsic constructor function. + */ +var TypedArray = Object.getPrototypeOf(Int8Array); + +function convertToBigInt(x) { + return (Array.isArray(x)) ? x.map(convertToBigInt) : BigInt(x); +} + +/** + * Callback for testing a typed array constructor. + * + * @callback typedArrayConstructorCallback + * @param {Function} Constructor the constructor object to test with. + */ + +/** + * Calls the provided function for every typed array constructor. + * + * @param {typedArrayConstructorCallback} f - the function to call for each typed array constructor. + * @param {Array} selected - An optional Array with filtered typed arrays + */ +function testWithBigIntTypedArrayConstructors(f, selected) { + var constructors = selected || BigIntTypedArrayConstructors; + for (var i = 0; i < constructors.length; ++i) { + var constructor = constructors[i]; + try { + f(constructor); + } catch (e) { + e.message += " (Testing with " + constructor.name + ".)"; + throw e; + } + } +} + +/** + * Helper for conversion operations on TypedArrays, the expected values + * properties are indexed in order to match the respective value for each + * TypedArray constructor + * @param {Function} fn - the function to call for each constructor and value. + * will be called with the constructor, value, expected + * value, and a initial value that can be used to avoid + * a false positive with an equivalent expected value. + */ +function testBigIntTypedArrayConversions(byteConversionValues, fn) { + var values = byteConversionValues.values; + var expected = byteConversionValues.expected; + + testWithBigIntTypedArrayConstructors(function(TA) { + var name = TA.name.slice(0, -5); + + return values.forEach(function(value, index) { + var exp = expected[name][index]; + var initial = 0; + if (exp === 0) { + initial = 1; + } + fn(TA, value, exp, initial); + }); + }); +} + \ No newline at end of file diff --git a/harness/testTypedArray.js b/harness/testTypedArray.js index 7f777b56c..bf6c4875e 100644 --- a/harness/testTypedArray.js +++ b/harness/testTypedArray.js @@ -20,22 +20,11 @@ var typedArrayConstructors = [ Uint8ClampedArray ]; -var numericTypedArrayConstructors = typedArrayConstructors.slice(); - -if (typeof BigInt !== "undefined") { - typedArrayConstructors.push(BigInt64Array); - typedArrayConstructors.push(BigUint64Array); -} - /** * The %TypedArray% intrinsic constructor function. */ var TypedArray = Object.getPrototypeOf(Int8Array); -function convertToBigInt(x) { - return (Array.isArray(x)) ? x.map(convertToBigInt) : BigInt(x); -} - /** * Callback for testing a typed array constructor. * @@ -52,12 +41,9 @@ function convertToBigInt(x) { function testWithTypedArrayConstructors(f, selected) { var constructors = selected || typedArrayConstructors; for (var i = 0; i < constructors.length; ++i) { + // TODO: Remove this var N = function(x) { return x; }; var constructor = constructors[i]; - if (constructor.name == "BigInt64Array" || - constructor.name == "BigUint64Array") { - N = convertToBigInt; - } try { f(constructor, N); } catch (e) { diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/detached-buffer.js new file mode 100644 index 000000000..3bfba3440 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/detached-buffer.js @@ -0,0 +1,21 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype-@@tostringtag +description: The getter method does not throw with a detached buffer +info: | + 22.2.3.32 get %TypedArray%.prototype [ @@toStringTag ] + + ... + 4. Let name be the value of O's [[TypedArrayName]] internal slot. + 5. Assert: name is a String value. + 6. Return name. +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, Symbol.toStringTag, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.sameValue(sample[Symbol.toStringTag], TA.name); +}); diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-accessor.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-accessor.js new file mode 100644 index 000000000..a7f843337 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-accessor.js @@ -0,0 +1,20 @@ +// 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.3.31 +description: > + Return undefined if this value does not have a [[TypedArrayName]] internal slot +info: | + 22.2.3.31 get %TypedArray%.prototype [ @@toStringTag ] + + 1. Let O be the this value. + ... + 3. If O does not have a [[TypedArrayName]] internal slot, return undefined. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.toStringTag, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(TypedArrayPrototype[Symbol.toStringTag], undefined); diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-func.js new file mode 100644 index 000000000..fee58c92f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-func.js @@ -0,0 +1,21 @@ +// 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.3.31 +description: If this value is not Object, return undefined. +info: | + 22.2.3.31 get %TypedArray%.prototype [ @@toStringTag ] + + 1. Let O be the this value. + 2. If Type(O) is not Object, return undefined. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.toStringTag, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var getter = Object.getOwnPropertyDescriptor( + TypedArrayPrototype, Symbol.toStringTag +).get; + +assert.sameValue(getter(), undefined); diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/length.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/length.js new file mode 100644 index 000000000..6b8e035cd --- /dev/null +++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/length.js @@ -0,0 +1,32 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.31 +description: > + get %TypedArray%.prototype [ @@toStringTag ].length is 0. +info: | + get %TypedArray%.prototype [ @@toStringTag ] + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, Symbol.toStringTag] +---*/ + +var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, Symbol.toStringTag); + +assert.sameValue(desc.get.length, 0); + +verifyNotEnumerable(desc.get, "length"); +verifyNotWritable(desc.get, "length"); +verifyConfigurable(desc.get, "length"); diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/name.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/name.js new file mode 100644 index 000000000..9b9342a72 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/name.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.31 +description: > + get %TypedArray%.prototype [ @@toStringTag ].name is "get [Symbol.toStringTag]". +info: | + get %TypedArray%.prototype [ @@toStringTag ] + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, Symbol.toStringTag] +---*/ + +var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, Symbol.toStringTag); + +assert.sameValue(desc.get.name, "get [Symbol.toStringTag]"); + +verifyNotEnumerable(desc.get, "name"); +verifyNotWritable(desc.get, "name"); +verifyConfigurable(desc.get, "name"); diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/prop-desc.js new file mode 100644 index 000000000..bae8ca763 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/prop-desc.js @@ -0,0 +1,28 @@ +// 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.3.31 +description: > + "@@toStringTag" property of TypedArrayPrototype +info: | + 22.2.3.31 get %TypedArray%.prototype [ @@toStringTag ] + + %TypedArray%.prototype[@@toStringTag] is an accessor property whose set + accessor function is undefined. + ... + + This property has the attributes { [[Enumerable]]: false, [[Configurable]]: + true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, Symbol.toStringTag] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var desc = Object.getOwnPropertyDescriptor( + TypedArrayPrototype, Symbol.toStringTag +); + +assert.sameValue(desc.set, undefined); +assert.sameValue(typeof desc.get, 'function'); +verifyNotEnumerable(TypedArrayPrototype, Symbol.toStringTag); +verifyConfigurable(TypedArrayPrototype, Symbol.toStringTag); diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/return-typedarrayname.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/return-typedarrayname.js new file mode 100644 index 000000000..80a3116b8 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/return-typedarrayname.js @@ -0,0 +1,21 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype-@@tostringtag +description: > + Return value from the [[TypedArrayName]] internal slot +info: | + 22.2.3.32 get %TypedArray%.prototype [ @@toStringTag ] + + ... + 4. Let name be the value of O's [[TypedArrayName]] internal slot. + 5. Assert: name is a String value. + 6. Return name. +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.toStringTag, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var ta = new TA(); + assert.sameValue(ta[Symbol.toStringTag], TA.name, "property value"); +}); diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-has-no-typedarrayname-internal.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-has-no-typedarrayname-internal.js new file mode 100644 index 000000000..9414c2d00 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-has-no-typedarrayname-internal.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype-@@tostringtag +description: > + Return undefined when `this` does not have a [[TypedArrayName]] internal slot +info: | + 22.2.3.32 get %TypedArray%.prototype [ @@toStringTag ] + + 1. Let O be the this value. + ... + 3. If O does not have a [[TypedArrayName]] internal slot, return undefined. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.toStringTag, DataView, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var getter = Object.getOwnPropertyDescriptor( + TypedArrayPrototype, Symbol.toStringTag +).get; + +assert.sameValue(getter.call({}), undefined); +assert.sameValue(getter.call([]), undefined); +assert.sameValue(getter.call(new ArrayBuffer(8)), undefined); + +var ab = new ArrayBuffer(8); +var dv = new DataView(ab, 0, 1); +assert.sameValue(getter.call(dv), undefined); diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-is-not-object.js new file mode 100644 index 000000000..1ae3cf292 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-is-not-object.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype-@@tostringtag +description: Return undefined when `this` is not Object +info: | + 22.2.3.32 get %TypedArray%.prototype [ @@toStringTag ] + + 1. Let O be the this value. + 2. If Type(O) is not Object, return undefined. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, Symbol.toStringTag, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var getter = Object.getOwnPropertyDescriptor( + TypedArrayPrototype, Symbol.toStringTag +).get; + +assert.sameValue(getter.call(undefined), undefined, "this is undefined"); +assert.sameValue(getter.call(42), undefined, "this is 42"); +assert.sameValue(getter.call("foo"), undefined, "this is a string"); +assert.sameValue(getter.call(true), undefined, "this is true"); +assert.sameValue(getter.call(false), undefined, "this is false"); +assert.sameValue(getter.call(Symbol("s")), undefined, "this is a Symbol"); +assert.sameValue(getter.call(null), undefined, "this is null"); diff --git a/test/built-ins/TypedArray/prototype/buffer/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/buffer/BigInt/detached-buffer.js new file mode 100644 index 000000000..3332f1a6c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/buffer/BigInt/detached-buffer.js @@ -0,0 +1,21 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype.buffer +description: The getter method does not throw with a detached buffer +info: | + 22.2.3.1 get %TypedArray%.prototype.buffer + + ... + 4. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot. + 5. Return buffer. +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var buffer = new ArrayBuffer(8); + var sample = new TA(buffer, 0, 1); + $DETACHBUFFER(sample.buffer); + assert.sameValue(sample.buffer, buffer); +}, [BigInt64Array, BigUint64Array]); diff --git a/test/built-ins/TypedArray/prototype/buffer/BigInt/return-buffer.js b/test/built-ins/TypedArray/prototype/buffer/BigInt/return-buffer.js new file mode 100644 index 000000000..c49a8df0a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/buffer/BigInt/return-buffer.js @@ -0,0 +1,22 @@ +// 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.3.1 +description: > + Return buffer from [[ViewedArrayBuffer]] internal slot +info: | + 22.2.3.1 get %TypedArray%.prototype.buffer + + ... + 4. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot. + 5. Return buffer. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT); + var ta = new TA(buffer); + + assert.sameValue(ta.buffer, buffer); +}, [BigInt64Array, BigUint64Array]); diff --git a/test/built-ins/TypedArray/prototype/byteLength/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/byteLength/BigInt/detached-buffer.js new file mode 100644 index 000000000..16cfcd434 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/byteLength/BigInt/detached-buffer.js @@ -0,0 +1,21 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype.bytelength +description: Returns 0 if the instance has a detached buffer +info: | + 22.2.3.2 get %TypedArray%.prototype.byteLength + + ... + 4. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot. + 5. If IsDetachedBuffer(buffer) is true, return 0. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.sameValue(sample.byteLength, 0); +}); diff --git a/test/built-ins/TypedArray/prototype/byteLength/BigInt/return-bytelength.js b/test/built-ins/TypedArray/prototype/byteLength/BigInt/return-bytelength.js new file mode 100644 index 000000000..c60a40801 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/byteLength/BigInt/return-bytelength.js @@ -0,0 +1,24 @@ +// 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.3.2 +description: > + Return value from [[ByteLength]] internal slot +info: | + 22.2.3.2 get %TypedArray%.prototype.byteLength + + ... + 6. Let size be the value of O's [[ByteLength]] internal slot. + 7. Return size. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var bytesPerElement = TA.BYTES_PER_ELEMENT; + var ta1 = new TA(); + assert.sameValue(ta1.byteLength, 0); + + var ta2 = new TA(42); + assert.sameValue(ta2.byteLength, 42 * bytesPerElement); +}); diff --git a/test/built-ins/TypedArray/prototype/byteOffset/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/byteOffset/BigInt/detached-buffer.js new file mode 100644 index 000000000..74710e488 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/byteOffset/BigInt/detached-buffer.js @@ -0,0 +1,22 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype.byteoffset +description: Returns 0 if the instance has a detached buffer +info: | + 22.2.3.3 get %TypedArray%.prototype.byteOffset + + ... + 4. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot. + 5. If IsDetachedBuffer(buffer) is true, return 0. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var buffer = new ArrayBuffer(128); + var sample = new TA(buffer, 8, 1); + $DETACHBUFFER(sample.buffer); + assert.sameValue(sample.byteOffset, 0); +}); diff --git a/test/built-ins/TypedArray/prototype/byteOffset/BigInt/return-byteoffset.js b/test/built-ins/TypedArray/prototype/byteOffset/BigInt/return-byteoffset.js new file mode 100644 index 000000000..692d5ee56 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/byteOffset/BigInt/return-byteoffset.js @@ -0,0 +1,31 @@ +// 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.3.3 +description: > + Return value from [[ByteOffset]] internal slot +info: | + 22.2.3.3 get %TypedArray%.prototype.byteOffset + + ... + 6. Let offset be the value of O's [[ByteOffset]] internal slot. + 7. Return size. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var ta1 = new TA(); + assert.sameValue(ta1.byteOffset, 0, "Regular typedArray"); + + var offset = 4 * TA.BYTES_PER_ELEMENT; + + var buffer1 = new ArrayBuffer(8 * TA.BYTES_PER_ELEMENT); + var ta2 = new TA(buffer1, offset); + assert.sameValue(ta2.byteOffset, offset, "TA(buffer, offset)"); + + var buffer2 = new ArrayBuffer(8 * TA.BYTES_PER_ELEMENT); + var sample = new TA(buffer2, offset); + var ta3 = new TA(sample); + assert.sameValue(ta3.byteOffset, 0, "TA(typedArray)"); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js new file mode 100644 index 000000000..709166c7e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js @@ -0,0 +1,77 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +es6id: 22.2.3.5 +description: > + end argument is coerced to an integer values. +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + %TypedArray%.prototype.copyWithin is a distinct function that implements the + same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length" and the actual copying of values in step 12 + must be performed in a manner that preserves the bit-level encoding of the + source data. + + ... + + 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] ) + + ... + 7. If end is undefined, let relativeEnd be len; else let relativeEnd be ? + ToInteger(end). + ... +includes: [compareArray.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, 0, null), + convertToBigInt([0, 1, 2, 3]) + ), + 'null value coerced to 0' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, 0, NaN), + convertToBigInt([0, 1, 2, 3]) + ), + 'NaN value coerced to 0' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, 0, false), + convertToBigInt([0, 1, 2, 3]) + ), + 'false value coerced to 0' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, 0, true), + convertToBigInt([0, 0, 2, 3]) + ), + 'true value coerced to 1' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, 0, '-2'), + convertToBigInt([0, 0, 1, 3]) + ), + 'string "-2" value coerced to integer -2' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, 0, -2.5), + convertToBigInt([0, 0, 1, 3]) + ), + 'float -2.5 value coerced to integer -2' + ); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js new file mode 100644 index 000000000..c91d0c883 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js @@ -0,0 +1,92 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +es6id: 22.2.3.5 +description: > + start argument is coerced to an integer value. +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + %TypedArray%.prototype.copyWithin is a distinct function that implements the + same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length" and the actual copying of values in step 12 + must be performed in a manner that preserves the bit-level encoding of the + source data. + + ... + + 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] ) + + ... + 5. Let relativeStart be ? ToInteger(start). + ... +includes: [compareArray.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, undefined), + convertToBigInt([0, 0, 1, 2]) + ), + 'undefined value coerced to 0' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, false), + convertToBigInt([0, 0, 1, 2]) + ), + 'false value coerced to 0' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, NaN), + convertToBigInt([0, 0, 1, 2]) + ), + 'NaN value coerced to 0' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, null), + convertToBigInt([0, 0, 1, 2]) + ), + 'null value coerced to 0' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, true), + convertToBigInt([1, 2, 3, 3]) + ), + 'true value coerced to 1' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, '1'), + convertToBigInt([1, 2, 3, 3]) + ), + 'string "1" value coerced to 1' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, 0.5), + convertToBigInt([0, 0, 1, 2]) + ), + '0.5 float value coerced to integer 0' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 1.5), + convertToBigInt([1, 2, 3, 3]) + ), + '1.5 float value coerced to integer 1' + ); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js new file mode 100644 index 000000000..7b7baf7d3 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js @@ -0,0 +1,92 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +es6id: 22.2.3.5 +description: > + target argument is coerced to an integer value. +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + %TypedArray%.prototype.copyWithin is a distinct function that implements the + same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length" and the actual copying of values in step 12 + must be performed in a manner that preserves the bit-level encoding of the + source data. + + ... + + 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] ) + + ... + 3. Let relativeTarget be ? ToInteger(target). + ... +includes: [compareArray.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(undefined, 1), + convertToBigInt([1, 2, 3, 3]) + ), + 'undefined value coerced to 0' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(false, 1), + convertToBigInt([1, 2, 3, 3]) + ), + 'false value coerced to 0' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(NaN, 1), + convertToBigInt([1, 2, 3, 3]) + ), + 'NaN value coerced to 0' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(null, 1), + convertToBigInt([1, 2, 3, 3]) + ), + 'null value coerced to 0' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(true, 0), + convertToBigInt([0, 0, 1, 2]) + ), + 'true value coerced to 1' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin('1', 0), + convertToBigInt([0, 0, 1, 2]) + ), + 'string "1" value coerced to 1' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0.5, 1), + convertToBigInt([1, 2, 3, 3]) + ), + '0.5 float value coerced to integer 0' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1.5, 0), + convertToBigInt([0, 0, 1, 2]) + ), + '1.5 float value coerced to integer 1' + ); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/detached-buffer.js new file mode 100644 index 000000000..0014ea674 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/detached-buffer.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +description: Throws a TypeError if this has a detached buffer +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [, end ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + ... + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +var obj = { + valueOf: function() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.copyWithin(obj, obj); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/get-length-ignores-length-prop.js new file mode 100644 index 000000000..0b02e6462 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/get-length-ignores-length-prop.js @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +es6id: 22.2.3.5 +description: > + Unreachable abrupt from Get(O, "length") as [[ArrayLength]] is returned. +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + %TypedArray%.prototype.copyWithin is a distinct function that implements the + same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length" and the actual copying of values in step 12 + must be performed in a manner that preserves the bit-level encoding of the + source data. + + ... + + 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] ) + + 1. Let O be ? ToObject(this value). + 2. Let len be ? ToLength(? Get(O, "length")). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +Object.defineProperty(TypedArray.prototype, "length", { + get: function() { + throw new Test262Error(); + } +}); + +testWithBigIntTypedArrayConstructors(function(TA) { + Object.defineProperty(TA.prototype, "length", { + get: function() { + throw new Test262Error(); + } + }); + + var sample = new TA(); + Object.defineProperty(sample, "length", { + get: function() { + throw new Test262Error(); + } + }); + + assert.sameValue(sample.copyWithin(0, 0), sample); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-func.js new file mode 100644 index 000000000..9b2836c2d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-func.js @@ -0,0 +1,29 @@ +// 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.3.5 +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [, end ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var copyWithin = TypedArray.prototype.copyWithin; + +assert.sameValue(typeof copyWithin, 'function'); + +assert.throws(TypeError, function() { + copyWithin(); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-method.js new file mode 100644 index 000000000..fdc3f22eb --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-method.js @@ -0,0 +1,29 @@ +// 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.3.5 +description: Requires a [[TypedArrayName]] internal slot. +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [, end ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.copyWithin, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.copyWithin(); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js new file mode 100644 index 000000000..56ed9e312 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.5 +description: > + %TypedArray%.prototype.copyWithin.length is 2. +info: | + %TypedArray%.prototype.copyWithin (target, start [, end ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.copyWithin.length, 2); + +verifyNotEnumerable(TypedArray.prototype.copyWithin, "length"); +verifyNotWritable(TypedArray.prototype.copyWithin, "length"); +verifyConfigurable(TypedArray.prototype.copyWithin, "length"); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js new file mode 100644 index 000000000..f1eaecc38 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.5 +description: > + %TypedArray%.prototype.copyWithin.name is "copyWithin". +info: | + %TypedArray%.prototype.copyWithin (target, start [, end ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.copyWithin.name, "copyWithin"); + +verifyNotEnumerable(TypedArray.prototype.copyWithin, "name"); +verifyNotWritable(TypedArray.prototype.copyWithin, "name"); +verifyConfigurable(TypedArray.prototype.copyWithin, "name"); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js new file mode 100644 index 000000000..45fd8f36d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js @@ -0,0 +1,95 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +es6id: 22.2.3.5 +description: > + Set values with negative end argument. +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + %TypedArray%.prototype.copyWithin is a distinct function that implements the + same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length" and the actual copying of values in step 12 + must be performed in a manner that preserves the bit-level encoding of the + source data. + + ... + + 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] ) + + ... + 7. If end is undefined, let relativeEnd be len; else let relativeEnd be ? + ToInteger(end). + 8. If relativeEnd < 0, let final be max((len + relativeEnd), 0); else let + final be min(relativeEnd, len). + ... +includes: [compareArray.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 1, -1), + convertToBigInt([1, 2, 2, 3]) + ), + '[0, 1, 2, 3].copyWithin(0, 1, -1) -> [1, 2, 2, 3]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(2, 0, -1), + convertToBigInt([0, 1, 0, 1, 2]) + ), + '[0, 1, 2, 3, 4].copyWithin(2, 0, -1) -> [0, 1, 0, 1, 2]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(1, 2, -2), + convertToBigInt([0, 2, 2, 3, 4]) + ), + '[0, 1, 2, 3, 4].copyWithin(1, 2, -2) -> [0, 2, 2, 3, 4]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, -2, -1), + convertToBigInt([2, 1, 2, 3]) + ), + '[0, 1, 2, 3].copyWithin(0, -2, -1) -> [2, 1, 2, 3]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(2, -2, -1), + convertToBigInt([0, 1, 3, 3, 4]) + ), + '[0, 1, 2, 3, 4].copyWithin(2, -2, 1) -> [0, 1, 3, 3, 4]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-3, -2, -1), + convertToBigInt([0, 2, 2, 3]) + ), + '[0, 1, 2, 3].copyWithin(-3, -2, -1) -> [0, 2, 2, 3]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(-2, -3, -1), + convertToBigInt([0, 1, 2, 2, 3]) + ), + '[0, 1, 2, 3, 4].copyWithin(-2, -3, -1) -> [0, 1, 2, 2, 3]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(-5, -2, -1), + convertToBigInt([3, 1, 2, 3, 4]) + ), + '[0, 1, 2, 3, 4].copyWithin(-5, -2, -1) -> [3, 1, 2, 3, 4]' + ); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js new file mode 100644 index 000000000..17c08eea3 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js @@ -0,0 +1,111 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +es6id: 22.2.3.5 +description: > + Set values with negative out of bounds end argument. +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + %TypedArray%.prototype.copyWithin is a distinct function that implements the + same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length" and the actual copying of values in step 12 + must be performed in a manner that preserves the bit-level encoding of the + source data. + + ... + + 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] ) + + ... + 7. If end is undefined, let relativeEnd be len; else let relativeEnd be ? + ToInteger(end). + 8. If relativeEnd < 0, let final be max((len + relativeEnd), 0); else let + final be min(relativeEnd, len). + ... +includes: [compareArray.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 1, -10), + convertToBigInt([0, 1, 2, 3]) + ), + '[0, 1, 2, 3].copyWithin(0, 1, -10) -> [0, 1, 2, 3]' + ); + + assert( + compareArray( + new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(0, 1, -Infinity), + convertToBigInt([1, 2, 3, 4, 5]) + ), + '[1, 2, 3, 4, 5].copyWithin(0, 1, -Infinity) -> [1, 2, 3, 4, 5]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, -2, -10), + convertToBigInt([0, 1, 2, 3]) + ), + '[0, 1, 2, 3].copyWithin(0, -2, -10) -> [0, 1, 2, 3]' + ); + + assert( + compareArray( + new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(0, -2, -Infinity), + convertToBigInt([1, 2, 3, 4, 5]) + ), + '[1, 2, 3, 4, 5].copyWithin(0, -2, -Infinity) -> [1, 2, 3, 4, 5]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, -9, -10), + convertToBigInt([0, 1, 2, 3]) + ), + '[0, 1, 2, 3].copyWithin(0, -9, -10) -> [0, 1, 2, 3]' + ); + + assert( + compareArray( + new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(0, -9, -Infinity), + convertToBigInt([1, 2, 3, 4, 5]) + ), + '[1, 2, 3, 4, 5].copyWithin(0, -9, -Infinity) -> [1, 2, 3, 4, 5]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-3, -2, -10), + convertToBigInt([0, 1, 2, 3]) + ), + '[0, 1, 2, 3].copyWithin(-3, -2, -10) -> [0, 1, 2, 3]' + ); + + assert( + compareArray( + new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(-3, -2, -Infinity), + convertToBigInt([1, 2, 3, 4, 5]) + ), + '[1, 2, 3, 4, 5].copyWithin(-3, -2, -Infinity) -> [1, 2, 3, 4, 5]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-7, -8, -9), + convertToBigInt([0, 1, 2, 3]) + ), + '[0, 1, 2, 3].copyWithin(-7, -8, -9) -> [0, 1, 2, 3]' + ); + + assert( + compareArray( + new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(-7, -8, -Infinity), + convertToBigInt([1, 2, 3, 4, 5]) + ), + '[1, 2, 3, 4, 5].copyWithin(-7, -8, -Infinity) -> [1, 2, 3, 4, 5]' + ); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js new file mode 100644 index 000000000..84ee0dcca --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js @@ -0,0 +1,93 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +es6id: 22.2.3.5 +description: > + Set values with out of bounds negative start argument. +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + %TypedArray%.prototype.copyWithin is a distinct function that implements the + same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length" and the actual copying of values in step 12 + must be performed in a manner that preserves the bit-level encoding of the + source data. + + ... + + 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] ) + + ... + 6. If relativeStart < 0, let from be max((len + relativeStart), 0); else let + from be min(relativeStart, len). + ... +includes: [compareArray.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, -10), + convertToBigInt([0, 1, 2, 3]) + ), + '[0, 1, 2, 3]).copyWithin(0, -10) -> [0, 1, 2, 3]' + ); + + assert( + compareArray( + new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(0, -Infinity), + convertToBigInt([1, 2, 3, 4, 5]) + ), + '[1, 2, 3, 4, 5]).copyWithin(0, -Infinity) -> [1, 2, 3, 4, 5]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(2, -10), + convertToBigInt([0, 1, 0, 1, 2]) + ), + '[0, 1, 2, 3, 4]).copyWithin(2, -2) -> [0, 1, 0, 1, 2]' + ); + + assert( + compareArray( + new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(2, -Infinity), + convertToBigInt([1, 2, 1, 2, 3]) + ), + '[1, 2, 3, 4, 5]).copyWithin(2, -Infinity) -> [1, 2, 1, 2, 3]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(10, -10), + convertToBigInt([0, 1, 2, 3, 4]) + ), + '[0, 1, 2, 3, 4]).copyWithin(10, -10) -> [0, 1, 2, 3, 4]' + ); + + assert( + compareArray( + new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(10, -Infinity), + convertToBigInt([1, 2, 3, 4, 5]) + ), + '[1, 2, 3, 4, 5]).copyWithin(10, -Infinity) -> [1, 2, 3, 4, 5]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-9, -10), + convertToBigInt([0, 1, 2, 3]) + ), + '[0, 1, 2, 3].copyWithin(-9, -10) -> [0, 1, 2, 3]' + ); + + assert( + compareArray( + new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(-9, -Infinity), + convertToBigInt([1, 2, 3, 4, 5]) + ), + '[1, 2, 3, 4, 5].copyWithin(-9, -Infinity) -> [1, 2, 3, 4, 5]' + ); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js new file mode 100644 index 000000000..613f4f50c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js @@ -0,0 +1,61 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +es6id: 22.2.3.5 +description: > + Set values with out of bounds negative target argument. +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + %TypedArray%.prototype.copyWithin is a distinct function that implements the + same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length" and the actual copying of values in step 12 + must be performed in a manner that preserves the bit-level encoding of the + source data. + + ... + + 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] ) + + ... + 4. If relativeTarget < 0, let to be max((len + relativeTarget), 0); else let + to be min(relativeTarget, len). + ... +includes: [compareArray.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-10, 0), + convertToBigInt([0, 1, 2, 3]) + ), + '[0, 1, 2, 3].copyWithin(-10, 0) -> [0, 1, 2, 3]' + ); + + assert( + compareArray( + new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(-Infinity, 0), + convertToBigInt([1, 2, 3, 4, 5]) + ), + '[1, 2, 3, 4, 5].copyWithin(-Infinity, 0) -> [1, 2, 3, 4, 5]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(-10, 2), + convertToBigInt([2, 3, 4, 3, 4]) + ), + '[0, 1, 2, 3, 4].copyWithin(-10, 2) -> [2, 3, 4, 3, 4]' + ); + + assert( + compareArray( + new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(-Infinity, 2), + convertToBigInt([3, 4, 5, 4, 5]) + ), + '[1, 2, 3, 4, 5].copyWithin(-Infinity, 2) -> [3, 4, 5, 4, 5]' + ); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js new file mode 100644 index 000000000..928d349d3 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js @@ -0,0 +1,77 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +es6id: 22.2.3.5 +description: > + Set values with negative start argument. +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + %TypedArray%.prototype.copyWithin is a distinct function that implements the + same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length" and the actual copying of values in step 12 + must be performed in a manner that preserves the bit-level encoding of the + source data. + + ... + + 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] ) + + ... + 6. If relativeStart < 0, let from be max((len + relativeStart), 0); else let + from be min(relativeStart, len). + ... +includes: [compareArray.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, -1), + convertToBigInt([3, 1, 2, 3]) + ), + '[0, 1, 2, 3].copyWithin(0, -1) -> [3, 1, 2, 3]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(2, -2), + convertToBigInt([0, 1, 3, 4, 4]) + ), + '[0, 1, 2, 3, 4].copyWithin(2, -2) -> [0, 1, 3, 4, 4]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(1, -2), + convertToBigInt([0, 3, 4, 3, 4]) + ), + '[0, 1, 2, 3, 4].copyWithin(1, -2) -> [0, 3, 4, 3, 4]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-1, -2), + convertToBigInt([0, 1, 2, 2]) + ), + '[0, 1, 2, 3].copyWithin(-1, -2) -> [ 0, 1, 2, 2 ]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(-2, -3), + convertToBigInt([0, 1, 2, 2, 3]) + ), + '[0, 1, 2, 3, 4].copyWithin(-2, -3) -> [0, 1, 2, 2, 3]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(-5, -2), + convertToBigInt([3, 4, 2, 3, 4]) + ), + '[0, 1, 2, 3, 4].copyWithin(-5, -2) -> [3, 4, 2, 3, 4]' + ); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js new file mode 100644 index 000000000..e7e08504b --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +es6id: 22.2.3.5 +description: > + Set values with negative target argument. +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + %TypedArray%.prototype.copyWithin is a distinct function that implements the + same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length" and the actual copying of values in step 12 + must be performed in a manner that preserves the bit-level encoding of the + source data. + + ... + + 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] ) + + ... + 4. If relativeTarget < 0, let to be max((len + relativeTarget), 0); else let + to be min(relativeTarget, len). + ... +includes: [compareArray.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-1, 0), + convertToBigInt([0, 1, 2, 0]) + ), + '[0, 1, 2, 3].copyWithin(-1, 0) -> [0, 1, 2, 0]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(-2, 2), + convertToBigInt([0, 1, 2, 2, 3]) + ), + '[0, 1, 2, 3, 4].copyWithin(-2, 2) -> [0, 1, 2, 2, 3]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-1, 2), + convertToBigInt([0, 1, 2, 2]) + ), + '[0, 1, 2, 3].copyWithin(-1, 2) -> [0, 1, 2, 2]' + ); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js new file mode 100644 index 000000000..a921443c4 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js @@ -0,0 +1,54 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +es6id: 22.2.3.5 +description: > + Max value of end position is the this.length. +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + %TypedArray%.prototype.copyWithin is a distinct function that implements the + same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length" and the actual copying of values in step 12 + must be performed in a manner that preserves the bit-level encoding of the + source data. + + ... +includes: [compareArray.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 1, 6), + convertToBigInt([1, 2, 3, 3]) + ), + '[0, 1, 2, 3].copyWithin(0, 1, 6) -> [1, 2, 3, 3]' + ); + + assert( + compareArray( + new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(0, 1, Infinity), + convertToBigInt([2, 3, 4, 5, 5]) + ), + '[1, 2, 3, 4, 5].copyWithin(0, 1, Infinity) -> [2, 3, 4, 5, 5]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3, 4, 5])).copyWithin(1, 3, 6), + convertToBigInt([0, 3, 4, 5, 4, 5]) + ), + '[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 6) -> [0, 3, 4, 5, 4, 5]' + ); + + assert( + compareArray( + new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(1, 3, Infinity), + convertToBigInt([1, 4, 5, 4, 5]) + ), + '[1, 2, 3, 4, 5].copyWithin(1, 3, Infinity) -> [1, 4, 5, 4, 5]' + ); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js new file mode 100644 index 000000000..8782ea76a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js @@ -0,0 +1,74 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +es6id: 22.2.3.5 +description: > + Max values of target and start positions are this.length. +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + %TypedArray%.prototype.copyWithin is a distinct function that implements the + same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length" and the actual copying of values in step 12 + must be performed in a manner that preserves the bit-level encoding of the + source data. + + ... +includes: [compareArray.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3, 4, 5])).copyWithin(6, 0), + convertToBigInt([0, 1, 2, 3, 4, 5]) + ) + ); + + assert( + compareArray( + new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(Infinity, 0), + convertToBigInt([1, 2, 3, 4, 5]) + ), + '[1, 2, 3, 4, 5].copyWithin(Infinity, 0) -> [1, 2, 3, 4, 5]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3, 4, 5])).copyWithin(0, 6), + convertToBigInt([0, 1, 2, 3, 4, 5]) + ) + ); + + assert( + compareArray( + new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(0, Infinity), + convertToBigInt([1, 2, 3, 4, 5]) + ), + '[1, 2, 3, 4, 5].copyWithin(0, Infinity) -> [1, 2, 3, 4, 5]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3, 4, 5])).copyWithin(6, 6), + convertToBigInt([0, 1, 2, 3, 4, 5]) + ) + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3, 4, 5])).copyWithin(10, 10), + convertToBigInt([0, 1, 2, 3, 4, 5]) + ) + ); + + assert( + compareArray( + new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(Infinity, Infinity), + convertToBigInt([1, 2, 3, 4, 5]) + ), + '[1, 2, 3, 4, 5].copyWithin(Infinity, Infinity) -> [1, 2, 3, 4, 5]' + ); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js new file mode 100644 index 000000000..f958bc6e0 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +es6id: 22.2.3.5 +description: > + Copy values with non-negative target and start positions. +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + %TypedArray%.prototype.copyWithin is a distinct function that implements the + same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length" and the actual copying of values in step 12 + must be performed in a manner that preserves the bit-level encoding of the + source data. + + ... +includes: [compareArray.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert( + compareArray( + new TA(convertToBigInt([1, 2, 3, 4, 5, 6])).copyWithin(0, 0), + convertToBigInt([1, 2, 3, 4, 5, 6]) + ) + ); + + assert( + compareArray( + new TA(convertToBigInt([1, 2, 3, 4, 5, 6])).copyWithin(0, 2), + convertToBigInt([3, 4, 5, 6, 5, 6]) + ) + ); + + assert( + compareArray( + new TA(convertToBigInt([1, 2, 3, 4, 5, 6])).copyWithin(3, 0), + convertToBigInt([1, 2, 3, 1, 2, 3]) + ) + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3, 4, 5])).copyWithin(1, 4), + convertToBigInt([0, 4, 5, 3, 4, 5]) + ) + ); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js new file mode 100644 index 000000000..cda7b0e03 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js @@ -0,0 +1,73 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +es6id: 22.2.3.5 +description: > + Copy values with non-negative target, start and end positions. +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + %TypedArray%.prototype.copyWithin is a distinct function that implements the + same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length" and the actual copying of values in step 12 + must be performed in a manner that preserves the bit-level encoding of the + source data. + + ... +includes: [compareArray.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 0, 0), + convertToBigInt([0, 1, 2, 3]) + ), + '[0, 1, 2, 3].copyWithin(0, 0, 0) -> [0, 1, 2, 3]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 0, 2), + convertToBigInt([0, 1, 2, 3]) + ), + '[0, 1, 2, 3].copyWithin(0, 0, 2) -> [0, 1, 2, 3]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 1, 2), + convertToBigInt([1, 1, 2, 3]) + ), + '[0, 1, 2, 3].copyWithin(0, 1, 2) -> [1, 1, 2, 3]' + ); + + /* + * 10. If from [0, 0, 1, 3]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3, 4, 5])).copyWithin(1, 3, 5), + convertToBigInt([0, 3, 4, 3, 4, 5]) + ), + '[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 5) -> [0, 3, 4, 3, 4, 5]' + ); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js new file mode 100644 index 000000000..c3e90369a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js @@ -0,0 +1,18 @@ +// 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.3.5 +description: > + "copyWithin" property of TypedArrayPrototype +info: | + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'copyWithin'); +verifyWritable(TypedArrayPrototype, 'copyWithin'); +verifyConfigurable(TypedArrayPrototype, 'copyWithin'); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end-is-symbol.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end-is-symbol.js new file mode 100644 index 000000000..adcbf5318 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end-is-symbol.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +es6id: 22.2.3.5 +description: > + Return abrupt if end is a Symbol. +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + %TypedArray%.prototype.copyWithin is a distinct function that implements the + same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length" and the actual copying of values in step 12 + must be performed in a manner that preserves the bit-level encoding of the + source data. + + ... + + 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] ) + + ... + 7. If end is undefined, let relativeEnd be len; else let relativeEnd be ? + ToInteger(end). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var s = Symbol(1); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + assert.throws(TypeError, function() { + sample.copyWithin(0, 0, s); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end.js new file mode 100644 index 000000000..bd4fd5bc1 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end.js @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +es6id: 22.2.3.5 +description: > + Return abrupt from ToInteger(end). +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + %TypedArray%.prototype.copyWithin is a distinct function that implements the + same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length" and the actual copying of values in step 12 + must be performed in a manner that preserves the bit-level encoding of the + source data. + + ... + + 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] ) + + ... + 7. If end is undefined, let relativeEnd be len; else let relativeEnd be ? + ToInteger(end). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var o1 = { + valueOf: function() { + throw new Test262Error(); + } + }; + var sample = new TA(); + assert.throws(Test262Error, function() { + sample.copyWithin(0, 0, o1); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start-is-symbol.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start-is-symbol.js new file mode 100644 index 000000000..196600a8a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start-is-symbol.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +es6id: 22.2.3.5 +description: > + Return abrupt if start is a Symbol. +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + %TypedArray%.prototype.copyWithin is a distinct function that implements the + same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length" and the actual copying of values in step 12 + must be performed in a manner that preserves the bit-level encoding of the + source data. + + ... + + 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] ) + + ... + 5. Let relativeStart be ? ToInteger(start). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var s = Symbol(1); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + assert.throws(TypeError, function() { + sample.copyWithin(0, s); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start.js new file mode 100644 index 000000000..788473453 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +es6id: 22.2.3.5 +description: > + Return abrupt from ToInteger(start). +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + %TypedArray%.prototype.copyWithin is a distinct function that implements the + same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length" and the actual copying of values in step 12 + must be performed in a manner that preserves the bit-level encoding of the + source data. + + ... + + 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] ) + + ... + 5. Let relativeStart be ? ToInteger(start). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var o = { + valueOf: function() { + throw new Test262Error(); + } +}; + +var err = { + valueOf: function() { + throw new Error("ToInteger(start) runs before ToInteger(end)"); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + assert.throws(Test262Error, function() { + sample.copyWithin(0, o, err); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target-is-symbol.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target-is-symbol.js new file mode 100644 index 000000000..20e8bf58a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target-is-symbol.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +es6id: 22.2.3.5 +description: > + Return abrupt if target is a Symbol. +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + %TypedArray%.prototype.copyWithin is a distinct function that implements the + same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length" and the actual copying of values in step 12 + must be performed in a manner that preserves the bit-level encoding of the + source data. + + ... + + 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] ) + + ... + 3. Let relativeTarget be ? ToInteger(target). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var s = Symbol(1); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + assert.throws(TypeError, function() { + sample.copyWithin(s, 0); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target.js new file mode 100644 index 000000000..9c8b00b4c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target.js @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +es6id: 22.2.3.5 +description: > + Return abrupt from ToInteger(target). +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + %TypedArray%.prototype.copyWithin is a distinct function that implements the + same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length" and the actual copying of values in step 12 + must be performed in a manner that preserves the bit-level encoding of the + source data. + + ... + + 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] ) + + ... + 3. Let relativeTarget be ? ToInteger(target). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var o = { + valueOf: function() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + assert.throws(Test262Error, function() { + sample.copyWithin(o); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js new file mode 100644 index 000000000..62a3f69a1 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +es6id: 22.2.3.5 +description: > + Returns `this`. +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + %TypedArray%.prototype.copyWithin is a distinct function that implements the + same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length" and the actual copying of values in step 12 + must be performed in a manner that preserves the bit-level encoding of the + source data. + + ... + + 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] ) + + 13. Return O. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample1 = new TA(); + var result1 = sample1.copyWithin(0, 0); + + assert.sameValue(result1, sample1); + + var sample2 = new TA(convertToBigInt([1, 2, 3])); + var result2 = sample2.copyWithin(1, 0); + + assert.sameValue(result2, sample2); +}); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-object.js new file mode 100644 index 000000000..3c1b7c435 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-object.js @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var copyWithin = TypedArray.prototype.copyWithin; + +assert.throws(TypeError, function() { + copyWithin.call(undefined, 0, 0); +}, "this is undefined"); + +assert.throws(TypeError, function() { + copyWithin.call(null, 0, 0); +}, "this is null"); + +assert.throws(TypeError, function() { + copyWithin.call(42, 0, 0); +}, "this is 42"); + +assert.throws(TypeError, function() { + copyWithin.call("1", 0, 0); +}, "this is a string"); + +assert.throws(TypeError, function() { + copyWithin.call(true, 0, 0); +}, "this is true"); + +assert.throws(TypeError, function() { + copyWithin.call(false, 0, 0); +}, "this is false"); + +var s = Symbol("s"); +assert.throws(TypeError, function() { + copyWithin.call(s, 0, 0); +}, "this is a Symbol"); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..95d9bfd12 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var copyWithin = TypedArray.prototype.copyWithin; + +assert.throws(TypeError, function() { + copyWithin.call({}, 0, 0); +}, "this is an Object"); + +assert.throws(TypeError, function() { + copyWithin.call([], 0, 0); +}, "this is an Array"); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + copyWithin.call(ab, 0, 0); +}, "this is an ArrayBuffer instance"); + +var dv = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + copyWithin.call(dv, 0, 0); +}, "this is a DataView instance"); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js new file mode 100644 index 000000000..3a0d5df7d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +es6id: 22.2.3.5 +description: > + If `end` is undefined, set final position to `this.length`. +info: | + 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] ) + + %TypedArray%.prototype.copyWithin is a distinct function that implements the + same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length" and the actual copying of values in step 12 + must be performed in a manner that preserves the bit-level encoding of the + source data. + + ... + + 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] ) + + ... + 7. If end is undefined, let relativeEnd be len; else let relativeEnd be ? + ToInteger(end). + ... +includes: [compareArray.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 1, undefined), + convertToBigInt([1, 2, 3, 3]) + ), + '[0, 1, 2, 3].copyWithin(0, 1, undefined) -> [1, 2, 3]' + ); + + assert( + compareArray( + new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 1), + convertToBigInt([1, 2, 3, 3]) + ), + '[0, 1, 2, 3].copyWithin(0, 1) -> [1, 2, 3, 3]' + ); +}); diff --git a/test/built-ins/TypedArray/prototype/entries/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/entries/BigInt/detached-buffer.js new file mode 100644 index 000000000..ead1ec4bf --- /dev/null +++ b/test/built-ins/TypedArray/prototype/entries/BigInt/detached-buffer.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.entries +description: Throws a TypeError if this has a detached buffer +info: | + 22.2.3.6 %TypedArray%.prototype.entries ( ) + + 1. Let O be the this value. + 2. Perform ? ValidateTypedArray(O). + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + ... + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.entries(); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/entries/BigInt/iter-prototype.js b/test/built-ins/TypedArray/prototype/entries/BigInt/iter-prototype.js new file mode 100644 index 000000000..ae795bb04 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/entries/BigInt/iter-prototype.js @@ -0,0 +1,25 @@ +// 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.3.6 +esid: sec-%typedarray%.prototype.entries +description: > + The prototype of the returned iterator is ArrayIteratorPrototype +info: | + 22.2.3.6 %TypedArray%.prototype.entries ( ) + + ... + 3. Return CreateArrayIterator(O, "key+value"). +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.iterator, TypedArray] +---*/ + +var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]()); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([0, 42, 64])); + var iter = sample.entries(); + + assert.sameValue(Object.getPrototypeOf(iter), ArrayIteratorProto); +}); diff --git a/test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js b/test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js new file mode 100644 index 000000000..2c2b47cd4 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js @@ -0,0 +1,37 @@ +// 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.3.6 +esid: sec-%typedarray%.prototype.entries +description: Return an iterator for the entries. +info: | + 22.2.3.6 %TypedArray%.prototype.entries ( ) + + ... + 3. Return CreateArrayIterator(O, "key+value"). +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +var sample = [0, 42, 64]; + +testWithBigIntTypedArrayConstructors(function(TA) { + var typedArray = new TA(convertToBigInt(sample)); + var itor = typedArray.entries(); + + var next = itor.next(); + assert(compareArray(next.value, [0, convertToBigInt(0)])); + assert.sameValue(next.done, false); + + next = itor.next(); + assert(compareArray(next.value, [1, convertToBigInt(42)])); + assert.sameValue(next.done, false); + + next = itor.next(); + assert(compareArray(next.value, [2, convertToBigInt(64)])); + assert.sameValue(next.done, false); + + next = itor.next(); + assert.sameValue(next.value, undefined); + assert.sameValue(next.done, true); +}); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-with-thisarg.js new file mode 100644 index 000000000..e6a878b01 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-with-thisarg.js @@ -0,0 +1,56 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.every +description: > + thisArg does not affect callbackfn arguments +info: | + 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.every is a distinct function that implements the same + algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] ) + + ... + 6. Repeat, while k < len + ... + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + + var results = []; + var thisArg = ["test262", 0, "ecma262", 0]; + + sample.every(function() { + results.push(arguments); + return true; + }, thisArg); + + assert.sameValue(results.length, 3, "results.length"); + assert.sameValue(thisArg.length, 4, "thisArg.length"); + + assert.sameValue(results[0].length, 3, "results[0].length"); + assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue"); + assert.sameValue(results[0][1], 0, "results[0][1] - k"); + assert.sameValue(results[0][2], sample, "results[0][2] - this"); + + assert.sameValue(results[1].length, 3, "results[1].length"); + assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue"); + assert.sameValue(results[1][1], 1, "results[1][1] - k"); + assert.sameValue(results[1][2], sample, "results[1][2] - this"); + + assert.sameValue(results[2].length, 3, "results[2].length"); + assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue"); + assert.sameValue(results[2][1], 2, "results[2][1] - k"); + assert.sameValue(results[2][2], sample, "results[2][2] - this"); +}); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-without-thisarg.js new file mode 100644 index 000000000..1f2dce111 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-without-thisarg.js @@ -0,0 +1,54 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.every +description: > + callbackfn arguments +info: | + 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.every is a distinct function that implements the same + algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] ) + + ... + 6. Repeat, while k < len + ... + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + + var results = []; + + sample.every(function() { + results.push(arguments); + return true; + }); + + assert.sameValue(results.length, 3, "results.length"); + + assert.sameValue(results[0].length, 3, "results[0].length"); + assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue"); + assert.sameValue(results[0][1], 0, "results[0][1] - k"); + assert.sameValue(results[0][2], sample, "results[0][2] - this"); + + assert.sameValue(results[1].length, 3, "results[1].length"); + assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue"); + assert.sameValue(results[1][1], 1, "results[1][1] - k"); + assert.sameValue(results[1][2], sample, "results[1][2] - this"); + + assert.sameValue(results[2].length, 3, "results[2].length"); + assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue"); + assert.sameValue(results[2][1], 2, "results[2][1] - k"); + assert.sameValue(results[2][2], sample, "results[2][2] - this"); +}); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-detachbuffer.js new file mode 100644 index 000000000..13660264f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-detachbuffer.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.every +description: > + Instance buffer can be detached during loop +info: | + 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.every is a distinct function that implements the same + algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] ) + + ... + 6. Repeat, while k < len + ... + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [detachArrayBuffer.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var loops = 0; + var sample = new TA(2); + + assert.throws(TypeError, function() { + sample.every(function() { + if (loops === 1) { + throw new Test262Error("callbackfn called twice"); + } + $DETACHBUFFER(sample.buffer); + loops++; + return true; + }); + }); + + assert.sameValue(loops, 1); +}); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-no-interaction-over-non-integer.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-no-interaction-over-non-integer.js new file mode 100644 index 000000000..678605aef --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-no-interaction-over-non-integer.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.every +description: > + Does not interact over non-integer properties +info: | + 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) + + ... + 6. Repeat, while k < len + ... + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([7, 8])); + + var results = []; + + sample.foo = 42; + sample[Symbol("1")] = 43; + + sample.every(function() { + results.push(arguments); + return true; + }); + + assert.sameValue(results.length, 2, "results.length"); + + assert.sameValue(results[0][1], 0, "results[0][1] - key"); + assert.sameValue(results[1][1], 1, "results[1][1] - key"); + + assert.sameValue(results[0][0], convertToBigInt(7), "results[0][0] - value"); + assert.sameValue(results[1][0], convertToBigInt(8), "results[1][0] - value"); +}); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-not-callable-throws.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-not-callable-throws.js new file mode 100644 index 000000000..49827a5ca --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-not-callable-throws.js @@ -0,0 +1,69 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.every +description: Throws a TypeError if callbackfn is not callable +info: | + 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.every is a distinct function that implements the same + algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] ) + + ... + 3. If IsCallable(callbackfn) is false, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + + assert.throws(TypeError, function() { + sample.every(); + }, "no args"); + + assert.throws(TypeError, function() { + sample.every(null); + }, "null"); + + assert.throws(TypeError, function() { + sample.every(undefined); + }, "undefined"); + + assert.throws(TypeError, function() { + sample.every("abc"); + }, "string"); + + assert.throws(TypeError, function() { + sample.every(1); + }, "number"); + + assert.throws(TypeError, function() { + sample.every(NaN); + }, "NaN"); + + assert.throws(TypeError, function() { + sample.every(false); + }, "false"); + + assert.throws(TypeError, function() { + sample.every(true); + }, "true"); + + assert.throws(TypeError, function() { + sample.every({}); + }, "{}"); + + assert.throws(TypeError, function() { + sample.every(sample); + }, "same typedArray instance"); + + assert.throws(TypeError, function() { + sample.every(Symbol("1")); + }, "symbol"); +}); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-not-called-on-empty.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-not-called-on-empty.js new file mode 100644 index 000000000..07c599fd7 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-not-called-on-empty.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.every +description: > + callbackfn is not called on empty instances +info: | + 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.every is a distinct function that implements the same + algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] ) + + ... + 6. Repeat, while k < len + .. + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var called = 0; + + new TA().every(function() { + called++; + }); + + assert.sameValue(called, 0); +}); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-return-does-not-change-instance.js new file mode 100644 index 000000000..b46f77ad0 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-return-does-not-change-instance.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.every +description: > + The callbackfn return does not change the instance +info: | + 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.every is a distinct function that implements the same + algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] ) + + ... + 6. Repeat, while k < len + .. + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42])); + + sample.every(function() { + return 43; + }); + + assert.sameValue(sample[0], convertToBigInt(40), "[0] == 40"); + assert.sameValue(sample[1], convertToBigInt(41), "[1] == 41"); + assert.sameValue(sample[2], convertToBigInt(42), "[2] == 42"); +}); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-returns-abrupt.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-returns-abrupt.js new file mode 100644 index 000000000..d165d7be7 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-returns-abrupt.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.every +description: Returns abrupt from callbackfn +info: | + 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.every is a distinct function that implements the same + algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] ) + + ... + 6. Repeat, while k < len + .. + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(3); + + assert.throws(Test262Error, function() { + sample.every(function() { + throw new Test262Error(); + }); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-set-value-during-interaction.js new file mode 100644 index 000000000..8949bb2f1 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-set-value-during-interaction.js @@ -0,0 +1,58 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.every +description: > + Integer indexed values changed during iteration +info: | + 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.every is a distinct function that implements the same + algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] ) + + ... + 6. Repeat, while k < len + .. + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect.set, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + var newVal = 0; + + sample.every(function(val, i) { + if (i > 0) { + assert.sameValue( + sample[i - 1], convertToBigInt(newVal - 1), + "get the changed value during the loop" + ); + assert.sameValue( + Reflect.set(sample, 0, convertToBigInt(7)), + true, + "re-set a value for sample[0]" + ); + } + assert.sameValue( + Reflect.set(sample, i, convertToBigInt(newVal)), + true, + "set value during iteration" + ); + + newVal++; + + return true; + }); + + assert.sameValue(sample[0], convertToBigInt(7), "changed values after iteration [0] == 7"); + assert.sameValue(sample[1], convertToBigInt(1), "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], convertToBigInt(2), "changed values after iteration [2] == 2"); +}); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-this.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-this.js new file mode 100644 index 000000000..589cfec30 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-this.js @@ -0,0 +1,59 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.every +description: > + callbackfn `this` value +info: | + 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.every is a distinct function that implements the same + algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] ) + + ... + 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + ... + 6. Repeat, while k < len + ... + c. If kPresent is true, then + ... + ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var expected = (function() { return this; })(); +var thisArg = {}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(3); + + var results1 = []; + + sample.every(function() { + results1.push(this); + return true; + }); + + assert.sameValue(results1.length, 3, "results1"); + assert.sameValue(results1[0], expected, "without thisArg - [0]"); + assert.sameValue(results1[1], expected, "without thisArg - [1]"); + assert.sameValue(results1[2], expected, "without thisArg - [2]"); + + var results2 = []; + + sample.every(function() { + results2.push(this); + return true; + }, thisArg); + + assert.sameValue(results2.length, 3, "results2"); + assert.sameValue(results2[0], thisArg, "using thisArg - [0]"); + assert.sameValue(results2[1], thisArg, "using thisArg - [1]"); + assert.sameValue(results2[2], thisArg, "using thisArg - [2]"); +}); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/every/BigInt/detached-buffer.js new file mode 100644 index 000000000..5c622dc6a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/BigInt/detached-buffer.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.every +description: Throws a TypeError if this has a detached buffer +info: | + 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + ... + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +var callbackfn = function() { + throw new Test262Error(); +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.every(callbackfn); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/every/BigInt/get-length-uses-internal-arraylength.js new file mode 100644 index 000000000..af887bf1e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/BigInt/get-length-uses-internal-arraylength.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.every +description: Get "length" uses internal ArrayLength +info: | + 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.every is a distinct function that implements the same + algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] ) + + 1. Let O be ? ToObject(this value). + 2. Let len be ? ToLength(? Get(O, "length")). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var getCalls = 0; +var desc = { + get: function getLen() { + getCalls++; + return 0; + } +}; + +Object.defineProperty(TypedArray.prototype, "length", desc); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + var calls = 0; + + Object.defineProperty(TA.prototype, "length", desc); + Object.defineProperty(sample, "length", desc); + + sample.every(function() { + calls++; + return true; + }); + + assert.sameValue(getCalls, 0, "ignores length properties"); + assert.sameValue(calls, 2, "iterations are not affected by custom length"); +}); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-func.js new file mode 100644 index 000000000..1ae892380 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-func.js @@ -0,0 +1,29 @@ +// 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.3.7 +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var every = TypedArray.prototype.every; + +assert.sameValue(typeof every, 'function'); + +assert.throws(TypeError, function() { + every(); +}); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-method.js new file mode 100644 index 000000000..24d9fd6fd --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-method.js @@ -0,0 +1,29 @@ +// 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.3.7 +description: Requires a [[TypedArrayName]] internal slot. +info: | + 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.every, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.every(); +}); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/length.js b/test/built-ins/TypedArray/prototype/every/BigInt/length.js new file mode 100644 index 000000000..ee523a260 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/BigInt/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.7 +description: > + %TypedArray%.prototype.every.length is 1. +info: | + %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.every.length, 1); + +verifyNotEnumerable(TypedArray.prototype.every, "length"); +verifyNotWritable(TypedArray.prototype.every, "length"); +verifyConfigurable(TypedArray.prototype.every, "length"); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/name.js b/test/built-ins/TypedArray/prototype/every/BigInt/name.js new file mode 100644 index 000000000..0bd6cc255 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/BigInt/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.7 +description: > + %TypedArray%.prototype.every.name is "every". +info: | + %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.every.name, "every"); + +verifyNotEnumerable(TypedArray.prototype.every, "name"); +verifyNotWritable(TypedArray.prototype.every, "name"); +verifyConfigurable(TypedArray.prototype.every, "name"); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/every/BigInt/prop-desc.js new file mode 100644 index 000000000..cd6a80a3a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/BigInt/prop-desc.js @@ -0,0 +1,18 @@ +// 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.3.7 +description: > + "every" property of TypedArrayPrototype +info: | + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'every'); +verifyWritable(TypedArrayPrototype, 'every'); +verifyConfigurable(TypedArrayPrototype, 'every'); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/returns-false-if-any-cb-returns-false.js b/test/built-ins/TypedArray/prototype/every/BigInt/returns-false-if-any-cb-returns-false.js new file mode 100644 index 000000000..8271e5109 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/BigInt/returns-false-if-any-cb-returns-false.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.every +description: > + Returns false if any callbackfn call returns a coerced false. +info: | + 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.every is a distinct function that implements the same + algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] ) + + ... + 7. Return true. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(42); + + [ + false, + "", + 0, + -0, + NaN, + undefined, + null + ].forEach(function(val) { + var called = 0; + var result = sample.every(function() { + called++; + if (called === 1) { + return true; + } + return val; + }); + assert.sameValue(called, 2, "callbackfn called until it returned " + val); + assert.sameValue(result, false, "result is false when it returned " + val); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/returns-true-if-every-cb-returns-true.js b/test/built-ins/TypedArray/prototype/every/BigInt/returns-true-if-every-cb-returns-true.js new file mode 100644 index 000000000..761b8784b --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/BigInt/returns-true-if-every-cb-returns-true.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.every +description: > + Returns true if every callbackfn returns a coerced true. +info: | + 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.every is a distinct function that implements the same + algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] ) + + ... + 7. Return true. +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var called = 0; + var values = [ + true, + 1, + "test262", + Symbol("1"), + {}, + [], + -1, + Infinity, + -Infinity, + 0.1, + -0.1 + ]; + var sample = new TA(values.length); + var result = sample.every(function() { + called++; + return values.unshift(); + }); + + assert.sameValue(called, sample.length, "callbackfn called for each index"); + assert.sameValue(result, true, "return is true"); +}); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/every/BigInt/this-is-not-object.js new file mode 100644 index 000000000..af9557ea0 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/BigInt/this-is-not-object.js @@ -0,0 +1,51 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.every +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var every = TypedArray.prototype.every; +var callbackfn = function() {}; + +assert.throws(TypeError, function() { + every.call(undefined, callbackfn); +}, "this is undefined"); + +assert.throws(TypeError, function() { + every.call(null, callbackfn); +}, "this is null"); + +assert.throws(TypeError, function() { + every.call(42, callbackfn); +}, "this is 42"); + +assert.throws(TypeError, function() { + every.call("1", callbackfn); +}, "this is a string"); + +assert.throws(TypeError, function() { + every.call(true, callbackfn); +}, "this is true"); + +assert.throws(TypeError, function() { + every.call(false, callbackfn); +}, "this is false"); + +var s = Symbol("s"); +assert.throws(TypeError, function() { + every.call(s, callbackfn); +}, "this is a Symbol"); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/every/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..21ff576b5 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.every +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var every = TypedArray.prototype.every; +var callbackfn = function() {}; + +assert.throws(TypeError, function() { + every.call({}, callbackfn); +}, "this is an Object"); + +assert.throws(TypeError, function() { + every.call([], callbackfn); +}, "this is an Array"); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + every.call(ab, callbackfn); +}, "this is an ArrayBuffer instance"); + +var dv = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + every.call(dv, callbackfn); +}, "this is a DataView instance"); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/every/BigInt/values-are-not-cached.js new file mode 100644 index 000000000..5be553d1d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/every/BigInt/values-are-not-cached.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.every +description: > + Integer indexed values are not cached before iteration +info: | + 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.every is a distinct function that implements the same + algorithm as Array.prototype.every as defined in 22.1.3.5 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg ] ) + + ... + 6. Repeat, while k < len + .. + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + + sample.every(function(v, i) { + if (i < sample.length - 1) { + sample[i+1] = convertToBigInt(42); + } + + assert.sameValue( + v, convertToBigInt(42), "method does not cache values before callbackfn calls" + ); + return true; + }); +}); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js b/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js new file mode 100644 index 000000000..9a53f55a4 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js @@ -0,0 +1,104 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.fill +es6id: 22.2.3.8 +description: > + Fills elements from coerced to Integer `start` and `end` values +info: | + 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + %TypedArray%.prototype.fill is a distinct function that implements the same + algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. However, such optimization + must not introduce any observable changes in the specified behaviour of the + algorithm. + + ... + + 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) + + ... + 3. Let relativeStart be ? ToInteger(start). + 4. If relativeStart < 0, let k be max((len + relativeStart), 0); else let k be + min(relativeStart, len). + 5. If end is undefined, let relativeEnd be len; else let relativeEnd be ? + ToInteger(end). + ... +includes: [compareArray.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert( + compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), undefined), convertToBigInt([1, 1])), + '`undefined` start coerced to 0' + ); + + assert( + compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 0, undefined), convertToBigInt([1, 1])), + 'If end is undefined, let relativeEnd be len' + ); + + assert( + compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), null), convertToBigInt([1, 1])), + '`null` start coerced to 0' + ); + + assert( + compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 0, null), convertToBigInt([0, 0])), + '`null` end coerced to 0' + ); + + assert( + compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), true), convertToBigInt([0, 1])), + '`true` start coerced to 1' + ); + + assert( + compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 0, true), convertToBigInt([1, 0])), + '`true` end coerced to 1' + ); + + assert( + compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), false), convertToBigInt([1, 1])), + '`false` start coerced to 0' + ); + + assert( + compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 0, false), convertToBigInt([0, 0])), + '`false` end coerced to 0' + ); + + assert( + compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), NaN), convertToBigInt([1, 1])), + '`NaN` start coerced to 0' + ); + + assert( + compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 0, NaN), convertToBigInt([0, 0])), + '`NaN` end coerced to 0' + ); + + assert( + compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), '1'), convertToBigInt([0, 1])), + 'string start coerced' + ); + + assert( + compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 0, '1'), convertToBigInt([1, 0])), + 'string end coerced' + ); + + assert( + compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 1.5), convertToBigInt([0, 1])), + 'start as a float number coerced' + ); + + assert( + compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 0, 1.5), convertToBigInt([1, 0])), + 'end as a float number coerced' + ); +}); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/fill/BigInt/detached-buffer.js new file mode 100644 index 000000000..96e7980ac --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/detached-buffer.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.fill +description: Throws a TypeError if this has a detached buffer +info: | + 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + ... + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +var obj = { + valueOf: function() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.fill(obj); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-once.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-once.js new file mode 100644 index 000000000..f26998f76 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-once.js @@ -0,0 +1,27 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.fill +description: > + Fills all the elements with non numeric values values. +info: | + 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + ... + 3. Let _value_ be ? ToNumber(_value_). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + + var n = 1; + sample.fill({ valueOf() { return convertToBigInt(n++); } }); + + assert.sameValue(n, 2, "additional unexpected ToNumber() calls"); + assert.sameValue(sample[0], convertToBigInt(1), "incorrect ToNumber result in index 0"); + assert.sameValue(sample[1], convertToBigInt(1), "incorrect ToNumber result in index 1"); +}); + diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations-consistent-nan.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations-consistent-nan.js new file mode 100644 index 000000000..827dc9344 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations-consistent-nan.js @@ -0,0 +1,70 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.fill +es6id: 22.2.3.8 +description: Consistent canonicalization of NaN values +info: | + 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + %TypedArray%.prototype.fill is a distinct function that implements the same + algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. However, such optimization + must not introduce any observable changes in the specified behaviour of the + algorithm. + + ... + + 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) + + ... + 7. Repeat, while k < final + a. Let Pk be ! ToString(k). + b. Perform ? Set(O, Pk, value, true). + ... + + 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , + isLittleEndian ] ) + + ... + 8. If type is "Float32", then + a. Set rawBytes to a List containing the 4 bytes that are the result + of converting value to IEEE 754-2008 binary32 format using “Round to + nearest, ties to even” rounding mode. If isLittleEndian is false, the + bytes are arranged in big endian order. Otherwise, the bytes are + arranged in little endian order. If value is NaN, rawValue may be set + to any implementation chosen IEEE 754-2008 binary64 format Not-a-Number + encoding. An implementation must always choose the same encoding for + each implementation distinguishable NaN value. + 9. Else, if type is "Float64", then + a. Set rawBytes to a List containing the 8 bytes that are the IEEE + 754-2008 binary64 format encoding of value. If isLittleEndian is false, + the bytes are arranged in big endian order. Otherwise, the bytes are + arranged in little endian order. If value is NaN, rawValue may be set + to any implementation chosen IEEE 754-2008 binary32 format Not-a-Number + encoding. An implementation must always choose the same encoding for + each implementation distinguishable NaN value. + ... +includes: [nans.js, testBigIntTypedArray.js, compareArray.js] +---*/ + +function body(FloatArray) { + var sample = new FloatArray(3); + var control, idx, someNaN, sampleBytes, controlBytes; + + for (idx = 0; idx < distinctNaNs.length; ++idx) { + someNaN = distinctNaNs[idx]; + control = new FloatArray([someNaN, someNaN, someNaN]); + + sample.fill(someNaN); + + sampleBytes = new Uint8Array(sample.buffer); + controlBytes = new Uint8Array(control.buffer); + assert(compareArray(sampleBytes, controlBytes), 'NaN value #' + idx); + } +} + +testWithBigIntTypedArrayConstructors(body, [Float32Array, Float64Array]); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations.js new file mode 100644 index 000000000..40e9e3fe9 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations.js @@ -0,0 +1,56 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.fill +es6id: 22.2.3.8 +description: > + Fills all the elements with non numeric values values. +info: | + 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + %TypedArray%.prototype.fill is a distinct function that implements the same + algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. However, such optimization + must not introduce any observable changes in the specified behaviour of the + algorithm. + + ... + + 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) + + ... + 7. Repeat, while k < final + a. Let Pk be ! ToString(k). + b. Perform ? Set(O, Pk, value, true). + ... + + 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , + isLittleEndian ] ) + + ... + 8. If type is "Float32", then + ... + 9. Else, if type is "Float64", then + ... + 10. Else, + ... + b. Let convOp be the abstract operation named in the Conversion Operation + column in Table 50 for Element Type type. + c. Let intValue be convOp(value). + d. If intValue ≥ 0, then + ... + e. Else, + ... +includes: [byteConversionValues.js, testBigIntTypedArray.js] +---*/ + +testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { + var sample = new TA([initial]); + + sample.fill(value); + + assert.sameValue(sample[0], expected, value + " converts to " + expected); +}); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js new file mode 100644 index 000000000..48602ea11 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.fill +es6id: 22.2.3.8 +description: > + Fills all the elements from a with a custom start and end indexes. +info: | + 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + %TypedArray%.prototype.fill is a distinct function that implements the same + algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. However, such optimization + must not introduce any observable changes in the specified behaviour of the + algorithm. + + ... + + 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) + + ... + 3. Let relativeStart be ? ToInteger(start). + 4. If relativeStart < 0, let k be max((len + relativeStart), 0); else let k be + min(relativeStart, len). + 5. If end is undefined, let relativeEnd be len; else let relativeEnd be ? + ToInteger(end). + 6. If relativeEnd < 0, let final be max((len + relativeEnd), 0); else let + final be min(relativeEnd, len). + ... +includes: [compareArray.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert(compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), 1, 2), convertToBigInt([0, 8, 0]))); + assert(compareArray(new TA(convertToBigInt([0, 0, 0, 0, 0])).fill(convertToBigInt(8), -3, 4), convertToBigInt([0, 0, 8, 8, 0]))); + assert(compareArray(new TA(convertToBigInt([0, 0, 0, 0, 0])).fill(convertToBigInt(8), -2, -1), convertToBigInt([0, 0, 0, 8, 0]))); + assert(compareArray(new TA(convertToBigInt([0, 0, 0, 0, 0])).fill(convertToBigInt(8), -1, -3), convertToBigInt([0, 0, 0, 0, 0]))); + assert(compareArray(new TA(convertToBigInt([0, 0, 0, 0, 0])).fill(convertToBigInt(8), 1, 3), convertToBigInt([0, 8, 8, 0, 0]))); +}); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js new file mode 100644 index 000000000..c4a97bfc9 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js @@ -0,0 +1,73 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.fill +es6id: 22.2.3.8 +description: > + Fills all the elements with non numeric values values. +info: | + 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + %TypedArray%.prototype.fill is a distinct function that implements the same + algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. However, such optimization + must not introduce any observable changes in the specified behaviour of the + algorithm. + + ... + + 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) + + ... + 7. Repeat, while k < final + a. Let Pk be ! ToString(k). + b. Perform ? Set(O, Pk, value, true). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 3. Let numValue be ? ToNumber(value). + ... + +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample; + + sample = new TA(convertToBigInt([42])); + sample.fill(false); + assert.sameValue(sample[0], convertToBigInt(0), "false => 0"); + + sample = new TA(convertToBigInt([42])); + sample.fill(true); + assert.sameValue(sample[0], convertToBigInt(1), "true => 1"); + + sample = new TA(convertToBigInt([42])); + sample.fill("7"); + assert.sameValue(sample[0], convertToBigInt(7), "string conversion"); + + sample = new TA(convertToBigInt([42])); + sample.fill({ + toString: function() { + return "1"; + }, + valueOf: function() { + return convertToBigInt(7); + } + }); + assert.sameValue(sample[0], convertToBigInt(7), "object valueOf conversion before toString"); + + sample = new TA(convertToBigInt([42])); + sample.fill({ + toString: function() { + return "7"; + } + }); + assert.sameValue(sample[0], convertToBigInt(7), "object toString when valueOf is absent"); +}); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js new file mode 100644 index 000000000..b5bbe59da --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.fill +es6id: 22.2.3.8 +description: > + Fills all the elements from a with a custom end index. +info: | + 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + %TypedArray%.prototype.fill is a distinct function that implements the same + algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. However, such optimization + must not introduce any observable changes in the specified behaviour of the + algorithm. + + ... + + 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) + + ... + 5. If end is undefined, let relativeEnd be len; else let relativeEnd be ? + ToInteger(end). + 6. If relativeEnd < 0, let final be max((len + relativeEnd), 0); else let + final be min(relativeEnd, len). + ... +includes: [compareArray.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert( + compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), 0, 1), convertToBigInt([8, 0, 0])), + "Fill elements from custom end position" + ); + + assert( + compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), 0, -1), convertToBigInt([8, 8, 0])), + "negative end sets final position to max((length + relativeEnd), 0)" + ); + + assert( + compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), 0, 5), convertToBigInt([8, 8, 8])), + "end position is never higher than of length" + ); + + assert( + compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), 0, -4), convertToBigInt([0, 0, 0])), + "end position is 0 when (len + relativeEnd) < 0" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js new file mode 100644 index 000000000..674cf1490 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js @@ -0,0 +1,51 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.fill +es6id: 22.2.3.8 +description: > + Fills all the elements from a with a custom start index. +info: | + 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + %TypedArray%.prototype.fill is a distinct function that implements the same + algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. However, such optimization + must not introduce any observable changes in the specified behaviour of the + algorithm. + + ... + + 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) + + ... + 4. If relativeStart < 0, let k be max((len + relativeStart), 0); else let k be + min(relativeStart, len). + ... +includes: [compareArray.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert( + compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), 1), convertToBigInt([0, 8, 8])), + "Fill elements from custom start position" + ); + + assert( + compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), 4), convertToBigInt([0, 0, 0])), + "start position is never higher than length" + ); + + assert( + compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), -1), convertToBigInt([0, 0, 8])), + "start < 0 sets initial position to max((len + relativeStart), 0)" + ); + + assert( + compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), -5), convertToBigInt([8, 8, 8])), + "start position is 0 when (len + relativeStart) < 0" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-symbol-throws.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-symbol-throws.js new file mode 100644 index 000000000..687db856d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-symbol-throws.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.fill +es6id: 22.2.3.8 +description: > + Throws a TypeError if value is a Symbol +info: | + 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + %TypedArray%.prototype.fill is a distinct function that implements the same + algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. However, such optimization + must not introduce any observable changes in the specified behaviour of the + algorithm. + + ... + + 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) + + ... + 7. Repeat, while k < final + a. Let Pk be ! ToString(k). + b. Perform ? Set(O, Pk, value, true). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 3. Let numValue be ? ToNumber(value). + ... + +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var s = Symbol('1'); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + + assert.throws(TypeError, function() { + sample.fill(s); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js new file mode 100644 index 000000000..83a2bbd7a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.fill +es6id: 22.2.3.8 +description: > + Fills all the elements with `value` from a default start and index. +info: | + 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + %TypedArray%.prototype.fill is a distinct function that implements the same + algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. However, such optimization + must not introduce any observable changes in the specified behaviour of the + algorithm. + + ... + + 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) + + ... + 7. Repeat, while k < final + a. Let Pk be ! ToString(k). + b. Perform ? Set(O, Pk, value, true). +includes: [compareArray.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert( + compareArray( + new TA().fill(convertToBigInt(8)), + [] + ), + "does not fill an empty instance" + ); + + assert( + compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8)), convertToBigInt([8, 8, 8])), + "Default start and end indexes are 0 and this.length" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/fill/BigInt/get-length-ignores-length-prop.js new file mode 100644 index 000000000..36ca60566 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/get-length-ignores-length-prop.js @@ -0,0 +1,52 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.fill +es6id: 22.2.3.8 +description: > + Unreachable abrupt from Get(O, "length") as [[ArrayLength]] is returned. +info: | + 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + %TypedArray%.prototype.fill is a distinct function that implements the same + algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. However, such optimization + must not introduce any observable changes in the specified behaviour of the + algorithm. + + ... + + 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) + + 1. Let O be ? ToObject(this value). + 2. Let len be ? ToLength(? Get(O, "length")). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +Object.defineProperty(TypedArray.prototype, "length", { + get: function() { + throw new Test262Error(); + } +}); + +testWithBigIntTypedArrayConstructors(function(TA) { + Object.defineProperty(TA.prototype, "length", { + get: function() { + throw new Test262Error(); + } + }); + + var sample = new TA(1); + Object.defineProperty(sample, "length", { + get: function() { + throw new Test262Error(); + } + }); + + assert.sameValue(sample.fill(convertToBigInt(1), 0), sample); +}); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-func.js new file mode 100644 index 000000000..363ba5180 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-func.js @@ -0,0 +1,29 @@ +// 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.3.8 +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var fill = TypedArray.prototype.fill; + +assert.sameValue(typeof fill, 'function'); + +assert.throws(TypeError, function() { + fill(); +}); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-method.js new file mode 100644 index 000000000..20dc89a17 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-method.js @@ -0,0 +1,29 @@ +// 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.3.8 +description: Requires a [[TypedArrayName]] internal slot. +info: | + 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.fill, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.fill(); +}); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/length.js b/test/built-ins/TypedArray/prototype/fill/BigInt/length.js new file mode 100644 index 000000000..17bf26159 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.8 +description: > + %TypedArray%.prototype.fill.length is 1. +info: | + %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.fill.length, 1); + +verifyNotEnumerable(TypedArray.prototype.fill, "length"); +verifyNotWritable(TypedArray.prototype.fill, "length"); +verifyConfigurable(TypedArray.prototype.fill, "length"); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/name.js b/test/built-ins/TypedArray/prototype/fill/BigInt/name.js new file mode 100644 index 000000000..99c9ec2b4 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.8 +description: > + %TypedArray%.prototype.fill.name is "fill". +info: | + %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.fill.name, "fill"); + +verifyNotEnumerable(TypedArray.prototype.fill, "name"); +verifyNotWritable(TypedArray.prototype.fill, "name"); +verifyConfigurable(TypedArray.prototype.fill, "name"); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/fill/BigInt/prop-desc.js new file mode 100644 index 000000000..b3f039205 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/prop-desc.js @@ -0,0 +1,18 @@ +// 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.3.8 +description: > + "fill" property of TypedArrayPrototype +info: | + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'fill'); +verifyWritable(TypedArrayPrototype, 'fill'); +verifyConfigurable(TypedArrayPrototype, 'fill'); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end-as-symbol.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end-as-symbol.js new file mode 100644 index 000000000..1ad1b898c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end-as-symbol.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.fill +es6id: 22.2.3.8 +description: > + Return abrupt if end is a Symbol. +info: | + 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + %TypedArray%.prototype.fill is a distinct function that implements the same + algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. However, such optimization + must not introduce any observable changes in the specified behaviour of the + algorithm. + + ... + + 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) + + ... + 5. If end is undefined, let relativeEnd be len; else let relativeEnd be ? + ToInteger(end). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var end = Symbol(1); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + assert.throws(TypeError, function() { + sample.fill(1, 0, end); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end.js new file mode 100644 index 000000000..3a2aa9285 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.fill +es6id: 22.2.3.8 +description: > + Return abrupt from ToInteger(end). +info: | + 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + %TypedArray%.prototype.fill is a distinct function that implements the same + algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. However, such optimization + must not introduce any observable changes in the specified behaviour of the + algorithm. + + ... + + 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) + + ... + 5. If end is undefined, let relativeEnd be len; else let relativeEnd be ? + ToInteger(end). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var end = { + valueOf: function() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + assert.throws(Test262Error, function() { + sample.fill(convertToBigInt(1), 0, end); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js new file mode 100644 index 000000000..5133dac24 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js @@ -0,0 +1,51 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.fill +es6id: 22.2.3.8 +description: > + Returns abrupt from value set +info: | + 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + %TypedArray%.prototype.fill is a distinct function that implements the same + algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. However, such optimization + must not introduce any observable changes in the specified behaviour of the + algorithm. + + ... + + 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) + + ... + 7. Repeat, while k < final + a. Let Pk be ! ToString(k). + b. Perform ? Set(O, Pk, value, true). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 3. Let numValue be ? ToNumber(value). + ... + +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42])); + var obj = { + valueOf: function() { + throw new Test262Error(); + } + }; + + assert.throws(Test262Error, function() { + sample.fill(obj); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start-as-symbol.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start-as-symbol.js new file mode 100644 index 000000000..69749d03c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start-as-symbol.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.fill +es6id: 22.2.3.8 +description: > + Return abrupt from ToInteger(start) as a Symbol. +info: | + 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + %TypedArray%.prototype.fill is a distinct function that implements the same + algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. However, such optimization + must not introduce any observable changes in the specified behaviour of the + algorithm. + + ... + + 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) + + ... + 3. Let relativeStart be ? ToInteger(start). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var start = Symbol(1); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + assert.throws(TypeError, function() { + sample.fill(1, start); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start.js new file mode 100644 index 000000000..37bed7f7a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.fill +es6id: 22.2.3.8 +description: > + Return abrupt from ToInteger(start). +info: | + 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + %TypedArray%.prototype.fill is a distinct function that implements the same + algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. However, such optimization + must not introduce any observable changes in the specified behaviour of the + algorithm. + + ... + + 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) + + ... + 3. Let relativeStart be ? ToInteger(start). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var start = { + valueOf: function() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + assert.throws(Test262Error, function() { + sample.fill(convertToBigInt(1), start); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-this.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-this.js new file mode 100644 index 000000000..b9b93eed4 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-this.js @@ -0,0 +1,21 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.fill +es6id: 22.2.3.8 +description: > + Returns `this`. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample1 = new TA(); + var result1 = sample1.fill(convertToBigInt(1)); + + assert.sameValue(result1, sample1); + + var sample2 = new TA(42); + var result2 = sample2.fill(convertToBigInt(7)); + assert.sameValue(result2, sample2); +}); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/fill/BigInt/this-is-not-object.js new file mode 100644 index 000000000..5846bbcae --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/this-is-not-object.js @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.fill +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var fill = TypedArray.prototype.fill; + +assert.throws(TypeError, function() { + fill.call(undefined, 0); +}, "this is undefined"); + +assert.throws(TypeError, function() { + fill.call(null, 0); +}, "this is null"); + +assert.throws(TypeError, function() { + fill.call(42, 0); +}, "this is 42"); + +assert.throws(TypeError, function() { + fill.call("1", 0); +}, "this is a string"); + +assert.throws(TypeError, function() { + fill.call(true, 0); +}, "this is true"); + +assert.throws(TypeError, function() { + fill.call(false, 0); +}, "this is false"); + +var s = Symbol("s"); +assert.throws(TypeError, function() { + fill.call(s, 0); +}, "this is a Symbol"); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/fill/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..8cb012108 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.fill +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var fill = TypedArray.prototype.fill; + +assert.throws(TypeError, function() { + fill.call({}, 0); +}, "this is an Object"); + +assert.throws(TypeError, function() { + fill.call([], 0); +}, "this is an Array"); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + fill.call(ab, 0); +}, "this is an ArrayBuffer instance"); + +var dv = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + fill.call(dv, 0); +}, "this is a DataView instance"); diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js b/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js index 0b935fd44..52b4e53c4 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js @@ -40,11 +40,9 @@ features: [TypedArray] testWithTypedArrayConstructors(function(TA, N) { var sample; - if (numericTypedArrayConstructors.includes(TA)) { - sample = new TA(N([42])); - sample.fill(null); - assert.sameValue(sample[0], 0, "null => 0"); - } + sample = new TA(N([42])); + sample.fill(null); + assert.sameValue(sample[0], 0, "null => 0"); sample = new TA(N([42])); sample.fill(false); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/arraylength-internal.js b/test/built-ins/TypedArray/prototype/filter/BigInt/arraylength-internal.js new file mode 100644 index 000000000..ecd36aa8a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/arraylength-internal.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: Uses internal ArrayLength instead of length property +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 3. Let len be the value of O's [[ArrayLength]] internal slot. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var getCalls = 0; +var desc = { + get: function getLen() { + getCalls++; + return 0; + } +}; + +Object.defineProperty(TypedArray.prototype, "length", desc); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(4); + var calls = 0; + + Object.defineProperty(TA.prototype, "length", desc); + Object.defineProperty(sample, "length", desc); + + sample.filter(function() { + calls++; + }); + + assert.sameValue(getCalls, 0, "ignores length properties"); + assert.sameValue(calls, 4, "interactions are not affected by custom length"); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-with-thisarg.js new file mode 100644 index 000000000..d0d796be5 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-with-thisarg.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + thisArg does not affect callbackfn arguments +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 9. Repeat, while k < len + ... + c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + + var results = []; + var thisArg = ["test262", 0, "ecma262", 0]; + + sample.filter(function() { + results.push(arguments); + }, thisArg); + + assert.sameValue(results.length, 3, "results.length"); + assert.sameValue(thisArg.length, 4, "thisArg.length"); + + assert.sameValue(results[0].length, 3, "results[0].length"); + assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue"); + assert.sameValue(results[0][1], 0, "results[0][1] - k"); + assert.sameValue(results[0][2], sample, "results[0][2] - this"); + + assert.sameValue(results[1].length, 3, "results[1].length"); + assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue"); + assert.sameValue(results[1][1], 1, "results[1][1] - k"); + assert.sameValue(results[1][2], sample, "results[1][2] - this"); + + assert.sameValue(results[2].length, 3, "results[2].length"); + assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue"); + assert.sameValue(results[2][1], 2, "results[2][1] - k"); + assert.sameValue(results[2][2], sample, "results[2][2] - this"); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-without-thisarg.js new file mode 100644 index 000000000..ca3e078d2 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-without-thisarg.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + callbackfn arguments +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 9. Repeat, while k < len + ... + c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + + var results = []; + + sample.filter(function() { + results.push(arguments); + }); + + assert.sameValue(results.length, 3, "results.length"); + + assert.sameValue(results[0].length, 3, "results[0].length"); + assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue"); + assert.sameValue(results[0][1], 0, "results[0][1] - k"); + assert.sameValue(results[0][2], sample, "results[0][2] - this"); + + assert.sameValue(results[1].length, 3, "results[1].length"); + assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue"); + assert.sameValue(results[1][1], 1, "results[1][1] - k"); + assert.sameValue(results[1][2], sample, "results[1][2] - this"); + + assert.sameValue(results[2].length, 3, "results[2].length"); + assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue"); + assert.sameValue(results[2][1], 2, "results[2][1] - k"); + assert.sameValue(results[2][2], sample, "results[2][2] - this"); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-called-before-ctor.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-called-before-ctor.js new file mode 100644 index 000000000..56c07c040 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-called-before-ctor.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: callbackfn is called for each item before TypedArraySpeciesCreate +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 9. Repeat, while k < len + ... + c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... + 10. Let A be ? TypedArraySpeciesCreate(O, « captured »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var length = 42; + var sample = new TA(length); + var calls = 0; + var before = false; + + sample.constructor = {}; + Object.defineProperty(sample, "constructor", { + get: function() { + before = calls === length; + } + }); + + sample.filter(function() { + calls++; + }); + + assert.sameValue(calls, 42, "callbackfn called for each item"); + assert.sameValue(before, true, "all callbackfn called before"); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-called-before-species.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-called-before-species.js new file mode 100644 index 000000000..e99e1b715 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-called-before-species.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: callbackfn is called for each item before TypedArraySpeciesCreate +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 9. Repeat, while k < len + ... + c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... + 10. Let A be ? TypedArraySpeciesCreate(O, « captured »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var length = 42; + var sample = new TA(length); + var calls = 0; + var before = false; + + sample.constructor = {}; + Object.defineProperty(sample.constructor, Symbol.species, { + get: function() { + before = calls === length; + } + }); + + sample.filter(function() { + calls++; + }); + + assert.sameValue(calls, 42, "callbackfn called for each item"); + assert.sameValue(before, true, "all callbackfn called before"); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js new file mode 100644 index 000000000..ff563cd3a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + Instance buffer can be detached during loop +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 9. Repeat, while k < len + ... + b. Let kValue be ? Get(O, Pk). + c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [detachArrayBuffer.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var loops = 0; + var sample = new TA(2); + + assert.throws(TypeError, function() { + sample.filter(function() { + if (loops === 1) { + throw new Test262Error("callbackfn called twice"); + } + $DETACHBUFFER(sample.buffer); + loops++; + }); + }); + + assert.sameValue(loops, 1); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-no-iteration-over-non-integer.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-no-iteration-over-non-integer.js new file mode 100644 index 000000000..b980efe72 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-no-iteration-over-non-integer.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + Does not iterate over non-integer properties +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 9. Repeat, while k < len + ... + c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([7, 8])); + + var results = []; + + sample.foo = 42; + sample[Symbol("1")] = 43; + + sample.filter(function() { + results.push(arguments); + }); + + assert.sameValue(results.length, 2, "results.length"); + + assert.sameValue(results[0][1], 0, "results[0][1] - k"); + assert.sameValue(results[1][1], 1, "results[1][1] - k"); + + assert.sameValue(results[0][0], convertToBigInt(7), "results[0][0] - kValue"); + assert.sameValue(results[1][0], convertToBigInt(8), "results[1][0] - kValue"); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-not-callable-throws.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-not-callable-throws.js new file mode 100644 index 000000000..6d2c4a71a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-not-callable-throws.js @@ -0,0 +1,58 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: Throws TypeError if callbackfn is not callable +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 4. If IsCallable(callbackfn) is false, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(4); + + assert.throws(TypeError, function() { + sample.filter(); + }, "no arg"); + + assert.throws(TypeError, function() { + sample.filter(undefined); + }, "undefined"); + + assert.throws(TypeError, function() { + sample.filter(null); + }, "null"); + + assert.throws(TypeError, function() { + sample.filter(true); + }, "true"); + + assert.throws(TypeError, function() { + sample.filter(false); + }, "false"); + + assert.throws(TypeError, function() { + sample.filter({}); + }, "{}"); + + assert.throws(TypeError, function() { + sample.filter([]); + }, "[]"); + + assert.throws(TypeError, function() { + sample.filter(1); + }, "Number"); + + assert.throws(TypeError, function() { + sample.filter(Symbol("")); + }, "symbol"); + + assert.throws(TypeError, function() { + sample.filter(""); + }, "string"); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-not-called-on-empty.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-not-called-on-empty.js new file mode 100644 index 000000000..47cc032e0 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-not-called-on-empty.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + callbackfn is not called on empty instances +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 9. Repeat, while k < len + ... + c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var called = 0; + + new TA().filter(function() { + called++; + }); + + assert.sameValue(called, 0); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-return-does-not-change-instance.js new file mode 100644 index 000000000..4bac77886 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-return-does-not-change-instance.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + The callbackfn return does not change the instance +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample1 = new TA(3); + + sample1[1] = convertToBigInt(1); + + sample1.filter(function() { + return 42; + }); + + assert.sameValue(sample1[0], convertToBigInt(0), "[0] == 0"); + assert.sameValue(sample1[1], convertToBigInt(1), "[1] == 1"); + assert.sameValue(sample1[2], convertToBigInt(0), "[2] == 0"); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-returns-abrupt.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-returns-abrupt.js new file mode 100644 index 000000000..411b5ef8c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-returns-abrupt.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + Returns abrupt from callbackfn +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 9. Repeat, while k < len + ... + c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(3); + + assert.throws(Test262Error, function() { + sample.filter(function() { + throw new Test262Error(); + }); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-set-value-during-iteration.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-set-value-during-iteration.js new file mode 100644 index 000000000..a4e86b427 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-set-value-during-iteration.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + Integer indexed values changed during iteration +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 9. Repeat, while k < len + ... + c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect.set, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + var newVal = 0; + + sample.filter(function(val, i) { + if (i > 0) { + assert.sameValue( + sample[i - 1], convertToBigInt(newVal - 1), + "get the changed value during the loop" + ); + assert.sameValue( + Reflect.set(sample, 0, convertToBigInt(7)), + true, + "re-set a value for sample[0]" + ); + } + assert.sameValue( + Reflect.set(sample, i, convertToBigInt(newVal)), + true, + "set value during interaction" + ); + + newVal++; + }); + + assert.sameValue(sample[0], convertToBigInt(7), "changed values after interaction [0] == 7"); + assert.sameValue(sample[1], convertToBigInt(1), "changed values after interaction [1] == 1"); + assert.sameValue(sample[2], convertToBigInt(2), "changed values after interaction [2] == 2"); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-this.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-this.js new file mode 100644 index 000000000..fc7e0bccb --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-this.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + callbackfn `this` value +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 5. If thisArg was supplied, let T be thisArg; else let T be undefined. + ... + 9. Repeat, while k < len + ... + c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var expected = (function() { return this; })(); +var thisArg = {}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(3); + + var results1 = []; + + sample.filter(function() { + results1.push(this); + }); + + assert.sameValue(results1.length, 3, "results1"); + assert.sameValue(results1[0], expected, "without thisArg - [0]"); + assert.sameValue(results1[1], expected, "without thisArg - [1]"); + assert.sameValue(results1[2], expected, "without thisArg - [2]"); + + var results2 = []; + + sample.filter(function() { + results2.push(this); + }, thisArg); + + assert.sameValue(results2.length, 3, "results2"); + assert.sameValue(results2[0], thisArg, "using thisArg - [0]"); + assert.sameValue(results2[1], thisArg, "using thisArg - [1]"); + assert.sameValue(results2[2], thisArg, "using thisArg - [2]"); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/filter/BigInt/detached-buffer.js new file mode 100644 index 000000000..19539b599 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/detached-buffer.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: Throws a TypeError if this has a detached buffer +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + ... + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +var callbackfn = function() { + throw new Test262Error(); +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.filter(callbackfn); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-func.js new file mode 100644 index 000000000..86c878c88 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-func.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. +/*--- +es6id: 22.2.3.9 +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + 1. Let O be the this value. + 2. Let valid be ValidateTypedArray(O). + 3. ReturnIfAbrupt(valid). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var filter = TypedArray.prototype.filter; + +assert.sameValue(typeof filter, 'function'); + +assert.throws(TypeError, function() { + filter(); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-method.js new file mode 100644 index 000000000..0c70719e1 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-method.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. +/*--- +es6id: 22.2.3.9 +description: Requires a [[TypedArrayName]] internal slot. +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + 1. Let O be the this value. + 2. Let valid be ValidateTypedArray(O). + 3. ReturnIfAbrupt(valid). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.filter, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.filter(); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/length.js b/test/built-ins/TypedArray/prototype/filter/BigInt/length.js new file mode 100644 index 000000000..2b5d020a3 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.9 +description: > + %TypedArray%.prototype.filter.length is 1. +info: | + %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.filter.length, 1); + +verifyNotEnumerable(TypedArray.prototype.filter, "length"); +verifyNotWritable(TypedArray.prototype.filter, "length"); +verifyConfigurable(TypedArray.prototype.filter, "length"); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/name.js b/test/built-ins/TypedArray/prototype/filter/BigInt/name.js new file mode 100644 index 000000000..f582e69dd --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.9 +description: > + %TypedArray%.prototype.filter.name is "filter". +info: | + %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.filter.name, "filter"); + +verifyNotEnumerable(TypedArray.prototype.filter, "name"); +verifyNotWritable(TypedArray.prototype.filter, "name"); +verifyConfigurable(TypedArray.prototype.filter, "name"); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/filter/BigInt/prop-desc.js new file mode 100644 index 000000000..898755704 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/prop-desc.js @@ -0,0 +1,18 @@ +// 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.3.9 +description: > + "filter" property of TypedArrayPrototype +info: | + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'filter'); +verifyWritable(TypedArrayPrototype, 'filter'); +verifyConfigurable(TypedArrayPrototype, 'filter'); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/result-does-not-share-buffer.js b/test/built-ins/TypedArray/prototype/filter/BigInt/result-does-not-share-buffer.js new file mode 100644 index 000000000..1a84196dc --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/result-does-not-share-buffer.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + Return does not share buffer +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 10. Let A be ? TypedArraySpeciesCreate(O, « captured »). + ... + 13. Return A. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42])); + var result; + + result = sample.filter(function() { return true; }); + assert.notSameValue(result.buffer, sample.buffer); + + result = sample.filter(function() { return false; }); + assert.notSameValue(result.buffer, sample.buffer); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/result-empty-callbackfn-returns-false.js b/test/built-ins/TypedArray/prototype/filter/BigInt/result-empty-callbackfn-returns-false.js new file mode 100644 index 000000000..34058a260 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/result-empty-callbackfn-returns-false.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + Returns empty if every callbackfn returns boolean false +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 12. For each element e of kept + a. Perform ! Set(A, ! ToString(n), e, true). + b. Increment n by 1. + 13. Return A. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(3); + + [ + false, + "", + 0, + -0, + NaN, + undefined, + null + ].forEach(function(val) { + var result = sample.filter(function() { + return val; + }); + assert.sameValue(result.length, 0, val); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/result-full-callbackfn-returns-true.js b/test/built-ins/TypedArray/prototype/filter/BigInt/result-full-callbackfn-returns-true.js new file mode 100644 index 000000000..d63ba8691 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/result-full-callbackfn-returns-true.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + Returns full length result if every callbackfn returns boolean false +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 12. For each element e of kept + a. Perform ! Set(A, ! ToString(n), e, true). + b. Increment n by 1. + 13. Return A. +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42])); + + [ + true, + 1, + "test262", + Symbol("1"), + {}, + [], + -1, + Infinity, + -Infinity, + 0.1, + -0.1 + ].forEach(function(val) { + var result = sample.filter(function() { return val; }); + assert(compareArray(result, sample), val); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-abrupt.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-abrupt.js new file mode 100644 index 000000000..9b7bc9dfc --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-abrupt.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: Return abrupt from SpeciesConstructor's get Constructor +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 10. Let A be ? TypedArraySpeciesCreate(O, « captured »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + 1. Assert: Type(O) is Object. + 2. Let C be ? Get(O, "constructor"). + 3. If C is undefined, return defaultConstructor. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + + Object.defineProperty(sample, "constructor", { + get: function() { + throw new Test262Error(); + } + }); + + assert.throws(Test262Error, function() { + sample.filter(function() { + return true; + }); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-inherited.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-inherited.js new file mode 100644 index 000000000..35fe965b0 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-inherited.js @@ -0,0 +1,64 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: get inherited constructor on SpeciesConstructor +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 10. Let A be ? TypedArraySpeciesCreate(O, « captured »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + 1. Assert: Type(O) is Object. + 2. Let C be ? Get(O, "constructor"). + 3. If C is undefined, return defaultConstructor. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var calls = 0; + var result; + + Object.defineProperty(TA.prototype, "constructor", { + get: function() { + calls++; + } + }); + + result = sample.filter(function() { + return true; + }); + + assert.sameValue(calls, 1, "called custom ctor get accessor once"); + + assert.sameValue( + Object.getPrototypeOf(result), + Object.getPrototypeOf(sample), + "use defaultCtor on an undefined return - getPrototypeOf check" + ); + assert.sameValue( + result.constructor, + undefined, + "used defaultCtor but still checks the inherited .constructor" + ); + + calls = 6; + result.constructor; + assert.sameValue( + calls, + 7, + "result.constructor triggers the inherited accessor property" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-returns-throws.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-returns-throws.js new file mode 100644 index 000000000..79e40b47c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-returns-throws.js @@ -0,0 +1,65 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + Throws if O.constructor returns a non-Object and non-undefined value +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 10. Let A be ? TypedArraySpeciesCreate(O, « captured »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + 1. Assert: Type(O) is Object. + 2. Let C be ? Get(O, "constructor"). + 3. If C is undefined, return defaultConstructor. + 4. If Type(C) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var callbackfn = function() { return true; }; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + + sample.constructor = 42; + assert.throws(TypeError, function() { + sample.filter(callbackfn); + }, "42"); + + sample.constructor = "1"; + assert.throws(TypeError, function() { + sample.filter(callbackfn); + }, "string"); + + sample.constructor = null; + assert.throws(TypeError, function() { + sample.filter(callbackfn); + }, "null"); + + sample.constructor = NaN; + assert.throws(TypeError, function() { + sample.filter(callbackfn); + }, "NaN"); + + sample.constructor = false; + assert.throws(TypeError, function() { + sample.filter(callbackfn); + }, "false"); + + sample.constructor = Symbol("1"); + assert.throws(TypeError, function() { + sample.filter(callbackfn); + }, "symbol"); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor.js new file mode 100644 index 000000000..0b64ac3ca --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor.js @@ -0,0 +1,54 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: get constructor on SpeciesConstructor +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 10. Let A be ? TypedArraySpeciesCreate(O, « captured »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + 1. Assert: Type(O) is Object. + 2. Let C be ? Get(O, "constructor"). + 3. If C is undefined, return defaultConstructor. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var calls = 0; + var result; + + Object.defineProperty(sample, "constructor", { + get: function() { + calls++; + } + }); + + result = sample.filter(function() { return true; }); + + assert.sameValue(calls, 1, "called custom ctor get accessor once"); + + assert.sameValue( + Object.getPrototypeOf(result), + Object.getPrototypeOf(sample), + "use defaultCtor on an undefined return - getPrototypeOf check" + ); + assert.sameValue( + result.constructor, + TA, + "use defaultCtor on an undefined return - .constructor check" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-abrupt.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-abrupt.js new file mode 100644 index 000000000..eb585beb7 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-abrupt.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + Returns abrupt from get @@species on found constructor +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 10. Let A be ? TypedArraySpeciesCreate(O, « captured »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + 1. Assert: Type(O) is Object. + 2. Let C be ? Get(O, "constructor"). + ... + 5. Let S be ? Get(C, @@species). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + + sample.constructor = {}; + + Object.defineProperty(sample.constructor, Symbol.species, { + get: function() { + throw new Test262Error(); + } + }); + + assert.throws(Test262Error, function() { + sample.filter(function() { return true; }); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-invocation.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-invocation.js new file mode 100644 index 000000000..1efefe1be --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-invocation.js @@ -0,0 +1,59 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + Verify arguments on custom @@species construct call +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 10. Let A be ? TypedArraySpeciesCreate(O, « captured »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + 4. Return ? TypedArrayCreate(constructor, argumentList). + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + ... + 7. If IsConstructor(S) is true, return S. + ... + + 22.2.4.6 TypedArrayCreate ( constructor, argumentList ) + + 1. Let newTypedArray be ? Construct(constructor, argumentList). + 2. Perform ? ValidateTypedArray(newTypedArray). + 3. If argumentList is a List of a single Number, then + ... + 4. Return newTypedArray. +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 42, 42])); + var result, ctorThis; + + sample.constructor = {}; + sample.constructor[Symbol.species] = function(count) { + result = arguments; + ctorThis = this; + return new TA(count); + }; + + sample.filter(function(v) { return v === convertToBigInt(42); }); + + assert.sameValue(result.length, 1, "called with 1 argument"); + assert.sameValue(result[0], 2, "[0] is the new captured length"); + + assert( + ctorThis instanceof sample.constructor[Symbol.species], + "`this` value in the @@species fn is an instance of the function itself" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-length-throws.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-length-throws.js new file mode 100644 index 000000000..80b0ea9f9 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-length-throws.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + Throws a TypeError if new typedArray's length < captured +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 10. Let A be ? TypedArraySpeciesCreate(O, « captured »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 4. Return ? TypedArrayCreate(constructor, argumentList). + + 22.2.4.6 TypedArrayCreate ( constructor, argumentList ) + + ... + 3. If argumentList is a List of a single Number, then + a. If the value of newTypedArray's [[ArrayLength]] internal slot < + argumentList[0], throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + + sample.constructor = {}; + sample.constructor[Symbol.species] = function() { + return new TA(); + }; + + assert.throws(TypeError, function() { + sample.filter(function() { return true; }); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-length.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-length.js new file mode 100644 index 000000000..38af74b53 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-length.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + Does not throw a TypeError if new typedArray's length >= captured +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 10. Let A be ? TypedArraySpeciesCreate(O, « captured »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 4. Return ? TypedArrayCreate(constructor, argumentList). + + 22.2.4.6 TypedArrayCreate ( constructor, argumentList ) + + ... + 3. If argumentList is a List of a single Number, then + a. If the value of newTypedArray's [[ArrayLength]] internal slot < + argumentList[0], throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + var customCount, result; + + sample.constructor = {}; + sample.constructor[Symbol.species] = function() { + return new TA(customCount); + }; + + customCount = 2; + result = sample.filter(function() { return true; }); + assert.sameValue(result.length, customCount, "length == count"); + + customCount = 5; + result = sample.filter(function() { return true; }); + assert.sameValue(result.length, customCount, "length > count"); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js new file mode 100644 index 000000000..31f2887b3 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js @@ -0,0 +1,54 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + Custom @@species constructor may return a different TypedArray +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 10. Let A be ? TypedArraySpeciesCreate(O, « captured »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + 4. Return ? TypedArrayCreate(constructor, argumentList). + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + ... + 7. If IsConstructor(S) is true, return S. + ... + + 22.2.4.6 TypedArrayCreate ( constructor, argumentList ) + + 1. Let newTypedArray be ? Construct(constructor, argumentList). + 2. Perform ? ValidateTypedArray(newTypedArray). + 3. If argumentList is a List of a single Number, then + ... + 4. Return newTypedArray. +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40])); + var otherTA = TA === Int8Array ? Int16Array : Int8Array; + var other = new otherTA([1, 0, 1]); + var result; + + sample.constructor = {}; + sample.constructor[Symbol.species] = function() { + return other; + }; + + result = sample.filter(function() {}); + + assert.sameValue(result, other, "returned another typedarray"); + assert(compareArray(result, [1, 0, 1]), "the returned object is preserved"); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-throws.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-throws.js new file mode 100644 index 000000000..ae5d33183 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-throws.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + Custom @@species constructor throws if it does not return a compatible object +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 10. Let A be ? TypedArraySpeciesCreate(O, « captured »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + 4. Return ? TypedArrayCreate(constructor, argumentList). + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + ... + 7. If IsConstructor(S) is true, return S. + ... + + 22.2.4.6 TypedArrayCreate ( constructor, argumentList ) + + 1. Let newTypedArray be ? Construct(constructor, argumentList). + 2. Perform ? ValidateTypedArray(newTypedArray). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + + sample.constructor = {}; + sample.constructor[Symbol.species] = Array; + + assert.throws(TypeError, function() { + sample.filter(function() {}); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor.js new file mode 100644 index 000000000..f881f792d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor.js @@ -0,0 +1,56 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + Use custom @@species constructor if available +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 10. Let A be ? TypedArraySpeciesCreate(O, « captured »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + 4. Return ? TypedArrayCreate(constructor, argumentList). + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + ... + 7. If IsConstructor(S) is true, return S. + ... + + 22.2.4.6 TypedArrayCreate ( constructor, argumentList ) + + 1. Let newTypedArray be ? Construct(constructor, argumentList). + 2. Perform ? ValidateTypedArray(newTypedArray). + 3. If argumentList is a List of a single Number, then + ... + 4. Return newTypedArray. +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42])); + var calls = 0; + var other, result; + + sample.constructor = {}; + sample.constructor[Symbol.species] = function(captured) { + calls++; + other = new TA(captured); + return other; + }; + + result = sample.filter(function() { return true; }); + + assert.sameValue(calls, 1, "ctor called once"); + assert.sameValue(result, other, "return is instance of custom constructor"); + assert(compareArray(result, convertToBigInt([40, 41, 42])), "values are set on the new obj"); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-returns-throws.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-returns-throws.js new file mode 100644 index 000000000..12a76cdda --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-returns-throws.js @@ -0,0 +1,66 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + Throws if returned @@species is not a constructor, null or undefined. +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 10. Let A be ? TypedArraySpeciesCreate(O, « captured »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + 7. If IsConstructor(S) is true, return S. + 8. Throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + + sample.constructor = {}; + + sample.constructor[Symbol.species] = 0; + assert.throws(TypeError, function() { + sample.filter(function() {}); + }, "0"); + + sample.constructor[Symbol.species] = "string"; + assert.throws(TypeError, function() { + sample.filter(function() {}); + }, "string"); + + sample.constructor[Symbol.species] = {}; + assert.throws(TypeError, function() { + sample.filter(function() {}); + }, "{}"); + + sample.constructor[Symbol.species] = NaN; + assert.throws(TypeError, function() { + sample.filter(function() {}); + }, "NaN"); + + sample.constructor[Symbol.species] = false; + assert.throws(TypeError, function() { + sample.filter(function() {}); + }, "false"); + + sample.constructor[Symbol.species] = true; + assert.throws(TypeError, function() { + sample.filter(function() {}); + }, "true"); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-use-default-ctor.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-use-default-ctor.js new file mode 100644 index 000000000..9ecb72b05 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-use-default-ctor.js @@ -0,0 +1,54 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + Use defaultConstructor if @@species is either undefined or null +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 10. Let A be ? TypedArraySpeciesCreate(O, « captured »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + var result; + + sample.constructor = {}; + + result = sample.filter(function() {}); + + assert.sameValue( + Object.getPrototypeOf(result), + Object.getPrototypeOf(sample), + "undefined @@species - prototype check " + ); + assert.sameValue(result.constructor, TA, "undefined @@species - ctor check"); + + sample.constructor[Symbol.species] = null; + result = sample.filter(function() {}); + + assert.sameValue( + Object.getPrototypeOf(result), + Object.getPrototypeOf(sample), + "null @@species - prototype check " + ); + assert.sameValue(result.constructor, TA, "null @@species - ctor check"); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species.js new file mode 100644 index 000000000..04e413a38 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + get @@species from found constructor +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 10. Let A be ? TypedArraySpeciesCreate(O, « captured »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + 1. Assert: Type(O) is Object. + 2. Let C be ? Get(O, "constructor"). + ... + 5. Let S be ? Get(C, @@species). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + var calls = 0; + + sample.constructor = {}; + + Object.defineProperty(sample.constructor, Symbol.species, { + get: function() { + calls++; + } + }); + + sample.filter(function() {}); + + assert.sameValue(calls, 1); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/filter/BigInt/this-is-not-object.js new file mode 100644 index 000000000..0a8a31a27 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/this-is-not-object.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + The following steps are taken: + + 1. Let O be the this value. + 2. Perform ? ValidateTypedArray(O). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var filter = TypedArray.prototype.filter; +var callbackfn = function() {}; + +assert.throws(TypeError, function() { + filter.call(undefined, callbackfn); +}, "this is undefined"); + +assert.throws(TypeError, function() { + filter.call(null, callbackfn); +}, "this is null"); + +assert.throws(TypeError, function() { + filter.call(42, callbackfn); +}, "this is 42"); + +assert.throws(TypeError, function() { + filter.call("1", callbackfn); +}, "this is a string"); + +assert.throws(TypeError, function() { + filter.call(true, callbackfn); +}, "this is true"); + +assert.throws(TypeError, function() { + filter.call(false, callbackfn); +}, "this is false"); + +var s = Symbol("s"); +assert.throws(TypeError, function() { + filter.call(s, callbackfn); +}, "this is a Symbol"); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/filter/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..4bb60e605 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + The following steps are taken: + + 1. Let O be the this value. + 2. Perform ? ValidateTypedArray(O). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var filter = TypedArray.prototype.filter; +var callbackfn = function() {}; + +assert.throws(TypeError, function() { + filter.call({}, callbackfn); +}, "this is an Object"); + +assert.throws(TypeError, function() { + filter.call([], callbackfn); +}, "this is an Array"); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + filter.call(ab, callbackfn); +}, "this is an ArrayBuffer instance"); + +var dv = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + filter.call(dv, callbackfn); +}, "this is a DataView instance"); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-not-cached.js new file mode 100644 index 000000000..25b7eb24a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-not-cached.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + Integer indexed values are not cached before interaction +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 9. Repeat, while k < len + ... + c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + + sample.filter(function(v, i) { + if (i < sample.length - 1) { + sample[i+1] = convertToBigInt(42); + } + + assert.sameValue( + v, convertToBigInt(42), "method does not cache values before callbackfn calls" + ); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-set.js b/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-set.js new file mode 100644 index 000000000..b7f2775f2 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-set.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. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + Returned instance with filtered values set on it +info: | + 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) + + ... + 12. For each element e of kept + a. Perform ! Set(A, ! ToString(n), e, true). + b. Increment n by 1. + 13. Return A. +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([41, 1, 42, 7])); + var result; + + result = sample.filter(function() { return true; }); + assert(compareArray(result, convertToBigInt([41, 1, 42, 7])), "values are set #1"); + + result = sample.filter(function(v) { + return v > convertToBigInt(40); + }); + assert(compareArray(result, convertToBigInt([41, 42])), "values are set #2"); +}); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/find/BigInt/detached-buffer.js new file mode 100644 index 000000000..f3cfaeb3e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/find/BigInt/detached-buffer.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.find +description: Throws a TypeError if this has a detached buffer +info: | + 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + ... + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +var predicate = function() { + throw new Test262Error(); +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.find(predicate); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/find/BigInt/get-length-ignores-length-prop.js new file mode 100644 index 000000000..790de25db --- /dev/null +++ b/test/built-ins/TypedArray/prototype/find/BigInt/get-length-ignores-length-prop.js @@ -0,0 +1,55 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.find +es6id: 22.2.3.10 +description: > + [[Get]] of "length" uses [[ArrayLength]] +info: | + 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] ) + + %TypedArray%.prototype.find is a distinct function that implements the same + algorithm as Array.prototype.find as defined in 22.1.3.8 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. + + ... + + 22.1.3.8 Array.prototype.find ( predicate[ , thisArg ] ) + + ... + 2. Let len be ? ToLength(? Get(O, "length")). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +Object.defineProperty(TypedArray.prototype, "length", { + get: function() { + throw new Test262Error(); + } +}); + +testWithBigIntTypedArrayConstructors(function(TA) { + Object.defineProperty(TA.prototype, "length", { + get: function() { + throw new Test262Error(); + } + }); + + var sample = new TA(convertToBigInt([42])); + + Object.defineProperty(sample, "length", { + get: function() { + throw new Test262Error(); + }, + configurable: true + }); + + assert.sameValue( + sample.find(function() { return true; }), + convertToBigInt(42) + ); +}); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-func.js new file mode 100644 index 000000000..eea7537b2 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-func.js @@ -0,0 +1,29 @@ +// 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.3.10 +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var find = TypedArray.prototype.find; + +assert.sameValue(typeof find, 'function'); + +assert.throws(TypeError, function() { + find(); +}); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-method.js new file mode 100644 index 000000000..ed0d1a9a2 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-method.js @@ -0,0 +1,29 @@ +// 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.3.10 +description: Requires a [[TypedArrayName]] internal slot. +info: | + 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.find, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.find(); +}); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/length.js b/test/built-ins/TypedArray/prototype/find/BigInt/length.js new file mode 100644 index 000000000..e61e1c21e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/find/BigInt/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.10 +description: > + %TypedArray%.prototype.find.length is 1. +info: | + %TypedArray%.prototype.find (predicate [ , thisArg ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.find.length, 1); + +verifyNotEnumerable(TypedArray.prototype.find, "length"); +verifyNotWritable(TypedArray.prototype.find, "length"); +verifyConfigurable(TypedArray.prototype.find, "length"); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/name.js b/test/built-ins/TypedArray/prototype/find/BigInt/name.js new file mode 100644 index 000000000..ab18751c2 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/find/BigInt/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.10 +description: > + %TypedArray%.prototype.find.name is "find". +info: | + %TypedArray%.prototype.find (predicate [ , thisArg ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.find.name, "find"); + +verifyNotEnumerable(TypedArray.prototype.find, "name"); +verifyNotWritable(TypedArray.prototype.find, "name"); +verifyConfigurable(TypedArray.prototype.find, "name"); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js new file mode 100644 index 000000000..6ed966f70 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js @@ -0,0 +1,78 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.find +es6id: 22.2.3.10 +description: > + Change values during predicate call +info: | + 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] ) + + %TypedArray%.prototype.find is a distinct function that implements the same + algorithm as Array.prototype.find as defined in 22.1.3.8 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. + + ... + + 22.1.3.8 Array.prototype.find ( predicate[ , thisArg ] ) + + ... + 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + 5. Let k be 0. + 6. Repeat, while k < len + ... + c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + ... +includes: [compareArray.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var arr = convertToBigInt([1, 2, 3]); + var sample; + var result; + + sample = new TA(3); + sample.find(function(val, i) { + sample[i] = arr[i]; + + assert.sameValue(val, convertToBigInt(0), "value is not mapped to instance"); + }); + assert(compareArray(sample, arr), "values set during each predicate call"); + + sample = new TA(arr); + result = sample.find(function(val, i) { + if ( i === 0 ) { + sample[2] = convertToBigInt(7); + } + return val === convertToBigInt(7); + }); + assert.sameValue(result, convertToBigInt(7), "value found"); + + sample = new TA(arr); + result = sample.find(function(val, i) { + if ( i === 0 ) { + sample[2] = convertToBigInt(7); + } + return val === convertToBigInt(3); + }); + assert.sameValue(result, undefined, "value not found"); + + sample = new TA(arr); + result = sample.find(function(val, i) { + if ( i > 0 ) { + sample[0] = convertToBigInt(7); + } + return val === convertToBigInt(7); + }); + assert.sameValue(result, undefined, "value not found - changed after call"); + + sample = new TA(arr); + result = sample.find(function() { + sample[0] = convertToBigInt(7); + return true; + }); + assert.sameValue(result, convertToBigInt(1), "find() returns previous found value"); +}); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-parameters.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-parameters.js new file mode 100644 index 000000000..fd69894e6 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-parameters.js @@ -0,0 +1,63 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.find +es6id: 22.2.3.10 +description: > + Predicate called as F.call( thisArg, kValue, k, O ) for each array entry. +info: | + 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] ) + + %TypedArray%.prototype.find is a distinct function that implements the same + algorithm as Array.prototype.find as defined in 22.1.3.8 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. + + ... + + 22.1.3.8 Array.prototype.find ( predicate[ , thisArg ] ) + + ... + 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + 5. Let k be 0. + 6. Repeat, while k < len + ... + c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([39, 2, 62])); + var results = []; + var result; + + sample.foo = "bar"; // Ignores non integer index properties + + sample.find(function() { + results.push(arguments); + }); + + assert.sameValue(results.length, 3, "predicate is called for each index"); + + result = results[0]; + assert.sameValue(result[0], convertToBigInt(39), "results[0][0] === 39, value"); + assert.sameValue(result[1], 0, "results[0][1] === 0, index"); + assert.sameValue(result[2], sample, "results[0][2] === sample, instance"); + assert.sameValue(result.length, 3, "results[0].length === 3 arguments"); + + result = results[1]; + assert.sameValue(result[0], convertToBigInt(2), "results[1][0] === 2, value"); + assert.sameValue(result[1], 1, "results[1][1] === 1, index"); + assert.sameValue(result[2], sample, "results[1][2] === sample, instance"); + assert.sameValue(result.length, 3, "results[1].length === 3 arguments"); + + result = results[2]; + assert.sameValue(result[0], convertToBigInt(62), "results[2][0] === 62, value"); + assert.sameValue(result[1], 2, "results[2][1] === 2, index"); + assert.sameValue(result[2], sample, "results[2][2] === sample, instance"); + assert.sameValue(result.length, 3, "results[2].length === 3 arguments"); +}); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-non-strict.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-non-strict.js new file mode 100644 index 000000000..538bd26ac --- /dev/null +++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-non-strict.js @@ -0,0 +1,60 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.find +es6id: 22.2.3.10 +description: > + Verify predicate this on non-strict mode +info: | + 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] ) + + %TypedArray%.prototype.find is a distinct function that implements the same + algorithm as Array.prototype.find as defined in 22.1.3.8 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. + + ... + + 22.1.3.8 Array.prototype.find ( predicate[ , thisArg ] ) + + ... + 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + ... + 6. Repeat, while k < len + ... + c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + ... +flags: [noStrict] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var T = this; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + var result; + + sample.find(function() { + result = this; + }); + + assert.sameValue(result, T, "without thisArg, predicate this is the global"); + + result = null; + sample.find(function() { + result = this; + }, undefined); + + assert.sameValue(result, T, "predicate this is the global when thisArg is undefined"); + + var o = {}; + result = null; + sample.find(function() { + result = this; + }, o); + + assert.sameValue(result, o, "thisArg becomes the predicate this"); +}); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-strict.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-strict.js new file mode 100644 index 000000000..414440969 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-strict.js @@ -0,0 +1,54 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.find +es6id: 22.2.3.10 +description: > + Verify predicate this on strict mode +info: | + 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] ) + + %TypedArray%.prototype.find is a distinct function that implements the same + algorithm as Array.prototype.find as defined in 22.1.3.8 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. + + ... + + 22.1.3.8 Array.prototype.find ( predicate[ , thisArg ] ) + + ... + 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + ... + 6. Repeat, while k < len + ... + c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + ... +flags: [onlyStrict] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + var result; + + sample.find(function() { + result = this; + }); + + assert.sameValue( + result, + undefined, + "without thisArg, predicate this is undefined" + ); + + var o = {}; + sample.find(function() { + result = this; + }, o); + + assert.sameValue(result, o, "thisArg becomes the predicate this"); +}); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-is-not-callable-throws.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-is-not-callable-throws.js new file mode 100644 index 000000000..c9b0f5ace --- /dev/null +++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-is-not-callable-throws.js @@ -0,0 +1,67 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.find +es6id: 22.2.3.10 +description: > + Throws a TypeError exception if predicate is not callable. +info: | + 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] ) + + %TypedArray%.prototype.find is a distinct function that implements the same + algorithm as Array.prototype.find as defined in 22.1.3.8 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. + + ... + + 22.1.3.8 Array.prototype.find ( predicate[ , thisArg ] ) + + ... + 3. If IsCallable(predicate) is false, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + + assert.throws(TypeError, function() { + sample.find({}); + }, "object"); + + assert.throws(TypeError, function() { + sample.find(null); + }, "null"); + + assert.throws(TypeError, function() { + sample.find(undefined); + }, "undefined"); + + assert.throws(TypeError, function() { + sample.find(false); + }, "false"); + + assert.throws(TypeError, function() { + sample.find(true); + }, "true"); + + assert.throws(TypeError, function() { + sample.find(1); + }, "number"); + + assert.throws(TypeError, function() { + sample.find(""); + }, "string"); + + assert.throws(TypeError, function() { + sample.find([]); + }, "array"); + + assert.throws(TypeError, function() { + sample.find(/./); + }, "regexp"); +}); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-may-detach-buffer.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-may-detach-buffer.js new file mode 100644 index 000000000..fafed535e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-may-detach-buffer.js @@ -0,0 +1,59 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.find +es6id: 22.2.3.10 +description: > + Predicate may detach the buffer +info: | + 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] ) + + %TypedArray%.prototype.find is a distinct function that implements the same + algorithm as Array.prototype.find as defined in 22.1.3.8 + + ... + + However, such optimization must not introduce any observable changes in the + specified behaviour of the algorithm and must take into account the + possibility that calls to predicate may cause the this value to become + detached. + + ... + + 22.1.3.8 Array.prototype.find ( predicate[ , thisArg ] ) + + ... + 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + 5. Let k be 0. + 6. Repeat, while k < len + ... + b. Let kValue be ? Get(O, Pk). + c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + ... + + 9.4.5.8 IntegerIndexedElementGet ( O, index ) + + ... + 3. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot. + 4. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + var loops = 0; + var completion = false; + + assert.throws(TypeError, function() { + sample.find(function() { + loops++; + $DETACHBUFFER(sample.buffer); + completion = true; + }); + }, "throws a TypeError getting a value from the detached buffer"); + + assert.sameValue(loops, 1, "predicate is called once"); + assert(completion, "abrupt completion does not come from DETACHBUFFER"); +}); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-not-called-on-empty-array.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-not-called-on-empty-array.js new file mode 100644 index 000000000..029c16522 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-not-called-on-empty-array.js @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.find +es6id: 22.2.3.10 +description: > + Predicate is not called on empty instances +info: | + 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] ) + + %TypedArray%.prototype.find is a distinct function that implements the same + algorithm as Array.prototype.find as defined in 22.1.3.8 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. + + ... + + 22.1.3.8 Array.prototype.find ( predicate[ , thisArg ] ) + + ... + 6. Repeat, while k < len + ... + c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + var called = false; + + var result = sample.find(function() { + called = true; + return true; + }); + + assert.sameValue( + called, + false, + "empty instance does not call predicate" + ); + assert.sameValue( + result, + undefined, + "find returns undefined when predicate is not called" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/find/BigInt/prop-desc.js new file mode 100644 index 000000000..13af89a56 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/find/BigInt/prop-desc.js @@ -0,0 +1,18 @@ +// 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.3.10 +description: > + "find" property of TypedArrayPrototype +info: | + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'find'); +verifyWritable(TypedArrayPrototype, 'find'); +verifyConfigurable(TypedArrayPrototype, 'find'); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/return-abrupt-from-predicate-call.js b/test/built-ins/TypedArray/prototype/find/BigInt/return-abrupt-from-predicate-call.js new file mode 100644 index 000000000..0942d004d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/find/BigInt/return-abrupt-from-predicate-call.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.find +es6id: 22.2.3.10 +description: > + Return abrupt from predicate call. +info: | + 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] ) + + %TypedArray%.prototype.find is a distinct function that implements the same + algorithm as Array.prototype.find as defined in 22.1.3.8 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. + + ... + + 22.1.3.8 Array.prototype.find ( predicate[ , thisArg ] ) + + ... + 6. Repeat, while k < len + ... + c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + + var predicate = function() { + throw new Test262Error(); + }; + + assert.throws(Test262Error, function() { + sample.find(predicate); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/return-found-value-predicate-result-is-true.js b/test/built-ins/TypedArray/prototype/find/BigInt/return-found-value-predicate-result-is-true.js new file mode 100644 index 000000000..63fda9413 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/find/BigInt/return-found-value-predicate-result-is-true.js @@ -0,0 +1,66 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.find +es6id: 22.2.3.10 +description: > + Return found value if predicate return a boolean true value. +info: | + 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] ) + + %TypedArray%.prototype.find is a distinct function that implements the same + algorithm as Array.prototype.find as defined in 22.1.3.8 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. + + ... + + 22.1.3.8 Array.prototype.find ( predicate[ , thisArg ] ) + + ... + 6. Repeat, while k < len + ... + c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + d. If testResult is true, return kValue. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([39, 2, 62])); + var called, result; + + called = 0; + result = sample.find(function() { + called++; + return true; + }); + assert.sameValue(result, convertToBigInt(39), "returned true on sample[0]"); + assert.sameValue(called, 1, "predicate was called once"); + + called = 0; + result = sample.find(function(val) { + called++; + return val === convertToBigInt(62); + }); + assert.sameValue(called, 3, "predicate was called three times"); + assert.sameValue(result, convertToBigInt(62), "returned true on sample[3]"); + + result = sample.find(function() { return "string"; }); + assert.sameValue(result, convertToBigInt(39), "ToBoolean(string)"); + + result = sample.find(function() { return {}; }); + assert.sameValue(result, convertToBigInt(39), "ToBoolean(object)"); + + result = sample.find(function() { return Symbol(""); }); + assert.sameValue(result, convertToBigInt(39), "ToBoolean(symbol)"); + + result = sample.find(function() { return 1; }); + assert.sameValue(result, convertToBigInt(39), "ToBoolean(number)"); + + result = sample.find(function() { return -1; }); + assert.sameValue(result, convertToBigInt(39), "ToBoolean(negative number)"); +}); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/return-undefined-if-predicate-returns-false-value.js b/test/built-ins/TypedArray/prototype/find/BigInt/return-undefined-if-predicate-returns-false-value.js new file mode 100644 index 000000000..86f3f6cd3 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/find/BigInt/return-undefined-if-predicate-returns-false-value.js @@ -0,0 +1,61 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.find +es6id: 22.2.3.10 +description: > + Return undefined if predicate always returns a boolean false value. +info: | + 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] ) + + %TypedArray%.prototype.find is a distinct function that implements the same + algorithm as Array.prototype.find as defined in 22.1.3.8 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". The implementation of the algorithm may be optimized with + the knowledge that the this value is an object that has a fixed length and + whose integer indexed properties are not sparse. + + ... + + 22.1.3.8 Array.prototype.find ( predicate[ , thisArg ] ) + + ... + 6. Repeat, while k < len + ... + c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + ... + 7. Return undefined. +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(3); + var called = 0; + + var result = sample.find(function() { + called++; + return false; + }); + + assert.sameValue(called, 3, "predicate was called three times"); + assert.sameValue(result, undefined); + + result = sample.find(function() { return ""; }); + assert.sameValue(result, undefined, "ToBoolean(empty string)"); + + result = sample.find(function() { return undefined; }); + assert.sameValue(result, undefined, "ToBoolean(undefined)"); + + result = sample.find(function() { return null; }); + assert.sameValue(result, undefined, "ToBoolean(null)"); + + result = sample.find(function() { return 0; }); + assert.sameValue(result, undefined, "ToBoolean(0)"); + + result = sample.find(function() { return -0; }); + assert.sameValue(result, undefined, "ToBoolean(-0)"); + + result = sample.find(function() { return NaN; }); + assert.sameValue(result, undefined, "ToBoolean(NaN)"); +}); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/find/BigInt/this-is-not-object.js new file mode 100644 index 000000000..149306352 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/find/BigInt/this-is-not-object.js @@ -0,0 +1,51 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.find +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var find = TypedArray.prototype.find; +var predicate = function() {}; + +assert.throws(TypeError, function() { + find.call(undefined, predicate); +}, "this is undefined"); + +assert.throws(TypeError, function() { + find.call(null, predicate); +}, "this is null"); + +assert.throws(TypeError, function() { + find.call(42, predicate); +}, "this is 42"); + +assert.throws(TypeError, function() { + find.call("1", predicate); +}, "this is a string"); + +assert.throws(TypeError, function() { + find.call(true, predicate); +}, "this is true"); + +assert.throws(TypeError, function() { + find.call(false, predicate); +}, "this is false"); + +var s = Symbol("s"); +assert.throws(TypeError, function() { + find.call(s, predicate); +}, "this is a Symbol"); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/find/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..957be1152 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/find/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.find +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var find = TypedArray.prototype.find; +var predicate = function() {}; + +assert.throws(TypeError, function() { + find.call({}, predicate); +}, "this is an Object"); + +assert.throws(TypeError, function() { + find.call([], predicate); +}, "this is an Array"); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + find.call(ab, predicate); +}, "this is an ArrayBuffer instance"); + +var dv = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + find.call(dv, predicate); +}, "this is a DataView instance"); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/detached-buffer.js new file mode 100644 index 000000000..f8e8ed449 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/detached-buffer.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.findindex +description: Throws a TypeError if this has a detached buffer +info: | + 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + ... + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +var predicate = function() { + throw new Test262Error(); +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.findIndex(predicate); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/get-length-ignores-length-prop.js new file mode 100644 index 000000000..64ba1216f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/get-length-ignores-length-prop.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.findindex +es6id: 22.2.3.11 +description: > + [[Get]] of "length" uses [[ArrayLength]] +info: | + 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] ) + + %TypedArray%.prototype.findIndex is a distinct function that implements the + same algorithm as Array.prototype.findIndex as defined in 22.1.3.9 except that + the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + ... + + 22.1.3.9 Array.prototype.findIndex ( predicate[ , thisArg ] ) + + ... + 2. Let len be ? ToLength(? Get(O, "length")). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +Object.defineProperty(TypedArray.prototype, "length", { + get: function() { + throw new Test262Error(); + } +}); + +testWithBigIntTypedArrayConstructors(function(TA) { + Object.defineProperty(TA.prototype, "length", { + get: function() { + throw new Test262Error(); + } + }); + + var sample = new TA(convertToBigInt([42])); + + Object.defineProperty(sample, "length", { + get: function() { + throw new Test262Error(); + }, + configurable: true + }); + + assert.sameValue( + sample.findIndex(function() { return true; }), + 0 + ); +}); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-func.js new file mode 100644 index 000000000..eec6d6341 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-func.js @@ -0,0 +1,29 @@ +// 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.3.11 +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var findIndex = TypedArray.prototype.findIndex; + +assert.sameValue(typeof findIndex, 'function'); + +assert.throws(TypeError, function() { + findIndex(); +}); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-method.js new file mode 100644 index 000000000..73197eb1d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-method.js @@ -0,0 +1,29 @@ +// 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.3.11 +description: Requires a [[TypedArrayName]] internal slot. +info: | + 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.findIndex, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.findIndex(); +}); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/length.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/length.js new file mode 100644 index 000000000..aeab6fc8e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.11 +description: > + %TypedArray%.prototype.findIndex.length is 1. +info: | + %TypedArray%.prototype.findIndex (predicate [ , thisArg ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.findIndex.length, 1); + +verifyNotEnumerable(TypedArray.prototype.findIndex, "length"); +verifyNotWritable(TypedArray.prototype.findIndex, "length"); +verifyConfigurable(TypedArray.prototype.findIndex, "length"); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/name.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/name.js new file mode 100644 index 000000000..a0cc1c772 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.11 +description: > + %TypedArray%.prototype.findIndex.name is "findIndex". +info: | + %TypedArray%.prototype.findIndex (predicate [ , thisArg ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.findIndex.name, "findIndex"); + +verifyNotEnumerable(TypedArray.prototype.findIndex, "name"); +verifyNotWritable(TypedArray.prototype.findIndex, "name"); +verifyConfigurable(TypedArray.prototype.findIndex, "name"); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js new file mode 100644 index 000000000..0dc15c76e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js @@ -0,0 +1,67 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.findindex +es6id: 22.2.3.11 +description: > + Change values during predicate call +info: | + 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] ) + + %TypedArray%.prototype.findIndex is a distinct function that implements the + same algorithm as Array.prototype.findIndex as defined in 22.1.3.9 except that + the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + ... + + 22.1.3.9 Array.prototype.findIndex ( predicate[ , thisArg ] ) + + ... + 6. Repeat, while k < len + ... + c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + ... +includes: [compareArray.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var arr = convertToBigInt([10, 20, 30]); + var sample; + var result; + + sample = new TA(3); + sample.findIndex(function(val, i) { + sample[i] = arr[i]; + + assert.sameValue(val, convertToBigInt(0), "value is not mapped to instance"); + }); + assert(compareArray(sample, arr), "values set during each predicate call"); + + sample = new TA(arr); + result = sample.findIndex(function(val, i) { + if ( i === 0 ) { + sample[2] = convertToBigInt(7); + } + return val === convertToBigInt(7); + }); + assert.sameValue(result, 2, "value found"); + + sample = new TA(arr); + result = sample.findIndex(function(val, i) { + if ( i === 0 ) { + sample[2] = convertToBigInt(7); + } + return val === convertToBigInt(30); + }); + assert.sameValue(result, -1, "value not found"); + + sample = new TA(arr); + result = sample.findIndex(function(val, i) { + if ( i > 0 ) { + sample[0] = convertToBigInt(7); + } + return val === convertToBigInt(7); + }); + assert.sameValue(result, -1, "value not found - changed after call"); +}); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-parameters.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-parameters.js new file mode 100644 index 000000000..e63adf53f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-parameters.js @@ -0,0 +1,61 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.findindex +es6id: 22.2.3.11 +description: > + Predicate called as F.call( thisArg, kValue, k, O ) for each array entry. +info: | + 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] ) + + %TypedArray%.prototype.findIndex is a distinct function that implements the + same algorithm as Array.prototype.findIndex as defined in 22.1.3.9 except that + the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + ... + + 22.1.3.9 Array.prototype.findIndex ( predicate[ , thisArg ] ) + + ... + 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + 5. Let k be 0. + 6. Repeat, while k < len + ... + c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([39, 2, 62])); + var results = []; + var result; + + sample.foo = "bar"; // Ignores non integer index properties + + sample.findIndex(function() { + results.push(arguments); + }); + + assert.sameValue(results.length, 3, "predicate is called for each index"); + + result = results[0]; + assert.sameValue(result[0], convertToBigInt(39), "results[0][0] === 39, value"); + assert.sameValue(result[1], 0, "results[0][1] === 0, index"); + assert.sameValue(result[2], sample, "results[0][2] === sample, instance"); + assert.sameValue(result.length, 3, "results[0].length === 3, arguments"); + + result = results[1]; + assert.sameValue(result[0], convertToBigInt(2), "results[1][0] === 2, value"); + assert.sameValue(result[1], 1, "results[1][1] === 1, index"); + assert.sameValue(result[2], sample, "results[1][2] === sample, instance"); + assert.sameValue(result.length, 3, "results[1].length === 3, arguments"); + + result = results[2]; + assert.sameValue(result[0], convertToBigInt(62), "results[2][0] === 62, value"); + assert.sameValue(result[1], 2, "results[2][1] === 2, index"); + assert.sameValue(result[2], sample, "results[2][2] === sample, instance"); + assert.sameValue(result.length, 3, "results[2].length === 3, arguments"); +}); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-non-strict.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-non-strict.js new file mode 100644 index 000000000..a4a8ab7eb --- /dev/null +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-non-strict.js @@ -0,0 +1,58 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.findindex +es6id: 22.2.3.11 +description: > + Verify predicate this on non-strict mode +info: | + 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] ) + + %TypedArray%.prototype.findIndex is a distinct function that implements the + same algorithm as Array.prototype.findIndex as defined in 22.1.3.9 except that + the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + ... + + 22.1.3.9 Array.prototype.findIndex ( predicate[ , thisArg ] ) + + ... + 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + 5. Let k be 0. + 6. Repeat, while k < len + ... + c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + ... +flags: [noStrict] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var T = this; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + var result; + + sample.findIndex(function() { + result = this; + }); + + assert.sameValue(result, T, "without thisArg, predicate this is the global"); + + result = null; + sample.findIndex(function() { + result = this; + }, undefined); + + assert.sameValue(result, T, "predicate this is the global when thisArg is undefined"); + + var o = {}; + result = null; + sample.findIndex(function() { + result = this; + }, o); + + assert.sameValue(result, o, "thisArg becomes the predicate this"); +}); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-strict.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-strict.js new file mode 100644 index 000000000..554a55aa0 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-strict.js @@ -0,0 +1,52 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.findindex +es6id: 22.2.3.11 +description: > + Predicate thisArg as F.call( thisArg, kValue, k, O ) for each array entry. +info: | + 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] ) + + %TypedArray%.prototype.findIndex is a distinct function that implements the + same algorithm as Array.prototype.findIndex as defined in 22.1.3.9 except that + the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + ... + + 22.1.3.9 Array.prototype.findIndex ( predicate[ , thisArg ] ) + + ... + 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + 5. Let k be 0. + 6. Repeat, while k < len + ... + c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + ... +flags: [onlyStrict] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + var result; + + sample.findIndex(function() { + result = this; + }); + + assert.sameValue( + result, + undefined, + "without thisArg, predicate this is undefined" + ); + + var o = {}; + sample.findIndex(function() { + result = this; + }, o); + + assert.sameValue(result, o, "thisArg becomes the predicate this"); +}); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-is-not-callable-throws.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-is-not-callable-throws.js new file mode 100644 index 000000000..3a2143101 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-is-not-callable-throws.js @@ -0,0 +1,65 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.findindex +es6id: 22.2.3.11 +description: > + Throws a TypeError exception if predicate is not callable. +info: | + 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] ) + + %TypedArray%.prototype.findIndex is a distinct function that implements the + same algorithm as Array.prototype.findIndex as defined in 22.1.3.9 except that + the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + ... + + 22.1.3.9 Array.prototype.findIndex ( predicate[ , thisArg ] ) + + ... + 3. If IsCallable(predicate) is false, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + assert.throws(TypeError, function() { + sample.findIndex({}); + }, "{}"); + + assert.throws(TypeError, function() { + sample.findIndex(null); + }, "null"); + + assert.throws(TypeError, function() { + sample.findIndex(undefined); + }, "undefined"); + + assert.throws(TypeError, function() { + sample.findIndex(false); + }, "false"); + + assert.throws(TypeError, function() { + sample.findIndex(true); + }, "true"); + + assert.throws(TypeError, function() { + sample.findIndex(1); + }, "1"); + + assert.throws(TypeError, function() { + sample.findIndex(""); + }, "string"); + + assert.throws(TypeError, function() { + sample.findIndex([]); + }, "[]"); + + assert.throws(TypeError, function() { + sample.findIndex(/./); + }, "/./"); +}); + diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-may-detach-buffer.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-may-detach-buffer.js new file mode 100644 index 000000000..3bf9014ff --- /dev/null +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-may-detach-buffer.js @@ -0,0 +1,52 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.findindex +es6id: 22.2.3.11 +description: > + Predicate may detach the buffer +info: | + 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] ) + + %TypedArray%.prototype.findIndex is a distinct function that implements the + same algorithm as Array.prototype.findIndex as defined in 22.1.3.9 except that + the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + ... + + 22.1.3.9 Array.prototype.findIndex ( predicate[ , thisArg ] ) + + ... + 6. Repeat, while k < len + ... + b. Let kValue be ? Get(O, Pk). + c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + ... + + 9.4.5.8 IntegerIndexedElementGet ( O, index ) + + ... + 3. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot. + 4. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + var loops = 0; + var completion = false; + + assert.throws(TypeError, function() { + sample.findIndex(function() { + loops++; + $DETACHBUFFER(sample.buffer); + completion = true; + }); + }, "throws a TypeError getting a value from the detached buffer"); + + assert.sameValue(loops, 1, "predicated is called once"); + assert(completion, "abrupt completion does not come from DETACHBUFFER"); +}); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-not-called-on-empty-array.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-not-called-on-empty-array.js new file mode 100644 index 000000000..a58100f03 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-not-called-on-empty-array.js @@ -0,0 +1,49 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.findindex +es6id: 22.2.3.11 +description: > + Predicate is not called on an empty instance +info: | + 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] ) + + %TypedArray%.prototype.findIndex is a distinct function that implements the + same algorithm as Array.prototype.findIndex as defined in 22.1.3.9 except that + the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + ... + + 22.1.3.9 Array.prototype.findIndex ( predicate[ , thisArg ] ) + + ... + 6. Repeat, while k < len + ... + c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + ... + 7. Return -1. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + var called = false; + + var predicate = function() { + called = true; + return true; + }; + + var result = sample.findIndex(predicate); + + assert.sameValue( + called, false, + "does not call predicate" + ); + assert.sameValue( + result, -1, + "returns -1 on an empty instance" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/prop-desc.js new file mode 100644 index 000000000..a4bf542d7 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/prop-desc.js @@ -0,0 +1,18 @@ +// 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.3.11 +description: > + "findIndex" property of TypedArrayPrototype +info: | + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'findIndex'); +verifyWritable(TypedArrayPrototype, 'findIndex'); +verifyConfigurable(TypedArrayPrototype, 'findIndex'); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-abrupt-from-predicate-call.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-abrupt-from-predicate-call.js new file mode 100644 index 000000000..6994a7954 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-abrupt-from-predicate-call.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.findindex +es6id: 22.2.3.11 +description: > + Return abrupt from predicate call. +info: | + 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] ) + + %TypedArray%.prototype.findIndex is a distinct function that implements the + same algorithm as Array.prototype.findIndex as defined in 22.1.3.9 except that + the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + ... + + 22.1.3.9 Array.prototype.findIndex ( predicate[ , thisArg ] ) + + ... + 5. Let k be 0. + 6. Repeat, while k < len + ... + c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var predicate = function() { + throw new Test262Error(); +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + assert.throws(Test262Error, function() { + sample.findIndex(predicate); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-index-predicate-result-is-true.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-index-predicate-result-is-true.js new file mode 100644 index 000000000..0c979bd4f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-index-predicate-result-is-true.js @@ -0,0 +1,66 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.findindex +es6id: 22.2.3.11 +description: > + Return index if predicate return a boolean true value. +info: | + 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] ) + + %TypedArray%.prototype.findIndex is a distinct function that implements the + same algorithm as Array.prototype.findIndex as defined in 22.1.3.9 except that + the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + ... + + 22.1.3.9 Array.prototype.findIndex ( predicate[ , thisArg ] ) + + ... + 5. Let k be 0. + 6. Repeat, while k < len + ... + c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + d. If testResult is true, return k. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([39, 3, 9])); + var called = 0; + + var result = sample.findIndex(function() { + called++; + return true; + }); + + assert.sameValue(result, 0, "returned true on sample[0]"); + assert.sameValue(called, 1, "predicate was called once"); + + called = 0; + result = sample.findIndex(function(val) { + called++; + return val === convertToBigInt(9); + }); + + assert.sameValue(called, 3, "predicate was called three times"); + assert.sameValue(result, 2, "returned true on sample[3]"); + + result = sample.findIndex(function() { return "string"; }); + assert.sameValue(result, 0, "ToBoolean(string)"); + + result = sample.findIndex(function() { return {}; }); + assert.sameValue(result, 0, "ToBoolean(object)"); + + result = sample.findIndex(function() { return Symbol(""); }); + assert.sameValue(result, 0, "ToBoolean(symbol)"); + + result = sample.findIndex(function() { return 1; }); + assert.sameValue(result, 0, "ToBoolean(number)"); + + result = sample.findIndex(function() { return -1; }); + assert.sameValue(result, 0, "ToBoolean(negative number)"); +}); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-negative-one-if-predicate-returns-false-value.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-negative-one-if-predicate-returns-false-value.js new file mode 100644 index 000000000..28001d77c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-negative-one-if-predicate-returns-false-value.js @@ -0,0 +1,59 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.findindex +es6id: 22.2.3.11 +description: > + Return -1 if predicate always returns a boolean false value. +info: | + 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] ) + + %TypedArray%.prototype.findIndex is a distinct function that implements the + same algorithm as Array.prototype.findIndex as defined in 22.1.3.9 except that + the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + ... + + 22.1.3.9 Array.prototype.findIndex ( predicate[ , thisArg ] ) + + ... + 6. Repeat, while k < len + ... + c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + ... + 7. Return -1. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([1, 2, 3])); + var called = 0; + + var result = sample.findIndex(function() { + called++; + return false; + }); + + assert.sameValue(called, 3, "predicate was called three times"); + assert.sameValue(result, -1, "result is -1 when predicate returns are false"); + + result = sample.findIndex(function() { return ""; }); + assert.sameValue(result, -1, "ToBoolean(string)"); + + result = sample.findIndex(function() { return undefined; }); + assert.sameValue(result, -1, "ToBoolean(undefined)"); + + result = sample.findIndex(function() { return null; }); + assert.sameValue(result, -1, "ToBoolean(null)"); + + result = sample.findIndex(function() { return 0; }); + assert.sameValue(result, -1, "ToBoolean(0)"); + + result = sample.findIndex(function() { return -0; }); + assert.sameValue(result, -1, "ToBoolean(-0)"); + + result = sample.findIndex(function() { return NaN; }); + assert.sameValue(result, -1, "ToBoolean(NaN)"); +}); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/this-is-not-object.js new file mode 100644 index 000000000..fedede8b0 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/this-is-not-object.js @@ -0,0 +1,51 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.findindex +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var findIndex = TypedArray.prototype.findIndex; +var predicate = function() {}; + +assert.throws(TypeError, function() { + findIndex.call(undefined, predicate); +}, "this is undefined"); + +assert.throws(TypeError, function() { + findIndex.call(null, predicate); +}, "this is null"); + +assert.throws(TypeError, function() { + findIndex.call(42, predicate); +}, "this is 42"); + +assert.throws(TypeError, function() { + findIndex.call("1", predicate); +}, "this is a string"); + +assert.throws(TypeError, function() { + findIndex.call(true, predicate); +}, "this is true"); + +assert.throws(TypeError, function() { + findIndex.call(false, predicate); +}, "this is false"); + +var s = Symbol("s"); +assert.throws(TypeError, function() { + findIndex.call(s, predicate); +}, "this is a Symbol"); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..0c1bbab00 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.findindex +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var findIndex = TypedArray.prototype.findIndex; +var predicate = function() {}; + +assert.throws(TypeError, function() { + findIndex.call({}, predicate); +}, "this is an Object"); + +assert.throws(TypeError, function() { + findIndex.call([], predicate); +}, "this is an Array"); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + findIndex.call(ab, predicate); +}, "this is an ArrayBuffer instance"); + +var dv = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + findIndex.call(dv, predicate); +}, "this is a DataView instance"); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/arraylength-internal.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/arraylength-internal.js new file mode 100644 index 000000000..c5d14f29e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/arraylength-internal.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.foreach +description: > + [[ArrayLength]] is accessed in place of performing a [[Get]] of "length" +info: | + 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.forEach is a distinct function that implements the same + algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length" +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample1 = new TA(42); + var loop = 0; + + Object.defineProperty(sample1, "length", {value: 1}); + + sample1.forEach(function() { + loop++; + }); + + assert.sameValue(loop, 42, "data descriptor"); + + var sample2 = new TA(7); + loop = 0; + + Object.defineProperty(sample2, "length", { + get: function() { + throw new Test262Error( + "Does not return abrupt getting length property" + ); + } + }); + + sample2.forEach(function() { + loop++; + }); + + assert.sameValue(loop, 7, "accessor descriptor"); +}); + diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-with-thisarg.js new file mode 100644 index 000000000..ada379de2 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-with-thisarg.js @@ -0,0 +1,55 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.foreach +description: > + thisArg does not affect callbackfn arguments +info: | + 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.forEach is a distinct function that implements the same + algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length" + + 22.1.3.10 Array.prototype.forEach ( callbackfn [ , thisArg ] ) + + ... + 6. Repeat, while k < len + ... + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Perform ? Call(callbackfn, T, « kValue, k, O »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + + var results = []; + var thisArg = ["test262", 0, "ecma262", 0]; + + sample.forEach(function() { + results.push(arguments); + }, thisArg); + + assert.sameValue(results.length, 3, "results.length"); + assert.sameValue(thisArg.length, 4, "thisArg.length"); + + assert.sameValue(results[0].length, 3, "results[0].length"); + assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue"); + assert.sameValue(results[0][1], 0, "results[0][1] - k"); + assert.sameValue(results[0][2], sample, "results[0][2] - this"); + + assert.sameValue(results[1].length, 3, "results[1].length"); + assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue"); + assert.sameValue(results[1][1], 1, "results[1][1] - k"); + assert.sameValue(results[1][2], sample, "results[1][2] - this"); + + assert.sameValue(results[2].length, 3, "results[2].length"); + assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue"); + assert.sameValue(results[2][1], 2, "results[2][1] - k"); + assert.sameValue(results[2][2], sample, "results[2][2] - this"); +}); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-without-thisarg.js new file mode 100644 index 000000000..81011139e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-without-thisarg.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.foreach +description: > + callbackfn arguments +info: | + 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.forEach is a distinct function that implements the same + algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length" + + 22.1.3.10 Array.prototype.forEach ( callbackfn [ , thisArg ] ) + + ... + 6. Repeat, while k < len + ... + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Perform ? Call(callbackfn, T, « kValue, k, O »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + + var results = []; + + sample.forEach(function() { + results.push(arguments); + }); + + assert.sameValue(results.length, 3, "results.length"); + + assert.sameValue(results[0].length, 3, "results[0].length"); + assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue"); + assert.sameValue(results[0][1], 0, "results[0][1] - k"); + assert.sameValue(results[0][2], sample, "results[0][2] - this"); + + assert.sameValue(results[1].length, 3, "results[1].length"); + assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue"); + assert.sameValue(results[1][1], 1, "results[1][1] - k"); + assert.sameValue(results[1][2], sample, "results[1][2] - this"); + + assert.sameValue(results[2].length, 3, "results[2].length"); + assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue"); + assert.sameValue(results[2][1], 2, "results[2][1] - k"); + assert.sameValue(results[2][2], sample, "results[2][2] - this"); +}); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-detachbuffer.js new file mode 100644 index 000000000..0f7725e4f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-detachbuffer.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.foreach +description: > + Instance buffer can be detached during loop +info: | + 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.forEach is a distinct function that implements the same + algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length" + + 22.1.3.10 Array.prototype.forEach ( callbackfn [ , thisArg ] ) + + ... + 6. Repeat, while k < len + ... + c. If kPresent is true, then + ... + ii. Perform ? Call(callbackfn, T, « kValue, k, O »). + ... +includes: [detachArrayBuffer.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var loops = 0; + var sample = new TA(2); + + assert.throws(TypeError, function() { + sample.forEach(function() { + if (loops === 1) { + throw new Test262Error("callbackfn called twice"); + } + $DETACHBUFFER(sample.buffer); + loops++; + }); + }); + + assert.sameValue(loops, 1); +}); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-is-not-callable.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-is-not-callable.js new file mode 100644 index 000000000..219872510 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-is-not-callable.js @@ -0,0 +1,54 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.foreach +description: > + callbackfn is not callable +info: | + 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.forEach is a distinct function that implements the same + algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length" + + 22.1.3.10 Array.prototype.forEach ( callbackfn [ , thisArg ] ) + + ... + 3. If IsCallable(callbackfn) is false, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(3); + + assert.throws(TypeError, function() { + sample.forEach(); + }); + + assert.throws(TypeError, function() { + sample.forEach(undefined); + }); + + assert.throws(TypeError, function() { + sample.forEach(null); + }); + + assert.throws(TypeError, function() { + sample.forEach({}); + }); + + assert.throws(TypeError, function() { + sample.forEach(1); + }); + + assert.throws(TypeError, function() { + sample.forEach(""); + }); + + assert.throws(TypeError, function() { + sample.forEach(false); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-no-interaction-over-non-integer.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-no-interaction-over-non-integer.js new file mode 100644 index 000000000..95c7e4b37 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-no-interaction-over-non-integer.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.foreach +description: > + Does not interact over non-integer properties +info: | + 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) + + ... + 6. Repeat, while k < len + ... + c. If kPresent is true, then + ... + ii. Perform ? Call(callbackfn, T, « kValue, k, O »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([7, 8])); + + var results = []; + + sample.foo = 42; + sample[Symbol("1")] = 43; + + sample.forEach(function() { + results.push(arguments); + }); + + assert.sameValue(results.length, 2, "results.length"); + + assert.sameValue(results[0][1], 0, "results[0][1] - k"); + assert.sameValue(results[1][1], 1, "results[1][1] - k"); + + assert.sameValue(results[0][0], convertToBigInt(7), "results[0][0] - kValue"); + assert.sameValue(results[1][0], convertToBigInt(8), "results[1][0] - kValue"); +}); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-not-called-on-empty.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-not-called-on-empty.js new file mode 100644 index 000000000..f81f5ac40 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-not-called-on-empty.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.foreach +description: > + callbackfn is not called on empty instances +info: | + 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.forEach is a distinct function that implements the same + algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length" + + 22.1.3.10 Array.prototype.forEach ( callbackfn [ , thisArg ] ) + + ... + 6. Repeat, while k < len + ... + c. If kPresent is true, then + ... + ii. Perform ? Call(callbackfn, T, « kValue, k, O »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var called = 0; + + new TA().forEach(function() { + called++; + }); + + assert.sameValue(called, 0); +}); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-return-does-not-change-instance.js new file mode 100644 index 000000000..82da435a1 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-return-does-not-change-instance.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. +/*--- +esid: sec-%typedarray%.prototype.foreach +description: > + The callbackfn return does not change the instance +info: | + 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.forEach is a distinct function that implements the same + algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length" +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample1 = new TA(3); + + sample1[1] = convertToBigInt(1); + + sample1.forEach(function() { + return 42; + }); + + assert.sameValue(sample1[0], convertToBigInt(0), "[0] == 0"); + assert.sameValue(sample1[1], convertToBigInt(1), "[1] == 1"); + assert.sameValue(sample1[2], convertToBigInt(0), "[2] == 0"); +}); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-returns-abrupt.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-returns-abrupt.js new file mode 100644 index 000000000..fb9c58a20 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-returns-abrupt.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.foreach +description: > + Returns abrupt from callbackfn +info: | + 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.forEach is a distinct function that implements the same + algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length" + + 22.1.3.10 Array.prototype.forEach ( callbackfn [ , thisArg ] ) + + ... + 6. Repeat, while k < len + ... + c. If kPresent is true, then + ... + ii. Perform ? Call(callbackfn, T, « kValue, k, O »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(3); + + assert.throws(Test262Error, function() { + sample.forEach(function() { + throw new Test262Error(); + }); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-set-value-during-interaction.js new file mode 100644 index 000000000..2b2865b4c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-set-value-during-interaction.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.foreach +description: > + Integer indexed values changed during iteration +info: | + 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.forEach is a distinct function that implements the same + algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length" +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect.set, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + var newVal = 0; + + sample.forEach(function(val, i) { + if (i > 0) { + assert.sameValue( + sample[i - 1], convertToBigInt(newVal - 1), + "get the changed value during the loop" + ); + assert.sameValue( + Reflect.set(sample, 0, convertToBigInt(7)), + true, + "re-set a value for sample[0]" + ); + } + assert.sameValue( + Reflect.set(sample, i, convertToBigInt(newVal)), + true, + "set value during iteration" + ); + + newVal++; + }); + + assert.sameValue(sample[0], convertToBigInt(7), "changed values after iteration [0] == 7"); + assert.sameValue(sample[1], convertToBigInt(1), "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], convertToBigInt(2), "changed values after iteration [2] == 2"); +}); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-this.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-this.js new file mode 100644 index 000000000..df900d125 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-this.js @@ -0,0 +1,57 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.foreach +description: > + callbackfn `this` value +info: | + 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.forEach is a distinct function that implements the same + algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length" + + 22.1.3.10 Array.prototype.forEach ( callbackfn [ , thisArg ] ) + + ... + 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + ... + 6. Repeat, while k < len + ... + c. If kPresent is true, then + ... + ii. Perform ? Call(callbackfn, T, « kValue, k, O »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var expected = (function() { return this; })(); +var thisArg = {}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(3); + + var results1 = []; + + sample.forEach(function() { + results1.push(this); + }); + + assert.sameValue(results1.length, 3, "results1"); + assert.sameValue(results1[0], expected, "without thisArg - [0]"); + assert.sameValue(results1[1], expected, "without thisArg - [1]"); + assert.sameValue(results1[2], expected, "without thisArg - [2]"); + + var results2 = []; + + sample.forEach(function() { + results2.push(this); + }, thisArg); + + assert.sameValue(results2.length, 3, "results2"); + assert.sameValue(results2[0], thisArg, "using thisArg - [0]"); + assert.sameValue(results2[1], thisArg, "using thisArg - [1]"); + assert.sameValue(results2[2], thisArg, "using thisArg - [2]"); +}); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/detached-buffer.js new file mode 100644 index 000000000..fe196e0cb --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/detached-buffer.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.foreach +description: Throws a TypeError if this has a detached buffer +info: | + 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + ... + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +var callbackfn = function() { + throw new Test262Error(); +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.forEach(callbackfn); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-func.js new file mode 100644 index 000000000..6ea0a324c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-func.js @@ -0,0 +1,29 @@ +// 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.3.12 +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var forEach = TypedArray.prototype.forEach; + +assert.sameValue(typeof forEach, 'function'); + +assert.throws(TypeError, function() { + forEach(); +}); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-method.js new file mode 100644 index 000000000..7062e8b1d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-method.js @@ -0,0 +1,29 @@ +// 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.3.12 +description: Requires a [[TypedArrayName]] internal slot. +info: | + 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.forEach, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.forEach(); +}); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/length.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/length.js new file mode 100644 index 000000000..bb291f677 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.12 +description: > + %TypedArray%.prototype.forEach.length is 1. +info: | + %TypedArray%.prototype.forEach (callbackfn [ , thisArg ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.forEach.length, 1); + +verifyNotEnumerable(TypedArray.prototype.forEach, "length"); +verifyNotWritable(TypedArray.prototype.forEach, "length"); +verifyConfigurable(TypedArray.prototype.forEach, "length"); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/name.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/name.js new file mode 100644 index 000000000..6adfd3c6b --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.12 +description: > + %TypedArray%.prototype.forEach.name is "forEach". +info: | + %TypedArray%.prototype.forEach (callbackfn [ , thisArg ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.forEach.name, "forEach"); + +verifyNotEnumerable(TypedArray.prototype.forEach, "name"); +verifyNotWritable(TypedArray.prototype.forEach, "name"); +verifyConfigurable(TypedArray.prototype.forEach, "name"); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/prop-desc.js new file mode 100644 index 000000000..56bafc356 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/prop-desc.js @@ -0,0 +1,18 @@ +// 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.3.12 +description: > + "forEach" property of TypedArrayPrototype +info: | + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'forEach'); +verifyWritable(TypedArrayPrototype, 'forEach'); +verifyConfigurable(TypedArrayPrototype, 'forEach'); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/returns-undefined.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/returns-undefined.js new file mode 100644 index 000000000..467825d27 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/returns-undefined.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.foreach +description: > + Returns undefined +info: | + 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.forEach is a distinct function that implements the same + algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length" +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample1 = new TA(42); + + var result1 = sample1.forEach(function() { + return 42; + }); + + assert.sameValue(result1, undefined, "result1"); + + var sample2 = new TA(1); + var result2 = sample2.forEach(function() { + return null; + }); + + assert.sameValue(result2, undefined, "result2"); +}); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/this-is-not-object.js new file mode 100644 index 000000000..6317c05d5 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/this-is-not-object.js @@ -0,0 +1,51 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.foreach +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var forEach = TypedArray.prototype.forEach; +var callbackfn = function() {}; + +assert.throws(TypeError, function() { + forEach.call(undefined, callbackfn); +}, "this is undefined"); + +assert.throws(TypeError, function() { + forEach.call(null, callbackfn); +}, "this is null"); + +assert.throws(TypeError, function() { + forEach.call(42, callbackfn); +}, "this is 42"); + +assert.throws(TypeError, function() { + forEach.call("1", callbackfn); +}, "this is a string"); + +assert.throws(TypeError, function() { + forEach.call(true, callbackfn); +}, "this is true"); + +assert.throws(TypeError, function() { + forEach.call(false, callbackfn); +}, "this is false"); + +var s = Symbol("s"); +assert.throws(TypeError, function() { + forEach.call(s, callbackfn); +}, "this is a Symbol"); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..33db208c9 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.foreach +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var forEach = TypedArray.prototype.forEach; +var callbackfn = function() {}; + +assert.throws(TypeError, function() { + forEach.call({}, callbackfn); +}, "this is an Object"); + +assert.throws(TypeError, function() { + forEach.call([], callbackfn); +}, "this is an Array"); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + forEach.call(ab, callbackfn); +}, "this is an ArrayBuffer instance"); + +var dv = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + forEach.call(dv, callbackfn); +}, "this is a DataView instance"); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/values-are-not-cached.js new file mode 100644 index 000000000..d937cf44f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/values-are-not-cached.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.foreach +description: > + Integer indexed values are not cached before iteration +info: | + 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.forEach is a distinct function that implements the same + algorithm as Array.prototype.forEach as defined in 22.1.3.10 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length" +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + + sample.forEach(function(v, i) { + if (i < sample.length - 1) { + sample[i+1] = convertToBigInt(42); + } + + assert.sameValue( + v, convertToBigInt(42), "method does not cache values before callbackfn calls" + ); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/includes/BigInt/detached-buffer.js new file mode 100644 index 000000000..990e4b01a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/detached-buffer.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.includes +description: Throws a TypeError if this has a detached buffer +info: | + 22.2.3.14 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + ... + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.includes(0); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-equal-or-greater-length-returns-false.js b/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-equal-or-greater-length-returns-false.js new file mode 100644 index 000000000..a59b7084a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-equal-or-greater-length-returns-false.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.includes +description: Return false if fromIndex >= ArrayLength +info: | + 22.2.3.13 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.includes is a distinct function that implements the + same algorithm as Array.prototype.includes as defined in 22.1.3.11 except that + the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.11 Array.prototype.includes ( searchElement [ , fromIndex ] ) + + ... + 4. Let n be ? ToInteger(fromIndex). (If fromIndex is undefined, this step + produces the value 0.) + 5. If n ≥ 0, then + a. Let k be n. + ... + 7. Repeat, while k < len + ... + 8. Return false. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample; + + sample = new TA(42); + assert.sameValue(sample.includes(0, 42), false); + assert.sameValue(sample.includes(0, 43), false); +}); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-infinity.js b/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-infinity.js new file mode 100644 index 000000000..0d44d7a65 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-infinity.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.includes +description: handle Infinity values for fromIndex +info: | + 22.2.3.13 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.includes is a distinct function that implements the + same algorithm as Array.prototype.includes as defined in 22.1.3.11 except that + the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.11 Array.prototype.includes ( searchElement [ , fromIndex ] ) + + ... + 4. Let n be ? ToInteger(fromIndex). (If fromIndex is undefined, this step + produces the value 0.) + 5. If n ≥ 0, then + a. Let k be n. + 6. Else n < 0, + a. Let k be len + n. + b. If k < 0, let k be 0. + 7. Repeat, while k < len + ... + 8. Return false. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 43, 41])); + + assert.sameValue( + sample.includes(convertToBigInt(43), Infinity), + false, + "includes(43, Infinity)" + ); + assert.sameValue( + sample.includes(convertToBigInt(43), -Infinity), + true, + "includes(43, -Infinity)"); +}); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-minus-zero.js b/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-minus-zero.js new file mode 100644 index 000000000..285a7c316 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-minus-zero.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.includes +description: -0 fromIndex becomes 0 +info: | + 22.2.3.13 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.includes is a distinct function that implements the + same algorithm as Array.prototype.includes as defined in 22.1.3.11 except that + the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.11 Array.prototype.includes ( searchElement [ , fromIndex ] ) + + ... + 5. If n ≥ 0, then + a. Let k be n. + ... + 7. Repeat, while k < len + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample; + + sample = new TA(convertToBigInt([42, 43])); + assert.sameValue(sample.includes(convertToBigInt(42), -0), true, "-0 [0]"); + assert.sameValue(sample.includes(convertToBigInt(43), -0), true, "-0 [1]"); + assert.sameValue(sample.includes(convertToBigInt(44), -0), false, "-0 [2]"); +}); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/includes/BigInt/get-length-uses-internal-arraylength.js new file mode 100644 index 000000000..85ab71b09 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/get-length-uses-internal-arraylength.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.includes +description: Get "length" uses internal ArrayLength +info: | + 22.2.3.13 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.includes is a distinct function that implements the + same algorithm as Array.prototype.includes as defined in 22.1.3.11 except that + the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.11 Array.prototype.includes ( searchElement [ , fromIndex ] ) + + ... + 2. Let len be ? ToLength(? Get(O, "length")). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +Object.defineProperty(TypedArray.prototype, "length", {value: 0}); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([7])); + + Object.defineProperty(TA.prototype, "length", {value: 0}); + Object.defineProperty(sample, "length", {value: 0}); + + assert.sameValue(sample.includes(convertToBigInt(7)), true); +}); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/includes/BigInt/invoked-as-func.js new file mode 100644 index 000000000..cb8069bc3 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/invoked-as-func.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.includes +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.14 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var includes = TypedArray.prototype.includes; + +assert.sameValue(typeof includes, "function"); + +assert.throws(TypeError, function() { + includes(); +}); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/includes/BigInt/invoked-as-method.js new file mode 100644 index 000000000..78f7428a1 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/invoked-as-method.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.includes +description: Requires a [[TypedArrayName]] internal slot. +info: | + 22.2.3.14 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.includes, "function"); + +assert.throws(TypeError, function() { + TypedArrayPrototype.includes(); +}); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/length-zero-returns-false.js b/test/built-ins/TypedArray/prototype/includes/BigInt/length-zero-returns-false.js new file mode 100644 index 000000000..9c06fa6c1 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/length-zero-returns-false.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.includes +description: Returns false if length is 0 +info: | + 22.2.3.13 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.includes is a distinct function that implements the + same algorithm as Array.prototype.includes as defined in 22.1.3.11 except that + the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.11 Array.prototype.includes ( searchElement [ , fromIndex ] ) + + ... + 2. Let len be ? ToLength(? Get(O, "length")). + 3. If len is 0, return false. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var fromIndex = { + valueOf: function() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + assert.sameValue(sample.includes(0), false, "returns false"); + assert.sameValue(sample.includes(), false, "returns false - no arg"); + assert.sameValue( + sample.includes(0, fromIndex), false, + "length is checked before ToInteger(fromIndex)" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/length.js b/test/built-ins/TypedArray/prototype/includes/BigInt/length.js new file mode 100644 index 000000000..9f7938791 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.includes +description: > + %TypedArray%.prototype.includes.length is 1. +info: | + %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.includes.length, 1); + +verifyNotEnumerable(TypedArray.prototype.includes, "length"); +verifyNotWritable(TypedArray.prototype.includes, "length"); +verifyConfigurable(TypedArray.prototype.includes, "length"); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/name.js b/test/built-ins/TypedArray/prototype/includes/BigInt/name.js new file mode 100644 index 000000000..fdc316989 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.includes +description: > + %TypedArray%.prototype.includes.name is "includes". +info: | + %TypedArray%.prototype.includes (searchElement [ , fromIndex ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.includes.name, "includes"); + +verifyNotEnumerable(TypedArray.prototype.includes, "name"); +verifyNotWritable(TypedArray.prototype.includes, "name"); +verifyConfigurable(TypedArray.prototype.includes, "name"); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/includes/BigInt/prop-desc.js new file mode 100644 index 000000000..fcdef18da --- /dev/null +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/prop-desc.js @@ -0,0 +1,18 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.includes +description: > + "includes" property of TypedArrayPrototype +info: | + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, "includes"); +verifyWritable(TypedArrayPrototype, "includes"); +verifyConfigurable(TypedArrayPrototype, "includes"); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex-symbol.js b/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex-symbol.js new file mode 100644 index 000000000..33c8861ab --- /dev/null +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex-symbol.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.includes +description: Return abrupt from ToInteger(fromIndex) - using symbol +info: | + 22.2.3.13 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.includes is a distinct function that implements the + same algorithm as Array.prototype.includes as defined in 22.1.3.11 except that + the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.11 Array.prototype.includes ( searchElement [ , fromIndex ] ) + + ... + 4. Let n be ? ToInteger(fromIndex). (If fromIndex is undefined, this step + produces the value 0.) + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var fromIndex = Symbol("1"); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([7])); + + assert.throws(TypeError, function() { + sample.includes(convertToBigInt(7), fromIndex); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex.js new file mode 100644 index 000000000..6ddcb1f70 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.includes +description: Return abrupt from ToInteger(fromIndex) +info: | + 22.2.3.13 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.includes is a distinct function that implements the + same algorithm as Array.prototype.includes as defined in 22.1.3.11 except that + the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.11 Array.prototype.includes ( searchElement [ , fromIndex ] ) + + ... + 4. Let n be ? ToInteger(fromIndex). (If fromIndex is undefined, this step + produces the value 0.) + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var fromIndex = { + valueOf: function() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([7])); + + assert.throws(Test262Error, function() { + sample.includes(convertToBigInt(7), fromIndex); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/search-found-returns-true.js b/test/built-ins/TypedArray/prototype/includes/BigInt/search-found-returns-true.js new file mode 100644 index 000000000..f11212ce4 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/search-found-returns-true.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.includes +description: returns true for found index +info: | + 22.2.3.13 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.includes is a distinct function that implements the + same algorithm as Array.prototype.includes as defined in 22.1.3.11 except that + the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.11 Array.prototype.includes ( searchElement [ , fromIndex ] ) + + ... + 5. If n ≥ 0, then + a. Let k be n. + 6. Else n < 0, + a. Let k be len + n. + b. If k < 0, let k be 0. + 7. Repeat, while k < len + a. Let elementK be the result of ? Get(O, ! ToString(k)). + b. If SameValueZero(searchElement, elementK) is true, return true. + c. Increase k by 1. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 42, 41])); + assert.sameValue(sample.includes(convertToBigInt(42)), true, "includes(42)"); + assert.sameValue(sample.includes(convertToBigInt(43)), true, "includes(43)"); + assert.sameValue(sample.includes(convertToBigInt(43), 1), true, "includes(43, 1)"); + assert.sameValue(sample.includes(convertToBigInt(42), 1), true, "includes(42, 1)"); + assert.sameValue(sample.includes(convertToBigInt(42), 2), true, "includes(42, 2)"); + + assert.sameValue(sample.includes(convertToBigInt(42), -4), true, "includes(42, -4)"); + assert.sameValue(sample.includes(convertToBigInt(42), -3), true, "includes(42, -3)"); + assert.sameValue(sample.includes(convertToBigInt(42), -2), true, "includes(42, -2)"); + assert.sameValue(sample.includes(convertToBigInt(42), -5), true, "includes(42, -5)"); +}); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/search-not-found-returns-false.js b/test/built-ins/TypedArray/prototype/includes/BigInt/search-not-found-returns-false.js new file mode 100644 index 000000000..5bf3b9086 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/search-not-found-returns-false.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.includes +description: returns false if the element is not found +info: | + 22.2.3.13 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.includes is a distinct function that implements the + same algorithm as Array.prototype.includes as defined in 22.1.3.11 except that + the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.11 Array.prototype.includes ( searchElement [ , fromIndex ] ) + + ... + 5. If n ≥ 0, then + a. Let k be n. + 6. Else n < 0, + a. Let k be len + n. + b. If k < 0, let k be 0. + 7. Repeat, while k < len + a. Let elementK be the result of ? Get(O, ! ToString(k)). + b. If SameValueZero(searchElement, elementK) is true, return true. + c. Increase k by 1. + 8. Return false. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample; + + sample = new TA(convertToBigInt([42, 43, 42, 41])); + assert.sameValue(sample.includes(convertToBigInt(44)), false, "includes(44)"); + assert.sameValue(sample.includes(convertToBigInt(43), 2), false, "includes(43, 2)"); + assert.sameValue(sample.includes(convertToBigInt(42), 3), false, "includes(42, 3)"); + assert.sameValue(sample.includes(convertToBigInt(44), -4), false, "includes(44, -4)"); + assert.sameValue(sample.includes(convertToBigInt(44), -5), false, "includes(44, -5)"); + assert.sameValue(sample.includes(convertToBigInt(42), -1), false, "includes(42, -1)"); +}); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/includes/BigInt/this-is-not-object.js new file mode 100644 index 000000000..2bee1f2f3 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/this-is-not-object.js @@ -0,0 +1,51 @@ +// 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.3.14 +esid: sec-%typedarray%.prototype.includes +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.14 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var includes = TypedArray.prototype.includes; + +assert.throws(TypeError, function() { + includes.call(undefined, 42); +}, "this is undefined"); + +assert.throws(TypeError, function() { + includes.call(null, 42); +}, "this is null"); + +assert.throws(TypeError, function() { + includes.call(42, 42); +}, "this is 42"); + +assert.throws(TypeError, function() { + includes.call("1", 42); +}, "this is a string"); + +assert.throws(TypeError, function() { + includes.call(true, 42); +}, "this is true"); + +assert.throws(TypeError, function() { + includes.call(false, 42); +}, "this is false"); + +var s = Symbol("s"); +assert.throws(TypeError, function() { + includes.call(s, 42); +}, "this is a Symbol"); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/includes/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..713fe26dd --- /dev/null +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.includes +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.14 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var includes = TypedArray.prototype.includes; + +assert.throws(TypeError, function() { + includes.call({}, 42); +}, "this is an Object"); + +assert.throws(TypeError, function() { + includes.call([], 42); +}, "this is an Array"); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + includes.call(ab, 42); +}, "this is an ArrayBuffer instance"); + +var dv = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + includes.call(dv, 42); +}, "this is a DataView instance"); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/includes/BigInt/tointeger-fromindex.js new file mode 100644 index 000000000..67fbd38da --- /dev/null +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/tointeger-fromindex.js @@ -0,0 +1,65 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.includes +description: get the integer value from fromIndex +info: | + 22.2.3.13 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.includes is a distinct function that implements the + same algorithm as Array.prototype.includes as defined in 22.1.3.11 except that + the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.11 Array.prototype.includes ( searchElement [ , fromIndex ] ) + + ... + 4. Let n be ? ToInteger(fromIndex). (If fromIndex is undefined, this step + produces the value 0.) + 5. If n ≥ 0, then + a. Let k be n. + ... + 7. Repeat, while k < len + a. Let elementK be the result of ? Get(O, ! ToString(k)). + b. If SameValueZero(searchElement, elementK) is true, return true. + c. Increase k by 1. + 8. Return false. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var obj = { + valueOf: function() { + return 1; + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample; + + sample = new TA(convertToBigInt([42, 43])); + assert.sameValue(sample.includes(convertToBigInt(42), "1"), false, "string [0]"); + assert.sameValue(sample.includes(convertToBigInt(43), "1"), true, "string [1]"); + + assert.sameValue(sample.includes(convertToBigInt(42), true), false, "true [0]"); + assert.sameValue(sample.includes(convertToBigInt(43), true), true, "true [1]"); + + assert.sameValue(sample.includes(convertToBigInt(42), false), true, "false [0]"); + assert.sameValue(sample.includes(convertToBigInt(43), false), true, "false [1]"); + + assert.sameValue(sample.includes(convertToBigInt(42), NaN), true, "NaN [0]"); + assert.sameValue(sample.includes(convertToBigInt(43), NaN), true, "NaN [1]"); + + assert.sameValue(sample.includes(convertToBigInt(42), null), true, "null [0]"); + assert.sameValue(sample.includes(convertToBigInt(43), null), true, "null [1]"); + + assert.sameValue(sample.includes(convertToBigInt(42), undefined), true, "undefined [0]"); + assert.sameValue(sample.includes(convertToBigInt(43), undefined), true, "undefined [1]"); + + assert.sameValue(sample.includes(convertToBigInt(42), null), true, "null [0]"); + assert.sameValue(sample.includes(convertToBigInt(43), null), true, "null [1]"); + + assert.sameValue(sample.includes(convertToBigInt(42), obj), false, "object [0]"); + assert.sameValue(sample.includes(convertToBigInt(43), obj), true, "object [1]"); +}); diff --git a/test/built-ins/TypedArray/prototype/includes/samevaluezero.js b/test/built-ins/TypedArray/prototype/includes/samevaluezero.js index c06e20b1a..c6ad3785b 100644 --- a/test/built-ins/TypedArray/prototype/includes/samevaluezero.js +++ b/test/built-ins/TypedArray/prototype/includes/samevaluezero.js @@ -36,9 +36,7 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(sample.includes(false), false, "false"); assert.sameValue(sample.includes(null), false, "null"); assert.sameValue(sample.includes(""), false, "empty string"); -}, - // ToBigInt(undefined) throws a TypeError exception. - numericTypedArrayConstructors); +}); testWithTypedArrayConstructors(function(FloatArray) { var sample = new FloatArray([42, 0, 1, undefined, NaN]); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/detached-buffer.js new file mode 100644 index 000000000..1d44ab16d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/detached-buffer.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.indexof +description: Throws a TypeError if this has a detached buffer +info: | + 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + ... + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.indexOf(0); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-equal-or-greater-length-returns-minus-one.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-equal-or-greater-length-returns-minus-one.js new file mode 100644 index 000000000..022f4a156 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-equal-or-greater-length-returns-minus-one.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. +/*--- +esid: sec-%typedarray%.prototype.indexof +description: Return -1 if fromIndex >= ArrayLength +info: | + 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.indexOf is a distinct function that implements the same + algorithm as Array.prototype.indexOf as defined in 22.1.3.12 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.12 Array.prototype.indexOf ( searchElement [ , fromIndex ] ) + + ... + 4. Let n be ? ToInteger(fromIndex). (If fromIndex is undefined, this step + produces the value 0.) + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample; + + sample = new TA(42); + assert.sameValue(sample.indexOf(0, 42), -1); + assert.sameValue(sample.indexOf(0, 43), -1); +}); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-infinity.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-infinity.js new file mode 100644 index 000000000..38a6515cf --- /dev/null +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-infinity.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.indexof +description: handle Infinity values for fromIndex +info: | + 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.indexOf is a distinct function that implements the same + algorithm as Array.prototype.indexOf as defined in 22.1.3.12 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.12 Array.prototype.indexOf ( searchElement [ , fromIndex ] ) + + ... + 6. If n ≥ 0, then + a. If n is -0, let k be +0; else let k be n. + 7. Else n < 0, + a. Let k be len + n. + b. If k < 0, let k be 0. + 8. Repeat, while k < len + a. Let kPresent be ? HasProperty(O, ! ToString(k)). + b. If kPresent is true, then + i. Let elementK be ? Get(O, ! ToString(k)). + ii. Let same be the result of performing Strict Equality Comparison + searchElement === elementK. + iii. If same is true, return k. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 43, 41])); + + assert.sameValue(sample.indexOf(convertToBigInt(43), Infinity), -1, "indexOf(43, Infinity)"); + assert.sameValue(sample.indexOf(convertToBigInt(43), -Infinity), 1, "indexOf(43, -Infinity)"); +}); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-minus-zero.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-minus-zero.js new file mode 100644 index 000000000..bd141027d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-minus-zero.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. +/*--- +esid: sec-%typedarray%.prototype.indexof +description: -0 fromIndex becomes 0 +info: | + 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.indexOf is a distinct function that implements the same + algorithm as Array.prototype.indexOf as defined in 22.1.3.12 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.12 Array.prototype.indexOf ( searchElement [ , fromIndex ] ) + + ... + 6. If n ≥ 0, then + a. If n is -0, let k be +0; else let k be n. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample; + + sample = new TA(convertToBigInt([42, 43])); + assert.sameValue(sample.indexOf(convertToBigInt(42), -0), 0, "-0 [0]"); + assert.sameValue(sample.indexOf(convertToBigInt(43), -0), 1, "-0 [1]"); +}); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/get-length-uses-internal-arraylength.js new file mode 100644 index 000000000..61a961bd4 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/get-length-uses-internal-arraylength.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.indexof +description: Get "length" uses internal ArrayLength +info: | + 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.indexOf is a distinct function that implements the same + algorithm as Array.prototype.indexOf as defined in 22.1.3.12 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.12 Array.prototype.indexOf ( searchElement [ , fromIndex ] ) + + ... + 2. Let len be ? ToLength(? Get(O, "length")). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +Object.defineProperty(TypedArray.prototype, "length", {value: 0}); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([7])); + + Object.defineProperty(TA.prototype, "length", {value: 0}); + Object.defineProperty(sample, "length", {value: 0}); + + assert.sameValue(sample.indexOf(convertToBigInt(7)), 0); +}); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-func.js new file mode 100644 index 000000000..8134bac14 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-func.js @@ -0,0 +1,29 @@ +// 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.3.13 +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var indexOf = TypedArray.prototype.indexOf; + +assert.sameValue(typeof indexOf, 'function'); + +assert.throws(TypeError, function() { + indexOf(); +}); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-method.js new file mode 100644 index 000000000..6a87487b7 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-method.js @@ -0,0 +1,29 @@ +// 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.3.13 +description: Requires a [[TypedArrayName]] internal slot. +info: | + 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.indexOf, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.indexOf(); +}); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/length-zero-returns-minus-one.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/length-zero-returns-minus-one.js new file mode 100644 index 000000000..510a58f7b --- /dev/null +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/length-zero-returns-minus-one.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.indexof +description: Returns -1 if length is 0 +info: | + 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.indexOf is a distinct function that implements the same + algorithm as Array.prototype.indexOf as defined in 22.1.3.12 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.12 Array.prototype.indexOf ( searchElement [ , fromIndex ] ) + + ... + 2. Let len be ? ToLength(? Get(O, "length")). + 3. If len is 0, return -1. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var fromIndex = { + valueOf: function() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + assert.sameValue(sample.indexOf(0), -1, "returns -1"); + assert.sameValue( + sample.indexOf(0, fromIndex), -1, + "length is checked before ToInteger(fromIndex)" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/length.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/length.js new file mode 100644 index 000000000..fc4a0303d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.13 +description: > + %TypedArray%.prototype.indexOf.length is 1. +info: | + %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.indexOf.length, 1); + +verifyNotEnumerable(TypedArray.prototype.indexOf, "length"); +verifyNotWritable(TypedArray.prototype.indexOf, "length"); +verifyConfigurable(TypedArray.prototype.indexOf, "length"); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/name.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/name.js new file mode 100644 index 000000000..594595344 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.13 +description: > + %TypedArray%.prototype.indexOf.name is "indexOf". +info: | + %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.indexOf.name, "indexOf"); + +verifyNotEnumerable(TypedArray.prototype.indexOf, "name"); +verifyNotWritable(TypedArray.prototype.indexOf, "name"); +verifyConfigurable(TypedArray.prototype.indexOf, "name"); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/prop-desc.js new file mode 100644 index 000000000..a9454f493 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/prop-desc.js @@ -0,0 +1,18 @@ +// 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.3.13 +description: > + "indexOf" property of TypedArrayPrototype +info: | + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'indexOf'); +verifyWritable(TypedArrayPrototype, 'indexOf'); +verifyConfigurable(TypedArrayPrototype, 'indexOf'); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/return-abrupt-tointeger-fromindex-symbol.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/return-abrupt-tointeger-fromindex-symbol.js new file mode 100644 index 000000000..843a22a29 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/return-abrupt-tointeger-fromindex-symbol.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.indexof +description: Return abrupt from ToInteger(fromIndex) - using symbol +info: | + 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.indexOf is a distinct function that implements the same + algorithm as Array.prototype.indexOf as defined in 22.1.3.12 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.12 Array.prototype.indexOf ( searchElement [ , fromIndex ] ) + + ... + 4. Let n be ? ToInteger(fromIndex). (If fromIndex is undefined, this step + produces the value 0.) + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var fromIndex = Symbol("1"); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + + assert.throws(TypeError, function() { + sample.indexOf(7, fromIndex); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/return-abrupt-tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/return-abrupt-tointeger-fromindex.js new file mode 100644 index 000000000..751b482b9 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/return-abrupt-tointeger-fromindex.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.indexof +description: Return abrupt from ToInteger(fromIndex) +info: | + 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.indexOf is a distinct function that implements the same + algorithm as Array.prototype.indexOf as defined in 22.1.3.12 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.12 Array.prototype.indexOf ( searchElement [ , fromIndex ] ) + + ... + 4. Let n be ? ToInteger(fromIndex). (If fromIndex is undefined, this step + produces the value 0.) + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var fromIndex = { + valueOf: function() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + + assert.throws(Test262Error, function() { + sample.indexOf(7, fromIndex); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/search-found-returns-index.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/search-found-returns-index.js new file mode 100644 index 000000000..e932c2689 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/search-found-returns-index.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.indexof +description: returns index for the first found element +info: | + 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.indexOf is a distinct function that implements the same + algorithm as Array.prototype.indexOf as defined in 22.1.3.12 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.12 Array.prototype.indexOf ( searchElement [ , fromIndex ] ) + + ... + 6. If n ≥ 0, then + a. If n is -0, let k be +0; else let k be n. + 7. Else n < 0, + a. Let k be len + n. + b. If k < 0, let k be 0. + 8. Repeat, while k < len + a. Let kPresent be ? HasProperty(O, ! ToString(k)). + b. If kPresent is true, then + i. Let elementK be ? Get(O, ! ToString(k)). + ii. Let same be the result of performing Strict Equality Comparison + searchElement === elementK. + iii. If same is true, return k. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 42, 41])); + assert.sameValue(sample.indexOf(convertToBigInt(42)), 0, "indexOf(42)"); + assert.sameValue(sample.indexOf(convertToBigInt(43)), 1, "indexOf(43)"); + assert.sameValue(sample.indexOf(convertToBigInt(43), 1), 1, "indexOf(43, 1)"); + assert.sameValue(sample.indexOf(convertToBigInt(42), 1), 2, "indexOf(42, 1)"); + assert.sameValue(sample.indexOf(convertToBigInt(42), 2), 2, "indexOf(42, 2)"); + + assert.sameValue(sample.indexOf(convertToBigInt(42), -4), 0, "indexOf(42, -4)"); + assert.sameValue(sample.indexOf(convertToBigInt(42), -3), 2, "indexOf(42, -3)"); + assert.sameValue(sample.indexOf(convertToBigInt(42), -2), 2, "indexOf(42, -2)"); + assert.sameValue(sample.indexOf(convertToBigInt(42), -5), 0, "indexOf(42, -5)"); +}); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/search-not-found-returns-minus-one.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/search-not-found-returns-minus-one.js new file mode 100644 index 000000000..94dc9285e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/search-not-found-returns-minus-one.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.indexof +description: returns -1 if the element if not found +info: | + 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.indexOf is a distinct function that implements the same + algorithm as Array.prototype.indexOf as defined in 22.1.3.12 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.12 Array.prototype.indexOf ( searchElement [ , fromIndex ] ) + + ... + 6. If n ≥ 0, then + a. If n is -0, let k be +0; else let k be n. + 7. Else n < 0, + a. Let k be len + n. + b. If k < 0, let k be 0. + ... + 9. Return -1. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample; + + sample = new TA(convertToBigInt([42, 43, 42, 41])); + assert.sameValue(sample.indexOf(convertToBigInt(44)), -1, "indexOf(44)"); + assert.sameValue(sample.indexOf(convertToBigInt(43), 2), -1, "indexOf(43, 2)"); + assert.sameValue(sample.indexOf(convertToBigInt(42), 3), -1, "indexOf(42, 3)"); + assert.sameValue(sample.indexOf(convertToBigInt(44), -4), -1, "indexOf(44, -4)"); + assert.sameValue(sample.indexOf(convertToBigInt(44), -5), -1, "indexOf(44, -5)"); + assert.sameValue(sample.indexOf(convertToBigInt(42), -1), -1, "indexOf(42, -1)"); +}); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/this-is-not-object.js new file mode 100644 index 000000000..c572d7dd3 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/this-is-not-object.js @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.indexof +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var indexOf = TypedArray.prototype.indexOf; + +assert.throws(TypeError, function() { + indexOf.call(undefined, 42); +}, "this is undefined"); + +assert.throws(TypeError, function() { + indexOf.call(null, 42); +}, "this is null"); + +assert.throws(TypeError, function() { + indexOf.call(42, 42); +}, "this is 42"); + +assert.throws(TypeError, function() { + indexOf.call("1", 42); +}, "this is a string"); + +assert.throws(TypeError, function() { + indexOf.call(true, 42); +}, "this is true"); + +assert.throws(TypeError, function() { + indexOf.call(false, 42); +}, "this is false"); + +var s = Symbol("s"); +assert.throws(TypeError, function() { + indexOf.call(s, 42); +}, "this is a Symbol"); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..753fc3f79 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.indexof +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var indexOf = TypedArray.prototype.indexOf; + +assert.throws(TypeError, function() { + indexOf.call({}, 42); +}, "this is an Object"); + +assert.throws(TypeError, function() { + indexOf.call([], 42); +}, "this is an Array"); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + indexOf.call(ab, 42); +}, "this is an ArrayBuffer instance"); + +var dv = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + indexOf.call(dv, 42); +}, "this is a DataView instance"); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/tointeger-fromindex.js new file mode 100644 index 000000000..e338bf1a4 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/tointeger-fromindex.js @@ -0,0 +1,57 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.indexof +description: Return -1 if fromIndex >= ArrayLength - converted values +info: | + 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.indexOf is a distinct function that implements the same + algorithm as Array.prototype.indexOf as defined in 22.1.3.12 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.12 Array.prototype.indexOf ( searchElement [ , fromIndex ] ) + + ... + 4. Let n be ? ToInteger(fromIndex). (If fromIndex is undefined, this step + produces the value 0.) + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var obj = { + valueOf: function() { + return 1; + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample; + + sample = new TA(convertToBigInt([42, 43])); + assert.sameValue(sample.indexOf(convertToBigInt(42), "1"), -1, "string [0]"); + assert.sameValue(sample.indexOf(convertToBigInt(43), "1"), 1, "string [1]"); + + assert.sameValue(sample.indexOf(convertToBigInt(42), true), -1, "true [0]"); + assert.sameValue(sample.indexOf(convertToBigInt(43), true), 1, "true [1]"); + + assert.sameValue(sample.indexOf(convertToBigInt(42), false), 0, "false [0]"); + assert.sameValue(sample.indexOf(convertToBigInt(43), false), 1, "false [1]"); + + assert.sameValue(sample.indexOf(convertToBigInt(42), NaN), 0, "NaN [0]"); + assert.sameValue(sample.indexOf(convertToBigInt(43), NaN), 1, "NaN [1]"); + + assert.sameValue(sample.indexOf(convertToBigInt(42), null), 0, "null [0]"); + assert.sameValue(sample.indexOf(convertToBigInt(43), null), 1, "null [1]"); + + assert.sameValue(sample.indexOf(convertToBigInt(42), undefined), 0, "undefined [0]"); + assert.sameValue(sample.indexOf(convertToBigInt(43), undefined), 1, "undefined [1]"); + + assert.sameValue(sample.indexOf(convertToBigInt(42), null), 0, "null [0]"); + assert.sameValue(sample.indexOf(convertToBigInt(43), null), 1, "null [1]"); + + assert.sameValue(sample.indexOf(convertToBigInt(42), obj), -1, "object [0]"); + assert.sameValue(sample.indexOf(convertToBigInt(43), obj), 1, "object [1]"); +}); diff --git a/test/built-ins/TypedArray/prototype/indexOf/strict-comparison.js b/test/built-ins/TypedArray/prototype/indexOf/strict-comparison.js index ddd3540f8..5a7883f97 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/strict-comparison.js +++ b/test/built-ins/TypedArray/prototype/indexOf/strict-comparison.js @@ -38,6 +38,4 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(sample.indexOf(null), -1, "null"); assert.sameValue(sample.indexOf(undefined), -1, "undefined"); assert.sameValue(sample.indexOf(""), -1, "empty string"); -}, - // Cannot create Big*64Arrays from non-safe integers. - numericTypedArrayConstructors); +}); diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/custom-separator-result-from-tostring-on-each-simple-value.js b/test/built-ins/TypedArray/prototype/join/BigInt/custom-separator-result-from-tostring-on-each-simple-value.js new file mode 100644 index 000000000..2f611e46f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/join/BigInt/custom-separator-result-from-tostring-on-each-simple-value.js @@ -0,0 +1,78 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.join +description: > + Concatenates the result of toString for each value with custom separator +info: | + 22.2.3.15 %TypedArray%.prototype.join ( separator ) + + %TypedArray%.prototype.join is a distinct function that implements the same + algorithm as Array.prototype.join as defined in 22.1.3.13 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.13 Array.prototype.join (separator) + + ... + 7. If element0 is undefined or null, let R be the empty String; otherwise, let + R be ? ToString(element0). + 8. Let k be 1. + 9. Repeat, while k < len + a. Let S be the String value produced by concatenating R and sep. + b. Let element be ? Get(O, ! ToString(k)). + c. If element is undefined or null, let next be the empty String; otherwise, + let next be ? ToString(element). + d. Let R be a String value produced by concatenating S and next. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([1, 0, 2, 3, 42, 127])); + + var result; + + result = sample.join(","); + assert.sameValue(result, "1,0,2,3,42,127"); + + result = sample.join(undefined); + assert.sameValue(result, "1,0,2,3,42,127"); + + result = sample.join(null); + assert.sameValue(result, "1null0null2null3null42null127"); + + result = sample.join(",,"); + assert.sameValue(result, "1,,0,,2,,3,,42,,127"); + + result = sample.join(0); + assert.sameValue(result, "10002030420127"); + + result = sample.join(""); + assert.sameValue(result, "102342127"); + + result = sample.join(" a b c "); + assert.sameValue(result, "1 a b c 0 a b c 2 a b c 3 a b c 42 a b c 127"); + + result = sample.join({}); + assert.sameValue(result, "1[object Object]0[object Object]2[object Object]3[object Object]42[object Object]127"); + + result = sample.join(true); + assert.sameValue(result, "1true0true2true3true42true127"); + + result = sample.join({ toString: function() { return "foo"; }}); + assert.sameValue(result, "1foo0foo2foo3foo42foo127"); + + result = sample.join({ toString: undefined, valueOf: function() { return "bar"; }}); + assert.sameValue(result, "1bar0bar2bar3bar42bar127"); + + result = sample.join(false); + assert.sameValue(result, "1false0false2false3false42false127"); + + result = sample.join(-1); + assert.sameValue(result, "1-10-12-13-142-1127"); + + result = sample.join(-0); + assert.sameValue(result, "10002030420127"); +}); diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/join/BigInt/detached-buffer.js new file mode 100644 index 000000000..1af7ae94c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/join/BigInt/detached-buffer.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.join +description: Throws a TypeError if this has a detached buffer +info: | + 22.2.3.15 %TypedArray%.prototype.join ( separator ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + ... + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +var obj = { + toString: function() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.join(obj); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/empty-instance-empty-string.js b/test/built-ins/TypedArray/prototype/join/BigInt/empty-instance-empty-string.js new file mode 100644 index 000000000..a7103a83e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/join/BigInt/empty-instance-empty-string.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.join +description: Return the empty String if length is 0 +info: | + 22.2.3.15 %TypedArray%.prototype.join ( separator ) + + %TypedArray%.prototype.join is a distinct function that implements the same + algorithm as Array.prototype.join as defined in 22.1.3.13 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.13 Array.prototype.join (separator) + + ... + 4. Let sep be ? ToString(separator). + 5. If len is zero, return the empty String. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + + assert.sameValue(sample.join(), ""); + assert.sameValue(sample.join("test262"), ""); +}); diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/join/BigInt/get-length-uses-internal-arraylength.js new file mode 100644 index 000000000..24ca6f0e3 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/join/BigInt/get-length-uses-internal-arraylength.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.join +description: Get "length" uses internal ArrayLength +info: | + 22.2.3.15 %TypedArray%.prototype.join ( separator ) + + %TypedArray%.prototype.join is a distinct function that implements the same + algorithm as Array.prototype.join as defined in 22.1.3.13 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.13 Array.prototype.join (separator) + + 1. Let O be ? ToObject(this value). + 2. Let len be ? ToLength(? Get(O, "length")). + ... + 5. If len is zero, return the empty String. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var getCalls = 0; +var desc = { + get: function getLen() { + getCalls++; + return 0; + } +}; + +Object.defineProperty(TypedArray.prototype, "length", desc); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + + Object.defineProperty(TA.prototype, "length", desc); + Object.defineProperty(sample, "length", desc); + + var result = sample.join(); + + assert.sameValue(getCalls, 0, "ignores length properties"); + assert.notSameValue(result, "", "result is not affected but custom length 0"); +}); diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-func.js new file mode 100644 index 000000000..f2bab1f7f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-func.js @@ -0,0 +1,29 @@ +// 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.3.14 +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.14 %TypedArray%.prototype.join ( separator ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var join = TypedArray.prototype.join; + +assert.sameValue(typeof join, 'function'); + +assert.throws(TypeError, function() { + join(); +}); diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-method.js new file mode 100644 index 000000000..11bf0beda --- /dev/null +++ b/test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-method.js @@ -0,0 +1,29 @@ +// 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.3.14 +description: Requires a [[TypedArrayName]] internal slot. +info: | + 22.2.3.14 %TypedArray%.prototype.join ( separator ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.join, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.join(); +}); diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/length.js b/test/built-ins/TypedArray/prototype/join/BigInt/length.js new file mode 100644 index 000000000..540d1aba3 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/join/BigInt/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.14 +description: > + %TypedArray%.prototype.join.length is 1. +info: | + %TypedArray%.prototype.join ( separator ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.join.length, 1); + +verifyNotEnumerable(TypedArray.prototype.join, "length"); +verifyNotWritable(TypedArray.prototype.join, "length"); +verifyConfigurable(TypedArray.prototype.join, "length"); diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/name.js b/test/built-ins/TypedArray/prototype/join/BigInt/name.js new file mode 100644 index 000000000..dea31a3c7 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/join/BigInt/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.14 +description: > + %TypedArray%.prototype.join.name is "join". +info: | + %TypedArray%.prototype.join ( separator ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.join.name, "join"); + +verifyNotEnumerable(TypedArray.prototype.join, "name"); +verifyNotWritable(TypedArray.prototype.join, "name"); +verifyConfigurable(TypedArray.prototype.join, "name"); diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/join/BigInt/prop-desc.js new file mode 100644 index 000000000..2102a0b24 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/join/BigInt/prop-desc.js @@ -0,0 +1,18 @@ +// 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.3.14 +description: > + "join" property of TypedArrayPrototype +info: | + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'join'); +verifyWritable(TypedArrayPrototype, 'join'); +verifyConfigurable(TypedArrayPrototype, 'join'); diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/result-from-tostring-on-each-simple-value.js b/test/built-ins/TypedArray/prototype/join/BigInt/result-from-tostring-on-each-simple-value.js new file mode 100644 index 000000000..186585603 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/join/BigInt/result-from-tostring-on-each-simple-value.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.join +description: Concatenates the result of toString for each simple value +info: | + 22.2.3.15 %TypedArray%.prototype.join ( separator ) + + %TypedArray%.prototype.join is a distinct function that implements the same + algorithm as Array.prototype.join as defined in 22.1.3.13 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.13 Array.prototype.join (separator) + + ... + 7. If element0 is undefined or null, let R be the empty String; otherwise, let + R be ? ToString(element0). + 8. Let k be 1. + 9. Repeat, while k < len + a. Let S be the String value produced by concatenating R and sep. + b. Let element be ? Get(O, ! ToString(k)). + c. If element is undefined or null, let next be the empty String; otherwise, + let next be ? ToString(element). + d. Let R be a String value produced by concatenating S and next. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([1, 0, 2, 3, 42, 127])); + + var result = sample.join(); + + assert.sameValue(result, "1,0,2,3,42,127"); +}); diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/return-abrupt-from-separator-symbol.js b/test/built-ins/TypedArray/prototype/join/BigInt/return-abrupt-from-separator-symbol.js new file mode 100644 index 000000000..fe27585b2 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/join/BigInt/return-abrupt-from-separator-symbol.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.join +description: Return abrupt from ToString(Symbol separator) +info: | + 22.2.3.15 %TypedArray%.prototype.join ( separator ) + + %TypedArray%.prototype.join is a distinct function that implements the same + algorithm as Array.prototype.join as defined in 22.1.3.13 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.13 Array.prototype.join (separator) + + ... + 4. Let sep be ? ToString(separator). + 5. If len is zero, return the empty String. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var s = Symbol(""); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + + assert.throws(TypeError, function() { + sample.join(s); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/return-abrupt-from-separator.js b/test/built-ins/TypedArray/prototype/join/BigInt/return-abrupt-from-separator.js new file mode 100644 index 000000000..beb8d16b0 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/join/BigInt/return-abrupt-from-separator.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.join +description: Return abrupt from ToString(separator) +info: | + 22.2.3.15 %TypedArray%.prototype.join ( separator ) + + %TypedArray%.prototype.join is a distinct function that implements the same + algorithm as Array.prototype.join as defined in 22.1.3.13 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.13 Array.prototype.join (separator) + + ... + 4. Let sep be ? ToString(separator). + 5. If len is zero, return the empty String. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var obj = { + toString: function() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + + assert.throws(Test262Error, function() { + sample.join(obj); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/join/BigInt/this-is-not-object.js new file mode 100644 index 000000000..6f04ef810 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/join/BigInt/this-is-not-object.js @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.join +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.15 %TypedArray%.prototype.join ( separator ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var join = TypedArray.prototype.join; + +assert.throws(TypeError, function() { + join.call(undefined, ""); +}, "this is undefined"); + +assert.throws(TypeError, function() { + join.call(null, ""); +}, "this is null"); + +assert.throws(TypeError, function() { + join.call(42, ""); +}, "this is 42"); + +assert.throws(TypeError, function() { + join.call("1", ""); +}, "this is a string"); + +assert.throws(TypeError, function() { + join.call(true, ""); +}, "this is true"); + +assert.throws(TypeError, function() { + join.call(false, ""); +}, "this is false"); + +var s = Symbol("s"); +assert.throws(TypeError, function() { + join.call(s, ""); +}, "this is a Symbol"); diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/join/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..582c99f3d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/join/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.join +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.15 %TypedArray%.prototype.join ( separator ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var join = TypedArray.prototype.join; + +assert.throws(TypeError, function() { + join.call({}, ""); +}, "this is an Object"); + +assert.throws(TypeError, function() { + join.call([], ""); +}, "this is an Array"); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + join.call(ab, ""); +}, "this is an ArrayBuffer instance"); + +var dv = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + join.call(dv, ""); +}, "this is a DataView instance"); diff --git a/test/built-ins/TypedArray/prototype/join/custom-separator-result-from-tostring-on-each-value.js b/test/built-ins/TypedArray/prototype/join/custom-separator-result-from-tostring-on-each-value.js index d135c173f..94caedf65 100644 --- a/test/built-ins/TypedArray/prototype/join/custom-separator-result-from-tostring-on-each-value.js +++ b/test/built-ins/TypedArray/prototype/join/custom-separator-result-from-tostring-on-each-value.js @@ -132,6 +132,4 @@ testWithTypedArrayConstructors(function(TA) { }).join(separator); result = sample.join(separator); assert.sameValue(result, expected, "using: " + separator); -}, - // Cannot create Big*64Arrays from non-safe integers. - numericTypedArrayConstructors); +}); diff --git a/test/built-ins/TypedArray/prototype/join/result-from-tostring-on-each-value.js b/test/built-ins/TypedArray/prototype/join/result-from-tostring-on-each-value.js index df27d079c..d3d699ffa 100644 --- a/test/built-ins/TypedArray/prototype/join/result-from-tostring-on-each-value.js +++ b/test/built-ins/TypedArray/prototype/join/result-from-tostring-on-each-value.js @@ -41,6 +41,4 @@ testWithTypedArrayConstructors(function(TA) { var result = sample.join(); assert.sameValue(result, expected); -}, - // Cannot construct Big*64Arrays from non-safe integers. - numericTypedArrayConstructors); +}); diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/keys/BigInt/detached-buffer.js new file mode 100644 index 000000000..90189e441 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/keys/BigInt/detached-buffer.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.keys +description: Throws a TypeError if this has a detached buffer +info: | + 22.2.3.16 %TypedArray%.prototype.keys ( ) + + 1. Let O be the this value. + 2. Perform ? ValidateTypedArray(O). + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + ... + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.keys(); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-func.js new file mode 100644 index 000000000..f96271997 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-func.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. +/*--- +es6id: 22.2.3.15 +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.15 %TypedArray%.prototype.keys ( ) + + 1. Let O be the this value. + 2. Let valid be ValidateTypedArray(O). + 3. ReturnIfAbrupt(valid). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var keys = TypedArray.prototype.keys; + +assert.sameValue(typeof keys, 'function'); + +assert.throws(TypeError, function() { + keys(); +}); diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-method.js new file mode 100644 index 000000000..ca9b0d663 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-method.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. +/*--- +es6id: 22.2.3.15 +description: Requires a [[TypedArrayName]] internal slot. +info: | + 22.2.3.15 %TypedArray%.prototype.keys ( ) + + 1. Let O be the this value. + 2. Let valid be ValidateTypedArray(O). + 3. ReturnIfAbrupt(valid). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.keys, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.keys(); +}); diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/iter-prototype.js b/test/built-ins/TypedArray/prototype/keys/BigInt/iter-prototype.js new file mode 100644 index 000000000..fd5e0a5ec --- /dev/null +++ b/test/built-ins/TypedArray/prototype/keys/BigInt/iter-prototype.js @@ -0,0 +1,25 @@ +// 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.3.16 +esid: sec-%typedarray%.prototype.keys +description: > + The prototype of the returned iterator is ArrayIteratorPrototype +info: | + 22.2.3.16 %TypedArray%.prototype.keys ( ) + + ... + 3. Return CreateArrayIterator(O, "key"). +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.iterator, TypedArray] +---*/ + +var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]()); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([0, 42, 64])); + var iter = sample.keys(); + + assert.sameValue(Object.getPrototypeOf(iter), ArrayIteratorProto); +}); diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/length.js b/test/built-ins/TypedArray/prototype/keys/BigInt/length.js new file mode 100644 index 000000000..39d20e5e2 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/keys/BigInt/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.15 +description: > + %TypedArray%.prototype.keys.length is 0. +info: | + %TypedArray%.prototype.keys ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.keys.length, 0); + +verifyNotEnumerable(TypedArray.prototype.keys, "length"); +verifyNotWritable(TypedArray.prototype.keys, "length"); +verifyConfigurable(TypedArray.prototype.keys, "length"); diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/name.js b/test/built-ins/TypedArray/prototype/keys/BigInt/name.js new file mode 100644 index 000000000..2cd9e67d4 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/keys/BigInt/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.15 +description: > + %TypedArray%.prototype.keys.name is "keys". +info: | + %TypedArray%.prototype.keys ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.keys.name, "keys"); + +verifyNotEnumerable(TypedArray.prototype.keys, "name"); +verifyNotWritable(TypedArray.prototype.keys, "name"); +verifyConfigurable(TypedArray.prototype.keys, "name"); diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/keys/BigInt/prop-desc.js new file mode 100644 index 000000000..669d27257 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/keys/BigInt/prop-desc.js @@ -0,0 +1,18 @@ +// 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.3.15 +description: > + "keys" property of TypedArrayPrototype +info: | + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'keys'); +verifyWritable(TypedArrayPrototype, 'keys'); +verifyConfigurable(TypedArrayPrototype, 'keys'); diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/return-itor.js b/test/built-ins/TypedArray/prototype/keys/BigInt/return-itor.js new file mode 100644 index 000000000..e4bc1b0ba --- /dev/null +++ b/test/built-ins/TypedArray/prototype/keys/BigInt/return-itor.js @@ -0,0 +1,37 @@ +// 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.3.16 +esid: sec-%typedarray%.prototype.keys +description: Return an iterator for the keys. +info: | + 22.2.3.16 %TypedArray%.prototype.keys ( ) + + ... + 3. Return CreateArrayIterator(O, "key"). +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var sample = [0, 42, 64]; + +testWithBigIntTypedArrayConstructors(function(TA) { + var typedArray = new TA(convertToBigInt(sample)); + var itor = typedArray.keys(); + + var next = itor.next(); + assert.sameValue(next.value, 0); + assert.sameValue(next.done, false); + + next = itor.next(); + assert.sameValue(next.value, 1); + assert.sameValue(next.done, false); + + next = itor.next(); + assert.sameValue(next.value, 2); + assert.sameValue(next.done, false); + + next = itor.next(); + assert.sameValue(next.value, undefined); + assert.sameValue(next.done, true); +}); diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/keys/BigInt/this-is-not-object.js new file mode 100644 index 000000000..7fd0c8f05 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/keys/BigInt/this-is-not-object.js @@ -0,0 +1,52 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.keys +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.16 %TypedArray%.prototype.keys ( ) + + The following steps are taken: + + 1. Let O be the this value. + 2. Perform ? ValidateTypedArray(O). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var keys = TypedArray.prototype.keys; + +assert.throws(TypeError, function() { + keys.call(undefined); +}, "this is undefined"); + +assert.throws(TypeError, function() { + keys.call(null); +}, "this is null"); + +assert.throws(TypeError, function() { + keys.call(42); +}, "this is 42"); + +assert.throws(TypeError, function() { + keys.call("1"); +}, "this is a string"); + +assert.throws(TypeError, function() { + keys.call(true); +}, "this is true"); + +assert.throws(TypeError, function() { + keys.call(false); +}, "this is false"); + +var s = Symbol("s"); +assert.throws(TypeError, function() { + keys.call(s); +}, "this is a Symbol"); diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/keys/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..6978bfb3d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/keys/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.keys +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.16 %TypedArray%.prototype.keys ( ) + + The following steps are taken: + + 1. Let O be the this value. + 2. Perform ? ValidateTypedArray(O). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var keys = TypedArray.prototype.keys; + +assert.throws(TypeError, function() { + keys.call({}); +}, "this is an Object"); + +assert.throws(TypeError, function() { + keys.call([]); +}, "this is an Array"); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + keys.call(ab); +}, "this is an ArrayBuffer instance"); + +var dv = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + keys.call(dv); +}, "this is a DataView instance"); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/detached-buffer.js new file mode 100644 index 000000000..616f96ce5 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/detached-buffer.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.lastindexof +description: Throws a TypeError if this has a detached buffer +info: | + 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + ... + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.lastIndexOf(0); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-infinity.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-infinity.js new file mode 100644 index 000000000..d7c28b130 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-infinity.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.lastindexof +description: handle Infinity values for fromIndex +info: | + 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.lastIndexOf is a distinct function that implements the + same algorithm as Array.prototype.lastIndexOf as defined in 22.1.3.15 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + ... + 5. If n ≥ 0, then + a. If n is -0, let k be +0; else let k be min(n, len - 1). + 6. Else n < 0, + a. Let k be len + n. + 7. Repeat, while k ≥ 0 + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 43, 41])); + + assert.sameValue(sample.lastIndexOf(convertToBigInt(43), Infinity), 2, "lastIndexOf(43, Infinity)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(43), -Infinity), -1, "lastIndexOf(43, -Infinity)"); +}); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-minus-zero.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-minus-zero.js new file mode 100644 index 000000000..284d49930 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-minus-zero.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. +/*--- +esid: sec-%typedarray%.prototype.lastindexof +description: -0 fromIndex becomes 0 +info: | + 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.lastIndexOf is a distinct function that implements the + same algorithm as Array.prototype.lastIndexOf as defined in 22.1.3.15 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + ... + 5. If n ≥ 0, then + a. If n is -0, let k be +0; else let k be min(n, len - 1). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample; + + sample = new TA(convertToBigInt([42, 43])); + assert.sameValue(sample.lastIndexOf(convertToBigInt(42), -0), 0, "-0 [0]"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(43), -0), -1, "-0 [1]"); +}); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/get-length-uses-internal-arraylength.js new file mode 100644 index 000000000..2b4daf2dd --- /dev/null +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/get-length-uses-internal-arraylength.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.lastindexof +description: Get "length" uses internal ArrayLength +info: | + 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.lastIndexOf is a distinct function that implements the + same algorithm as Array.prototype.lastIndexOf as defined in 22.1.3.15 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + ... + 2. Let len be ? ToLength(? Get(O, "length")). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +Object.defineProperty(TypedArray.prototype, "length", {value: 0}); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([7])); + + Object.defineProperty(TA.prototype, "length", {value: 0}); + Object.defineProperty(sample, "length", {value: 0}); + + assert.sameValue(sample.lastIndexOf(convertToBigInt(7)), 0); +}); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-func.js new file mode 100644 index 000000000..d36811f90 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-func.js @@ -0,0 +1,29 @@ +// 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.3.16 +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.16 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var lastIndexOf = TypedArray.prototype.lastIndexOf; + +assert.sameValue(typeof lastIndexOf, 'function'); + +assert.throws(TypeError, function() { + lastIndexOf(); +}); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-method.js new file mode 100644 index 000000000..ec03407bb --- /dev/null +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-method.js @@ -0,0 +1,29 @@ +// 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.3.16 +description: Requires a [[TypedArrayName]] internal slot. +info: | + 22.2.3.16 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.lastIndexOf, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.lastIndexOf(); +}); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length-zero-returns-minus-one.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length-zero-returns-minus-one.js new file mode 100644 index 000000000..07fc5da72 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length-zero-returns-minus-one.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.lastindexof +description: Returns -1 if length is 0 +info: | + 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.lastIndexOf is a distinct function that implements the + same algorithm as Array.prototype.lastIndexOf as defined in 22.1.3.15 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + ... + 2. Let len be ? ToLength(? Get(O, "length")). + 3. If len is 0, return -1. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var fromIndex = { + valueOf: function() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + assert.sameValue(sample.lastIndexOf(0), -1, "returns -1"); + assert.sameValue( + sample.lastIndexOf(0, fromIndex), -1, + "length is checked before ToInteger(fromIndex)" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length.js new file mode 100644 index 000000000..809454a16 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.16 +description: > + %TypedArray%.prototype.lastIndexOf.length is 1. +info: | + %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.lastIndexOf.length, 1); + +verifyNotEnumerable(TypedArray.prototype.lastIndexOf, "length"); +verifyNotWritable(TypedArray.prototype.lastIndexOf, "length"); +verifyConfigurable(TypedArray.prototype.lastIndexOf, "length"); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/name.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/name.js new file mode 100644 index 000000000..4e500aaf4 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.16 +description: > + %TypedArray%.prototype.lastIndexOf.name is "lastIndexOf". +info: | + %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.lastIndexOf.name, "lastIndexOf"); + +verifyNotEnumerable(TypedArray.prototype.lastIndexOf, "name"); +verifyNotWritable(TypedArray.prototype.lastIndexOf, "name"); +verifyConfigurable(TypedArray.prototype.lastIndexOf, "name"); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/prop-desc.js new file mode 100644 index 000000000..0b5ab2e59 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/prop-desc.js @@ -0,0 +1,18 @@ +// 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.3.16 +description: > + "lastIndexOf" property of TypedArrayPrototype +info: | + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'lastIndexOf'); +verifyWritable(TypedArrayPrototype, 'lastIndexOf'); +verifyConfigurable(TypedArrayPrototype, 'lastIndexOf'); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/return-abrupt-tointeger-fromindex-symbol.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/return-abrupt-tointeger-fromindex-symbol.js new file mode 100644 index 000000000..67c1ea4c6 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/return-abrupt-tointeger-fromindex-symbol.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.lastindexof +description: Return abrupt from ToInteger(fromIndex) - using symbol +info: | + 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.lastIndexOf is a distinct function that implements the + same algorithm as Array.prototype.lastIndexOf as defined in 22.1.3.15 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + ... + 4. If argument fromIndex was passed, let n be ? ToInteger(fromIndex); else let + n be len-1. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var fromIndex = Symbol("1"); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + + assert.throws(TypeError, function() { + sample.lastIndexOf(7, fromIndex); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/return-abrupt-tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/return-abrupt-tointeger-fromindex.js new file mode 100644 index 000000000..2f3465b34 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/return-abrupt-tointeger-fromindex.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.lastindexof +description: Return abrupt from ToInteger(fromIndex) +info: | + 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.lastIndexOf is a distinct function that implements the + same algorithm as Array.prototype.lastIndexOf as defined in 22.1.3.15 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + ... + 4. If argument fromIndex was passed, let n be ? ToInteger(fromIndex); else let + n be len-1. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var fromIndex = { + valueOf: function() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + + assert.throws(Test262Error, function() { + sample.lastIndexOf(7, fromIndex); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-found-returns-index.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-found-returns-index.js new file mode 100644 index 000000000..255672fa4 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-found-returns-index.js @@ -0,0 +1,57 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.lastindexof +description: returns index for the first found element +info: | + 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.lastIndexOf is a distinct function that implements the + same algorithm as Array.prototype.lastIndexOf as defined in 22.1.3.15 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + ... + 5. If n ≥ 0, then + a. If n is -0, let k be +0; else let k be min(n, len - 1). + 6. Else n < 0, + a. Let k be len + n. + 7. Repeat, while k ≥ 0 + a. Let kPresent be ? HasProperty(O, ! ToString(k)). + b. If kPresent is true, then + i. Let elementK be ? Get(O, ! ToString(k)). + ii. Let same be the result of performing Strict Equality Comparison + searchElement === elementK. + iii. If same is true, return k. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 42, 41])); + assert.sameValue(sample.lastIndexOf(convertToBigInt(42)), 2, "lastIndexOf(42)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(43)), 1, "lastIndexOf(43)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(41)), 3, "lastIndexOf(41)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(41), 3), 3, "lastIndexOf(41, 3)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(41), 4), 3, "lastIndexOf(41, 4)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(43), 1), 1, "lastIndexOf(43, 1)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(43), 2), 1, "lastIndexOf(43, 2)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(43), 3), 1, "lastIndexOf(43, 3)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(43), 4), 1, "lastIndexOf(43, 4)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(42), 0), 0, "lastIndexOf(42, 0)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(42), 1), 0, "lastIndexOf(42, 1)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(42), 2), 2, "lastIndexOf(42, 2)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(42), 3), 2, "lastIndexOf(42, 3)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(42), 4), 2, "lastIndexOf(42, 4)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(42), -4), 0, "lastIndexOf(42, -4)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(42), -3), 0, "lastIndexOf(42, -3)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(42), -2), 2, "lastIndexOf(42, -2)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(42), -1), 2, "lastIndexOf(42, -1)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(43), -3), 1, "lastIndexOf(43, -3)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(43), -2), 1, "lastIndexOf(43, -2)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(43), -1), 1, "lastIndexOf(43, -1)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(41), -1), 3, "lastIndexOf(41, -1)"); +}); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-not-found-returns-minus-one.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-not-found-returns-minus-one.js new file mode 100644 index 000000000..d53260ab8 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-not-found-returns-minus-one.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.lastindexof +description: returns -1 if the element if not found +info: | + 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.lastIndexOf is a distinct function that implements the + same algorithm as Array.prototype.lastIndexOf as defined in 22.1.3.15 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + ... + 5. If n ≥ 0, then + a. If n is -0, let k be +0; else let k be min(n, len - 1). + 6. Else n < 0, + a. Let k be len + n. + 7. Repeat, while k ≥ 0 + ... + 8. Return -1. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample; + + sample = new TA(convertToBigInt([42, 43, 42, 41])); + assert.sameValue(sample.lastIndexOf(convertToBigInt(44)), -1, "lastIndexOf(44)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(44), -4), -1, "lastIndexOf(44, -4)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(44), -5), -1, "lastIndexOf(44, -5)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(42), -5), -1, "lastIndexOf(42, -5)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(43), -4), -1, "lastIndexOf(43, -4)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(43), -5), -1, "lastIndexOf(43, -5)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(41), 0), -1, "lastIndexOf(41, 0)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(41), 1), -1, "lastIndexOf(41, 1)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(41), 2), -1, "lastIndexOf(41, 2)"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(43), 0), -1, "lastIndexOf(43, 0)"); +}); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/this-is-not-object.js new file mode 100644 index 000000000..02a4312c0 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/this-is-not-object.js @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.lastindexof +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var lastIndexOf = TypedArray.prototype.lastIndexOf; + +assert.throws(TypeError, function() { + lastIndexOf.call(undefined, 42); +}, "this is undefined"); + +assert.throws(TypeError, function() { + lastIndexOf.call(null, 42); +}, "this is null"); + +assert.throws(TypeError, function() { + lastIndexOf.call(42, 42); +}, "this is 42"); + +assert.throws(TypeError, function() { + lastIndexOf.call("1", 42); +}, "this is a string"); + +assert.throws(TypeError, function() { + lastIndexOf.call(true, 42); +}, "this is true"); + +assert.throws(TypeError, function() { + lastIndexOf.call(false, 42); +}, "this is false"); + +var s = Symbol("s"); +assert.throws(TypeError, function() { + lastIndexOf.call(s, 42); +}, "this is a Symbol"); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..e59dc5c53 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.lastindexof +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var lastIndexOf = TypedArray.prototype.lastIndexOf; + +assert.throws(TypeError, function() { + lastIndexOf.call({}, 42); +}, "this is an Object"); + +assert.throws(TypeError, function() { + lastIndexOf.call([], 42); +}, "this is an Array"); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + lastIndexOf.call(ab, 42); +}, "this is an ArrayBuffer instance"); + +var dv = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + lastIndexOf.call(dv, 42); +}, "this is a DataView instance"); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/tointeger-fromindex.js new file mode 100644 index 000000000..8c591c1a7 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/tointeger-fromindex.js @@ -0,0 +1,57 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.lastindexof +description: Return -1 if fromIndex >= ArrayLength - converted values +info: | + 22.2.3.17 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + %TypedArray%.prototype.lastIndexOf is a distinct function that implements the + same algorithm as Array.prototype.lastIndexOf as defined in 22.1.3.15 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) + + ... + 4. If argument fromIndex was passed, let n be ? ToInteger(fromIndex); else let + n be len-1. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var obj = { + valueOf: function() { + return 1; + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample; + + sample = new TA(convertToBigInt([42, 43])); + assert.sameValue(sample.lastIndexOf(convertToBigInt(42), "1"), 0, "string [0]"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(43), "1"), 1, "string [1]"); + + assert.sameValue(sample.lastIndexOf(convertToBigInt(42), true), 0, "true [0]"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(43), true), 1, "true [1]"); + + assert.sameValue(sample.lastIndexOf(convertToBigInt(42), false), 0, "false [0]"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(43), false), -1, "false [1]"); + + assert.sameValue(sample.lastIndexOf(convertToBigInt(42), NaN), 0, "NaN [0]"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(43), NaN), -1, "NaN [1]"); + + assert.sameValue(sample.lastIndexOf(convertToBigInt(42), null), 0, "null [0]"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(43), null), -1, "null [1]"); + + assert.sameValue(sample.lastIndexOf(convertToBigInt(42), undefined), 0, "undefined [0]"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(43), undefined), -1, "undefined [1]"); + + assert.sameValue(sample.lastIndexOf(convertToBigInt(42), null), 0, "null [0]"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(43), null), -1, "null [1]"); + + assert.sameValue(sample.lastIndexOf(convertToBigInt(42), obj), 0, "object [0]"); + assert.sameValue(sample.lastIndexOf(convertToBigInt(43), obj), 1, "object [1]"); +}); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/strict-comparison.js b/test/built-ins/TypedArray/prototype/lastIndexOf/strict-comparison.js index 1adeec42f..374cebfa5 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/strict-comparison.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/strict-comparison.js @@ -38,6 +38,4 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue(sample.lastIndexOf(null), -1, "null"); assert.sameValue(sample.lastIndexOf(undefined), -1, "undefined"); assert.sameValue(sample.lastIndexOf(""), -1, "empty string"); -}, - // Cannot create Big*64Arrays from non-safe integers. - numericTypedArrayConstructors); +}); diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/length/BigInt/detached-buffer.js new file mode 100644 index 000000000..31ee55484 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/length/BigInt/detached-buffer.js @@ -0,0 +1,21 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype.length +description: Returns 0 if the instance has a detached buffer +info: | + 22.2.3.18 get %TypedArray%.prototype.length + + ... + 5. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot. + 6. If IsDetachedBuffer(buffer) is true, return 0. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(42); + $DETACHBUFFER(sample.buffer); + assert.sameValue(sample.length, 0); +}); diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-accessor.js b/test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-accessor.js new file mode 100644 index 000000000..e8f07cb68 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-accessor.js @@ -0,0 +1,23 @@ +// 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.3.17 +description: > + Requires this value to have a [[ViewedArrayBuffer]] internal slot +info: | + 22.2.3.17 get %TypedArray%.prototype.length + + 1. Let O be the this value. + ... + 3. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.throws(TypeError, function() { + TypedArrayPrototype.length; +}); diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-func.js new file mode 100644 index 000000000..0e3283914 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-func.js @@ -0,0 +1,23 @@ +// 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.3.17 +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.17 get %TypedArray%.prototype.length + + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var getter = Object.getOwnPropertyDescriptor( + TypedArrayPrototype, 'length' +).get; + +assert.throws(TypeError, function() { + getter(); +}); diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/length.js b/test/built-ins/TypedArray/prototype/length/BigInt/length.js new file mode 100644 index 000000000..873bf7d57 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/length/BigInt/length.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.17 +description: > + get %TypedArray%.prototype.length.length is 0. +info: | + get %TypedArray%.prototype.length + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "length"); + +assert.sameValue(desc.get.length, 0); + +verifyNotEnumerable(desc.get, "length"); +verifyNotWritable(desc.get, "length"); +verifyConfigurable(desc.get, "length"); diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/name.js b/test/built-ins/TypedArray/prototype/length/BigInt/name.js new file mode 100644 index 000000000..168a579c7 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/length/BigInt/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.17 +description: > + get %TypedArray%.prototype.length.name is "get length". +info: | + get %TypedArray%.prototype.length + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "length"); + +assert.sameValue(desc.get.name, "get length"); + +verifyNotEnumerable(desc.get, "name"); +verifyNotWritable(desc.get, "name"); +verifyConfigurable(desc.get, "name"); diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/length/BigInt/prop-desc.js new file mode 100644 index 000000000..be321d354 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/length/BigInt/prop-desc.js @@ -0,0 +1,23 @@ +// 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.3.17 +description: > + "length" property of TypedArrayPrototype +info: | + %TypedArray%.prototype.length is an accessor property whose set accessor + function is undefined. + + Section 17: Every accessor property described in clauses 18 through 26 and in + Annex B.2 has the attributes {[[Enumerable]]: false, [[Configurable]]: true } +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var desc = Object.getOwnPropertyDescriptor(TypedArrayPrototype, "length"); + +assert.sameValue(desc.set, undefined); +assert.sameValue(typeof desc.get, "function"); + +verifyNotEnumerable(TypedArrayPrototype, "length"); +verifyConfigurable(TypedArrayPrototype, "length"); diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/return-length.js b/test/built-ins/TypedArray/prototype/length/BigInt/return-length.js new file mode 100644 index 000000000..419acd0f6 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/length/BigInt/return-length.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype.length +description: > + Return value from the [[ArrayLength]] internal slot +info: | + 22.2.3.18 get %TypedArray%.prototype.length + + ... + 6. Let length be the value of O's [[ArrayLength]] internal slot. + 7. Return length. + + --- + + The current tests on `prop-desc.js` and `length.js` already assert `length` is + not a dynamic property as in regular arrays. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var ta1 = new TA(); + assert.sameValue(ta1.length, 0); + + var ta2 = new TA(42); + assert.sameValue(ta2.length, 42); +}); diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/this-has-no-typedarrayname-internal.js b/test/built-ins/TypedArray/prototype/length/BigInt/this-has-no-typedarrayname-internal.js new file mode 100644 index 000000000..1dd1d7696 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/length/BigInt/this-has-no-typedarrayname-internal.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype.length +description: > + Throws a TypeError exception when `this` does not have a [[TypedArrayName]] + internal slot +info: | + 22.2.3.18 get %TypedArray%.prototype.length + + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, DataView, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var getter = Object.getOwnPropertyDescriptor( + TypedArrayPrototype, "length" +).get; + +assert.throws(TypeError, function() { + getter.call({}); +}); + +assert.throws(TypeError, function() { + getter.call([]); +}); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + getter.call(ab); +}); + +var dv = new DataView(new ArrayBuffer(8), 0); +assert.throws(TypeError, function() { + getter.call(dv); +}); diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/length/BigInt/this-is-not-object.js new file mode 100644 index 000000000..663a6402b --- /dev/null +++ b/test/built-ins/TypedArray/prototype/length/BigInt/this-is-not-object.js @@ -0,0 +1,49 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype.length +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.18 get %TypedArray%.prototype.length + + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; +var getter = Object.getOwnPropertyDescriptor( + TypedArrayPrototype, "length" +).get; + + +assert.throws(TypeError, function() { + getter.call(undefined); +}, "undefined"); + +assert.throws(TypeError, function() { + getter.call(null); +}, "null"); + +assert.throws(TypeError, function() { + getter.call(42); +}, "number"); + +assert.throws(TypeError, function() { + getter.call("1"); +}, "string"); + +assert.throws(TypeError, function() { + getter.call(true); +}, "true"); + +assert.throws(TypeError, function() { + getter.call(false); +}, "false"); + +var s = Symbol("s"); +assert.throws(TypeError, function() { + getter.call(s); +}, "symbol"); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/arraylength-internal.js b/test/built-ins/TypedArray/prototype/map/BigInt/arraylength-internal.js new file mode 100644 index 000000000..c74501315 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/arraylength-internal.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.map +description: > + [[ArrayLength]] is accessed in place of performing a [[Get]] of "length" +info: | + 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + + ... + 3. Let len be the value of O's [[ArrayLength]] internal slot. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample1 = new TA(42); + var loop = 0; + + Object.defineProperty(sample1, "length", {value: 1}); + + sample1.map(function() { + loop++; + return convertToBigInt(0); + }); + assert.sameValue(loop, 42, "data descriptor"); + + loop = 0; + var sample2 = new TA(4); + Object.defineProperty(sample2, "length", { + get: function() { + throw new Test262Error( + "Does not return abrupt getting length property" + ); + } + }); + + sample2.map(function() { + loop++; + return convertToBigInt(0); + }); + assert.sameValue(loop, 4, "accessor descriptor"); +}); + diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-with-thisarg.js new file mode 100644 index 000000000..85ff13e4e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-with-thisarg.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.map +description: > + thisArg does not affect callbackfn arguments +info: | + 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + + ... + 8. Repeat, while k < len + a. Let Pk be ! ToString(k). + b. Let kValue be ? Get(O, Pk). + c. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + + var results = []; + var thisArg = ["test262", 0, "ecma262", 0]; + + sample.map(function() { + results.push(arguments); + return convertToBigInt(0); + }, thisArg); + + assert.sameValue(results.length, 3, "results.length"); + assert.sameValue(thisArg.length, 4, "thisArg.length"); + + assert.sameValue(results[0].length, 3, "results[0].length"); + assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue"); + assert.sameValue(results[0][1], 0, "results[0][1] - k"); + assert.sameValue(results[0][2], sample, "results[0][2] - this"); + + assert.sameValue(results[1].length, 3, "results[1].length"); + assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue"); + assert.sameValue(results[1][1], 1, "results[1][1] - k"); + assert.sameValue(results[1][2], sample, "results[1][2] - this"); + + assert.sameValue(results[2].length, 3, "results[2].length"); + assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue"); + assert.sameValue(results[2][1], 2, "results[2][1] - k"); + assert.sameValue(results[2][2], sample, "results[2][2] - this"); +}); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-without-thisarg.js new file mode 100644 index 000000000..1e12f5551 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-without-thisarg.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.map +description: > + callbackfn arguments +info: | + 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + + ... + 8. Repeat, while k < len + a. Let Pk be ! ToString(k). + b. Let kValue be ? Get(O, Pk). + c. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + + var results = []; + + sample.map(function() { + results.push(arguments); + return convertToBigInt(0); + }); + + assert.sameValue(results.length, 3, "results.length"); + + assert.sameValue(results[0].length, 3, "results[0].length"); + assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue"); + assert.sameValue(results[0][1], 0, "results[0][1] - k"); + assert.sameValue(results[0][2], sample, "results[0][2] - this"); + + assert.sameValue(results[1].length, 3, "results[1].length"); + assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue"); + assert.sameValue(results[1][1], 1, "results[1][1] - k"); + assert.sameValue(results[1][2], sample, "results[1][2] - this"); + + assert.sameValue(results[2].length, 3, "results[2].length"); + assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue"); + assert.sameValue(results[2][1], 2, "results[2][1] - k"); + assert.sameValue(results[2][2], sample, "results[2][2] - this"); +}); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-detachbuffer.js new file mode 100644 index 000000000..59971da1e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-detachbuffer.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.map +description: > + Instance buffer can be detached during loop +info: | + 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + + ... + 8. Repeat, while k < len + ... + b. Let kValue be ? Get(O, Pk). + c. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »). + ... +includes: [detachArrayBuffer.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var loops = 0; + var sample = new TA(2); + + assert.throws(TypeError, function() { + sample.map(function() { + if (loops === 1) { + throw new Test262Error("callbackfn called twice"); + } + $DETACHBUFFER(sample.buffer); + loops++; + return convertToBigInt(0); + }); + }); + + assert.sameValue(loops, 1, "callbackfn called only once"); +}); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-is-not-callable.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-is-not-callable.js new file mode 100644 index 000000000..4f30cdf50 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-is-not-callable.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.map +description: > + callbackfn is not callable +info: | + 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + + ... + 4. If IsCallable(callbackfn) is false, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(3); + + assert.throws(TypeError, function() { + sample.map(); + }); + + assert.throws(TypeError, function() { + sample.map(undefined); + }); + + assert.throws(TypeError, function() { + sample.map(null); + }); + + assert.throws(TypeError, function() { + sample.map({}); + }); + + assert.throws(TypeError, function() { + sample.map(1); + }); + + assert.throws(TypeError, function() { + sample.map(""); + }); + + assert.throws(TypeError, function() { + sample.map(false); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-no-interaction-over-non-integer-properties.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-no-interaction-over-non-integer-properties.js new file mode 100644 index 000000000..a1b5639f1 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-no-interaction-over-non-integer-properties.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.map +description: > + Does not interact over non-integer properties +info: | + 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + + ... + 8. Repeat, while k < len + a. Let Pk be ! ToString(k). + b. Let kValue be ? Get(O, Pk). + c. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »). + ... +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([7, 8])); + + var results = []; + + sample.foo = 42; + sample[Symbol("1")] = 43; + + sample.map(function() { + results.push(arguments); + return convertToBigInt(0); + }); + + assert.sameValue(results.length, 2, "results.length"); + + assert.sameValue(results[0][1], 0, "results[0][1] - k"); + assert.sameValue(results[1][1], 1, "results[1][1] - k"); + + assert.sameValue(results[0][0], convertToBigInt(7), "results[0][0] - kValue"); + assert.sameValue(results[1][0], convertToBigInt(8), "results[1][0] - kValue"); +}); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-not-called-on-empty.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-not-called-on-empty.js new file mode 100644 index 000000000..3e7a82aeb --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-not-called-on-empty.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.map +description: > + callbackfn is not called on empty instances +info: | + 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + + ... + 7. Let k be 0. + 8. Repeat, while k < len + ... + c. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var called = 0; + + new TA().map(function() { + called++; + }); + + assert.sameValue(called, 0); +}); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-affects-returned-object.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-affects-returned-object.js new file mode 100644 index 000000000..cfd180d1f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-affects-returned-object.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.map +description: > + The callbackfn returned values are applied to the new instance +info: | + 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + + 6. Let A be ? TypedArraySpeciesCreate(O, « len »). + 7. Let k be 0. + 8. Repeat, while k < len + ... + c. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »). + d. Perform ? Set(A, Pk, mappedValue, true). + ... + 9. Return A. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([1, 2, 4])); + var result = sample.map(function(v) { + return v * convertToBigInt(3); + }); + + assert.sameValue(result[0], convertToBigInt(3), "result[0] == 3"); + assert.sameValue(result[1], convertToBigInt(6), "result[1] == 6"); + assert.sameValue(result[2], convertToBigInt(12), "result[2] == 12"); +}); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-change-instance.js new file mode 100644 index 000000000..bc0f6f32b --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-change-instance.js @@ -0,0 +1,25 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.map +description: > + The callbackfn return does not change the `this` instance +info: | + 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample1 = new TA(3); + + sample1[1] = convertToBigInt(1); + + sample1.map(function() { + return convertToBigInt(42); + }); + + assert.sameValue(sample1[0], convertToBigInt(0), "[0] == 0"); + assert.sameValue(sample1[1], convertToBigInt(1), "[1] == 1"); + assert.sameValue(sample1[2], convertToBigInt(0), "[2] == 0"); +}); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-copy-non-integer-properties.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-copy-non-integer-properties.js new file mode 100644 index 000000000..a672b35bd --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-copy-non-integer-properties.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.map +description: > + Does not copy non-integer properties to returned value +info: | + 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + + ... + 8. Repeat, while k < len + a. Let Pk be ! ToString(k). + b. Let kValue be ? Get(O, Pk). + c. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([7, 8])); + var bar = Symbol("1"); + + sample.foo = 42; + sample[bar] = 1; + + var result = sample.map(function() { + return convertToBigInt(0); + }); + + assert.sameValue(result.length, 2, "result.length"); + assert.sameValue( + Object.getOwnPropertyDescriptor(result, "foo"), + undefined, + "foo" + ); + assert.sameValue( + Object.getOwnPropertyDescriptor(result, bar), + undefined, + "bar" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-returns-abrupt.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-returns-abrupt.js new file mode 100644 index 000000000..c8080729d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-returns-abrupt.js @@ -0,0 +1,22 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.map +description: > + Returns abrupt from callbackfn +info: | + 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(3); + + assert.throws(Test262Error, function() { + sample.map(function() { + throw new Test262Error(); + }); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-set-value-during-interaction.js new file mode 100644 index 000000000..2e0f7eed1 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-set-value-during-interaction.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.map +description: > + Integer indexed values changed during iteration +info: | + 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect.set, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + var newVal = 0; + + sample.map(function(val, i) { + if (i > 0) { + assert.sameValue( + sample[i - 1], convertToBigInt(newVal - 1), + "get the changed value during the loop" + ); + assert.sameValue( + Reflect.set(sample, 0, convertToBigInt(7)), + true, + "re-set a value for sample[0]" + ); + } + assert.sameValue( + Reflect.set(sample, i, convertToBigInt(newVal)), + true, + "set value during iteration" + ); + + newVal++; + return convertToBigInt(0); + }); + + assert.sameValue(sample[0], convertToBigInt(7), "changed values after iteration [0] == 7"); + assert.sameValue(sample[1], convertToBigInt(1), "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], convertToBigInt(2), "changed values after iteration [2] == 2"); +}); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-this.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-this.js new file mode 100644 index 000000000..e5ee5393c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-this.js @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.map +description: > + callbackfn `this` value +info: | + 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + + ... + 5. If thisArg was supplied, let T be thisArg; else let T be undefined. + ... + 8. Repeat, while k < len + ... + c. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var expected = (function() { return this; })(); +var thisArg = {}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(3); + + var results1 = []; + + sample.map(function() { + results1.push(this); + return convertToBigInt(0); + }); + + assert.sameValue(results1.length, 3, "results1"); + assert.sameValue(results1[0], expected, "without thisArg - [0]"); + assert.sameValue(results1[1], expected, "without thisArg - [1]"); + assert.sameValue(results1[2], expected, "without thisArg - [2]"); + + var results2 = []; + + sample.map(function() { + results2.push(this); + return convertToBigInt(0); + }, thisArg); + + assert.sameValue(results2.length, 3, "results2"); + assert.sameValue(results2[0], thisArg, "using thisArg - [0]"); + assert.sameValue(results2[1], thisArg, "using thisArg - [1]"); + assert.sameValue(results2[2], thisArg, "using thisArg - [2]"); +}); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/map/BigInt/detached-buffer.js new file mode 100644 index 000000000..c7039bd1d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/detached-buffer.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.map +description: Throws a TypeError if this has a detached buffer +info: | + 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + + 1. Let O be the this value. + 2. Perform ? ValidateTypedArray(O). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + ... + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +var callbackfn = function() { + throw new Test262Error(); +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.map(callbackfn); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-func.js new file mode 100644 index 000000000..1c07da18e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-func.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. +/*--- +es6id: 22.2.3.18 +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.18 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + + 1. Let O be the this value. + 2. Let valid be ValidateTypedArray(O). + 3. ReturnIfAbrupt(valid). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var map = TypedArray.prototype.map; + +assert.sameValue(typeof map, 'function'); + +assert.throws(TypeError, function() { + map(); +}); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-method.js new file mode 100644 index 000000000..3d5bb1f8f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-method.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. +/*--- +es6id: 22.2.3.18 +description: Requires a [[TypedArrayName]] internal slot. +info: | + 22.2.3.18 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + + 1. Let O be the this value. + 2. Let valid be ValidateTypedArray(O). + 3. ReturnIfAbrupt(valid). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.map, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.map(); +}); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/length.js b/test/built-ins/TypedArray/prototype/map/BigInt/length.js new file mode 100644 index 000000000..75c9a5ace --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.18 +description: > + %TypedArray%.prototype.map.length is 1. +info: | + %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.map.length, 1); + +verifyNotEnumerable(TypedArray.prototype.map, "length"); +verifyNotWritable(TypedArray.prototype.map, "length"); +verifyConfigurable(TypedArray.prototype.map, "length"); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/name.js b/test/built-ins/TypedArray/prototype/map/BigInt/name.js new file mode 100644 index 000000000..bd5237b2d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.18 +description: > + %TypedArray%.prototype.map.name is "map". +info: | + %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.map.name, "map"); + +verifyNotEnumerable(TypedArray.prototype.map, "name"); +verifyNotWritable(TypedArray.prototype.map, "name"); +verifyConfigurable(TypedArray.prototype.map, "name"); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/map/BigInt/prop-desc.js new file mode 100644 index 000000000..c68afe481 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/prop-desc.js @@ -0,0 +1,18 @@ +// 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.3.18 +description: > + "map" property of TypedArrayPrototype +info: | + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'map'); +verifyWritable(TypedArrayPrototype, 'map'); +verifyConfigurable(TypedArrayPrototype, 'map'); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation-consistent-nan.js b/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation-consistent-nan.js new file mode 100644 index 000000000..a8c3cb62e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation-consistent-nan.js @@ -0,0 +1,61 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.map +description: Consistent canonicalization of NaN values +info: | + 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + + ... + 8. Repeat, while k < len + ... + d. Perform ? Set(A, Pk, mappedValue, true). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). + ... + + 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , + isLittleEndian ] ) + + ... + 8. If type is "Float32", then + a. Set rawBytes to a List containing the 4 bytes that are the result + of converting value to IEEE 754-2008 binary32 format using “Round to + nearest, ties to even” rounding mode. If isLittleEndian is false, the + bytes are arranged in big endian order. Otherwise, the bytes are + arranged in little endian order. If value is NaN, rawValue may be set + to any implementation chosen IEEE 754-2008 binary64 format Not-a-Number + encoding. An implementation must always choose the same encoding for + each implementation distinguishable NaN value. + 9. Else, if type is "Float64", then + a. Set rawBytes to a List containing the 8 bytes that are the IEEE + 754-2008 binary64 format encoding of value. If isLittleEndian is false, + the bytes are arranged in big endian order. Otherwise, the bytes are + arranged in little endian order. If value is NaN, rawValue may be set + to any implementation chosen IEEE 754-2008 binary32 format Not-a-Number + encoding. An implementation must always choose the same encoding for + each implementation distinguishable NaN value. + ... +includes: [nans.js, testBigIntTypedArray.js, compareArray.js] +---*/ + +function body(FloatArray) { + var sample = new FloatArray(distinctNaNs); + var sampleBytes, resultBytes; + var i = 0; + + var result = sample.map(function() { + return distinctNaNs[i++]; + }); + + sampleBytes = new Uint8Array(sample.buffer); + resultBytes = new Uint8Array(result.buffer); + + assert(compareArray(sampleBytes, resultBytes)); +} + +testWithBigIntTypedArrayConstructors(body, [Float32Array, Float64Array]); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation.js b/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation.js new file mode 100644 index 000000000..fdc16e2ab --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation.js @@ -0,0 +1,51 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.map +description: > + Verify conversion values on returned instance +info: | + 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + + ... + 8. Repeat, while k < len + ... + d. Perform ? Set(A, Pk, mappedValue, true). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). + ... + + 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , + isLittleEndian ] ) + + ... + 8. If type is "Float32", then + ... + 9. Else, if type is "Float64", then + ... + 10. Else, + ... + b. Let convOp be the abstract operation named in the Conversion Operation + column in Table 50 for Element Type type. + c. Let intValue be convOp(value). + d. If intValue ≥ 0, then + ... + e. Else, + ... +includes: [byteConversionValues.js, testBigIntTypedArray.js] +---*/ + +testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { + var sample = new TA([initial]); + + var result = sample.map(function() { + return value; + }); + + assert.sameValue(result[0], expected, value + " converts to " + expected); +}); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-from-empty-length.js b/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-from-empty-length.js new file mode 100644 index 000000000..957bb7cdd --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-from-empty-length.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.map +description: > + Returns a new typedArray instance from the same constructor with the same + length and a new buffer object - testing on an instance with length == 0 +info: | + 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + + ... + 6. Let A be ? TypedArraySpeciesCreate(O, « len »). + 7. Let k be 0. + 8. Repeat, while k < len + ... + c. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »). + ... + 9. Return A. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(0); + + var result = sample.map(function() {}); + + assert.notSameValue(result, sample, "new typedArray object"); + assert.sameValue(result.constructor, TA, "same constructor"); + assert(result instanceof TA, "result is an instance of " + TA.name); + assert.sameValue( + Object.getPrototypeOf(result), + Object.getPrototypeOf(sample), + "result has the same prototype of sample" + ); + assert.sameValue(result.length, 0, "same length"); + assert.notSameValue(result.buffer, sample.buffer, "new buffer"); +}); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-from-positive-length.js b/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-from-positive-length.js new file mode 100644 index 000000000..e7ba97709 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-from-positive-length.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.map +description: > + Returns a new typedArray instance from the same constructor with the same + length and a new buffer object - testing on an instance with length > 0 +info: | + 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + + ... + 6. Let A be ? TypedArraySpeciesCreate(O, « len »). + 7. Let k be 0. + 8. Repeat, while k < len + ... + c. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »). + ... + 9. Return A. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(3); + + var result = sample.map(function(v) { + return v; + }); + + assert.notSameValue(result, sample, "new typedArray object"); + assert.sameValue(result.constructor, sample.constructor, "same constructor"); + assert.sameValue(result.length, 3, "same length"); + assert.notSameValue(result.buffer, sample.buffer, "new buffer"); +}); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/map/BigInt/this-is-not-object.js new file mode 100644 index 000000000..50fa543a6 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/this-is-not-object.js @@ -0,0 +1,51 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.map +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + + 1. Let O be the this value. + 2. Perform ? ValidateTypedArray(O). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var map = TypedArray.prototype.map; +var callbackfn = function() {}; + +assert.throws(TypeError, function() { + map.call(undefined, callbackfn); +}, "this is undefined"); + +assert.throws(TypeError, function() { + map.call(null, callbackfn); +}, "this is null"); + +assert.throws(TypeError, function() { + map.call(42, callbackfn); +}, "this is 42"); + +assert.throws(TypeError, function() { + map.call("1", callbackfn); +}, "this is a string"); + +assert.throws(TypeError, function() { + map.call(true, callbackfn); +}, "this is true"); + +assert.throws(TypeError, function() { + map.call(false, callbackfn); +}, "this is false"); + +var s = Symbol("s"); +assert.throws(TypeError, function() { + map.call(s, callbackfn); +}, "this is a Symbol"); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/map/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..97266d749 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.map +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) + + 1. Let O be the this value. + 2. Perform ? ValidateTypedArray(O). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var map = TypedArray.prototype.map; +var callbackfn = function() {}; + +assert.throws(TypeError, function() { + map.call({}, callbackfn); +}, "this is an Object"); + +assert.throws(TypeError, function() { + map.call([], callbackfn); +}, "this is an Array"); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + map.call(ab, callbackfn); +}, "this is an ArrayBuffer instance"); + +var dv = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + map.call(dv, callbackfn); +}, "this is a DataView instance"); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/map/BigInt/values-are-not-cached.js new file mode 100644 index 000000000..a8665d931 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/map/BigInt/values-are-not-cached.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.map +description: > + Integer indexed values changed during iteration +info: | + 22.2.3.19 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + + sample.map(function(v, i) { + if (i < sample.length - 1) { + sample[i+1] = convertToBigInt(42); + } + + assert.sameValue( + v, convertToBigInt(42), "method does not cache values before callbackfn calls" + ); + + return convertToBigInt(0); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-custom-accumulator.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-custom-accumulator.js new file mode 100644 index 000000000..8527302fd --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-custom-accumulator.js @@ -0,0 +1,58 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduce +description: > + callbackfn arguments using custom accumulator +info: | + 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduce is a distinct function that implements the same + algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] ) + + ... + 8. Repeat, while k < len + ... + c. If kPresent is true, then + ... + i. Let accumulator be ? Call(callbackfn, undefined, « accumulator, kValue, + k, O »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + + var results = []; + + sample.reduce(function(accumulator) { + results.push(arguments); + return accumulator + 1; + }, 7); + + assert.sameValue(results.length, 3, "results.length"); + + assert.sameValue(results[0].length, 4, "results[0].length"); + assert.sameValue(results[0][0], 7, "results[0][0] - accumulator"); + assert.sameValue(results[0][1], convertToBigInt(42), "results[0][1] - kValue"); + assert.sameValue(results[0][2], 0, "results[0][2] - k"); + assert.sameValue(results[0][3], sample, "results[0][3] - this"); + + assert.sameValue(results[1].length, 4, "results[1].length"); + assert.sameValue(results[1][0], 8, "results[1][0] - accumulator"); + assert.sameValue(results[1][1], convertToBigInt(43), "results[1][1] - kValue"); + assert.sameValue(results[1][2], 1, "results[1][2] - k"); + assert.sameValue(results[1][3], sample, "results[1][3] - this"); + + assert.sameValue(results[2].length, 4, "results[2].length"); + assert.sameValue(results[2][0], 9, "results[2][0] - accumulator"); + assert.sameValue(results[2][1], convertToBigInt(44), "results[2][1] - kValue"); + assert.sameValue(results[2][2], 2, "results[2][2] - k"); + assert.sameValue(results[2][3], sample, "results[2][3] - this"); +}); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-default-accumulator.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-default-accumulator.js new file mode 100644 index 000000000..b4514895a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-default-accumulator.js @@ -0,0 +1,59 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduce +description: > + callbackfn arguments using default accumulator (value at index 0) +info: | + 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduce is a distinct function that implements the same + algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] ) + + ... + 7. Else initialValue is not present, + a. Let kPresent be false. + b. Repeat, while kPresent is false and k < len + ... + iii. If kPresent is true, then + 1. Let accumulator be ? Get(O, Pk). + ... + 8. Repeat, while k < len + ... + c. If kPresent is true, then + ... + i. Let accumulator be ? Call(callbackfn, undefined, « accumulator, kValue, + k, O »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + + var results = []; + + sample.reduce(function(accumulator) { + results.push(arguments); + return accumulator - convertToBigInt(1); + }); + + assert.sameValue(results.length, 2, "results.length"); + + assert.sameValue(results[0].length, 4, "results[1].length"); + assert.sameValue(results[0][0], convertToBigInt(42), "results[1][0] - accumulator"); + assert.sameValue(results[0][1], convertToBigInt(43), "results[1][1] - kValue"); + assert.sameValue(results[0][2], 1, "results[1][2] - k"); + assert.sameValue(results[0][3], sample, "results[1][3] - this"); + + assert.sameValue(results[1].length, 4, "results[2].length"); + assert.sameValue(results[1][0], convertToBigInt(41), "results[2][0] - accumulator"); + assert.sameValue(results[1][1], convertToBigInt(44), "results[2][1] - kValue"); + assert.sameValue(results[1][2], 2, "results[2][2] - k"); + assert.sameValue(results[1][3], sample, "results[2][3] - this"); +}); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-detachbuffer.js new file mode 100644 index 000000000..60ce57fe7 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-detachbuffer.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduce +description: > + Instance buffer can be detached during loop +info: | + 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduce is a distinct function that implements the same + algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] ) + + ... + 8. Repeat, while k < len + ... + c. If kPresent is true, then + ... + i. Let accumulator be ? Call(callbackfn, undefined, « accumulator, kValue, + k, O »). + ... +includes: [detachArrayBuffer.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var loops = 0; + var sample = new TA(2); + + assert.throws(TypeError, function() { + sample.reduce(function() { + if (loops === 1) { + throw new Test262Error("callbackfn called twice"); + } + $DETACHBUFFER(sample.buffer); + loops++; + }, 0); + }); + + assert.sameValue(loops, 1, "callbackfn called only once"); +}); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-is-not-callable-throws.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-is-not-callable-throws.js new file mode 100644 index 000000000..36b147501 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-is-not-callable-throws.js @@ -0,0 +1,67 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduce +description: > + Throws TypeError if callbackfn is not callable +info: | + 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduce is a distinct function that implements the same + algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] ) + + ... + 3. If IsCallable(callbackfn) is false, throw a TypeError exception. + 4. If len is 0 and initialValue is not present, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + + assert.throws(TypeError, function() { + sample.reduce(); + }, "no arg"); + + assert.throws(TypeError, function() { + sample.reduce(undefined); + }, "undefined"); + + assert.throws(TypeError, function() { + sample.reduce(null); + }, "null"); + + assert.throws(TypeError, function() { + sample.reduce({}); + }, "{}"); + + assert.throws(TypeError, function() { + sample.reduce(1); + }, "1"); + + assert.throws(TypeError, function() { + sample.reduce(NaN); + }, "NaN"); + + assert.throws(TypeError, function() { + sample.reduce(""); + }, "string"); + + assert.throws(TypeError, function() { + sample.reduce(false); + }, "false"); + + assert.throws(TypeError, function() { + sample.reduce(true); + }, "true"); + + assert.throws(TypeError, function() { + sample.reduce(Symbol("")); + }, "symbol"); +}); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-no-iteration-over-non-integer-properties.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-no-iteration-over-non-integer-properties.js new file mode 100644 index 000000000..b230de900 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-no-iteration-over-non-integer-properties.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduce +description: > + Does not iterate over non-integer properties +info: | + 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduce is a distinct function that implements the same + algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] ) + + ... + 8. Repeat, while k < len + ... + c. If kPresent is true, then + ... + i. Let accumulator be ? Call(callbackfn, undefined, « accumulator, kValue, + k, O »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([7, 8])); + + var results = []; + + sample.foo = 42; + sample[Symbol("1")] = 43; + + sample.reduce(function() { + results.push(arguments); + }, 0); + + assert.sameValue(results.length, 2, "results.length"); + + assert.sameValue(results[0][2], 0, "results[0][2] - k"); + assert.sameValue(results[1][2], 1, "results[1][2] - k"); + + assert.sameValue(results[0][1], convertToBigInt(7), "results[0][1] - kValue"); + assert.sameValue(results[1][1], convertToBigInt(8), "results[1][1] - kValue"); +}); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-not-called-on-empty.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-not-called-on-empty.js new file mode 100644 index 000000000..8bcbcfd43 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-not-called-on-empty.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduce +description: > + callbackfn is not called on empty instances +info: | + 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduce is a distinct function that implements the same + algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] ) + + ... + 4. If len is 0 and initialValue is not present, throw a TypeError exception. + ... + 8. Repeat, while k < len + ... + c. If kPresent is true, then + ... + i. Let accumulator be ? Call(callbackfn, undefined, « accumulator, kValue, + k, O »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var called = 0; + + new TA().reduce(function() { + called++; + }, undefined); + + assert.sameValue(called, 0); +}); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-return-does-not-change-instance.js new file mode 100644 index 000000000..05a8adddf --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-return-does-not-change-instance.js @@ -0,0 +1,21 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduce +description: > + The callbackfn return does not change the `this` instance +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([0, 1, 0])); + + sample.reduce(function() { + return 42; + }, 7); + + assert.sameValue(sample[0], convertToBigInt(0), "[0] == 0"); + assert.sameValue(sample[1], convertToBigInt(1), "[1] == 1"); + assert.sameValue(sample[2], convertToBigInt(0), "[2] == 0"); +}); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-returns-abrupt.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-returns-abrupt.js new file mode 100644 index 000000000..25470aff7 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-returns-abrupt.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduce +description: > + Returns abrupt from callbackfn +info: | + 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduce is a distinct function that implements the same + algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] ) + + ... + 8. Repeat, while k < len + ... + c. If kPresent is true, then + ... + i. Let accumulator be ? Call(callbackfn, undefined, « accumulator, kValue, + k, O »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + + assert.throws(Test262Error, function() { + sample.reduce(function() { + throw new Test262Error(); + }); + }); + + assert.throws(Test262Error, function() { + sample.reduce(function() { + throw new Test262Error(); + }, 0); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-set-value-during-iteration.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-set-value-during-iteration.js new file mode 100644 index 000000000..395a5aea7 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-set-value-during-iteration.js @@ -0,0 +1,49 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.reduce +description: > + Integer indexed values changed during iteration +info: | + 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduce is a distinct function that implements the same + algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] ) +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect.set, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + var newVal = 0; + + sample.reduce(function(acc, val, i) { + if (i > 0) { + assert.sameValue( + sample[i - 1], convertToBigInt(newVal - 1), + "get the changed value during the loop" + ); + assert.sameValue( + Reflect.set(sample, 0, convertToBigInt(7)), + true, + "re-set a value for sample[0]" + ); + } + assert.sameValue( + Reflect.set(sample, i, convertToBigInt(newVal)), + true, + "set value during iteration" + ); + + newVal++; + }, 0); + + assert.sameValue(sample[0], convertToBigInt(7), "changed values after iteration [0] == 7"); + assert.sameValue(sample[1], convertToBigInt(1), "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], convertToBigInt(2), "changed values after iteration [2] == 2"); +}); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-this.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-this.js new file mode 100644 index 000000000..fe364eeac --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-this.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduce +description: > + callbackfn `this` value +info: | + 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduce is a distinct function that implements the same + algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] ) + + ... + 8. Repeat, while k < len + ... + c. If kPresent is true, then + ... + i. Let accumulator be ? Call(callbackfn, undefined, « accumulator, kValue, + k, O »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var expected = (function() { return this; })(); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(3); + + var results = []; + + sample.reduce(function() { + results.push(this); + }, 0); + + assert.sameValue(results.length, 3, "results.length"); + assert.sameValue(results[0], expected, "[0]"); + assert.sameValue(results[1], expected, "[1]"); + assert.sameValue(results[2], expected, "[2]"); +}); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/detached-buffer.js new file mode 100644 index 000000000..91763bcfb --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/detached-buffer.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduce +description: Throws a TypeError if this has a detached buffer +info: | + 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + ... + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +var callbackfn = function() { + throw new Test262Error(); +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.reduce(callbackfn); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/empty-instance-return-initialvalue.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/empty-instance-return-initialvalue.js new file mode 100644 index 000000000..34ed97d79 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/empty-instance-return-initialvalue.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduce +description: > + Returns given initialValue on empty instances without calling callbackfn +info: | + 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduce is a distinct function that implements the same + algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] ) + + ... + 7. Else initialValue is not present, + ... + b. Repeat, while kPresent is false and k < len + ... + iii. If kPresent is true, then + 1. Let accumulator be ? Get(O, Pk). + iv. Increase k by 1. + ... + 8. Repeat, while k < len + ... + 9. Return accumulator. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var called = false; + var result = new TA().reduce(function() { + called = true; + }, 42); + + assert.sameValue(result, 42); + assert.sameValue(called, false); +}); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/empty-instance-with-no-initialvalue-throws.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/empty-instance-with-no-initialvalue-throws.js new file mode 100644 index 000000000..f903b32a0 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/empty-instance-with-no-initialvalue-throws.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduce +description: > + If len is 0 and initialValue is not present, throw a TypeError exception. +info: | + 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduce is a distinct function that implements the same + algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] ) + + ... + 4. If len is 0 and initialValue is not present, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var called = 0; + + assert.throws(TypeError, function() { + new TA().reduce(function() { + called++; + }); + }); + + assert.sameValue(called, 0); +}); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/get-length-uses-internal-arraylength.js new file mode 100644 index 000000000..a4f6c763e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/get-length-uses-internal-arraylength.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduce +description: Get "length" uses internal ArrayLength +info: | + 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduce is a distinct function that implements the same + algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] ) + + 1. Let O be ? ToObject(this value). + 2. Let len be ? ToLength(? Get(O, "length")). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var getCalls = 0; +var desc = { + get: function getLen() { + getCalls++; + return 0; + } +}; + +Object.defineProperty(TypedArray.prototype, "length", desc); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + var calls = 0; + + Object.defineProperty(TA.prototype, "length", desc); + Object.defineProperty(sample, "length", desc); + + sample.reduce(function() { + calls++; + }, 0); + + assert.sameValue(getCalls, 0, "ignores length properties"); + assert.sameValue(calls, 2, "iterations are not affected by custom length"); +}); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-func.js new file mode 100644 index 000000000..32441ea61 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-func.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. +/*--- +es6id: 22.2.3.19 +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.19 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) + + ... + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var reduce = TypedArray.prototype.reduce; + +assert.sameValue(typeof reduce, 'function'); + +assert.throws(TypeError, function() { + reduce(); +}); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-method.js new file mode 100644 index 000000000..fcc586259 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-method.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. +/*--- +es6id: 22.2.3.19 +description: Requires a [[TypedArrayName]] internal slot. +info: | + 22.2.3.19 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) + + ... + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.reduce, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.reduce(); +}); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/length.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/length.js new file mode 100644 index 000000000..03b80a145 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.19 +description: > + %TypedArray%.prototype.reduce.length is 1. +info: | + %TypedArray%.prototype.reduce ( callbackfn [ , thisArg ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.reduce.length, 1); + +verifyNotEnumerable(TypedArray.prototype.reduce, "length"); +verifyNotWritable(TypedArray.prototype.reduce, "length"); +verifyConfigurable(TypedArray.prototype.reduce, "length"); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/name.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/name.js new file mode 100644 index 000000000..86ad9f3d4 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.19 +description: > + %TypedArray%.prototype.reduce.name is "reduce". +info: | + %TypedArray%.prototype.reduce ( callbackfn [ , thisArg ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.reduce.name, "reduce"); + +verifyNotEnumerable(TypedArray.prototype.reduce, "name"); +verifyNotWritable(TypedArray.prototype.reduce, "name"); +verifyConfigurable(TypedArray.prototype.reduce, "name"); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/prop-desc.js new file mode 100644 index 000000000..6b53a2630 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/prop-desc.js @@ -0,0 +1,18 @@ +// 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.3.19 +description: > + "reduce" property of TypedArrayPrototype +info: | + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'reduce'); +verifyWritable(TypedArrayPrototype, 'reduce'); +verifyConfigurable(TypedArrayPrototype, 'reduce'); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/result-is-last-callbackfn-return.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/result-is-last-callbackfn-return.js new file mode 100644 index 000000000..83e9a723f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/result-is-last-callbackfn-return.js @@ -0,0 +1,59 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduce +description: > + Returns last accumulator value +info: | + 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduce is a distinct function that implements the same + algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] ) + + ... + 7. Else initialValue is not present, + ... + b. Repeat, while kPresent is false and k < len + ... + iii. If kPresent is true, then + 1. Let accumulator be ? Get(O, Pk). + iv. Increase k by 1. + ... + 8. Repeat, while k < len + ... + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let accumulator be ? Call(callbackfn, undefined, « accumulator, + kValue, k, O »). + 9. Return accumulator. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var calls, result; + + calls = 0; + result = new TA(convertToBigInt([1, 2, 3])).reduce(function() { + calls++; + + if (calls == 2) { + return 42; + } + }); + assert.sameValue(result, 42, "using default accumulator"); + + calls = 0; + result = new TA(convertToBigInt([1, 2, 3])).reduce(function() { + calls++; + + if (calls == 3) { + return 7; + } + }, 0); + assert.sameValue(result, 7, "using custom accumulator"); +}); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/result-of-any-type.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/result-of-any-type.js new file mode 100644 index 000000000..370a5b052 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/result-of-any-type.js @@ -0,0 +1,67 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduce +description: > + Result can be of any type without any number conversions +info: | + 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduce is a distinct function that implements the same + algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] ) + + ... + 7. Else initialValue is not present, + ... + b. Repeat, while kPresent is false and k < len + ... + iii. If kPresent is true, then + 1. Let accumulator be ? Get(O, Pk). + iv. Increase k by 1. + ... + 8. Repeat, while k < len + ... + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let accumulator be ? Call(callbackfn, undefined, « accumulator, + kValue, k, O »). + 9. Return accumulator. +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + [ + ["test262", "string"], + ["", "empty string"], + [undefined, "undefined"], + [null, "null"], + [-0, "-0"], + [42, "integer"], + [NaN, "NaN"], + [Infinity, "Infinity"], + [0.6, "float number"], + [true, "true"], + [false, "false"], + [Symbol(""), "symbol"], + [{}, "object"] + ].forEach(function(item) { + var result; + + result = sample.reduce(function() { + return item[0]; + }); + assert.sameValue(result, item[0], item[1] + " - using default accumulator"); + + result = sample.reduce(function() { + return item[0]; + }, 0); + + assert.sameValue(result, item[0], item[1] + " - using custom accumulator"); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/return-first-value-without-callbackfn.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/return-first-value-without-callbackfn.js new file mode 100644 index 000000000..7fbd76fa0 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/return-first-value-without-callbackfn.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduce +description: > + Returns [0] without calling callbackfn if length is 1 and initialValue is not + present. +info: | + 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduce is a distinct function that implements the same + algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] ) + + ... + 7. Else initialValue is not present, + ... + b. Repeat, while kPresent is false and k < len + ... + iii. If kPresent is true, then + 1. Let accumulator be ? Get(O, Pk). + iv. Increase k by 1. + ... + 8. Repeat, while k < len + ... + 9. Return accumulator. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var called = false; + var result = new TA(convertToBigInt([42])).reduce(function() { + called = true; + }); + + assert.sameValue(result, convertToBigInt(42)); + assert.sameValue(called, false); +}); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/this-is-not-object.js new file mode 100644 index 000000000..14680f3d4 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/this-is-not-object.js @@ -0,0 +1,51 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduce +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var reduce = TypedArray.prototype.reduce; +var callbackfn = function() {}; + +assert.throws(TypeError, function() { + reduce.call(undefined, callbackfn); +}, "this is undefined"); + +assert.throws(TypeError, function() { + reduce.call(null, callbackfn); +}, "this is null"); + +assert.throws(TypeError, function() { + reduce.call(42, callbackfn); +}, "this is 42"); + +assert.throws(TypeError, function() { + reduce.call("1", callbackfn); +}, "this is a string"); + +assert.throws(TypeError, function() { + reduce.call(true, callbackfn); +}, "this is true"); + +assert.throws(TypeError, function() { + reduce.call(false, callbackfn); +}, "this is false"); + +var s = Symbol("s"); +assert.throws(TypeError, function() { + reduce.call(s, callbackfn); +}, "this is a Symbol"); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..6dedc8cd2 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduce +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var reduce = TypedArray.prototype.reduce; +var callbackfn = function() {}; + +assert.throws(TypeError, function() { + reduce.call({}, callbackfn); +}, "this is an Object"); + +assert.throws(TypeError, function() { + reduce.call([], callbackfn); +}, "this is an Array"); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + reduce.call(ab, callbackfn); +}, "this is an ArrayBuffer instance"); + +var dv = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + reduce.call(dv, callbackfn); +}, "this is a DataView instance"); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/values-are-not-cached.js new file mode 100644 index 000000000..7b602dd9d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/values-are-not-cached.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduce +description: > + Integer indexed values are not cached before iteration +info: | + 22.2.3.20 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduce is a distinct function that implements the same + algorithm as Array.prototype.reduce as defined in 22.1.3.19 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.19 Array.prototype.reduce ( callbackfn [ , initialValue ] ) + + ... + 8. Repeat, while k < len + ... + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let accumulator be ? Call(callbackfn, undefined, « accumulator, kValue, + k, O »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + + sample.reduce(function(a, v, i) { + if (i < sample.length - 1) { + sample[i+1] = convertToBigInt(42); + } + + assert.sameValue( + v, convertToBigInt(42), "method does not cache values before callbackfn calls" + ); + }, 0); +}); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-custom-accumulator.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-custom-accumulator.js new file mode 100644 index 000000000..8ecb1ff4f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-custom-accumulator.js @@ -0,0 +1,59 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduceright +description: > + callbackfn arguments using custom accumulator +info: | + 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduceRight is a distinct function that implements the + same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + ... + 8. Repeat, while k ≥ 0 + ... + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let accumulator be ? Call(callbackfn, undefined, « accumulator, + kValue, k, O »). + d. Decrease k by 1. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + + var results = []; + + sample.reduceRight(function(accumulator) { + results.push(arguments); + return accumulator + 1; + }, 7); + + assert.sameValue(results.length, 3, "results.length"); + + assert.sameValue(results[0].length, 4, "results[0].length"); + assert.sameValue(results[0][0], 7, "results[0][0] - accumulator"); + assert.sameValue(results[0][1], convertToBigInt(44), "results[0][1] - kValue"); + assert.sameValue(results[0][2], 2, "results[0][2] - k"); + assert.sameValue(results[0][3], sample, "results[0][3] - this"); + + assert.sameValue(results[1].length, 4, "results[1].length"); + assert.sameValue(results[1][0], 8, "results[1][0] - accumulator"); + assert.sameValue(results[1][1], convertToBigInt(43), "results[1][1] - kValue"); + assert.sameValue(results[1][2], 1, "results[1][2] - k"); + assert.sameValue(results[1][3], sample, "results[1][3] - this"); + + assert.sameValue(results[2].length, 4, "results[2].length"); + assert.sameValue(results[2][0], 9, "results[2][0] - accumulator"); + assert.sameValue(results[2][1], convertToBigInt(42), "results[2][1] - kValue"); + assert.sameValue(results[2][2], 0, "results[2][2] - k"); + assert.sameValue(results[2][3], sample, "results[2][3] - this"); +}); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-default-accumulator.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-default-accumulator.js new file mode 100644 index 000000000..d80202ebc --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-default-accumulator.js @@ -0,0 +1,62 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduceright +description: > + callbackfn arguments using default accumulator (value at last index) +info: | + 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduceRight is a distinct function that implements the + same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + ... + 7. Else initialValue is not present, + ... + b. Repeat, while kPresent is false and k ≥ 0 + ... + ii. Let kPresent be ? HasProperty(O, Pk). + iii. If kPresent is true, then + 1. Let accumulator be ? Get(O, Pk). + iv. Decrease k by 1. + ... + 8. Repeat, while k ≥ 0 + ... + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let accumulator be ? Call(callbackfn, undefined, « accumulator, + kValue, k, O »). + d. Decrease k by 1. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + + var results = []; + + sample.reduceRight(function(accumulator) { + results.push(arguments); + return accumulator + convertToBigInt(1); + }); + + assert.sameValue(results.length, 2, "results.length"); + + assert.sameValue(results[0].length, 4, "results[1].length"); + assert.sameValue(results[0][0], convertToBigInt(44), "results[1][0] - accumulator"); + assert.sameValue(results[0][1], convertToBigInt(43), "results[1][1] - kValue"); + assert.sameValue(results[0][2], 1, "results[1][2] - k"); + assert.sameValue(results[0][3], sample, "results[1][3] - this"); + + assert.sameValue(results[1].length, 4, "results[2].length"); + assert.sameValue(results[1][0], convertToBigInt(45), "results[2][0] - accumulator"); + assert.sameValue(results[1][1], convertToBigInt(42), "results[2][1] - kValue"); + assert.sameValue(results[1][2], 0, "results[2][2] - k"); + assert.sameValue(results[1][3], sample, "results[2][3] - this"); +}); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-detachbuffer.js new file mode 100644 index 000000000..c484769f4 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-detachbuffer.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduceright +description: > + Instance buffer can be detached during loop +info: | + 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduceRight is a distinct function that implements the + same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + ... + 8. Repeat, while k < len + ... + c. If kPresent is true, then + ... + i. Let accumulator be ? Call(callbackfn, undefined, « accumulator, kValue, + k, O »). + ... +includes: [detachArrayBuffer.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var loops = 0; + var sample = new TA(2); + + assert.throws(TypeError, function() { + sample.reduceRight(function() { + if (loops === 1) { + throw new Test262Error("callbackfn called twice"); + } + $DETACHBUFFER(sample.buffer); + loops++; + }, 0); + }); + + assert.sameValue(loops, 1, "callbackfn called only once"); +}); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-is-not-callable-throws.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-is-not-callable-throws.js new file mode 100644 index 000000000..880e1a1a9 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-is-not-callable-throws.js @@ -0,0 +1,67 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduceright +description: > + Throws TypeError if callbackfn is not callable +info: | + 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduceRight is a distinct function that implements the + same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + ... + 3. If IsCallable(callbackfn) is false, throw a TypeError exception. + 4. If len is 0 and initialValue is not present, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + + assert.throws(TypeError, function() { + sample.reduceRight(); + }, "no arg"); + + assert.throws(TypeError, function() { + sample.reduceRight(undefined); + }, "undefined"); + + assert.throws(TypeError, function() { + sample.reduceRight(null); + }, "null"); + + assert.throws(TypeError, function() { + sample.reduceRight({}); + }, "{}"); + + assert.throws(TypeError, function() { + sample.reduceRight(1); + }, "1"); + + assert.throws(TypeError, function() { + sample.reduceRight(NaN); + }, "NaN"); + + assert.throws(TypeError, function() { + sample.reduceRight(""); + }, "string"); + + assert.throws(TypeError, function() { + sample.reduceRight(false); + }, "false"); + + assert.throws(TypeError, function() { + sample.reduceRight(true); + }, "true"); + + assert.throws(TypeError, function() { + sample.reduceRight(Symbol("")); + }, "symbol"); +}); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-no-iteration-over-non-integer-properties.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-no-iteration-over-non-integer-properties.js new file mode 100644 index 000000000..a0f2fb513 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-no-iteration-over-non-integer-properties.js @@ -0,0 +1,49 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduceright +description: > + Does not iterate over non-integer properties +info: | + 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduceRight is a distinct function that implements the + same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + ... + 8. Repeat, while k ≥ 0 + ... + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let accumulator be ? Call(callbackfn, undefined, « accumulator, + kValue, k, O »). + d. Decrease k by 1. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([7, 8])); + + var results = []; + + sample.foo = 42; + sample[Symbol("1")] = 43; + + sample.reduceRight(function() { + results.push(arguments); + }, 0); + + assert.sameValue(results.length, 2, "results.length"); + + assert.sameValue(results[0][2], 1, "results[0][2] - k"); + assert.sameValue(results[1][2], 0, "results[1][2] - k"); + + assert.sameValue(results[0][1], convertToBigInt(8), "results[0][1] - kValue"); + assert.sameValue(results[1][1], convertToBigInt(7), "results[1][1] - kValue"); +}); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-not-called-on-empty.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-not-called-on-empty.js new file mode 100644 index 000000000..ce9dc4b05 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-not-called-on-empty.js @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduceright +description: > + callbackfn is not called on empty instances +info: | + 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduceRight is a distinct function that implements the + same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + ... + 4. If len is 0 and initialValue is not present, throw a TypeError exception. + ... + 8. Repeat, while k ≥ 0 + ... + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let accumulator be ? Call(callbackfn, undefined, « accumulator, + kValue, k, O »). + d. Decrease k by 1. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var called = 0; + + new TA().reduceRight(function() { + called++; + }, undefined); + + assert.sameValue(called, 0); +}); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-return-does-not-change-instance.js new file mode 100644 index 000000000..2bf7460bf --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-return-does-not-change-instance.js @@ -0,0 +1,21 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduceright +description: > + The callbackfn return does not change the `this` instance +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([0, 1, 0])); + + sample.reduceRight(function() { + return 42; + }, 7); + + assert.sameValue(sample[0], convertToBigInt(0), "[0] == 0"); + assert.sameValue(sample[1], convertToBigInt(1), "[1] == 1"); + assert.sameValue(sample[2], convertToBigInt(0), "[2] == 0"); +}); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-returns-abrupt.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-returns-abrupt.js new file mode 100644 index 000000000..ce1cc6d0e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-returns-abrupt.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduceright +description: > + Returns abrupt from callbackfn +info: | + 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduceRight is a distinct function that implements the + same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + ... + 8. Repeat, while k < len + ... + c. If kPresent is true, then + ... + i. Let accumulator be ? Call(callbackfn, undefined, « accumulator, kValue, + k, O »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + + assert.throws(Test262Error, function() { + sample.reduceRight(function() { + throw new Test262Error(); + }); + }); + + assert.throws(Test262Error, function() { + sample.reduceRight(function() { + throw new Test262Error(); + }, 0); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-set-value-during-iteration.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-set-value-during-iteration.js new file mode 100644 index 000000000..d0fd3510f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-set-value-during-iteration.js @@ -0,0 +1,49 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.reduceright +description: > + Integer indexed values changed during iteration +info: | + 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduceRight is a distinct function that implements the + same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] ) +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect.set, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + var newVal = 0; + + sample.reduceRight(function(acc, val, i) { + if (i < sample.length - 1) { + assert.sameValue( + sample[i + 1], convertToBigInt(newVal - 1), + "get the changed value during the loop" + ); + assert.sameValue( + Reflect.set(sample, 2, convertToBigInt(7)), + true, + "re-set a value for sample[2]" + ); + } + assert.sameValue( + Reflect.set(sample, i, convertToBigInt(newVal)), + true, + "set value during iteration" + ); + + newVal++; + }, 0); + + assert.sameValue(sample[0], convertToBigInt(2), "changed values after iteration [0] == 2"); + assert.sameValue(sample[1], convertToBigInt(1), "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], convertToBigInt(7), "changed values after iteration [2] == 7"); +}); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-this.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-this.js new file mode 100644 index 000000000..6210eea50 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-this.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduceright +description: > + callbackfn `this` value +info: | + 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduceRight is a distinct function that implements the + same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + ... + 8. Repeat, while k ≥ 0 + ... + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let accumulator be ? Call(callbackfn, undefined, « accumulator, + kValue, k, O »). + d. Decrease k by 1. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var expected = (function() { return this; })(); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(3); + + var results = []; + + sample.reduceRight(function() { + results.push(this); + }, 0); + + assert.sameValue(results.length, 3, "results.length"); + assert.sameValue(results[0], expected, "[0]"); + assert.sameValue(results[1], expected, "[1]"); + assert.sameValue(results[2], expected, "[2]"); +}); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/detached-buffer.js new file mode 100644 index 000000000..08e635433 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/detached-buffer.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduceright +description: Throws a TypeError if this has a detached buffer +info: | + 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + ... + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +var callbackfn = function() { + throw new Test262Error(); +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.reduceRight(callbackfn); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/empty-instance-return-initialvalue.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/empty-instance-return-initialvalue.js new file mode 100644 index 000000000..2818b78b1 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/empty-instance-return-initialvalue.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduceright +description: > + Returns given initialValue on empty instances without calling callbackfn +info: | + 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduceRight is a distinct function that implements the + same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + ... + 7. Else initialValue is not present, + ... + b. Repeat, while kPresent is false and k ≥ 0 + ... + ii. Let kPresent be ? HasProperty(O, Pk). + iii. If kPresent is true, then + 1. Let accumulator be ? Get(O, Pk). + iv. Decrease k by 1. + ... + 8. Repeat, while k ≥ 0 + ... + 9. Return accumulator. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var called = false; + var result = new TA().reduceRight(function() { + called = true; + }, 42); + + assert.sameValue(result, 42); + assert.sameValue(called, false); +}); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/empty-instance-with-no-initialvalue-throws.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/empty-instance-with-no-initialvalue-throws.js new file mode 100644 index 000000000..65b07a1ce --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/empty-instance-with-no-initialvalue-throws.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduceright +description: > + If len is 0 and initialValue is not present, throw a TypeError exception. +info: | + 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduceRight is a distinct function that implements the + same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + ... + 4. If len is 0 and initialValue is not present, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var called = 0; + + assert.throws(TypeError, function() { + new TA().reduceRight(function() { + called++; + }); + }); + + assert.sameValue(called, 0); +}); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/get-length-uses-internal-arraylength.js new file mode 100644 index 000000000..e2cb704a0 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/get-length-uses-internal-arraylength.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduceright +description: Get "length" uses internal ArrayLength +info: | + 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduceRight is a distinct function that implements the + same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + 1. Let O be ? ToObject(this value). + 2. Let len be ? ToLength(? Get(O, "length")). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var getCalls = 0; +var desc = { + get: function getLen() { + getCalls++; + return 0; + } +}; + +Object.defineProperty(TypedArray.prototype, "length", desc); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + var calls = 0; + + Object.defineProperty(TA.prototype, "length", desc); + Object.defineProperty(sample, "length", desc); + + sample.reduceRight(function() { + calls++; + }, 0); + + assert.sameValue(getCalls, 0, "ignores length properties"); + assert.sameValue(calls, 2, "iterations are not affected by custom length"); +}); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-func.js new file mode 100644 index 000000000..7bc30e60c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-func.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. +/*--- +es6id: 22.2.3.20 +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.20 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + ... + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var reduceRight = TypedArray.prototype.reduceRight; + +assert.sameValue(typeof reduceRight, 'function'); + +assert.throws(TypeError, function() { + reduceRight(); +}); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-method.js new file mode 100644 index 000000000..468ad5e36 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-method.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. +/*--- +es6id: 22.2.3.20 +description: Requires a [[TypedArrayName]] internal slot. +info: | + 22.2.3.20 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + ... + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.reduceRight, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.reduceRight(); +}); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/length.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/length.js new file mode 100644 index 000000000..cb857c2f5 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.20 +description: > + %TypedArray%.prototype.reduceRight.length is 1. +info: | + %TypedArray%.prototype.reduceRight ( callbackfn [ , thisArg ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.reduceRight.length, 1); + +verifyNotEnumerable(TypedArray.prototype.reduceRight, "length"); +verifyNotWritable(TypedArray.prototype.reduceRight, "length"); +verifyConfigurable(TypedArray.prototype.reduceRight, "length"); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/name.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/name.js new file mode 100644 index 000000000..fa94ac119 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.20 +description: > + %TypedArray%.prototype.reduceRight.name is "reduceRight". +info: | + %TypedArray%.prototype.reduceRight ( callbackfn [ , thisArg ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.reduceRight.name, "reduceRight"); + +verifyNotEnumerable(TypedArray.prototype.reduceRight, "name"); +verifyNotWritable(TypedArray.prototype.reduceRight, "name"); +verifyConfigurable(TypedArray.prototype.reduceRight, "name"); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/prop-desc.js new file mode 100644 index 000000000..71eeecbbf --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/prop-desc.js @@ -0,0 +1,18 @@ +// 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.3.20 +description: > + "reduceRight" property of TypedArrayPrototype +info: | + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'reduceRight'); +verifyWritable(TypedArrayPrototype, 'reduceRight'); +verifyConfigurable(TypedArrayPrototype, 'reduceRight'); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-is-last-callbackfn-return.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-is-last-callbackfn-return.js new file mode 100644 index 000000000..feeb92f0f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-is-last-callbackfn-return.js @@ -0,0 +1,61 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduceright +description: > + Returns last accumulator value +info: | + 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduceRight is a distinct function that implements the + same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + ... + 7. Else initialValue is not present, + ... + b. Repeat, while kPresent is false and k ≥ 0 + ... + ii. Let kPresent be ? HasProperty(O, Pk). + iii. If kPresent is true, then + 1. Let accumulator be ? Get(O, Pk). + iv. Decrease k by 1. + ... + 8. Repeat, while k ≥ 0 + ... + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let accumulator be ? Call(callbackfn, undefined, « accumulator, + kValue, k, O »). + d. Decrease k by 1. + 9. Return accumulator. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var calls, result; + + calls = 0; + result = new TA(convertToBigInt([1, 2, 3])).reduceRight(function() { + calls++; + + if (calls == 2) { + return 42; + } + }); + assert.sameValue(result, 42, "using default accumulator"); + + calls = 0; + result = new TA(convertToBigInt([1, 2, 3])).reduceRight(function() { + calls++; + + if (calls == 3) { + return 7; + } + }, 0); + assert.sameValue(result, 7, "using custom accumulator"); +}); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-of-any-type.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-of-any-type.js new file mode 100644 index 000000000..d3731ab58 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-of-any-type.js @@ -0,0 +1,69 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduceright +description: > + Result can be of any type without any number conversions +info: | + 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduceRight is a distinct function that implements the + same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + ... + 7. Else initialValue is not present, + ... + b. Repeat, while kPresent is false and k ≥ 0 + ... + ii. Let kPresent be ? HasProperty(O, Pk). + iii. If kPresent is true, then + 1. Let accumulator be ? Get(O, Pk). + iv. Decrease k by 1. + ... + 8. Repeat, while k ≥ 0 + ... + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let accumulator be ? Call(callbackfn, undefined, « accumulator, + kValue, k, O »). + d. Decrease k by 1. + 9. Return accumulator. +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + [ + ["test262", "string"], + ["", "empty string"], + [undefined, "undefined"], + [null, "null"], + [-0, "-0"], + [42, "integer"], + [NaN, "NaN"], + [Infinity, "Infinity"], + [0.6, "float number"], + [true, "true"], + [false, "false"], + [Symbol(""), "symbol"], + [{}, "object"] + ].forEach(function(item) { + var result; + + result = sample.reduceRight(function() { + return item[0]; + }); + assert.sameValue(result, item[0], item[1] + " - using default accumulator"); + + result = sample.reduceRight(function() { + return item[0]; + }, 0); + + assert.sameValue(result, item[0], item[1] + " - using custom accumulator"); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/return-first-value-without-callbackfn.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/return-first-value-without-callbackfn.js new file mode 100644 index 000000000..3219fb682 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/return-first-value-without-callbackfn.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduceright +description: > + Returns [0] without calling callbackfn if length is 1 and initialValue is not + present. +info: | + 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduceRight is a distinct function that implements the + same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + ... + 7. Else initialValue is not present, + ... + b. Repeat, while kPresent is false and k ≥ 0 + ... + ii. Let kPresent be ? HasProperty(O, Pk). + iii. If kPresent is true, then + 1. Let accumulator be ? Get(O, Pk). + iv. Decrease k by 1. + ... + 8. Repeat, while k ≥ 0 + ... + 9. Return accumulator. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var called = false; + var result = new TA(convertToBigInt([42])).reduceRight(function() { + called = true; + }); + + assert.sameValue(result, convertToBigInt(42)); + assert.sameValue(called, false); +}); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/this-is-not-object.js new file mode 100644 index 000000000..fccf9de2b --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/this-is-not-object.js @@ -0,0 +1,51 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduceright +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var reduceRight = TypedArray.prototype.reduceRight; +var callbackfn = function() {}; + +assert.throws(TypeError, function() { + reduceRight.call(undefined, callbackfn); +}, "this is undefined"); + +assert.throws(TypeError, function() { + reduceRight.call(null, callbackfn); +}, "this is null"); + +assert.throws(TypeError, function() { + reduceRight.call(42, callbackfn); +}, "this is 42"); + +assert.throws(TypeError, function() { + reduceRight.call("1", callbackfn); +}, "this is a string"); + +assert.throws(TypeError, function() { + reduceRight.call(true, callbackfn); +}, "this is true"); + +assert.throws(TypeError, function() { + reduceRight.call(false, callbackfn); +}, "this is false"); + +var s = Symbol("s"); +assert.throws(TypeError, function() { + reduceRight.call(s, callbackfn); +}, "this is a Symbol"); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..8092e93e9 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduceright +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var reduceRight = TypedArray.prototype.reduceRight; +var callbackfn = function() {}; + +assert.throws(TypeError, function() { + reduceRight.call({}, callbackfn); +}, "this is an Object"); + +assert.throws(TypeError, function() { + reduceRight.call([], callbackfn); +}, "this is an Array"); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + reduceRight.call(ab, callbackfn); +}, "this is an ArrayBuffer instance"); + +var dv = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + reduceRight.call(dv, callbackfn); +}, "this is a DataView instance"); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/values-are-not-cached.js new file mode 100644 index 000000000..a7f5cda05 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/values-are-not-cached.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduceright +description: > + Integer indexed values are not cached before iteration +info: | + 22.2.3.21 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + %TypedArray%.prototype.reduceRight is a distinct function that implements the + same algorithm as Array.prototype.reduceRight as defined in 22.1.3.20 except + that the this object's [[ArrayLength]] internal slot is accessed in place of + performing a [[Get]] of "length". + + 22.1.3.20 Array.prototype.reduceRight ( callbackfn [ , initialValue ] ) + + ... + 8. Repeat, while k ≥ 0 + ... + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let accumulator be ? Call(callbackfn, undefined, « accumulator, + kValue, k, O »). + d. Decrease k by 1. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([44, 43, 42])); + + sample.reduceRight(function(a, v, i) { + if (i > 0) { + sample[i-1] = convertToBigInt(42); + } + + assert.sameValue( + v, convertToBigInt(42), "method does not cache values before callbackfn calls" + ); + }, 0); +}); diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/detached-buffer.js new file mode 100644 index 000000000..5067380d5 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/detached-buffer.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reverse +description: Throws a TypeError if this has a detached buffer +info: | + 22.2.3.22 %TypedArray%.prototype.reverse ( ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + ... + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.reverse(); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/get-length-uses-internal-arraylength.js new file mode 100644 index 000000000..7acdfdfff --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/get-length-uses-internal-arraylength.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reverse +description: Get "length" uses internal ArrayLength +info: | + 22.2.3.22 %TypedArray%.prototype.reverse ( ) + + %TypedArray%.prototype.reverse is a distinct function that implements the same + algorithm as Array.prototype.reverse as defined in 22.1.3.21 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.21 Array.prototype.reverse ( ) + + 1. Let O be ? ToObject(this value). + 2. Let len be ? ToLength(? Get(O, "length")). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var getCalls = 0; +var desc = { + get: function getLen() { + getCalls++; + return 0; + } +}; + +Object.defineProperty(TypedArray.prototype, "length", desc); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + + Object.defineProperty(TA.prototype, "length", desc); + Object.defineProperty(sample, "length", desc); + + sample.reverse(); + + assert.sameValue(getCalls, 0, "ignores length properties"); +}); diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-func.js new file mode 100644 index 000000000..f8b4b6fde --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-func.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. +/*--- +es6id: 22.2.3.21 +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.21 %TypedArray%.prototype.reverse ( ) + + ... + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var reverse = TypedArray.prototype.reverse; + +assert.sameValue(typeof reverse, 'function'); + +assert.throws(TypeError, function() { + reverse(); +}); diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-method.js new file mode 100644 index 000000000..ec8dd5945 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-method.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. +/*--- +es6id: 22.2.3.21 +description: Requires a [[TypedArrayName]] internal slot. +info: | + 22.2.3.21 %TypedArray%.prototype.reverse ( ) + + ... + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.reverse, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.reverse(); +}); diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/length.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/length.js new file mode 100644 index 000000000..afb56f9e1 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.21 +description: > + %TypedArray%.prototype.reverse.length is 0. +info: | + %TypedArray%.prototype.reverse ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.reverse.length, 0); + +verifyNotEnumerable(TypedArray.prototype.reverse, "length"); +verifyNotWritable(TypedArray.prototype.reverse, "length"); +verifyConfigurable(TypedArray.prototype.reverse, "length"); diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/name.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/name.js new file mode 100644 index 000000000..9652d5a60 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.21 +description: > + %TypedArray%.prototype.reverse.name is "reverse". +info: | + %TypedArray%.prototype.reverse ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.reverse.name, "reverse"); + +verifyNotEnumerable(TypedArray.prototype.reverse, "name"); +verifyNotWritable(TypedArray.prototype.reverse, "name"); +verifyConfigurable(TypedArray.prototype.reverse, "name"); diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/preserves-non-numeric-properties.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/preserves-non-numeric-properties.js new file mode 100644 index 000000000..a06d52f98 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/preserves-non-numeric-properties.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reverse +description: Preserves non numeric properties +info: | + 22.2.3.22 %TypedArray%.prototype.reverse ( ) + + %TypedArray%.prototype.reverse is a distinct function that implements the same + algorithm as Array.prototype.reverse as defined in 22.1.3.21 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.21 Array.prototype.reverse ( ) + + ... + 6. Return O. +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var s = Symbol("1"); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample, result; + + sample = new TA(2); + sample.foo = 42; + sample.bar = "bar"; + sample[s] = 1; + result = sample.reverse(); + assert.sameValue(result.foo, 42, "sample.foo === 42"); + assert.sameValue(result.bar, "bar", "sample.bar === 'bar'"); + assert.sameValue(result[s], 1, "sample[s] === 1"); +}); diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/prop-desc.js new file mode 100644 index 000000000..56c828f36 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/prop-desc.js @@ -0,0 +1,18 @@ +// 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.3.21 +description: > + "reverse" property of TypedArrayPrototype +info: | + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'reverse'); +verifyWritable(TypedArrayPrototype, 'reverse'); +verifyConfigurable(TypedArrayPrototype, 'reverse'); diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/returns-original-object.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/returns-original-object.js new file mode 100644 index 000000000..c9f8fdafd --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/returns-original-object.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reverse +description: Returns the same object +info: | + 22.2.3.22 %TypedArray%.prototype.reverse ( ) + + %TypedArray%.prototype.reverse is a distinct function that implements the same + algorithm as Array.prototype.reverse as defined in 22.1.3.21 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.21 Array.prototype.reverse ( ) + + ... + 6. Return O. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var buffer = new ArrayBuffer(64); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample, result, expectedLength; + + sample = new TA(buffer, 0); + expectedLength = sample.length; + result = sample.reverse(); + assert.sameValue(result, sample, "returns the same object"); + assert.sameValue(sample.buffer, buffer, "keeps the same buffer"); + assert.sameValue(sample.length, expectedLength, "length is preserved"); + + sample = new TA(buffer, 0, 0); + result = sample.reverse(); + assert.sameValue(result, sample, "returns the same object (empty instance)"); + assert.sameValue(sample.buffer, buffer, "keeps the same buffer (empty instance)"); + assert.sameValue(sample.length, 0, "length is preserved (empty instance)"); +}); diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/reverts.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/reverts.js new file mode 100644 index 000000000..660088f02 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/reverts.js @@ -0,0 +1,57 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reverse +description: Reverts values +info: | + 22.2.3.22 %TypedArray%.prototype.reverse ( ) + + %TypedArray%.prototype.reverse is a distinct function that implements the same + algorithm as Array.prototype.reverse as defined in 22.1.3.21 except that the + this object's [[ArrayLength]] internal slot is accessed in place of performing + a [[Get]] of "length". + + 22.1.3.21 Array.prototype.reverse ( ) + + ... + 6. Return O. +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +var buffer = new ArrayBuffer(64); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(buffer, 0, 4); + var other = new TA(buffer, 0, 5); + + sample[0] = convertToBigInt(42); + sample[1] = convertToBigInt(43); + sample[2] = convertToBigInt(2); + sample[3] = convertToBigInt(1); + other[4] = convertToBigInt(7); + + sample.reverse(); + assert( + compareArray(sample, convertToBigInt([1, 2, 43, 42])) + ); + + assert( + compareArray(other, convertToBigInt([1, 2, 43, 42, 7])) + ); + + sample[0] = convertToBigInt(7); + sample[1] = convertToBigInt(17); + sample[2] = convertToBigInt(1); + sample[3] = convertToBigInt(0); + other[4] = convertToBigInt(42); + + other.reverse(); + assert( + compareArray(other, convertToBigInt([42, 0, 1, 17, 7])) + ); + + assert( + compareArray(sample, convertToBigInt([42, 0, 1, 17])) + ); +}); diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/this-is-not-object.js new file mode 100644 index 000000000..82255a345 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/this-is-not-object.js @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reverse +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.22 %TypedArray%.prototype.reverse ( ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var reverse = TypedArray.prototype.reverse; + +assert.throws(TypeError, function() { + reverse.call(undefined); +}, "this is undefined"); + +assert.throws(TypeError, function() { + reverse.call(null); +}, "this is null"); + +assert.throws(TypeError, function() { + reverse.call(42); +}, "this is 42"); + +assert.throws(TypeError, function() { + reverse.call("1"); +}, "this is a string"); + +assert.throws(TypeError, function() { + reverse.call(true); +}, "this is true"); + +assert.throws(TypeError, function() { + reverse.call(false); +}, "this is false"); + +var s = Symbol("s"); +assert.throws(TypeError, function() { + reverse.call(s); +}, "this is a Symbol"); diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..07b5138d9 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reverse +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.22 %TypedArray%.prototype.reverse ( ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var reverse = TypedArray.prototype.reverse; + +assert.throws(TypeError, function() { + reverse.call({}); +}, "this is an Object"); + +assert.throws(TypeError, function() { + reverse.call([]); +}, "this is an Array"); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + reverse.call(ab); +}, "this is an ArrayBuffer instance"); + +var dv = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + reverse.call(dv); +}, "this is a DataView instance"); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-negative-integer-offset-throws.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-negative-integer-offset-throws.js new file mode 100644 index 000000000..a5896d24b --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-negative-integer-offset-throws.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-array-offset +description: > + Throw a RangeError exception if targetOffset < 0 +info: | + 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] ) + + 1. Assert: array is any ECMAScript language value other than an Object with a + [[TypedArrayName]] internal slot. If it is such an Object, the definition in + 22.2.3.23.2 applies. + ... + 6. Let targetOffset be ? ToInteger(offset). + 7. If targetOffset < 0, throw a RangeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(4); + + assert.throws(RangeError, function() { + sample.set([1], -1); + }, "-1"); + + assert.throws(RangeError, function() { + sample.set([1], -1.00001); + }, "-1.00001"); + + assert.throws(RangeError, function() { + sample.set([1], -Infinity); + }, "-Infinity"); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-offset-tointeger.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-offset-tointeger.js new file mode 100644 index 000000000..b47dc9de6 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-offset-tointeger.js @@ -0,0 +1,95 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-array-offset +description: > + ToInteger(offset) operations +info: | + 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] ) + + 1. Assert: array is any ECMAScript language value other than an Object with a + [[TypedArrayName]] internal slot. If it is such an Object, the definition in + 22.2.3.23.2 applies. + ... + 6. Let targetOffset be ? ToInteger(offset). + 7. If targetOffset < 0, throw a RangeError exception. + ... +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample; + + sample = new TA(convertToBigInt([1, 2])); + sample.set([convertToBigInt(42)], ""); + assert(compareArray(sample, convertToBigInt([42, 2])), "the empty string"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set([convertToBigInt(42)], "0"); + assert(compareArray(sample, convertToBigInt([42, 2])), "'0'"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set([convertToBigInt(42)], false); + assert(compareArray(sample, convertToBigInt([42, 2])), "false"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set([convertToBigInt(42)], 0.1); + assert(compareArray(sample, convertToBigInt([42, 2])), "0.1"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set([convertToBigInt(42)], 0.9); + assert(compareArray(sample, convertToBigInt([42, 2])), "0.9"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set([convertToBigInt(42)], -0.5); + assert(compareArray(sample, convertToBigInt([42, 2])), "-0.5"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set([convertToBigInt(42)], 1.1); + assert(compareArray(sample, convertToBigInt([1, 42])), "1.1"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set([convertToBigInt(42)], NaN); + assert(compareArray(sample, convertToBigInt([42, 2])), "NaN"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set([convertToBigInt(42)], null); + assert(compareArray(sample, convertToBigInt([42, 2])), "null"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set([convertToBigInt(42)], undefined); + assert(compareArray(sample, convertToBigInt([42, 2])), "undefined"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set([convertToBigInt(42)], {}); + assert(compareArray(sample, convertToBigInt([42, 2])), "{}"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set([convertToBigInt(42)], []); + assert(compareArray(sample, convertToBigInt([42, 2])), "[]"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set([convertToBigInt(42)], [0]); + assert(compareArray(sample, convertToBigInt([42, 2])), "[0]"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set([convertToBigInt(42)], true); + assert(compareArray(sample, convertToBigInt([1, 42])), "true"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set([convertToBigInt(42)], "1"); + assert(compareArray(sample, convertToBigInt([1, 42])), "'1'"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set([convertToBigInt(42)], [1]); + assert(compareArray(sample, convertToBigInt([1, 42])), "[1]"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set([convertToBigInt(42)], { valueOf: function() {return 1;} }); + assert(compareArray(sample, convertToBigInt([1, 42])), "valueOf"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set([convertToBigInt(42)], { toString: function() {return 1;} }); + assert(compareArray(sample, convertToBigInt([1, 42])), "toString"); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-length.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-length.js new file mode 100644 index 000000000..2dd5b23ea --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-length.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-array-offset +description: > + Return abrupt getting src "length" +info: | + 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] ) + + 1. Assert: array is any ECMAScript language value other than an Object with a + [[TypedArrayName]] internal slot. If it is such an Object, the definition in + 22.2.3.23.2 applies. + ... + 16. Let srcLength be ? ToLength(? Get(src, "length")). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var obj = {}; +Object.defineProperty(obj, "length", { + get: function() { + throw new Test262Error(); + } +}); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([1, 2, 3])); + + assert.throws(Test262Error, function() { + sample.set(obj); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-value.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-value.js new file mode 100644 index 000000000..451e7bad1 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-value.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-array-offset +description: > + Return abrupt from getting src property value +info: | + 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] ) + + 1. Assert: array is any ECMAScript language value other than an Object with a + [[TypedArrayName]] internal slot. If it is such an Object, the definition in + 22.2.3.23.2 applies. + ... + 21. Repeat, while targetByteIndex < limit + a. Let Pk be ! ToString(k). + b. Let kNumber be ? ToNumber(? Get(src, Pk)). + c. If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception. + d. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType, + kNumber). + ... +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var obj = { + length: 4, + "0": convertToBigInt(42), + "1": convertToBigInt(43), + "3": convertToBigInt(44) + }; + Object.defineProperty(obj, "2", { + get: function() { + throw new Test262Error(); + } + }); + + var sample = new TA(convertToBigInt([1, 2, 3, 4])); + + assert.throws(Test262Error, function() { + sample.set(obj); + }); + + assert( + compareArray(sample, convertToBigInt([42, 43, 3, 4])), + "values are set until exception" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length-symbol.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length-symbol.js new file mode 100644 index 000000000..f1a65b06e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length-symbol.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. +/*--- +esid: sec-%typedarray%.prototype.set-array-offset +description: > + Return abrupt getting src "length" as symbol +info: | + 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] ) + + 1. Assert: array is any ECMAScript language value other than an Object with a + [[TypedArrayName]] internal slot. If it is such an Object, the definition in + 22.2.3.23.2 applies. + ... + 16. Let srcLength be ? ToLength(? Get(src, "length")). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var obj = { + length: Symbol("1") +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([1, 2, 3])); + + assert.throws(TypeError, function() { + sample.set(obj); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length.js new file mode 100644 index 000000000..401a486db --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-array-offset +description: > + Return abrupt from ToLength(src "length") +info: | + 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] ) + + 1. Assert: array is any ECMAScript language value other than an Object with a + [[TypedArrayName]] internal slot. If it is such an Object, the definition in + 22.2.3.23.2 applies. + ... + 16. Let srcLength be ? ToLength(? Get(src, "length")). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var obj1 = { + length: { + valueOf: function() { + throw new Test262Error(); + } + } +}; + +var obj2 = { + length: { + toString: function() { + throw new Test262Error(); + } + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([1, 2, 3])); + + assert.throws(Test262Error, function() { + sample.set(obj1); + }, "valueOf"); + + assert.throws(Test262Error, function() { + sample.set(obj2); + }, "toString"); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value-symbol.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value-symbol.js new file mode 100644 index 000000000..fd9121934 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value-symbol.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-array-offset +description: > + Return abrupt from ToNumber(src property symbol value) +info: | + 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] ) + + 1. Assert: array is any ECMAScript language value other than an Object with a + [[TypedArrayName]] internal slot. If it is such an Object, the definition in + 22.2.3.23.2 applies. + ... + 21. Repeat, while targetByteIndex < limit + a. Let Pk be ! ToString(k). + b. Let kNumber be ? ToNumber(? Get(src, Pk)). + c. If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception. + d. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType, + kNumber). + ... +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var obj = { + length: 4, + "0": convertToBigInt(42), + "1": convertToBigInt(43), + "2": Symbol("1"), + "3": convertToBigInt(44) + }; + + var sample = new TA(convertToBigInt([1, 2, 3, 4])); + + assert.throws(TypeError, function() { + sample.set(obj); + }); + + assert( + compareArray(sample, convertToBigInt([42, 43, 3, 4])), + "values are set until exception" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value.js new file mode 100644 index 000000000..af1f98349 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-array-offset +description: > + Return abrupt from ToNumber(src property value) +info: | + 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] ) + + 1. Assert: array is any ECMAScript language value other than an Object with a + [[TypedArrayName]] internal slot. If it is such an Object, the definition in + 22.2.3.23.2 applies. + ... + 21. Repeat, while targetByteIndex < limit + a. Let Pk be ! ToString(k). + b. Let kNumber be ? ToNumber(? Get(src, Pk)). + c. If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception. + d. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType, + kNumber). + ... +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var obj = { + length: 4, + "0": convertToBigInt(42), + "1": convertToBigInt(43), + "2": { + valueOf: function() { + throw new Test262Error(); + } + }, + "3": convertToBigInt(44) + }; + + var sample = new TA(convertToBigInt([1, 2, 3, 4])); + + assert.throws(Test262Error, function() { + sample.set(obj); + }); + + assert( + compareArray(sample, convertToBigInt([42, 43, 3, 4])), + "values are set until exception" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-tointeger-offset-symbol.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-tointeger-offset-symbol.js new file mode 100644 index 000000000..f9d8699ab --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-tointeger-offset-symbol.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-array-offset +description: > + Return abrupt from ToInteger(Symbol offset) +info: | + 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] ) + + 1. Assert: array is any ECMAScript language value other than an Object with a + [[TypedArrayName]] internal slot. If it is such an Object, the definition in + 22.2.3.23.2 applies. + ... + 6. Let targetOffset be ? ToInteger(offset). +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var s = Symbol("1"); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + + assert.throws(TypeError, function() { + sample.set([1], s); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-tointeger-offset.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-tointeger-offset.js new file mode 100644 index 000000000..ca31811e5 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-tointeger-offset.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-array-offset +description: > + Return abrupt from ToInteger(offset) +info: | + 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] ) + + 1. Assert: array is any ECMAScript language value other than an Object with a + [[TypedArrayName]] internal slot. If it is such an Object, the definition in + 22.2.3.23.2 applies. + ... + 6. Let targetOffset be ? ToInteger(offset). +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var obj1 = { + valueOf: function() { + throw new Test262Error(); + } +}; + +var obj2 = { + toString: function() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + + assert.throws(Test262Error, function() { + sample.set([], obj1); + }, "abrupt from valueOf"); + + assert.throws(Test262Error, function() { + sample.set([], obj2); + }, "abrupt from toString"); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-toobject-offset.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-toobject-offset.js new file mode 100644 index 000000000..8ee19ce7c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-toobject-offset.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. +/*--- +esid: sec-%typedarray%.prototype.set-array-offset +description: > + Return abrupt from ToObject(array) +info: | + 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] ) + + 1. Assert: array is any ECMAScript language value other than an Object with a + [[TypedArrayName]] internal slot. If it is such an Object, the definition in + 22.2.3.23.2 applies. + ... + 15. Let src be ? ToObject(array). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([1, 2, 3])); + + assert.throws(TypeError, function() { + sample.set(undefined); + }, "undefined"); + + assert.throws(TypeError, function() { + sample.set(null); + }, "null"); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values-in-order.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values-in-order.js new file mode 100644 index 000000000..7a5ed9850 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values-in-order.js @@ -0,0 +1,72 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-array-offset +description: > + Get and set each value in order +info: | + 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] ) + + 1. Assert: array is any ECMAScript language value other than an Object with a + [[TypedArrayName]] internal slot. If it is such an Object, the definition in + 22.2.3.23.2 applies. + ... + 21. Repeat, while targetByteIndex < limit + a. Let Pk be ! ToString(k). + b. Let kNumber be ? ToNumber(? Get(src, Pk)). + c. If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception. + d. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType, + kNumber). + ... +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(5); + var calls = []; + var obj = { + length: 3 + }; + Object.defineProperty(obj, 0, { + get: function() { + calls.push(0); + calls.push(sample.join()); + return convertToBigInt(42); + } + }); + + Object.defineProperty(obj, 1, { + get: function() { + calls.push(1); + calls.push(sample.join()); + return convertToBigInt(43); + } + }); + + Object.defineProperty(obj, 2, { + get: function() { + calls.push(2); + calls.push(sample.join()); + return convertToBigInt(44); + } + }); + + Object.defineProperty(obj, 3, { + get: function() { + throw new Test262Error("Should not call obj[3]"); + } + }); + + sample.set(obj, 1); + + assert( + compareArray(sample, convertToBigInt([0, 42, 43, 44, 0])), + "values are set for src length" + ); + + assert( + compareArray(calls, [0, "0,0,0,0,0", 1, "0,42,0,0,0", 2, "0,42,43,0,0"]), + "values are set in order" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values.js new file mode 100644 index 000000000..3a5888726 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values.js @@ -0,0 +1,63 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-array-offset +description: > + Set values to target and return undefined +info: | + 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] ) + + 1. Assert: array is any ECMAScript language value other than an Object with a + [[TypedArrayName]] internal slot. If it is such an Object, the definition in + 22.2.3.23.2 applies. + ... + 21. Repeat, while targetByteIndex < limit + Let Pk be ! ToString(k). + Let kNumber be ? ToNumber(? Get(src, Pk)). + If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception. + Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType, kNumber). + ... + 22. Return undefined. +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var src = convertToBigInt([42, 43]); + var srcObj = { + length: 2, + '0': convertToBigInt(7), + '1': convertToBigInt(17) + }; + var sample, result; + + sample = new TA(convertToBigInt([1, 2, 3, 4])); + result = sample.set(src, 0); + assert(compareArray(sample, convertToBigInt([42, 43, 3, 4])), "offset: 0, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sample = new TA(convertToBigInt([1, 2, 3, 4])); + result = sample.set(src, 1); + assert(compareArray(sample, convertToBigInt([1, 42, 43, 4])), "offset: 1, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sample = new TA(convertToBigInt([1, 2, 3, 4])); + result = sample.set(src, 2); + assert(compareArray(sample, convertToBigInt([1, 2, 42, 43])), "offset: 2, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sample = new TA(convertToBigInt([1, 2, 3, 4])); + result = sample.set(srcObj, 0); + assert(compareArray(sample, convertToBigInt([7, 17, 3, 4])), "offset: 0, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sample = new TA(convertToBigInt([1, 2, 3, 4])); + result = sample.set(srcObj, 1); + assert(compareArray(sample, convertToBigInt([1, 7, 17, 4])), "offset: 1, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sample = new TA(convertToBigInt([1, 2, 3, 4])); + result = sample.set(srcObj, 2); + assert(compareArray(sample, convertToBigInt([1, 2, 7, 17])), "offset: 2, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-conversions.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-conversions.js new file mode 100644 index 000000000..04d518689 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-conversions.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. +/*--- +esid: sec-%typedarray%.prototype.set-array-offset +description: > + Values conversions on ToNumber(src property value) +info: | + 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] ) + + 1. Assert: array is any ECMAScript language value other than an Object with a + [[TypedArrayName]] internal slot. If it is such an Object, the definition in + 22.2.3.23.2 applies. + ... + 21. Repeat, while targetByteIndex < limit + a. Let Pk be ! ToString(k). + b. Let kNumber be ? ToNumber(? Get(src, Pk)). + c. If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception. + d. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType, + kNumber). + ... +includes: [byteConversionValues.js, testBigIntTypedArray.js] +---*/ + +testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { + var sample = new TA([initial]); + + sample.set([value]); + + assert.sameValue(sample[0], expected, "["+value+"] => ["+expected +"]"); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-type-conversions.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-type-conversions.js new file mode 100644 index 000000000..a07ffab4f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-type-conversions.js @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-array-offset +description: > + Type conversions on ToNumber(src property value) +info: | + 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] ) + + 1. Assert: array is any ECMAScript language value other than an Object with a + [[TypedArrayName]] internal slot. If it is such an Object, the definition in + 22.2.3.23.2 applies. + ... + 21. Repeat, while targetByteIndex < limit + a. Let Pk be ! ToString(k). + b. Let kNumber be ? ToNumber(? Get(src, Pk)). + c. If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception. + d. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType, + kNumber). + ... +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var obj1 = { + valueOf: function() { + return convertToBigInt(42); + } + }; + + var obj2 = { + toString: function() { + return "42"; + } + }; + + // undefined and NaN covered on typedArrayConversions + var arr = ["1", "", false, true, nullish, obj1, obj2, [], [1]]; + + var sample = new TA(arr.length); + var expected = new TA(convertToBigInt([1, 0, 0, 1, 42, 42, 0, 1])); + + sample.set(arr); + + assert( + compareArray(sample, expected), + "sample: [" + sample + "], expected: [" + expected + "]" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-values-are-not-cached.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-values-are-not-cached.js new file mode 100644 index 000000000..3ad61f0b6 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-values-are-not-cached.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-array-offset +description: > + Values from src array are not cached +info: | + 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] ) + + 1. Assert: array is any ECMAScript language value other than an Object with a + [[TypedArrayName]] internal slot. If it is such an Object, the definition in + 22.2.3.23.2 applies. + ... + 21. Repeat, while targetByteIndex < limit + a. Let Pk be ! ToString(k). + b. Let kNumber be ? ToNumber(? Get(src, Pk)). + c. If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception. + d. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType, + kNumber). + ... +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(5); + var obj = { + length: 5, + '1': convertToBigInt(7), + '2': convertToBigInt(7), + '3': convertToBigInt(7), + '4': convertToBigInt(7) + }; + Object.defineProperty(obj, 0, { + get: function() { + obj[1] = convertToBigInt(43); + obj[2] = convertToBigInt(44); + obj[3] = convertToBigInt(45); + obj[4] = convertToBigInt(46); + return convertToBigInt(42); + } + }); + + sample.set(obj); + + assert(compareArray(sample, convertToBigInt([42, 43, 44, 45, 46]))); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-target-arraylength-internal.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-target-arraylength-internal.js new file mode 100644 index 000000000..95c1a9776 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-target-arraylength-internal.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-array-offset +description: > + Uses target's internal [[ArrayLength]] +info: | + 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] ) + + 1. Assert: array is any ECMAScript language value other than an Object with a + [[TypedArrayName]] internal slot. If it is such an Object, the definition in + 22.2.3.23.2 applies. + ... + 10. Let targetLength be the value of target's [[ArrayLength]] internal slot. + ... + 17. If srcLength + targetOffset > targetLength, throw a RangeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var getCalls = 0; +var desc = { + get: function() { + getCalls++; + return 0; + } +}; + +Object.defineProperty(TypedArray.prototype, "length", desc); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + + Object.defineProperty(TA.prototype, "length", desc); + Object.defineProperty(sample, "length", desc); + + sample.set(convertToBigInt([42, 43])); + + assert.sameValue(getCalls, 0, "ignores length properties"); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-on-get-src-value-throws.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-on-get-src-value-throws.js new file mode 100644 index 000000000..7e53f4221 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-on-get-src-value-throws.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-array-offset +description: > + Throws an error if buffer is detached before setting a value +info: | + 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] ) + + 1. Assert: array is any ECMAScript language value other than an Object with a + [[TypedArrayName]] internal slot. If it is such an Object, the definition in + 22.2.3.23.2 applies. + ... + 21. Repeat, while targetByteIndex < limit + a. Let Pk be ! ToString(k). + b. Let kNumber be ? ToNumber(? Get(src, Pk)). + c. If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception. + d. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType, + kNumber). + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([1, 2, 3])); + var obj = { + length: 3, + "0": convertToBigInt(42) + }; + Object.defineProperty(obj, 1, { + get: function() { + $DETACHBUFFER(sample.buffer); + } + }); + Object.defineProperty(obj, 2, { + get: function() { + throw new Test262Error("Should not get other values"); + } + }); + + assert.throws(TypeError, function() { + sample.set(obj); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-on-tointeger-offset-throws.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-on-tointeger-offset-throws.js new file mode 100644 index 000000000..a25113b5a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-on-tointeger-offset-throws.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-array-offset +description: > + Throws a TypeError if targetBuffer is detached on ToInteger(offset) +info: | + 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] ) + + 1. Assert: array is any ECMAScript language value other than an Object with a + [[TypedArrayName]] internal slot. If it is such an Object, the definition in + 22.2.3.23.2 applies. + ... + 6. Let targetOffset be ? ToInteger(offset). + ... + 8. Let targetBuffer be the value of target's [[ViewedArrayBuffer]] internal + slot. + 9. If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + var calledOffset = 0; + var obj = { + valueOf: function() { + $DETACHBUFFER(sample.buffer); + calledOffset += 1; + } + }; + + assert.throws(TypeError, function() { + sample.set([1], obj); + }); + + assert.sameValue(calledOffset, 1); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-throws.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-throws.js new file mode 100644 index 000000000..9a2bd2531 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-throws.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-array-offset +description: > + Throws a TypeError if targetBuffer is detached +info: | + 22.2.3.23.1 %TypedArray%.prototype.set (array [ , offset ] ) + + 1. Assert: array is any ECMAScript language value other than an Object with a + [[TypedArrayName]] internal slot. If it is such an Object, the definition in + 22.2.3.23.2 applies. + ... + 8. Let targetBuffer be the value of target's [[ViewedArrayBuffer]] internal + slot. + 9. If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception. + ... + 15. Let src be ? ToObject(array). + 16. Let srcLength be ? ToLength(? Get(src, "length")). + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +var obj = {}; +Object.defineProperty(obj, "length", { + get: function() { + throw new Test262Error(); + } +}); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + $DETACHBUFFER(sample.buffer); + + assert.throws(TypeError, function() { + sample.set([1]); + }, "regular check"); + + assert.throws(TypeError, function() { + sample.set(obj); + }, "IsDetachedBuffer happens before Get(src.length)"); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js b/test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js new file mode 100644 index 000000000..07ec82242 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set +es6id: 22.2.3.22.2 +description: Preservation of bit-level encoding +info: | + [...] + 28. Else, + a. NOTE: If srcType and targetType are the same, the transfer must be + performed in a manner that preserves the bit-level encoding of the + source data. + b. Repeat, while targetByteIndex < limit + i. Let value be GetValueFromBuffer(srcBuffer, srcByteIndex, "Uint8"). + ii. Perform SetValueInBuffer(targetBuffer, targetByteIndex, "Uint8", + value). + iii. Set srcByteIndex to srcByteIndex + 1. + iv. Set targetByteIndex to targetByteIndex + 1. +includes: [nans.js, compareArray.js, testBigIntTypedArray.js] +---*/ + +function body(FloatArray) { + var source = new FloatArray(distinctNaNs); + var target = new FloatArray(distinctNaNs.length); + var sourceBytes, targetBytes; + + target.set(source); + + sourceBytes = new Uint8Array(source.buffer); + targetBytes = new Uint8Array(target.buffer); + + assert(compareArray(sourceBytes, targetBytes)) +} + +testWithBigIntTypedArrayConstructors(body, [Float32Array, Float64Array]); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-func.js new file mode 100644 index 000000000..1826706ff --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-func.js @@ -0,0 +1,21 @@ +// 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.3.22 +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.22 %TypedArray%.prototype.set ( overloaded [ , offset ]) + + This function is not generic. The this value must be an object with a + [[TypedArrayName]] internal slot. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var set = TypedArray.prototype.set; + +assert.sameValue(typeof set, 'function'); + +assert.throws(TypeError, function() { + set(); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-method.js new file mode 100644 index 000000000..4f52624e7 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-method.js @@ -0,0 +1,21 @@ +// 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.3.22 +description: Requires a [[TypedArrayName]] internal slot. +info: | + 22.2.3.22 %TypedArray%.prototype.set ( overloaded [ , offset ]) + + This function is not generic. The this value must be an object with a + [[TypedArrayName]] internal slot. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.set, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.set(); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/length.js b/test/built-ins/TypedArray/prototype/set/BigInt/length.js new file mode 100644 index 000000000..a206e85a9 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.22 +description: > + %TypedArray%.prototype.set.length is 1. +info: | + %TypedArray%.prototype.set ( overloaded [ , offset ]) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.set.length, 1); + +verifyNotEnumerable(TypedArray.prototype.set, "length"); +verifyNotWritable(TypedArray.prototype.set, "length"); +verifyConfigurable(TypedArray.prototype.set, "length"); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/name.js b/test/built-ins/TypedArray/prototype/set/BigInt/name.js new file mode 100644 index 000000000..2bb904d8f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.22 +description: > + %TypedArray%.prototype.set.name is "set". +info: | + %TypedArray%.prototype.set ( overloaded [ , offset ]) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.set.name, "set"); + +verifyNotEnumerable(TypedArray.prototype.set, "name"); +verifyNotWritable(TypedArray.prototype.set, "name"); +verifyConfigurable(TypedArray.prototype.set, "name"); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/set/BigInt/prop-desc.js new file mode 100644 index 000000000..6dabe5c1b --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/prop-desc.js @@ -0,0 +1,18 @@ +// 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.3.22 +description: > + "set" property of TypedArrayPrototype +info: | + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'set'); +verifyWritable(TypedArrayPrototype, 'set'); +verifyConfigurable(TypedArrayPrototype, 'set'); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/set/BigInt/this-is-not-object.js new file mode 100644 index 000000000..d1b6242e9 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/this-is-not-object.js @@ -0,0 +1,75 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-overloaded-offset +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.23 %TypedArray%.prototype.set + + ... + 2. Let target be the this value. + 3. If Type(target) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var set = TypedArray.prototype.set; + +assert.throws(TypeError, function() { + set.call(undefined, []); +}, "this is undefined"); + +assert.throws(TypeError, function() { + set.call(null, []); +}, "this is null"); + +assert.throws(TypeError, function() { + set.call(undefined, new Int8Array()); +}, "this is undefined"); + +assert.throws(TypeError, function() { + set.call(null, new Int8Array()); +}, "this is null"); + +assert.throws(TypeError, function() { + set.call(42, []); +}, "this is 42"); + +assert.throws(TypeError, function() { + set.call("1", []); +}, "this is a string"); + +assert.throws(TypeError, function() { + set.call(true, []); +}, "this is true"); + +assert.throws(TypeError, function() { + set.call(false, []); +}, "this is false"); + +var s1 = Symbol("s"); +assert.throws(TypeError, function() { + set.call(s1, []); +}, "this is a Symbol"); + +assert.throws(TypeError, function() { + set.call(42, new Int8Array(1)); +}, "this is 42"); + +assert.throws(TypeError, function() { + set.call("1", new Int8Array(1)); +}, "this is a string"); + +assert.throws(TypeError, function() { + set.call(true, new Int8Array(1)); +}, "this is true"); + +assert.throws(TypeError, function() { + set.call(false, new Int8Array(1)); +}, "this is false"); + +var s2 = Symbol("s"); +assert.throws(TypeError, function() { + set.call(s2, new Int8Array(1)); +}, "this is a Symbol"); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/set/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..77220ea6a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,56 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-overloaded-offset +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.23 %TypedArray%.prototype.set + + ... + 2. Let target be the this value. + 3. If Type(target) is not Object, throw a TypeError exception. + 4. If target does not have a [[TypedArrayName]] internal slot, throw a + TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var set = TypedArray.prototype.set; + +assert.throws(TypeError, function() { + set.call({}, []); +}, "this is an Object"); + +assert.throws(TypeError, function() { + set.call([], []); +}, "this is an Array"); + +var ab1 = new ArrayBuffer(8); +assert.throws(TypeError, function() { + set.call(ab1, []); +}, "this is an ArrayBuffer instance"); + +var dv1 = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + set.call(dv1, []); +}, "this is a DataView instance"); + +assert.throws(TypeError, function() { + set.call({}, new Int8Array()); +}, "this is an Object"); + +assert.throws(TypeError, function() { + set.call([], new Int8Array()); +}, "this is an Array"); + +var ab2 = new ArrayBuffer(8); +assert.throws(TypeError, function() { + set.call(ab2, new Int8Array()); +}, "this is an ArrayBuffer instance"); + +var dv2 = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + set.call(dv2, new Int8Array()); +}, "this is a DataView instance"); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-negative-integer-offset-throws.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-negative-integer-offset-throws.js new file mode 100644 index 000000000..d5848d91a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-negative-integer-offset-throws.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-typedarray-offset +description: > + Throw a RangeError exception if targetOffset < 0 +info: | + 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] ) + + 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not, + the definition in 22.2.3.23.1 applies. + ... + 6. Let targetOffset be ? ToInteger(offset). + 7. If targetOffset < 0, throw a RangeError exception. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + + assert.throws(RangeError, function() { + sample.set(sample, -1); + }, "-1"); + + assert.throws(RangeError, function() { + sample.set(sample, -1.00001); + }, "-1.00001"); + + assert.throws(RangeError, function() { + sample.set(sample, -Infinity); + }, "-Infinity"); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-offset-tointeger.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-offset-tointeger.js new file mode 100644 index 000000000..9d5b2478f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-offset-tointeger.js @@ -0,0 +1,93 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-typedarray-offset +description: > + ToInteger(offset) operations +info: | + 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] ) + + 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not, + the definition in 22.2.3.23.1 applies. + ... + 6. Let targetOffset be ? ToInteger(offset). +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample; + var src = new TA(convertToBigInt([42])); + + sample = new TA(convertToBigInt([1, 2])); + sample.set(src, ""); + assert(compareArray(sample, convertToBigInt([42, 2])), "the empty string"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set(src, "0"); + assert(compareArray(sample, convertToBigInt([42, 2])), "'0'"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set(src, false); + assert(compareArray(sample, convertToBigInt([42, 2])), "false"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set(src, 0.1); + assert(compareArray(sample, convertToBigInt([42, 2])), "0.1"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set(src, 0.9); + assert(compareArray(sample, convertToBigInt([42, 2])), "0.9"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set(src, -0.5); + assert(compareArray(sample, convertToBigInt([42, 2])), "-0.5"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set(src, 1.1); + assert(compareArray(sample, convertToBigInt([1, 42])), "1.1"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set(src, NaN); + assert(compareArray(sample, convertToBigInt([42, 2])), "NaN"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set(src, null); + assert(compareArray(sample, convertToBigInt([42, 2])), "null"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set(src, undefined); + assert(compareArray(sample, convertToBigInt([42, 2])), "undefined"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set(src, {}); + assert(compareArray(sample, convertToBigInt([42, 2])), "{}"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set(src, []); + assert(compareArray(sample, convertToBigInt([42, 2])), "[]"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set(src, [0]); + assert(compareArray(sample, convertToBigInt([42, 2])), "[0]"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set(src, true); + assert(compareArray(sample, convertToBigInt([1, 42])), "true"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set(src, "1"); + assert(compareArray(sample, convertToBigInt([1, 42])), "'1'"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set(src, [1]); + assert(compareArray(sample, convertToBigInt([1, 42])), "[1]"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set(src, { valueOf: function() {return 1;} }); + assert(compareArray(sample, convertToBigInt([1, 42])), "valueOf"); + + sample = new TA(convertToBigInt([1, 2])); + sample.set(src, { toString: function() {return 1;} }); + assert(compareArray(sample, convertToBigInt([1, 42])), "toString"); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-return-abrupt-from-tointeger-offset-symbol.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-return-abrupt-from-tointeger-offset-symbol.js new file mode 100644 index 000000000..1dd14da8c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-return-abrupt-from-tointeger-offset-symbol.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-typedarray-offset +description: > + Return abrupt from ToInteger(Symbol offset) +info: | + 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] ) + + 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not, + the definition in 22.2.3.23.1 applies. + ... + 6. Let targetOffset be ? ToInteger(offset). +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var s = Symbol("1"); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + + assert.throws(TypeError, function() { + sample.set(sample, s); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-return-abrupt-from-tointeger-offset.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-return-abrupt-from-tointeger-offset.js new file mode 100644 index 000000000..7f3c93ff3 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-return-abrupt-from-tointeger-offset.js @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-typedarray-offset +description: > + Return abrupt from ToInteger(offset) +info: | + 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] ) + + 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not, + the definition in 22.2.3.23.1 applies. + ... + 6. Let targetOffset be ? ToInteger(offset). +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var obj1 = { + valueOf: function() { + throw new Test262Error(); + } +}; + +var obj2 = { + toString: function() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + + assert.throws(Test262Error, function() { + sample.set(sample, obj1); + }, "abrupt from valueOf"); + + assert.throws(Test262Error, function() { + sample.set(sample, obj2); + }, "abrupt from toString"); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions-sab.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions-sab.js new file mode 100644 index 000000000..7cf6f1111 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions-sab.js @@ -0,0 +1,51 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.set-typedarray-offset +description: > + Set converted values from different buffer of different types and different type instances +includes: [byteConversionValues.js, testBigIntTypedArray.js] +features: [BigInt, SharedArrayBuffer] +---*/ + +testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { + if (TA === Float64Array || TA === Float32Array || TA === Uint8ClampedArray) { + return; + } + if (TA === Int32Array) { + return; + } + + var sab, src, target; + + sab = new SharedArrayBuffer(4); + src = new Int32Array(sab); + src[0] = value; + target = new TA([initial]); + + target.set(src); + + assert.sameValue(target[0], expected, "src is SAB-backed"); + + sab = new SharedArrayBuffer(4); + src = new Int32Array([value]); + target = new TA(sab); + target[0] = initial; + + target.set(src); + + assert.sameValue(target[0], expected, "target is SAB-backed"); + + var sab1 = new SharedArrayBuffer(4); + var sab2 = new SharedArrayBuffer(4); + src = new Int32Array(sab1); + src[0] = value; + target = new TA(sab2); + target[0] = initial; + + target.set(src); + + assert.sameValue(target[0], expected, "src and target are SAB-backed"); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions.js new file mode 100644 index 000000000..5e819db9c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-typedarray-offset +description: > + Set converted values from different buffer and different type instances +info: | + 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] ) + + 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not, + the definition in 22.2.3.23.1 applies. + ... + 23. If SameValue(srcBuffer, targetBuffer) is true, then + ... + 24. Else, let srcByteIndex be srcByteOffset. + ... + 27. If SameValue(srcType, targetType) is true, then, + ... + 28. Else, + a. Repeat, while targetByteIndex < limit + i. Let value be GetValueFromBuffer(srcBuffer, srcByteIndex, srcType). + ii. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType, + value). +includes: [byteConversionValues.js, testBigIntTypedArray.js] +---*/ + +testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { + if (TA === Float64Array) { + return; + } + var src = new Float64Array([value]); + var target = new TA([initial]); + + target.set(src); + + assert.sameValue(target[0], expected); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-sab.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-sab.js new file mode 100644 index 000000000..408633ced --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-sab.js @@ -0,0 +1,107 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.set-typedarray-offset +description: > + Set values from different instances using the different buffer and different + type. +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, SharedArrayBuffer, TypedArray] +---*/ + +var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; + +testWithBigIntTypedArrayConstructors(function(TA) { + var other = Int32Array; + var sab = new SharedArrayBuffer(2 * other.BYTES_PER_ELEMENT); + var src = new other(sab); + src[0] = 42; + src[1] = 43; + var sample, result; + + sample = new TA([1, 2, 3, 4]); + result = sample.set(src, 0); + assert(compareArray(sample, [42, 43, 3, 4]), "src is SAB-backed, offset: 0, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sample = new TA([1, 2, 3, 4]); + result = sample.set(src, 1); + assert(compareArray(sample, [1, 42, 43, 4]), "src is SAB-backed, offset: 1, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sample = new TA([1, 2, 3, 4]); + result = sample.set(src, 2); + assert(compareArray(sample, [1, 2, 42, 43]), "src is SAB-backed, offset: 2, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + + src = new other([42, 43]); + + sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); + sample = new TA(sab); + sample[0] = 1; + sample[1] = 2; + sample[2] = 3; + sample[3] = 4; + result = sample.set(src, 0); + assert(compareArray(sample, [42, 43, 3, 4]), "sample is SAB-backed, offset: 0, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); + sample = new TA(sab); + sample[0] = 1; + sample[1] = 2; + sample[2] = 3; + sample[3] = 4; + result = sample.set(src, 1); + assert(compareArray(sample, [1, 42, 43, 4]), "sample is SAB-backed, offset: 1, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); + sample = new TA(sab); + sample[0] = 1; + sample[1] = 2; + sample[2] = 3; + sample[3] = 4; + result = sample.set(src, 2); + assert(compareArray(sample, [1, 2, 42, 43]), "sample is SAB-backed, offset: 2, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + var sab1 = new SharedArrayBuffer(2 * other.BYTES_PER_ELEMENT); + src = new other(sab1); + src[0] = 42; + src[1] = 43; + + var sab2; + sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); + sample = new TA(sab2); + sample[0] = 1; + sample[1] = 2; + sample[2] = 3; + sample[3] = 4; + result = sample.set(src, 0); + assert(compareArray(sample, [42, 43, 3, 4]), "src and sample are SAB-backed, offset: 0, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); + sample = new TA(sab2); + sample[0] = 1; + sample[1] = 2; + sample[2] = 3; + sample[3] = 4; + result = sample.set(src, 1); + assert(compareArray(sample, [1, 42, 43, 4]), "src and sample are SAB-backed, offset: 1, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); + sample = new TA(sab2); + sample[0] = 1; + sample[1] = 2; + sample[2] = 3; + sample[3] = 4; + result = sample.set(src, 2); + assert(compareArray(sample, [1, 2, 42, 43]), "src and sample are SAB-backed, offset: 2, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); +}, int_views); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type.js new file mode 100644 index 000000000..1b1869345 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-typedarray-offset +description: > + Set values from different instances using the different buffer and different + type. +info: | + 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] ) + + 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not, + the definition in 22.2.3.23.1 applies. + ... + 23. If SameValue(srcBuffer, targetBuffer) is true, then + ... + 24. Else, let srcByteIndex be srcByteOffset. + ... + 27. If SameValue(srcType, targetType) is true, then, + ... + 28. Else, + a. Repeat, while targetByteIndex < limit + i. Let value be GetValueFromBuffer(srcBuffer, srcByteIndex, srcType). + ii. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType, + value). +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var other = TA === BigInt64Array ? BigUint64Array : BigInt64Array; + var src = new other(convertToBigInt([42, 43])); + var sample, result; + + sample = new TA(convertToBigInt([1, 2, 3, 4])); + result = sample.set(src, 0); + assert(compareArray(sample, convertToBigInt([42, 43, 3, 4])), "offset: 0, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sample = new TA(convertToBigInt([1, 2, 3, 4])); + result = sample.set(src, 1); + assert(compareArray(sample, convertToBigInt([1, 42, 43, 4])), "offset: 1, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sample = new TA(convertToBigInt([1, 2, 3, 4])); + result = sample.set(src, 2); + assert(compareArray(sample, convertToBigInt([1, 2, 42, 43])), "offset: 2, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type-sab.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type-sab.js new file mode 100644 index 000000000..6e1279ea4 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type-sab.js @@ -0,0 +1,107 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-typedarray-offset +description: > + Set values from different instances using the different buffer and same + constructor. srcBuffer values are cached. +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, SharedArrayBuffer, TypedArray] +---*/ + +var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample, result; + + var sab = new SharedArrayBuffer(2 * TA.BYTES_PER_ELEMENT); + var src = new TA(sab); + src[0] = 42; + src[1] = 43; + + sample = new TA([1, 2, 3, 4]); + result = sample.set(src, 1); + assert(compareArray(sample, [1, 42, 43, 4]), "src is SAB-backed, offset: 1, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sample = new TA([1, 2, 3, 4]); + result = sample.set(src, 0); + assert(compareArray(sample, [42, 43, 3, 4]), "src is SAB-backed, offset: 0, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sample = new TA([1, 2, 3, 4]); + result = sample.set(src, 2); + assert(compareArray(sample, [1, 2, 42, 43]), "src is SAB-backed, offset: 2, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + + src = new TA([42, 43]); + + sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); + sample = new TA(sab); + sample[0] = 1; + sample[1] = 2; + sample[2] = 3; + sample[3] = 4; + result = sample.set(src, 1); + assert(compareArray(sample, [1, 42, 43, 4]), "sample is SAB-backed, offset: 1, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); + sample = new TA(sab); + sample[0] = 1; + sample[1] = 2; + sample[2] = 3; + sample[3] = 4; + result = sample.set(src, 0); + assert(compareArray(sample, [42, 43, 3, 4]), "sample is SAB-backed, offset: 0, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); + sample = new TA(sab); + sample[0] = 1; + sample[1] = 2; + sample[2] = 3; + sample[3] = 4; + result = sample.set(src, 2); + assert(compareArray(sample, [1, 2, 42, 43]), "sample is SAB-backed, offset: 2, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + + var sab1 = new SharedArrayBuffer(2 * TA.BYTES_PER_ELEMENT); + src = new TA(sab1); + src[0] = 42; + src[1] = 43; + + var sab2; + sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); + sample = new TA(sab2); + sample[0] = 1; + sample[1] = 2; + sample[2] = 3; + sample[3] = 4; + result = sample.set(src, 1); + assert(compareArray(sample, [1, 42, 43, 4]), "src and sample are SAB-backed, offset: 1, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); + sample = new TA(sab2); + sample[0] = 1; + sample[1] = 2; + sample[2] = 3; + sample[3] = 4; + result = sample.set(src, 0); + assert(compareArray(sample, [42, 43, 3, 4]), "src and sample are SAB-backed, offset: 0, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); + sample = new TA(sab2); + sample[0] = 1; + sample[1] = 2; + sample[2] = 3; + sample[3] = 4; + result = sample.set(src, 2); + assert(compareArray(sample, [1, 2, 42, 43]), "src and sample are SAB-backed, offset: 2, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); +}, int_views); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type.js new file mode 100644 index 000000000..be938ca51 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type.js @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-typedarray-offset +description: > + Set values from different instances using the different buffer and same + constructor. srcBuffer values are cached. +info: | + 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] ) + + 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not, + the definition in 22.2.3.23.1 applies. + ... + 23. If SameValue(srcBuffer, targetBuffer) is true, then + ... + 24. Else, let srcByteIndex be srcByteOffset. + ... + 27. If SameValue(srcType, targetType) is true, then, + a. NOTE: If srcType and targetType are the same, the transfer must be + performed in a manner that preserves the bit-level encoding of the source + data. + b. Repeat, while targetByteIndex < limit + i. Let value be GetValueFromBuffer(srcBuffer, srcByteIndex, "Uint8"). + ii. Perform SetValueInBuffer(targetBuffer, targetByteIndex, "Uint8", + value). + ... + 29. Return undefined. +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample, result; + var src = new TA(convertToBigInt([42, 43])); + + sample = new TA(convertToBigInt([1, 2, 3, 4])); + result = sample.set(src, 1); + assert(compareArray(sample, convertToBigInt([1, 42, 43, 4])), "offset: 1, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sample = new TA(convertToBigInt([1, 2, 3, 4])); + result = sample.set(src, 0); + assert(compareArray(sample, convertToBigInt([42, 43, 3, 4])), "offset: 0, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sample = new TA(convertToBigInt([1, 2, 3, 4])); + result = sample.set(src, 2); + assert(compareArray(sample, convertToBigInt([1, 2, 42, 43])), "offset: 2, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type-sab.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type-sab.js new file mode 100644 index 000000000..86c686e3b --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type-sab.js @@ -0,0 +1,51 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.set-typedarray-offset +description: > + Set values from different instances using the same buffer and same + constructor. srcBuffer values are cached. +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, SharedArrayBuffer, TypedArray] +---*/ + +var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample, src, result, sab; + + sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); + sample = new TA(sab); + sample[0] = 1; + sample[1] = 2; + sample[2] = 3; + sample[3] = 4; + src = new TA(sample.buffer, 0, 2); + result = sample.set(src, 0); + assert(compareArray(sample, [1, 2, 3, 4]), "offset: 0, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); + sample = new TA(sab); + sample[0] = 1; + sample[1] = 2; + sample[2] = 3; + sample[3] = 4; + src = new TA(sample.buffer, 0, 2); + result = sample.set(src, 1); + assert(compareArray(sample, [1, 1, 2, 4]), "offset: 1, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); + sample = new TA(sab); + sample[0] = 1; + sample[1] = 2; + sample[2] = 3; + sample[3] = 4; + src = new TA(sample.buffer, 0, 2); + result = sample.set(src, 2); + assert(compareArray(sample, [1, 2, 1, 2]), "offset: 2, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); +}, int_views); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type.js new file mode 100644 index 000000000..8daad3956 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-typedarray-offset +description: > + Set values from different instances using the same buffer and same + constructor. srcBuffer values are cached. +info: | + 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] ) + + 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not, + the definition in 22.2.3.23.1 applies. + ... + 23. If SameValue(srcBuffer, targetBuffer) is true, then + a. Let srcBuffer be ? CloneArrayBuffer(srcBuffer, srcByteOffset, srcLength, + %ArrayBuffer%). + b. NOTE: %ArrayBuffer% is used to clone srcBuffer because is it known to not + have any observable side-effects. + ... + ... + 27. If SameValue(srcType, targetType) is true, then, + a. NOTE: If srcType and targetType are the same, the transfer must be + performed in a manner that preserves the bit-level encoding of the source + data. + b. Repeat, while targetByteIndex < limit + i. Let value be GetValueFromBuffer(srcBuffer, srcByteIndex, "Uint8"). + ii. Perform SetValueInBuffer(targetBuffer, targetByteIndex, "Uint8", + value). +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample, src, result; + + sample = new TA(convertToBigInt([1, 2, 3, 4])); + src = new TA(sample.buffer, 0, 2); + result = sample.set(src, 0); + assert(compareArray(sample, convertToBigInt([1, 2, 3, 4])), "offset: 0, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sample = new TA(convertToBigInt([1, 2, 3, 4])); + src = new TA(sample.buffer, 0, 2); + result = sample.set(src, 1); + assert(compareArray(sample, convertToBigInt([1, 1, 2, 4])), "offset: 1, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + + sample = new TA(convertToBigInt([1, 2, 3, 4])); + src = new TA(sample.buffer, 0, 2); + result = sample.set(src, 2); + assert(compareArray(sample, convertToBigInt([1, 2, 1, 2])), "offset: 2, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-arraylength-internal.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-arraylength-internal.js new file mode 100644 index 000000000..9da7cbdcf --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-arraylength-internal.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-typedarray-offset +description: > + Uses typedArray's internal [[ArrayLength]] +info: | + 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] ) + + 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not, + the definition in 22.2.3.23.1 applies. + ... + 20. Let srcLength be the value of typedArray's [[ArrayLength]] internal slot. + ... + 22. If srcLength + targetOffset > targetLength, throw a RangeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var getCalls = 0; +var desc = { + get: function getLen() { + getCalls++; + return 42; + } +}; + +Object.defineProperty(TypedArray.prototype, "length", desc); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + var src = new TA(convertToBigInt([42, 43])); + + Object.defineProperty(TA.prototype, "length", desc); + Object.defineProperty(src, "length", desc); + + sample.set(src); + + assert.sameValue(getCalls, 0, "ignores length properties"); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-byteoffset-internal.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-byteoffset-internal.js new file mode 100644 index 000000000..b75cbbd8e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-byteoffset-internal.js @@ -0,0 +1,45 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-typedarray-offset +description: > + Uses typedArray's internal [[ByteOffset]] +info: | + 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] ) + 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not, + the definition in 22.2.3.23.1 applies. + ... + 21. Let srcByteOffset be typedArray.[[ByteOffset]]. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var getCalls = 0; +var desc = { + get: function getLen() { + getCalls++; + return 0; + } +}; + +Object.defineProperty(TypedArray.prototype, "byteOffset", desc); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + var src = new TA(convertToBigInt([42, 43])); + var other = TA === BigInt64Array ? BigUint64Array : BigInt64Array; + var src2 = new other(convertToBigInt([42, 43])); + var src3 = new other(sample.buffer, 0, 2); + + Object.defineProperty(TA.prototype, "byteOffset", desc); + Object.defineProperty(src, "byteOffset", desc); + Object.defineProperty(src2, "byteOffset", desc); + Object.defineProperty(src3, "byteOffset", desc); + + sample.set(src); + sample.set(src2); + sample.set(src3); + + assert.sameValue(getCalls, 0, "ignores byteOffset properties"); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-range-greather-than-target-throws-rangeerror.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-range-greather-than-target-throws-rangeerror.js new file mode 100644 index 000000000..2a24d0990 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-range-greather-than-target-throws-rangeerror.js @@ -0,0 +1,51 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-typedarray-offset +description: > + If srcLength + targetOffset > targetLength, throw a RangeError exception. +info: | + 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] ) + + 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not, + the definition in 22.2.3.23.1 applies. + ... + 6. Let targetOffset be ? ToInteger(offset). + ... + 10. Let targetLength be the value of target's [[ArrayLength]] internal slot. + ... + 20. Let srcLength be the value of typedArray's [[ArrayLength]] internal slot. + ... + 22. If srcLength + targetOffset > targetLength, throw a RangeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample, src; + + sample = new TA(2); + src = new TA(2); + assert.throws(RangeError, function() { + sample.set(src, 1); + }, "2 + 1 > 2"); + + sample = new TA(1); + src = new TA(2); + assert.throws(RangeError, function() { + sample.set(src, 0); + }, "2 + 0 > 1"); + + sample = new TA(1); + src = new TA(0); + assert.throws(RangeError, function() { + sample.set(src, 2); + }, "0 + 2 > 1"); + + sample = new TA(2); + src = new TA(2); + assert.throws(RangeError, function() { + sample.set(src, Infinity); + }, "2 + Infinity > 2"); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-srcbuffer-detached-during-tointeger-offset-throws.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-srcbuffer-detached-during-tointeger-offset-throws.js new file mode 100644 index 000000000..98ae8b2fa --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-srcbuffer-detached-during-tointeger-offset-throws.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-typedarray-offset +description: > + Throws a TypeError if srcBuffer is detached on ToInteger(offset) +info: | + 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] ) + + 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not, + the definition in 22.2.3.23.1 applies. + ... + 6. Let targetOffset be ? ToInteger(offset). + ... + 11. Let srcBuffer be the value of typedArray's [[ViewedArrayBuffer]] internal + slot. + 12. If IsDetachedBuffer(srcBuffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + var target = new TA(); + var calledOffset = 0; + var obj = { + valueOf: function() { + $DETACHBUFFER(target.buffer); + calledOffset += 1; + } + }; + + assert.throws(TypeError, function() { + sample.set(target, obj); + }); + + assert.sameValue(calledOffset, 1); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-arraylength-internal.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-arraylength-internal.js new file mode 100644 index 000000000..7eed1fff1 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-arraylength-internal.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-typedarray-offset +description: > + Uses target's internal [[ArrayLength]] +info: | + 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] ) + + 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not, + the definition in 22.2.3.23.1 applies. + 2. Let target be the this value. + ... + 10. Let targetLength be the value of target's [[ArrayLength]] internal slot. + ... + 22. If srcLength + targetOffset > targetLength, throw a RangeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var getCalls = 0; +var desc = { + get: function() { + getCalls++; + return 0; + } +}; + +Object.defineProperty(TypedArray.prototype, "length", desc); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + var src = new TA(convertToBigInt([42, 43])); + + Object.defineProperty(TA.prototype, "length", desc); + Object.defineProperty(sample, "length", desc); + + sample.set(src); + + assert.sameValue(getCalls, 0, "ignores length properties"); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-byteoffset-internal.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-byteoffset-internal.js new file mode 100644 index 000000000..ba1909dd5 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-byteoffset-internal.js @@ -0,0 +1,44 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-typedarray-offset +description: > + Uses target's internal [[ArrayLength]] +info: | + 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] ) + 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not, + the definition in 22.2.3.23.1 applies. + 2. Let target be the this value. + ... + 16. Let targetByteOffset be target.[[ByteOffset]]. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var getCalls = 0; +var desc = { + get: function() { + getCalls++; + return 0; + } +}; + +Object.defineProperty(TypedArray.prototype, "byteOffset", desc); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + var src = new TA(convertToBigInt([42, 43])); + var other = TA === BigInt64Array ? BigUint64Array : BigInt64Array; + var src2 = new other(convertToBigInt([42, 43])); + var src3 = new other(sample.buffer, 0, 2); + + Object.defineProperty(TA.prototype, "byteOffset", desc); + Object.defineProperty(sample, "byteOffset", desc); + + sample.set(src); + sample.set(src2); + sample.set(src3); + + assert.sameValue(getCalls, 0, "ignores byteoffset properties"); +}); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-targetbuffer-detached-during-tointeger-offset-throws.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-targetbuffer-detached-during-tointeger-offset-throws.js new file mode 100644 index 000000000..b57c24551 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-targetbuffer-detached-during-tointeger-offset-throws.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set-typedarray-offset +description: > + Throws a TypeError if targetBuffer is detached on ToInteger(offset) +info: | + 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] ) + + 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not, + the definition in 22.2.3.23.1 applies. + ... + 6. Let targetOffset be ? ToInteger(offset). + ... + 8. Let targetBuffer be the value of target's [[ViewedArrayBuffer]] internal + slot. + 9. If IsDetachedBuffer(targetBuffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + var src = new TA(1); + var calledOffset = 0; + var obj = { + valueOf: function() { + $DETACHBUFFER(sample.buffer); + calledOffset += 1; + } + }; + + assert.throws(TypeError, function() { + sample.set(src, obj); + }); + + assert.sameValue(calledOffset, 1); +}); diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-other-type.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-other-type.js index 9ea3f3ef0..45d648c1a 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-other-type.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-other-type.js @@ -56,4 +56,4 @@ testWithTypedArrayConstructors(function(TA) { assert(compareArray(sample, expected[TA.name]), sample); assert.sameValue(result, undefined, "returns undefined"); -}, numericTypedArrayConstructors); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/arraylength-internal.js b/test/built-ins/TypedArray/prototype/slice/BigInt/arraylength-internal.js new file mode 100644 index 000000000..9f97ab033 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/arraylength-internal.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: Use internal ArrayLength instead of getting a length property +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 3. Let len be the value of O's [[ArrayLength]] internal slot. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var getCalls = 0; +var desc = { + get: function getLen() { + getCalls++; + return 0; + } +}; + +Object.defineProperty(TypedArray.prototype, "length", desc); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + + Object.defineProperty(TA.prototype, "length", desc); + Object.defineProperty(sample, "length", desc); + + var result = sample.slice(); + + assert.sameValue(getCalls, 0, "ignores length properties"); + assert.sameValue(result[0], convertToBigInt(42)); + assert.sameValue(result[1], convertToBigInt(43)); + assert.sameValue(result.hasOwnProperty(2), false); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/bit-precision.js b/test/built-ins/TypedArray/prototype/slice/BigInt/bit-precision.js new file mode 100644 index 000000000..4c581eb60 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/bit-precision.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +es6id: 22.2.3.23 +description: Preservation of bit-level encoding +info: | + [...] + 15. Else if count > 0, then + [...] + e. NOTE: If srcType and targetType are the same, the transfer must be + performed in a manner that preserves the bit-level encoding of the + source data. + f. Let srcByteOffet be the value of O's [[ByteOffset]] internal slot. + g. Let targetByteIndex be A's [[ByteOffset]] internal slot. + h. Let srcByteIndex be (k × elementSize) + srcByteOffet. + i. Let limit be targetByteIndex + count × elementSize. + j. Repeat, while targetByteIndex < limit + i. Let value be GetValueFromBuffer(srcBuffer, srcByteIndex, "Uint8"). + ii. Perform SetValueInBuffer(targetBuffer, targetByteIndex, "Uint8", + value). + iii. Increase srcByteIndex by 1. + iv. Increase targetByteIndex by 1. +includes: [nans.js, compareArray.js, testBigIntTypedArray.js] +---*/ + +function body(FloatArray) { + var subject = new FloatArray(distinctNaNs); + var sliced, subjectBytes, slicedBytes; + + sliced = subject.slice(); + + subjectBytes = new Uint8Array(subject.buffer); + slicedBytes = new Uint8Array(sliced.buffer); + + assert(compareArray(subjectBytes, slicedBytes)); +} + +testWithBigIntTypedArrayConstructors(body, [Float32Array, Float64Array]); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-custom-ctor-other-targettype.js b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-custom-ctor-other-targettype.js new file mode 100644 index 000000000..5dee0faf7 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-custom-ctor-other-targettype.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: > + Throws a TypeError buffer is detached on Get custom constructor. Using other + targetType +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 9. Let A be ? TypedArraySpeciesCreate(O, « count »). + ... + 14. If SameValue(srcType, targetType) is false, then + a. Let n be 0. + b. Repeat, while k < final + ... + ii. Let kValue be ? Get(O, Pk). + ... + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + + sample.constructor = {}; + sample.constructor[Symbol.species] = function(count) { + var other = TA === Int8Array ? Int16Array : Int8Array; + $DETACHBUFFER(sample.buffer); + return new other(count); + }; + + assert.throws(TypeError, function() { + sample.slice(); + }, "step 14.b.ii - ? Get(O, Pk), O has a detached buffer"); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-custom-ctor-same-targettype.js b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-custom-ctor-same-targettype.js new file mode 100644 index 000000000..a5e64a7d1 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-custom-ctor-same-targettype.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: Throws a TypeError buffer is detached on Get custom constructor. +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 9. Let A be ? TypedArraySpeciesCreate(O, « count »). + ... + 14. If SameValue(srcType, targetType) is false, then + ... + 15. Else if count > 0, then + a. Let srcBuffer be the value of O's [[ViewedArrayBuffer]] internal slot. + b. If IsDetachedBuffer(srcBuffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + + sample.constructor = {}; + sample.constructor[Symbol.species] = function(count) { + $DETACHBUFFER(sample.buffer); + return new TA(count); + }; + + assert.throws(TypeError, function() { + sample.slice(); + }, "step 15.b, IsDetachedBuffer(srcBuffer) is true"); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-get-ctor.js b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-get-ctor.js new file mode 100644 index 000000000..5ce258d5c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-get-ctor.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: Throws a TypeError buffer is detached on Get constructor. +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 9. Let A be ? TypedArraySpeciesCreate(O, « count »). + ... + 14. If SameValue(srcType, targetType) is false, then + ... + 15. Else if count > 0, then + a. Let srcBuffer be the value of O's [[ViewedArrayBuffer]] internal slot. + b. If IsDetachedBuffer(srcBuffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + + Object.defineProperty(sample, "constructor", { + get: function() { + $DETACHBUFFER(sample.buffer); + } + }); + assert.throws(TypeError, function() { + sample.slice(); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-speciesctor-get-species-custom-ctor-throws.js b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-speciesctor-get-species-custom-ctor-throws.js new file mode 100644 index 000000000..29258266b --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-speciesctor-get-species-custom-ctor-throws.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: > + Custom @@species constructor throws if it returns an instance with a detached + buffer +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 9. Let A be ? TypedArraySpeciesCreate(O, « count »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + 4. Return ? TypedArrayCreate(constructor, argumentList). + + 22.2.4.6 TypedArrayCreate ( constructor, argumentList ) + + 1. Let newTypedArray be ? Construct(constructor, argumentList). + 2. Perform ? ValidateTypedArray(newTypedArray). + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + + sample.constructor = {}; + sample.constructor[Symbol.species] = function(count) { + var other = new TA(count); + $DETACHBUFFER(other.buffer); + return other; + }; + + assert.throws(TypeError, function() { + sample.slice(); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-zero-count-custom-ctor-other-targettype.js b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-zero-count-custom-ctor-other-targettype.js new file mode 100644 index 000000000..adcd18b71 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-zero-count-custom-ctor-other-targettype.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: > + Does not throw a TypeError if buffer is detached on custom constructor and + `k >= final`. Using other targetType. +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 9. Let A be ? TypedArraySpeciesCreate(O, « count »). + ... + 14. If SameValue(srcType, targetType) is false, then + a. Let n be 0. + b. Repeat, while k < final + ... + ii. Let kValue be ? Get(O, Pk). + ... + ... + 16. Return A. +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample, result, other; + var ctor = {}; + ctor[Symbol.species] = function(count) { + other = TA === Int8Array ? Int16Array : Int8Array; + $DETACHBUFFER(sample.buffer); + return new other(count); + }; + + sample = new TA(0); + sample.constructor = ctor; + result = sample.slice(); + assert.sameValue(result.length, 0, "#1: result.length"); + assert.notSameValue(result.buffer, sample.buffer, "#1: creates a new buffer"); + assert.sameValue(result.constructor, other, "#1: ctor"); + + sample = new TA(4); + sample.constructor = ctor; + result = sample.slice(1, 1); + assert.sameValue(result.length, 0, "#2: result.length"); + assert.notSameValue(result.buffer, sample.buffer, "#2: creates a new buffer"); + assert.sameValue(result.constructor, other, "#2: ctor"); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-zero-count-custom-ctor-same-targettype.js b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-zero-count-custom-ctor-same-targettype.js new file mode 100644 index 000000000..67372bd73 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer-zero-count-custom-ctor-same-targettype.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: > + Does not throw a TypeError if buffer is detached on custom constructor and + `k >= final`. Using same targetType. +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 9. Let A be ? TypedArraySpeciesCreate(O, « count »). + ... + 14. If SameValue(srcType, targetType) is false, then + ... + 15. Else if count > 0, then + a. Let srcBuffer be the value of O's [[ViewedArrayBuffer]] internal slot. + b. If IsDetachedBuffer(srcBuffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample, result; + var ctor = {}; + ctor[Symbol.species] = function(count) { + $DETACHBUFFER(sample.buffer); + return new TA(count); + }; + + sample = new TA(0); + sample.constructor = ctor; + result = sample.slice(); + assert.sameValue(result.length, 0, "#1: result.length"); + assert.notSameValue(result.buffer, sample.buffer, "#1: creates a new buffer"); + assert.sameValue(result.constructor, TA, "#1: ctor"); + + sample = new TA(4); + sample.constructor = ctor; + result = sample.slice(1, 1); + assert.sameValue(result.length, 0, "#2: result.length"); + assert.notSameValue(result.buffer, sample.buffer, "#2: creates a new buffer"); + assert.sameValue(result.constructor, TA, "#2: ctor"); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer.js new file mode 100644 index 000000000..846386175 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/detached-buffer.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: Throws a TypeError if this has a detached buffer +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + 1. Let O be the this value. + 2. Perform ? ValidateTypedArray(O). + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + ... + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +var obj = { + valueOf: function() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.slice(obj, obj); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/infinity.js b/test/built-ins/TypedArray/prototype/slice/BigInt/infinity.js new file mode 100644 index 000000000..07f62263a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/infinity.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: Infinity values on start and end +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + + assert( + compareArray(sample.slice(-Infinity), convertToBigInt([40, 41, 42, 43])), + "start == -Infinity" + ); + assert( + compareArray(sample.slice(Infinity), []), + "start == Infinity" + ); + assert( + compareArray(sample.slice(0, -Infinity), []), + "end == -Infinity" + ); + assert( + compareArray(sample.slice(0, Infinity), convertToBigInt([40, 41, 42, 43])), + "end == Infinity" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-func.js new file mode 100644 index 000000000..d12fa6245 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-func.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. +/*--- +es6id: 22.2.3.23 +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.23 %TypedArray%.prototype.slice ( start, end ) + + 1. Let O be the this value. + 2. Let valid be ValidateTypedArray(O). + 3. ReturnIfAbrupt(valid). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var slice = TypedArray.prototype.slice; + +assert.sameValue(typeof slice, 'function'); + +assert.throws(TypeError, function() { + slice(); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-method.js new file mode 100644 index 000000000..c352bbaf6 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-method.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. +/*--- +es6id: 22.2.3.23 +description: Requires a [[TypedArrayName]] internal slot. +info: | + 22.2.3.23 %TypedArray%.prototype.slice ( start, end ) + + 1. Let O be the this value. + 2. Let valid be ValidateTypedArray(O). + 3. ReturnIfAbrupt(valid). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.slice, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.slice(); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/length.js b/test/built-ins/TypedArray/prototype/slice/BigInt/length.js new file mode 100644 index 000000000..615fac7a2 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.23 +description: > + %TypedArray%.prototype.slice.length is 2. +info: | + %TypedArray%.prototype.slice ( start, end ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.slice.length, 2); + +verifyNotEnumerable(TypedArray.prototype.slice, "length"); +verifyNotWritable(TypedArray.prototype.slice, "length"); +verifyConfigurable(TypedArray.prototype.slice, "length"); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/minus-zero.js b/test/built-ins/TypedArray/prototype/slice/BigInt/minus-zero.js new file mode 100644 index 000000000..19657957a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/minus-zero.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: -0 values on start and end +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + + assert( + compareArray(sample.slice(-0), convertToBigInt([40, 41, 42, 43])), + "start == -0" + ); + assert( + compareArray(sample.slice(-0, 4), convertToBigInt([40, 41, 42, 43])), + "start == -0, end == length" + ); + assert( + compareArray(sample.slice(0, -0), []), + "start == 0, end == -0" + ); + assert( + compareArray(sample.slice(-0, -0), []), + "start == -0, end == -0" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/name.js b/test/built-ins/TypedArray/prototype/slice/BigInt/name.js new file mode 100644 index 000000000..e26ef197a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.23 +description: > + %TypedArray%.prototype.slice.name is "slice". +info: | + %TypedArray%.prototype.slice ( start, end ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.slice.name, "slice"); + +verifyNotEnumerable(TypedArray.prototype.slice, "name"); +verifyNotWritable(TypedArray.prototype.slice, "name"); +verifyConfigurable(TypedArray.prototype.slice, "name"); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/slice/BigInt/prop-desc.js new file mode 100644 index 000000000..a750f3750 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/prop-desc.js @@ -0,0 +1,18 @@ +// 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.3.23 +description: > + "slice" property of TypedArrayPrototype +info: | + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'slice'); +verifyWritable(TypedArrayPrototype, 'slice'); +verifyConfigurable(TypedArrayPrototype, 'slice'); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/result-does-not-copy-ordinary-properties.js b/test/built-ins/TypedArray/prototype/slice/BigInt/result-does-not-copy-ordinary-properties.js new file mode 100644 index 000000000..00b6132ac --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/result-does-not-copy-ordinary-properties.js @@ -0,0 +1,22 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: Result does not import own properties +info: | + 22.2.3.24 %TypedArray%.prototype.slice( start , end ) +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([41, 42, 43, 44])); + sample.foo = 42; + + var result = sample.slice(); + assert.sameValue( + result.hasOwnProperty("foo"), + false, + "does not import own property" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-different-length.js b/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-different-length.js new file mode 100644 index 000000000..22c8a0abe --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-different-length.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: slice may return a new instance with a smaller length +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + + function testRes(result, expected, msg) { + assert(compareArray(result, expected), msg + ", result: [" + result + "]"); + } + + testRes(sample.slice(1), convertToBigInt([41, 42, 43]), "begin == 1"); + testRes(sample.slice(2), convertToBigInt([42, 43]), "begin == 2"); + testRes(sample.slice(3), convertToBigInt([43]), "begin == 3"); + + testRes(sample.slice(1, 4), convertToBigInt([41, 42, 43]), "begin == 1, end == length"); + testRes(sample.slice(2, 4), convertToBigInt([42, 43]), "begin == 2, end == length"); + testRes(sample.slice(3, 4), convertToBigInt([43]), "begin == 3, end == length"); + + testRes(sample.slice(0, 1), convertToBigInt([40]), "begin == 0, end == 1"); + testRes(sample.slice(0, 2), convertToBigInt([40, 41]), "begin == 0, end == 2"); + testRes(sample.slice(0, 3), convertToBigInt([40, 41, 42]), "begin == 0, end == 3"); + + testRes(sample.slice(-1), convertToBigInt([43]), "begin == -1"); + testRes(sample.slice(-2), convertToBigInt([42, 43]), "begin == -2"); + testRes(sample.slice(-3), convertToBigInt([41, 42, 43]), "begin == -3"); + + testRes(sample.slice(-1, 4), convertToBigInt([43]), "begin == -1, end == length"); + testRes(sample.slice(-2, 4), convertToBigInt([42, 43]), "begin == -2, end == length"); + testRes(sample.slice(-3, 4), convertToBigInt([41, 42, 43]), "begin == -3, end == length"); + + testRes(sample.slice(0, -1), convertToBigInt([40, 41, 42]), "begin == 0, end == -1"); + testRes(sample.slice(0, -2), convertToBigInt([40, 41]), "begin == 0, end == -2"); + testRes(sample.slice(0, -3), convertToBigInt([40]), "begin == 0, end == -3"); + + testRes(sample.slice(-0, -1), convertToBigInt([40, 41, 42]), "begin == -0, end == -1"); + testRes(sample.slice(-0, -2), convertToBigInt([40, 41]), "begin == -0, end == -2"); + testRes(sample.slice(-0, -3), convertToBigInt([40]), "begin == -0, end == -3"); + + testRes(sample.slice(-2, -1), convertToBigInt([42]), "length == 4, begin == -2, end == -1"); + testRes(sample.slice(1, -1), convertToBigInt([41, 42]), "length == 4, begin == 1, end == -1"); + testRes(sample.slice(1, -2), convertToBigInt([41]), "length == 4, begin == 1, end == -2"); + testRes(sample.slice(2, -1), convertToBigInt([42]), "length == 4, begin == 2, end == -1"); + + testRes(sample.slice(-1, 5), convertToBigInt([43]), "begin == -1, end > length"); + testRes(sample.slice(-2, 4), convertToBigInt([42, 43]), "begin == -2, end > length"); + testRes(sample.slice(-3, 4), convertToBigInt([41, 42, 43]), "begin == -3, end > length"); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-empty-length.js b/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-empty-length.js new file mode 100644 index 000000000..386149b45 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-empty-length.js @@ -0,0 +1,52 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: slice may return a new empty instance +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + + function testRes(result, msg) { + assert.sameValue(result.length, 0, msg); + assert.sameValue( + result.hasOwnProperty(0), + false, + msg + " & result.hasOwnProperty(0) === false" + ); + } + + testRes(sample.slice(4), "begin == length"); + testRes(sample.slice(5), "begin > length"); + + testRes(sample.slice(4, 4), "begin == length, end == length"); + testRes(sample.slice(5, 4), "begin > length, end == length"); + + testRes(sample.slice(4, 5), "begin == length, end > length"); + testRes(sample.slice(5, 5), "begin > length, end > length"); + + testRes(sample.slice(0, 0), "begin == 0, end == 0"); + testRes(sample.slice(-0, -0), "begin == -0, end == -0"); + testRes(sample.slice(1, 0), "begin > 0, end == 0"); + testRes(sample.slice(-1, 0), "being < 0, end == 0"); + + testRes(sample.slice(2, 1), "begin > 0, begin < length, begin > end, end > 0"); + testRes(sample.slice(2, 2), "begin > 0, begin < length, begin == end"); + + testRes(sample.slice(2, -2), "begin > 0, begin < length, end == -2"); + + testRes(sample.slice(-1, -1), "length = 4, begin == -1, end == -1"); + testRes(sample.slice(-1, -2), "length = 4, begin == -1, end == -2"); + testRes(sample.slice(-2, -2), "length = 4, begin == -2, end == -2"); + + testRes(sample.slice(0, -4), "begin == 0, end == -length"); + testRes(sample.slice(-4, -4), "begin == -length, end == -length"); + testRes(sample.slice(-5, -4), "begin < -length, end == -length"); + + testRes(sample.slice(0, -5), "begin == 0, end < -length"); + testRes(sample.slice(-4, -5), "begin == -length, end < -length"); + testRes(sample.slice(-5, -5), "begin < -length, end < -length"); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-same-length.js b/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-same-length.js new file mode 100644 index 000000000..a8cee48aa --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-same-length.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: slice may return a new instance with the same length +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + + function testRes(result, msg) { + assert.sameValue(result.length, 4, msg); + assert.sameValue(result[0], convertToBigInt(40), msg + " & result[0] === 40"); + assert.sameValue(result[1], convertToBigInt(41), msg + " & result[1] === 41"); + assert.sameValue(result[2], convertToBigInt(42), msg + " & result[2] === 42"); + assert.sameValue(result[3], convertToBigInt(43), msg + " & result[3] === 43"); + } + + testRes(sample.slice(0), "begin == 0"); + testRes(sample.slice(-4), "begin == -srcLength"); + testRes(sample.slice(-5), "begin < -srcLength"); + + testRes(sample.slice(0, 4), "begin == 0, end == srcLength"); + testRes(sample.slice(-4, 4), "begin == -srcLength, end == srcLength"); + testRes(sample.slice(-5, 4), "begin < -srcLength, end == srcLength"); + + testRes(sample.slice(0, 5), "begin == 0, end > srcLength"); + testRes(sample.slice(-4, 5), "begin == -srcLength, end > srcLength"); + testRes(sample.slice(-5, 5), "begin < -srcLength, end > srcLength"); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-end-symbol.js b/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-end-symbol.js new file mode 100644 index 000000000..c0ec87e5a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-end-symbol.js @@ -0,0 +1,25 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: Return abrupt from ToInteger(end), end is symbol +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 6. If end is undefined, let relativeEnd be len; else let relativeEnd be ? + ToInteger(end). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var s = Symbol("1"); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + + assert.throws(TypeError, function() { + sample.slice(0, s); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-end.js b/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-end.js new file mode 100644 index 000000000..9fa211798 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-end.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: Return abrupt from ToInteger(end) +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 6. If end is undefined, let relativeEnd be len; else let relativeEnd be ? + ToInteger(end). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var o1 = { + valueOf: function() { + throw new Test262Error(); + } +}; + +var o2 = { + toString: function() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + + assert.throws(Test262Error, function() { + sample.slice(0, o1); + }); + + assert.throws(Test262Error, function() { + sample.slice(0, o2); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-start-symbol.js b/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-start-symbol.js new file mode 100644 index 000000000..6e003f8df --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-start-symbol.js @@ -0,0 +1,24 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: Return abrupt from ToInteger(start), start is symbol +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 4. Let relativeStart be ? ToInteger(start). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var s = Symbol("1"); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + + assert.throws(TypeError, function() { + sample.slice(s); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-start.js b/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-start.js new file mode 100644 index 000000000..3b79f1375 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-start.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: Return abrupt from ToInteger(start) +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 4. Let relativeStart be ? ToInteger(start). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var o1 = { + valueOf: function() { + throw new Test262Error(); + } +}; + +var o2 = { + toString: function() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + + assert.throws(Test262Error, function() { + sample.slice(o1); + }); + + assert.throws(Test262Error, function() { + sample.slice(o2); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/set-values-from-different-ctor-type.js b/test/built-ins/TypedArray/prototype/slice/BigInt/set-values-from-different-ctor-type.js new file mode 100644 index 000000000..93b074f1f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/set-values-from-different-ctor-type.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: > + Perform regular set if target's uses a different element type +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 9. Let A be ? TypedArraySpeciesCreate(O, « count »). + 10. Let srcName be the String value of O's [[TypedArrayName]] internal slot. + 11. Let srcType be the String value of the Element Type value in Table 50 for + srcName. + 12. Let targetName be the String value of A's [[TypedArrayName]] internal + slot. + 13. Let targetType be the String value of the Element Type value in Table 50 + for targetName. + 14. If SameValue(srcType, targetType) is false, then + a. Let n be 0. + b. Repeat, while k < final + i. Let Pk be ! ToString(k). + ii. Let kValue be ? Get(O, Pk). + iii. Perform ? Set(A, ! ToString(n), kValue, true). + iv. Increase k by 1. + v. Increase n by 1. + ... + 16. Return A +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +var arr = [42, 43, 44]; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt(arr)); + var other = TA === BigInt64Array ? BigUint64Array : BigInt64Array; + + sample.constructor = {}; + sample.constructor[Symbol.species] = other; + + var result = sample.slice(); + + assert(compareArray(result, convertToBigInt(arr)), "values are set"); + assert.notSameValue(result.buffer, sample.buffer, "creates a new buffer"); + assert.sameValue(result.constructor, other, "used the custom ctor"); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-abrupt.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-abrupt.js new file mode 100644 index 000000000..6294fa6b1 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-abrupt.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: Return abrupt from SpeciesConstructor's get Constructor +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 9. Let A be ? TypedArraySpeciesCreate(O, « count »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + 1. Assert: Type(O) is Object. + 2. Let C be ? Get(O, "constructor"). + 3. If C is undefined, return defaultConstructor. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + + Object.defineProperty(sample, "constructor", { + get: function() { + throw new Test262Error(); + } + }); + + assert.throws(Test262Error, function() { + sample.slice(); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-inherited.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-inherited.js new file mode 100644 index 000000000..15f1e5765 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-inherited.js @@ -0,0 +1,62 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: get inherited constructor on SpeciesConstructor +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 9. Let A be ? TypedArraySpeciesCreate(O, « count »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + 1. Assert: Type(O) is Object. + 2. Let C be ? Get(O, "constructor"). + 3. If C is undefined, return defaultConstructor. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var calls = 0; + var result; + + Object.defineProperty(TA.prototype, "constructor", { + get: function() { + calls++; + } + }); + + result = sample.slice(); + + assert.sameValue(calls, 1, "called custom ctor get accessor once"); + + assert.sameValue( + Object.getPrototypeOf(result), + Object.getPrototypeOf(sample), + "use defaultCtor on an undefined return - getPrototypeOf check" + ); + assert.sameValue( + result.constructor, + undefined, + "used defaultCtor but still checks the inherited .constructor" + ); + + calls = 6; + result.constructor; + assert.sameValue( + calls, + 7, + "result.constructor triggers the inherited accessor property" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-returns-throws.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-returns-throws.js new file mode 100644 index 000000000..7a742b9b8 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-returns-throws.js @@ -0,0 +1,63 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: > + Throws if O.constructor returns a non-Object and non-undefined value +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 9. Let A be ? TypedArraySpeciesCreate(O, « count »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + 1. Assert: Type(O) is Object. + 2. Let C be ? Get(O, "constructor"). + 3. If C is undefined, return defaultConstructor. + 4. If Type(C) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + + sample.constructor = 42; + assert.throws(TypeError, function() { + sample.slice(); + }, "42"); + + sample.constructor = "1"; + assert.throws(TypeError, function() { + sample.slice(); + }, "string"); + + sample.constructor = null; + assert.throws(TypeError, function() { + sample.slice(); + }, "null"); + + sample.constructor = NaN; + assert.throws(TypeError, function() { + sample.slice(); + }, "NaN"); + + sample.constructor = false; + assert.throws(TypeError, function() { + sample.slice(); + }, "false"); + + sample.constructor = Symbol("1"); + assert.throws(TypeError, function() { + sample.slice(); + }, "symbol"); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor.js new file mode 100644 index 000000000..967579071 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor.js @@ -0,0 +1,54 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: get constructor on SpeciesConstructor +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 9. Let A be ? TypedArraySpeciesCreate(O, « count »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + 1. Assert: Type(O) is Object. + 2. Let C be ? Get(O, "constructor"). + 3. If C is undefined, return defaultConstructor. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var calls = 0; + var result; + + Object.defineProperty(sample, "constructor", { + get: function() { + calls++; + } + }); + + result = sample.slice(); + + assert.sameValue(calls, 1, "called custom ctor get accessor once"); + + assert.sameValue( + Object.getPrototypeOf(result), + Object.getPrototypeOf(sample), + "use defaultCtor on an undefined return - getPrototypeOf check" + ); + assert.sameValue( + result.constructor, + TA, + "use defaultCtor on an undefined return - .constructor check" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-abrupt.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-abrupt.js new file mode 100644 index 000000000..74de9aceb --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-abrupt.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: > + Returns abrupt from get @@species on found constructor +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 9. Let A be ? TypedArraySpeciesCreate(O, « count »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + 1. Assert: Type(O) is Object. + 2. Let C be ? Get(O, "constructor"). + ... + 5. Let S be ? Get(C, @@species). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + + sample.constructor = {}; + + Object.defineProperty(sample.constructor, Symbol.species, { + get: function() { + throw new Test262Error(); + } + }); + + assert.throws(Test262Error, function() { + sample.slice(); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-invocation.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-invocation.js new file mode 100644 index 000000000..5187a421f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-invocation.js @@ -0,0 +1,59 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: > + Verify arguments on custom @@species construct call +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 9. Let A be ? TypedArraySpeciesCreate(O, « count »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + 4. Return ? TypedArrayCreate(constructor, argumentList). + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + ... + 7. If IsConstructor(S) is true, return S. + ... + + 22.2.4.6 TypedArrayCreate ( constructor, argumentList ) + + 1. Let newTypedArray be ? Construct(constructor, argumentList). + 2. Perform ? ValidateTypedArray(newTypedArray). + 3. If argumentList is a List of a single Number, then + ... + 4. Return newTypedArray. +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42])); + var result, ctorThis; + + sample.constructor = {}; + sample.constructor[Symbol.species] = function(count) { + result = arguments; + ctorThis = this; + return new TA(count); + }; + + sample.slice(1); + + assert.sameValue(result.length, 1, "called with 1 arguments"); + assert.sameValue(result[0], 2, "[0] is the new length count"); + + assert( + ctorThis instanceof sample.constructor[Symbol.species], + "`this` value in the @@species fn is an instance of the function itself" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-length-throws.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-length-throws.js new file mode 100644 index 000000000..6f699c2d3 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-length-throws.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: > + Throws a TypeError if new typedArray's length < count +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 9. Let A be ? TypedArraySpeciesCreate(O, « count »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 4. Return ? TypedArrayCreate(constructor, argumentList). + + 22.2.4.6 TypedArrayCreate ( constructor, argumentList ) + + ... + 3. If argumentList is a List of a single Number, then + a. If the value of newTypedArray's [[ArrayLength]] internal slot < + argumentList[0], throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + + sample.constructor = {}; + sample.constructor[Symbol.species] = function() { + return new TA(); + }; + + assert.throws(TypeError, function() { + sample.slice(); + }); +}); \ No newline at end of file diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-length.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-length.js new file mode 100644 index 000000000..5159487ae --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-length.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: > + Does not throw a TypeError if new typedArray's length >= count +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 9. Let A be ? TypedArraySpeciesCreate(O, « count »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 4. Return ? TypedArrayCreate(constructor, argumentList). + + 22.2.4.6 TypedArrayCreate ( constructor, argumentList ) + + ... + 3. If argumentList is a List of a single Number, then + a. If the value of newTypedArray's [[ArrayLength]] internal slot < + argumentList[0], throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + var customCount, result; + + sample.constructor = {}; + sample.constructor[Symbol.species] = function() { + return new TA(customCount); + }; + + customCount = 2; + result = sample.slice(); + assert.sameValue(result.length, customCount, "length == count"); + + customCount = 5; + result = sample.slice(); + assert.sameValue(result.length, customCount, "length > count"); +}); \ No newline at end of file diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js new file mode 100644 index 000000000..b323cc7ec --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: > + Custom @@species constructor may return a totally different TypedArray +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 9. Let A be ? TypedArraySpeciesCreate(O, « count »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + 4. Return ? TypedArrayCreate(constructor, argumentList). + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + ... + 7. If IsConstructor(S) is true, return S. + ... + + 22.2.4.6 TypedArrayCreate ( constructor, argumentList ) + + 1. Let newTypedArray be ? Construct(constructor, argumentList). + 2. Perform ? ValidateTypedArray(newTypedArray). + 3. If argumentList is a List of a single Number, then + ... + 4. Return newTypedArray. +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40])); + var other = new Int8Array([1, 0, 1]); + var result; + + sample.constructor = {}; + sample.constructor[Symbol.species] = function() { + return other; + }; + + result = sample.slice(0, 0); + + assert.sameValue(result, other, "returned another typedarray"); + assert(compareArray(result, [1, 0, 1]), "the returned object is preserved"); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-throws.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-throws.js new file mode 100644 index 000000000..e35f1af62 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-throws.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: > + Custom @@species constructor throws if it does not return a compatible object +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 9. Let A be ? TypedArraySpeciesCreate(O, « count »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + 4. Return ? TypedArrayCreate(constructor, argumentList). + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + ... + 7. If IsConstructor(S) is true, return S. + ... + + 22.2.4.6 TypedArrayCreate ( constructor, argumentList ) + + 1. Let newTypedArray be ? Construct(constructor, argumentList). + 2. Perform ? ValidateTypedArray(newTypedArray). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + var ctor = function() {}; + + sample.constructor = {}; + sample.constructor[Symbol.species] = ctor; + + assert.throws(TypeError, function() { + sample.slice(); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor.js new file mode 100644 index 000000000..00a426e10 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor.js @@ -0,0 +1,54 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: > + Use custom @@species constructor if available +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 9. Let A be ? TypedArraySpeciesCreate(O, « count »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + 4. Return ? TypedArrayCreate(constructor, argumentList). + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + ... + 7. If IsConstructor(S) is true, return S. + ... + + 22.2.4.6 TypedArrayCreate ( constructor, argumentList ) + + 1. Let newTypedArray be ? Construct(constructor, argumentList). + 2. Perform ? ValidateTypedArray(newTypedArray). + 3. If argumentList is a List of a single Number, then + ... + 4. Return newTypedArray. +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42])); + var calls = 0; + var result; + + sample.constructor = {}; + sample.constructor[Symbol.species] = function(count) { + calls++; + return new TA(count); + }; + + result = sample.slice(1); + + assert.sameValue(calls, 1, "ctor called once"); + assert(compareArray(result, convertToBigInt([41, 42])), "expected object"); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-returns-throws.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-returns-throws.js new file mode 100644 index 000000000..a24ba5a52 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-returns-throws.js @@ -0,0 +1,66 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: > + Throws if returned @@species is not a constructor, null or undefined. +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 9. Let A be ? TypedArraySpeciesCreate(O, « count »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + 7. If IsConstructor(S) is true, return S. + 8. Throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + + sample.constructor = {}; + + sample.constructor[Symbol.species] = 0; + assert.throws(TypeError, function() { + sample.slice(); + }, "0"); + + sample.constructor[Symbol.species] = "string"; + assert.throws(TypeError, function() { + sample.slice(); + }, "string"); + + sample.constructor[Symbol.species] = {}; + assert.throws(TypeError, function() { + sample.slice(); + }, "{}"); + + sample.constructor[Symbol.species] = NaN; + assert.throws(TypeError, function() { + sample.slice(); + }, "NaN"); + + sample.constructor[Symbol.species] = false; + assert.throws(TypeError, function() { + sample.slice(); + }, "false"); + + sample.constructor[Symbol.species] = true; + assert.throws(TypeError, function() { + sample.slice(); + }, "true"); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-use-default-ctor.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-use-default-ctor.js new file mode 100644 index 000000000..4429f6336 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-use-default-ctor.js @@ -0,0 +1,54 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: > + Use defaultConstructor if @@species is either undefined or null +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 9. Let A be ? TypedArraySpeciesCreate(O, « count »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + var result; + + sample.constructor = {}; + + result = sample.slice(); + + assert.sameValue( + Object.getPrototypeOf(result), + Object.getPrototypeOf(sample), + "undefined @@species - prototype check " + ); + assert.sameValue(result.constructor, TA, "undefined @@species - ctor check"); + + sample.constructor[Symbol.species] = null; + result = sample.slice(); + + assert.sameValue( + Object.getPrototypeOf(result), + Object.getPrototypeOf(sample), + "null @@species - prototype check " + ); + assert.sameValue(result.constructor, TA, "null @@species - ctor check"); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species.js new file mode 100644 index 000000000..a2cf9e131 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: > + get @@species from found constructor +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 9. Let A be ? TypedArraySpeciesCreate(O, « count »). + ... + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + 1. Assert: Type(O) is Object. + 2. Let C be ? Get(O, "constructor"). + ... + 5. Let S be ? Get(C, @@species). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + var calls = 0; + + sample.constructor = {}; + + Object.defineProperty(sample.constructor, Symbol.species, { + get: function() { + calls++; + } + }); + + sample.slice(); + + assert.sameValue(calls, 1); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/slice/BigInt/this-is-not-object.js new file mode 100644 index 000000000..a16cf1c8c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/this-is-not-object.js @@ -0,0 +1,52 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + The following steps are taken: + + 1. Let O be the this value. + 2. Perform ? ValidateTypedArray(O). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var slice = TypedArray.prototype.slice; + +assert.throws(TypeError, function() { + slice.call(undefined, 0, 0); +}, "this is undefined"); + +assert.throws(TypeError, function() { + slice.call(null, 0, 0); +}, "this is null"); + +assert.throws(TypeError, function() { + slice.call(42, 0, 0); +}, "this is 42"); + +assert.throws(TypeError, function() { + slice.call("1", 0, 0); +}, "this is a string"); + +assert.throws(TypeError, function() { + slice.call(true, 0, 0); +}, "this is true"); + +assert.throws(TypeError, function() { + slice.call(false, 0, 0); +}, "this is false"); + +var s = Symbol("s"); +assert.throws(TypeError, function() { + slice.call(s, 0, 0); +}, "this is a Symbol"); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/slice/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..ad429c8a1 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + The following steps are taken: + + 1. Let O be the this value. + 2. Perform ? ValidateTypedArray(O). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var slice = TypedArray.prototype.slice; + +assert.throws(TypeError, function() { + slice.call({}, 0, 0); +}, "this is an Object"); + +assert.throws(TypeError, function() { + slice.call([], 0, 0); +}, "this is an Array"); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + slice.call(ab, 0, 0); +}, "this is an ArrayBuffer instance"); + +var dv = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + slice.call(dv, 0, 0); +}, "this is a DataView instance"); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-end.js b/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-end.js new file mode 100644 index 000000000..979b2df9f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-end.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: ToInteger(end) +info: | + 22.2.3.24 %TypedArray%.prototype.slice( start , end ) + + ... + 6. If end is undefined, let relativeEnd be len; else let relativeEnd be ? + ToInteger(end). + ... +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +var obj = { + valueOf: function() { + return 2; + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + + assert(compareArray(sample.slice(0, false), []), "false"); + assert(compareArray(sample.slice(0, true), convertToBigInt([40])), "true"); + + assert(compareArray(sample.slice(0, NaN), []), "NaN"); + assert(compareArray(sample.slice(0, null), []), "null"); + assert(compareArray(sample.slice(0, undefined), convertToBigInt([40, 41, 42, 43])), "undefined"); + + assert(compareArray(sample.slice(0, 0.6), []), "0.6"); + assert(compareArray(sample.slice(0, 1.1), convertToBigInt([40])), "1.1"); + assert(compareArray(sample.slice(0, 1.5), convertToBigInt([40])), "1.5"); + assert(compareArray(sample.slice(0, -0.6), []), "-0.6"); + assert(compareArray(sample.slice(0, -1.1), convertToBigInt([40, 41, 42])), "-1.1"); + assert(compareArray(sample.slice(0, -1.5), convertToBigInt([40, 41, 42])), "-1.5"); + + assert(compareArray(sample.slice(0, "3"), convertToBigInt([40, 41, 42])), "string"); + assert( + compareArray( + sample.slice(0, obj), + convertToBigInt([40, 41]) + ), + "object" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-start.js b/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-start.js new file mode 100644 index 000000000..8ce0fde83 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-start.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: ToInteger(begin) +info: | + 22.2.3.24 %TypedArray%.prototype.slice ( start, end ) + + ... + 4. Let relativeStart be ? ToInteger(start). + ... +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +var obj = { + valueOf: function() { + return 2; + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + + assert(compareArray(sample.slice(false), convertToBigInt([40, 41, 42, 43])), "false"); + assert(compareArray(sample.slice(true), convertToBigInt([41, 42, 43])), "true"); + + assert(compareArray(sample.slice(NaN), convertToBigInt([40, 41, 42, 43])), "NaN"); + assert(compareArray(sample.slice(null), convertToBigInt([40, 41, 42, 43])), "null"); + assert(compareArray(sample.slice(undefined), convertToBigInt([40, 41, 42, 43])), "undefined"); + + assert(compareArray(sample.slice(1.1), convertToBigInt([41, 42, 43])), "1.1"); + assert(compareArray(sample.slice(1.5), convertToBigInt([41, 42, 43])), "1.5"); + assert(compareArray(sample.slice(0.6), convertToBigInt([40, 41, 42, 43])), "0.6"); + + assert(compareArray(sample.slice(-1.5), convertToBigInt([43])), "-1.5"); + assert(compareArray(sample.slice(-1.1), convertToBigInt([43])), "-1.1"); + assert(compareArray(sample.slice(-0.6), convertToBigInt([40, 41, 42, 43])), "-0.6"); + + assert(compareArray(sample.slice("3"), convertToBigInt([43])), "string"); + assert( + compareArray( + sample.slice(obj), + convertToBigInt([42, 43]) + ), + "object" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-with-thisarg.js new file mode 100644 index 000000000..df0c06fc3 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-with-thisarg.js @@ -0,0 +1,57 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.some +description: > + thisArg does not affect callbackfn arguments +info: | + 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.some is a distinct function that implements the same + algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] ) + + ... + 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + ... + 6. Repeat, while k < len + ... + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + + var results = []; + var thisArg = ["test262", 0, "ecma262", 0]; + + sample.some(function() { + results.push(arguments); + }, thisArg); + + assert.sameValue(results.length, 3, "results.length"); + assert.sameValue(thisArg.length, 4, "thisArg.length"); + + assert.sameValue(results[0].length, 3, "results[0].length"); + assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue"); + assert.sameValue(results[0][1], 0, "results[0][1] - k"); + assert.sameValue(results[0][2], sample, "results[0][2] - this"); + + assert.sameValue(results[1].length, 3, "results[1].length"); + assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue"); + assert.sameValue(results[1][1], 1, "results[1][1] - k"); + assert.sameValue(results[1][2], sample, "results[1][2] - this"); + + assert.sameValue(results[2].length, 3, "results[2].length"); + assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue"); + assert.sameValue(results[2][1], 2, "results[2][1] - k"); + assert.sameValue(results[2][2], sample, "results[2][2] - this"); +}); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-without-thisarg.js new file mode 100644 index 000000000..4f52490ef --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-without-thisarg.js @@ -0,0 +1,55 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.some +description: > + callbackfn arguments +info: | + 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.some is a distinct function that implements the same + algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] ) + + ... + 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + ... + 6. Repeat, while k < len + ... + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + + var results = []; + + sample.some(function() { + results.push(arguments); + }); + + assert.sameValue(results.length, 3, "results.length"); + + assert.sameValue(results[0].length, 3, "results[0].length"); + assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue"); + assert.sameValue(results[0][1], 0, "results[0][1] - k"); + assert.sameValue(results[0][2], sample, "results[0][2] - this"); + + assert.sameValue(results[1].length, 3, "results[1].length"); + assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue"); + assert.sameValue(results[1][1], 1, "results[1][1] - k"); + assert.sameValue(results[1][2], sample, "results[1][2] - this"); + + assert.sameValue(results[2].length, 3, "results[2].length"); + assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue"); + assert.sameValue(results[2][1], 2, "results[2][1] - k"); + assert.sameValue(results[2][2], sample, "results[2][2] - this"); +}); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-detachbuffer.js new file mode 100644 index 000000000..9c92aed23 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-detachbuffer.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.some +description: > + Instance buffer can be detached during loop +info: | + 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.some is a distinct function that implements the same + algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] ) + + ... + 6. Repeat, while k < len + ... + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [detachArrayBuffer.js, testBigIntTypedArray.js] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var loops = 0; + var sample = new TA(2); + + assert.throws(TypeError, function() { + sample.some(function() { + if (loops === 1) { + throw new Test262Error("callbackfn called twice"); + } + $DETACHBUFFER(sample.buffer); + loops++; + }); + }); + + assert.sameValue(loops, 1); +}); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-no-interaction-over-non-integer.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-no-interaction-over-non-integer.js new file mode 100644 index 000000000..b01b5e621 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-no-interaction-over-non-integer.js @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.some +description: > + Does not interact over non-integer properties +info: | + 22.2.3.7 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) + + ... + 6. Repeat, while k < len + ... + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([7, 8])); + + var results = []; + + sample.foo = 42; + sample[Symbol("1")] = 43; + + sample.some(function() { + results.push(arguments); + }); + + assert.sameValue(results.length, 2, "results.length"); + + assert.sameValue(results[0][1], 0, "results[0][1] - key"); + assert.sameValue(results[1][1], 1, "results[1][1] - key"); + + assert.sameValue(results[0][0], convertToBigInt(7), "results[0][0] - value"); + assert.sameValue(results[1][0], convertToBigInt(8), "results[1][0] - value"); +}); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-not-callable-throws.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-not-callable-throws.js new file mode 100644 index 000000000..ce453a2c6 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-not-callable-throws.js @@ -0,0 +1,69 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.some +description: Throws a TypeError if callbackfn is not callable +info: | + 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.some is a distinct function that implements the same + algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] ) + + ... + 3. If IsCallable(callbackfn) is false, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + + assert.throws(TypeError, function() { + sample.some(); + }, "no args"); + + assert.throws(TypeError, function() { + sample.some(null); + }, "null"); + + assert.throws(TypeError, function() { + sample.some(undefined); + }, "undefined"); + + assert.throws(TypeError, function() { + sample.some("abc"); + }, "string"); + + assert.throws(TypeError, function() { + sample.some(1); + }, "number"); + + assert.throws(TypeError, function() { + sample.some(NaN); + }, "NaN"); + + assert.throws(TypeError, function() { + sample.some(false); + }, "false"); + + assert.throws(TypeError, function() { + sample.some(true); + }, "true"); + + assert.throws(TypeError, function() { + sample.some({}); + }, "{}"); + + assert.throws(TypeError, function() { + sample.some(sample); + }, "same typedArray instance"); + + assert.throws(TypeError, function() { + sample.some(Symbol("1")); + }, "symbol"); +}); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-not-called-on-empty.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-not-called-on-empty.js new file mode 100644 index 000000000..4480beb4d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-not-called-on-empty.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.some +description: > + callbackfn is not called on empty instances +info: | + 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.some is a distinct function that implements the same + algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] ) + + ... + 6. Repeat, while k < len + .. + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var called = 0; + + new TA().some(function() { + called++; + }); + + assert.sameValue(called, 0); +}); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-return-does-not-change-instance.js new file mode 100644 index 000000000..19a6337d0 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-return-does-not-change-instance.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.some +description: > + The callbackfn return does not change the instance +info: | + 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.some is a distinct function that implements the same + algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] ) + + ... + 6. Repeat, while k < len + .. + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42])); + + sample.some(function() { + return 0; + }); + + assert.sameValue(sample[0], convertToBigInt(40), "[0] == 40"); + assert.sameValue(sample[1], convertToBigInt(41), "[1] == 41"); + assert.sameValue(sample[2], convertToBigInt(42), "[2] == 42"); +}); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-returns-abrupt.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-returns-abrupt.js new file mode 100644 index 000000000..eef277bfb --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-returns-abrupt.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.some +description: Returns abrupt from callbackfn +info: | + 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.some is a distinct function that implements the same + algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] ) + + ... + 6. Repeat, while k < len + .. + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(3); + + assert.throws(Test262Error, function() { + sample.some(function() { + throw new Test262Error(); + }); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-set-value-during-interaction.js new file mode 100644 index 000000000..4a2331d42 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-set-value-during-interaction.js @@ -0,0 +1,56 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.some +description: > + Integer indexed values changed during iteration +info: | + 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.some is a distinct function that implements the same + algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] ) + + ... + 6. Repeat, while k < len + .. + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect.set, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + var newVal = 0; + + sample.some(function(val, i) { + if (i > 0) { + assert.sameValue( + sample[i - 1], convertToBigInt(newVal - 1), + "get the changed value during the loop" + ); + assert.sameValue( + Reflect.set(sample, 0, convertToBigInt(7)), + true, + "re-set a value for sample[0]" + ); + } + assert.sameValue( + Reflect.set(sample, i, convertToBigInt(newVal)), + true, + "set value during iteration" + ); + + newVal++; + }); + + assert.sameValue(sample[0], convertToBigInt(7), "changed values after iteration [0] == 7"); + assert.sameValue(sample[1], convertToBigInt(1), "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], convertToBigInt(2), "changed values after iteration [2] == 2"); +}); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-this.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-this.js new file mode 100644 index 000000000..dc08ba4aa --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-this.js @@ -0,0 +1,57 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.some +description: > + callbackfn `this` value +info: | + 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.some is a distinct function that implements the same + algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] ) + + ... + 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + ... + 6. Repeat, while k < len + ... + c. If kPresent is true, then + ... + ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var expected = (function() { return this; })(); +var thisArg = {}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(3); + + var results1 = []; + + sample.some(function() { + results1.push(this); + }); + + assert.sameValue(results1.length, 3, "results1"); + assert.sameValue(results1[0], expected, "without thisArg - [0]"); + assert.sameValue(results1[1], expected, "without thisArg - [1]"); + assert.sameValue(results1[2], expected, "without thisArg - [2]"); + + var results2 = []; + + sample.some(function() { + results2.push(this); + }, thisArg); + + assert.sameValue(results2.length, 3, "results2"); + assert.sameValue(results2[0], thisArg, "using thisArg - [0]"); + assert.sameValue(results2[1], thisArg, "using thisArg - [1]"); + assert.sameValue(results2[2], thisArg, "using thisArg - [2]"); +}); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/some/BigInt/detached-buffer.js new file mode 100644 index 000000000..ec32a7df4 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/BigInt/detached-buffer.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.some +description: Throws a TypeError if this has a detached buffer +info: | + 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + ... + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +var callbackfn = function() { + throw new Test262Error(); +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.some(callbackfn); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/some/BigInt/get-length-uses-internal-arraylength.js new file mode 100644 index 000000000..2135d10ca --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/BigInt/get-length-uses-internal-arraylength.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.some +description: Get "length" uses internal ArrayLength +info: | + 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.some is a distinct function that implements the same + algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] ) + + 1. Let O be ? ToObject(this value). + 2. Let len be ? ToLength(? Get(O, "length")). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var getCalls = 0; +var desc = { + get: function getLen() { + getCalls++; + return 0; + } +}; + +Object.defineProperty(TypedArray.prototype, "length", desc); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + var calls = 0; + + Object.defineProperty(TA.prototype, "length", desc); + Object.defineProperty(sample, "length", desc); + + sample.some(function() { + calls++; + }); + + assert.sameValue(getCalls, 0, "ignores length properties"); + assert.sameValue(calls, 2, "iterations are not affected by custom length"); +}); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-func.js new file mode 100644 index 000000000..f093afd9b --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-func.js @@ -0,0 +1,29 @@ +// 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.3.24 +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.24 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var some = TypedArray.prototype.some; + +assert.sameValue(typeof some, 'function'); + +assert.throws(TypeError, function() { + some(); +}); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-method.js new file mode 100644 index 000000000..7fc537318 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-method.js @@ -0,0 +1,29 @@ +// 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.3.24 +description: Requires a [[TypedArrayName]] internal slot. +info: | + 22.2.3.24 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.some, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.some(); +}); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/length.js b/test/built-ins/TypedArray/prototype/some/BigInt/length.js new file mode 100644 index 000000000..c1574968f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/BigInt/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.24 +description: > + %TypedArray%.prototype.some.length is 1. +info: | + %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.some.length, 1); + +verifyNotEnumerable(TypedArray.prototype.some, "length"); +verifyNotWritable(TypedArray.prototype.some, "length"); +verifyConfigurable(TypedArray.prototype.some, "length"); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/name.js b/test/built-ins/TypedArray/prototype/some/BigInt/name.js new file mode 100644 index 000000000..e216ae780 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/BigInt/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.24 +description: > + %TypedArray%.prototype.some.name is "some". +info: | + %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.some.name, "some"); + +verifyNotEnumerable(TypedArray.prototype.some, "name"); +verifyNotWritable(TypedArray.prototype.some, "name"); +verifyConfigurable(TypedArray.prototype.some, "name"); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/some/BigInt/prop-desc.js new file mode 100644 index 000000000..00de662ca --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/BigInt/prop-desc.js @@ -0,0 +1,18 @@ +// 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.3.24 +description: > + "some" property of TypedArrayPrototype +info: | + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'some'); +verifyWritable(TypedArrayPrototype, 'some'); +verifyConfigurable(TypedArrayPrototype, 'some'); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/returns-false-if-every-cb-returns-false.js b/test/built-ins/TypedArray/prototype/some/BigInt/returns-false-if-every-cb-returns-false.js new file mode 100644 index 000000000..ef733a11e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/BigInt/returns-false-if-every-cb-returns-false.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.some +description: > + Returns false if every callbackfn calls returns a coerced false. +info: | + 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.some is a distinct function that implements the same + algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] ) + + ... + 7. Return true. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(42); + + [ + false, + "", + 0, + -0, + NaN, + undefined, + null + ].forEach(function(val) { + var called = 0; + var result = sample.some(function() { + called++; + return val; + }); + assert.sameValue(called, 42, "callbackfn called for each index property"); + assert.sameValue(result, false, "result is false - " + val); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/returns-true-if-any-cb-returns-true.js b/test/built-ins/TypedArray/prototype/some/BigInt/returns-true-if-any-cb-returns-true.js new file mode 100644 index 000000000..da956be06 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/BigInt/returns-true-if-any-cb-returns-true.js @@ -0,0 +1,59 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.some +description: > + Returns true if any callbackfn returns a coerced true. +info: | + 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.some is a distinct function that implements the same + algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] ) + + ... + 6. Repeat, while k < len + ... + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + iii. If testResult is true, return true. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var s = Symbol("1"); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(42); + [ + true, + 1, + "test262", + s, + {}, + [], + -1, + Infinity, + -Infinity, + 0.1, + -0.1 + ].forEach(function(val) { + var called = 0; + var result = sample.some(function() { + called++; + if (called == 1) { + return false; + } + return val; + }); + assert.sameValue(called, 2, "callbackfn called for each index property"); + + var msg = "result is true - " + (val === s ? "symbol" : val); + assert.sameValue(result, true, msg); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/some/BigInt/this-is-not-object.js new file mode 100644 index 000000000..cc7aba63f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/BigInt/this-is-not-object.js @@ -0,0 +1,51 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.some +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var some = TypedArray.prototype.some; +var callbackfn = function() {}; + +assert.throws(TypeError, function() { + some.call(undefined, callbackfn); +}, "this is undefined"); + +assert.throws(TypeError, function() { + some.call(null, callbackfn); +}, "this is null"); + +assert.throws(TypeError, function() { + some.call(42, callbackfn); +}, "this is 42"); + +assert.throws(TypeError, function() { + some.call("1", callbackfn); +}, "this is a string"); + +assert.throws(TypeError, function() { + some.call(true, callbackfn); +}, "this is true"); + +assert.throws(TypeError, function() { + some.call(false, callbackfn); +}, "this is false"); + +var s = Symbol("s"); +assert.throws(TypeError, function() { + some.call(s, callbackfn); +}, "this is a Symbol"); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/some/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..3cc3bb41f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.some +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var some = TypedArray.prototype.some; +var callbackfn = function () {}; + +assert.throws(TypeError, function() { + some.call({}, callbackfn); +}, "this is an Object"); + +assert.throws(TypeError, function() { + some.call([], callbackfn); +}, "this is an Array"); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + some.call(ab, callbackfn); +}, "this is an ArrayBuffer instance"); + +var dv = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + some.call(dv, callbackfn); +}, "this is a DataView instance"); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/some/BigInt/values-are-not-cached.js new file mode 100644 index 000000000..bd1d209f8 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/some/BigInt/values-are-not-cached.js @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.some +description: > + Integer indexed values are not cached before iteration +info: | + 22.2.3.25 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) + + %TypedArray%.prototype.some is a distinct function that implements the same + algorithm as Array.prototype.some as defined in 22.1.3.24 except that the this + object's [[ArrayLength]] internal slot is accessed in place of performing a + [[Get]] of "length". + + 22.1.3.24 Array.prototype.some ( callbackfn [ , thisArg ] ) + + ... + 6. Repeat, while k < len + .. + c. If kPresent is true, then + i. Let kValue be ? Get(O, Pk). + ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44])); + + sample.some(function(v, i) { + if (i < sample.length - 1) { + sample[i+1] = convertToBigInt(42); + } + + assert.sameValue( + v, convertToBigInt(42), "method does not cache values before callbackfn calls" + ); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/arraylength-internal.js b/test/built-ins/TypedArray/prototype/sort/BigInt/arraylength-internal.js new file mode 100644 index 000000000..b8436a5f3 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/arraylength-internal.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.sort +description: Use internal ArrayLength instead of getting a length property +info: | + 22.2.3.26 %TypedArray%.prototype.sort ( comparefn ) + + ... + 3. Let len be the value of obj's [[ArrayLength]] internal slot. +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +var getCalls = 0; +var desc = { + get: function getLen() { + getCalls++; + return 0; + } +}; + +Object.defineProperty(TypedArray.prototype, "length", desc); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 42, 42])); + getCalls = 0; + + Object.defineProperty(TA.prototype, "length", desc); + Object.defineProperty(sample, "length", desc); + + var result = sample.sort(); + + assert.sameValue(getCalls, 0, "ignores length properties"); + assert( + compareArray(result, sample), + "result is not affected by custom length" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-call-throws.js b/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-call-throws.js new file mode 100644 index 000000000..d319341a7 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-call-throws.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.sort +description: Returns abrupt from comparefn +info: | + 22.2.3.26 %TypedArray%.prototype.sort ( comparefn ) + + When the TypedArray SortCompare abstract operation is called with two + arguments x and y, the following steps are taken: + + ... + 2. If the argument comparefn is not undefined, then + a. Let v be ? Call(comparefn, undefined, « x, y »). + ... + ... + + 22.1.3.25 Array.prototype.sort (comparefn) + + The following steps are taken: + + - If an abrupt completion is returned from any of these operations, it is + immediately returned as the value of this function. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44, 45, 46])); + var calls = 0; + + var comparefn = function() { + calls += 1; + throw new Test262Error(); + }; + + assert.throws(Test262Error, function() { + sample.sort(comparefn); + }); + + assert.sameValue(calls, 1, "immediately returned"); +}); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-calls.js b/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-calls.js new file mode 100644 index 000000000..c058cddac --- /dev/null +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-calls.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.sort +description: comparefn is called if not undefined +info: | + 22.2.3.26 %TypedArray%.prototype.sort ( comparefn ) + + When the TypedArray SortCompare abstract operation is called with two + arguments x and y, the following steps are taken: + + ... + 2. If the argument comparefn is not undefined, then + a. Let v be ? Call(comparefn, undefined, « x, y »). + ... + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var expectedThis = (function() { + return this; +})(); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 42, 42, 42, 42])); + var calls = []; + + var comparefn = function() { + calls.push([this, arguments]); + }; + + sample.sort(comparefn); + + assert(calls.length > 0, "calls comparefn"); + calls.forEach(function(args) { + assert.sameValue(args[0], expectedThis, "comparefn is called no specific this"); + assert.sameValue(args[1].length, 2, "comparefn is always called with 2 args"); + assert.sameValue(args[1][0], convertToBigInt(42), "x is a listed value"); + assert.sameValue(args[1][0], convertToBigInt(42), "y is a listed value"); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-nonfunction-call-throws.js b/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-nonfunction-call-throws.js new file mode 100644 index 000000000..80f23f618 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-nonfunction-call-throws.js @@ -0,0 +1,55 @@ +// Copyright (C) 2017 Jordan Harband. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.sort +description: throws on a non-undefined non-function +info: | + 22.2.3.26 %TypedArray%.prototype.sort ( comparefn ) + + Upon entry, the following steps are performed to initialize evaluation + of the sort function. These steps are used instead of the entry steps + in 22.1.3.25: + + ... + 1. If _comparefn_ is not *undefined* and IsCallable(_comparefn_) is *false*, throw a *TypeError* exception. + ... + +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43, 44, 45, 46])); + + assert.throws(TypeError, function() { + sample.sort(null); + }); + + assert.throws(TypeError, function() { + sample.sort(true); + }); + + assert.throws(TypeError, function() { + sample.sort(false); + }); + + assert.throws(TypeError, function() { + sample.sort(''); + }); + + assert.throws(TypeError, function() { + sample.sort(/a/g); + }); + + assert.throws(TypeError, function() { + sample.sort(42); + }); + + assert.throws(TypeError, function() { + sample.sort([]); + }); + + assert.throws(TypeError, function() { + sample.sort({}); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/detached-buffer-comparefn.js b/test/built-ins/TypedArray/prototype/sort/BigInt/detached-buffer-comparefn.js new file mode 100644 index 000000000..caa7f80a2 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/detached-buffer-comparefn.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.sort +description: Throws a TypeError if comparefn detaches the object buffer +info: | + 22.2.3.26 %TypedArray%.prototype.sort ( comparefn ) + + When the TypedArray SortCompare abstract operation is called with two + arguments x and y, the following steps are taken: + + ... + 2. If the argument comparefn is not undefined, then + a. Let v be ? Call(comparefn, undefined, « x, y »). + b. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(4); + var calls = 0; + var comparefn = function() { + if (calls > 0) { + throw new Test262Error(); + } + calls++; + $DETACHBUFFER(sample.buffer); + }; + + assert.throws(TypeError, function() { + sample.sort(comparefn); + }); + + assert.sameValue(calls, 1); +}); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/sort/BigInt/detached-buffer.js new file mode 100644 index 000000000..e49bb0883 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/detached-buffer.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.sort +description: Throws a TypeError if this has a detached buffer +info: | + 22.2.3.26 %TypedArray%.prototype.sort ( comparefn ) + + 1. Let obj be the this value. + 2. Let buffer be ? ValidateTypedArray(obj). + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + ... + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +var comparefn = function() { + throw new Test262Error(); +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.sort(comparefn); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-func.js new file mode 100644 index 000000000..89e84fc27 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-func.js @@ -0,0 +1,35 @@ +// 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.3.25 +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.25 %TypedArray%.prototype.sort ( comparefn ) + + ... + This function is not generic. The this value must be an object with a + [[TypedArrayName]] internal slot. + ... + + 1. Let obj be the this value as the argument. + 2. Let buffer be ValidateTypedArray(obj). + 3. ReturnIfAbrupt(buffer). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var sort = TypedArray.prototype.sort; + +assert.sameValue(typeof sort, 'function'); + +assert.throws(TypeError, function() { + sort(); +}); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-method.js new file mode 100644 index 000000000..fea2db35b --- /dev/null +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-method.js @@ -0,0 +1,35 @@ +// 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.3.25 +description: Requires a [[TypedArrayName]] internal slot. +info: | + 22.2.3.25 %TypedArray%.prototype.sort ( comparefn ) + + ... + This function is not generic. The this value must be an object with a + [[TypedArrayName]] internal slot. + ... + + 1. Let obj be the this value as the argument. + 2. Let buffer be ValidateTypedArray(obj). + 3. ReturnIfAbrupt(buffer). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.sort, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.sort(); +}); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/length.js b/test/built-ins/TypedArray/prototype/sort/BigInt/length.js new file mode 100644 index 000000000..028e2639b --- /dev/null +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.25 +description: > + %TypedArray%.prototype.sort.length is 1. +info: | + %TypedArray%.prototype.sort ( comparefn ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.sort.length, 1); + +verifyNotEnumerable(TypedArray.prototype.sort, "length"); +verifyNotWritable(TypedArray.prototype.sort, "length"); +verifyConfigurable(TypedArray.prototype.sort, "length"); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/name.js b/test/built-ins/TypedArray/prototype/sort/BigInt/name.js new file mode 100644 index 000000000..2214531a3 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.25 +description: > + %TypedArray%.prototype.sort.name is "sort". +info: | + %TypedArray%.prototype.sort ( comparefn ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.sort.name, "sort"); + +verifyNotEnumerable(TypedArray.prototype.sort, "name"); +verifyNotWritable(TypedArray.prototype.sort, "name"); +verifyConfigurable(TypedArray.prototype.sort, "name"); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/sort/BigInt/prop-desc.js new file mode 100644 index 000000000..21f05def7 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/prop-desc.js @@ -0,0 +1,18 @@ +// 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.3.25 +description: > + "sort" property of TypedArrayPrototype +info: | + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'sort'); +verifyWritable(TypedArrayPrototype, 'sort'); +verifyConfigurable(TypedArrayPrototype, 'sort'); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/return-same-instance.js b/test/built-ins/TypedArray/prototype/sort/BigInt/return-same-instance.js new file mode 100644 index 000000000..d3ad6056f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/return-same-instance.js @@ -0,0 +1,25 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.sort +description: Returns the same instance +info: | + 22.2.3.26 %TypedArray%.prototype.sort ( comparefn ) + + When the TypedArray SortCompare abstract operation is called with two + arguments x and y, the following steps are taken: + + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([2, 1])); + var result = sample.sort(); + + assert.sameValue(sample, result, "without comparefn"); + + result = sample.sort(function() { return 0; }); + assert.sameValue(sample, result, "with comparefn"); +}); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/sortcompare-with-no-tostring.js b/test/built-ins/TypedArray/prototype/sort/BigInt/sortcompare-with-no-tostring.js new file mode 100644 index 000000000..b7f73c650 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/sortcompare-with-no-tostring.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.sort +description: TypedArrays sort does not cast values to String +info: | + 22.2.3.26 %TypedArray%.prototype.sort ( comparefn ) + + When the TypedArray SortCompare abstract operation is called with two + arguments x and y, the following steps are taken: + + ... + 2. If the argument comparefn is not undefined, then + a. Let v be ? Call(comparefn, undefined, « x, y »). + ... + ... +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +var origToString = Number.prototype.toString; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([20, 100, 3])); + var result = sample.sort(); + assert(compareArray(result, convertToBigInt([3, 20, 100]))); +}); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values-nan.js b/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values-nan.js new file mode 100644 index 000000000..7a553b13e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values-nan.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.sort +description: Sort values to numeric ascending order +info: | + 22.2.3.26 %TypedArray%.prototype.sort ( comparefn ) + + When the TypedArray SortCompare abstract operation is called with two + arguments x and y, the following steps are taken: + + ... + + NOTE: Because NaN always compares greater than any other value, NaN property + values always sort to the end of the result when comparefn is not provided. +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample; + + sample = new TA([2, NaN, NaN, 0, 1]).sort(); + assert.sameValue(sample[0], 0, "#1 [0]"); + assert.sameValue(sample[1], 1, "#1 [1]"); + assert.sameValue(sample[2], 2, "#1 [2]"); + assert.sameValue(sample[3], NaN, "#1 [3]"); + assert.sameValue(sample[4], NaN, "#1 [4]"); + + sample = new TA([3, NaN, NaN, Infinity, 0, -Infinity, 2]).sort(); + assert.sameValue(sample[0], -Infinity, "#2 [0]"); + assert.sameValue(sample[1], 0, "#2 [1]"); + assert.sameValue(sample[2], 2, "#2 [2]"); + assert.sameValue(sample[3], 3, "#2 [3]"); + assert.sameValue(sample[4], Infinity, "#2 [4]"); + assert.sameValue(sample[5], NaN, "#2 [5]"); + assert.sameValue(sample[6], NaN, "#2 [6]"); +}, [Float64Array, Float32Array]); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js b/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js new file mode 100644 index 000000000..588f1b49f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.sort +description: Sort values to numeric ascending order +info: | + 22.2.3.26 %TypedArray%.prototype.sort ( comparefn ) + + When the TypedArray SortCompare abstract operation is called with two + arguments x and y, the following steps are taken: + + ... +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample; + + sample = new TA(convertToBigInt([4, 3, 2, 1])).sort(); + assert(compareArray(sample, convertToBigInt([1, 2, 3, 4])), "descending values"); + + sample = new TA(convertToBigInt([3, 4, 1, 2])).sort(); + assert(compareArray(sample, convertToBigInt([1, 2, 3, 4])), "mixed numbers"); + + sample = new TA(convertToBigInt([3, 4, 3, 1, 0, 1, 2])).sort(); + assert(compareArray(sample, convertToBigInt([0, 1, 1, 2, 3, 3, 4])), "repeating numbers"); + + sample = new TA(convertToBigInt([1, 0, -0, 2])).sort(); + assert(compareArray(sample, convertToBigInt([0, 0, 1, 2])), "0s"); +}); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA([-4, 3, 4, -3, 2, -2, 1, 0]).sort(); + assert(compareArray(sample, [-4, -3, -2, 0, 1, 2, 3, 4]), "negative values"); +}, [Float64Array, Float32Array, Int8Array, Int16Array, Int32Array]); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample; + + sample = new TA([0.5, 0, 1.5, 1]).sort(); + assert(compareArray(sample, [0, 0.5, 1, 1.5]), "non integers"); + + sample = new TA([0.5, 0, 1.5, -0.5, -1, -1.5, 1]).sort(); + assert(compareArray(sample, [-1.5, -1, -0.5, 0, 0.5, 1, 1.5]), "non integers + negatives"); + + sample = new TA([1, 0, -0, 2]).sort(); + assert(compareArray(sample, [0, 0, 1, 2]), "0 and -0"); + + sample = new TA([3, 4, Infinity, -Infinity, 1, 2]).sort(); + assert(compareArray(sample, [-Infinity, 1, 2, 3, 4, Infinity]), "infinities"); + +}, [Float64Array, Float32Array]); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/sort/BigInt/this-is-not-object.js new file mode 100644 index 000000000..9c8a4c7fb --- /dev/null +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/this-is-not-object.js @@ -0,0 +1,51 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.sort +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.26 %TypedArray%.prototype.sort ( comparefn ) + + 1. Let obj be the this value as the argument. + 2. Let buffer be ? ValidateTypedArray(obj). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var sort = TypedArray.prototype.sort; +var comparefn = function() {}; + +assert.throws(TypeError, function() { + sort.call(undefined, comparefn); +}, "this is undefined"); + +assert.throws(TypeError, function() { + sort.call(null, comparefn); +}, "this is null"); + +assert.throws(TypeError, function() { + sort.call(42, comparefn); +}, "this is 42"); + +assert.throws(TypeError, function() { + sort.call("1", comparefn); +}, "this is a string"); + +assert.throws(TypeError, function() { + sort.call(true, comparefn); +}, "this is true"); + +assert.throws(TypeError, function() { + sort.call(false, comparefn); +}, "this is false"); + +var s = Symbol("s"); +assert.throws(TypeError, function() { + sort.call(s, comparefn); +}, "this is a Symbol"); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/sort/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..74e47bae5 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.sort +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.26 %TypedArray%.prototype.sort ( comparefn ) + + 1. Let obj be the this value as the argument. + 2. Let buffer be ? ValidateTypedArray(obj). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var sort = TypedArray.prototype.sort; +var comparefn = function() {}; + +assert.throws(TypeError, function() { + sort.call({}, comparefn); +}, "this is an Object"); + +assert.throws(TypeError, function() { + sort.call([], comparefn); +}, "this is an Array"); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + sort.call(ab, comparefn); +}, "this is an ArrayBuffer instance"); + +var dv = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + sort.call(dv, comparefn); +}, "this is a DataView instance"); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/detached-buffer.js new file mode 100644 index 000000000..b8e4087e5 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/detached-buffer.js @@ -0,0 +1,65 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: Throws a TypeError creating a new instance with a detached buffer +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 7. Let relativeBegin be ? ToInteger(begin). + ... + 9. If end is undefined, let relativeEnd be srcLength; else, let relativeEnd be + ? ToInteger(end). + ... + 17. Return ? TypedArraySpeciesCreate(O, argumentsList). + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + 4. Return ? TypedArrayCreate(constructor, argumentList). + + 22.2.4.6 TypedArrayCreate ( constructor, argumentList ) + + 1. Let newTypedArray be ? Construct(constructor, argumentList). + ... + + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + ... + 11. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +var begin, end; + +var o1 = { + valueOf: function() { + begin = true; + return 0; + } +}; + +var o2 = { + valueOf: function() { + end = true; + return 2; + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + begin = false; + end = false; + + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.subarray(o1, o2); + }); + + assert(begin, "observable ToInteger(begin)"); + assert(end, "observable ToInteger(end)"); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/infinity.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/infinity.js new file mode 100644 index 000000000..0ac7cb592 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/infinity.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: Infinity values on begin and end +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + + assert( + compareArray(sample.subarray(-Infinity), convertToBigInt([40, 41, 42, 43])), + "begin == -Infinity" + ); + assert( + compareArray(sample.subarray(Infinity), []), + "being == Infinity" + ); + assert( + compareArray(sample.subarray(0, -Infinity), []), + "end == -Infinity" + ); + assert( + compareArray(sample.subarray(0, Infinity), convertToBigInt([40, 41, 42, 43])), + "end == Infinity" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-func.js new file mode 100644 index 000000000..ca9598644 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-func.js @@ -0,0 +1,24 @@ +// 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.3.26 +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.26 %TypedArray%.prototype.subarray( [ begin [ , end ] ] ) + + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var subarray = TypedArray.prototype.subarray; + +assert.sameValue(typeof subarray, 'function'); + +assert.throws(TypeError, function() { + subarray(); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-method.js new file mode 100644 index 000000000..abfefd8fc --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-method.js @@ -0,0 +1,24 @@ +// 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.3.26 +description: Requires a [[TypedArrayName]] internal slot. +info: | + 22.2.3.26 %TypedArray%.prototype.subarray( [ begin [ , end ] ] ) + + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.subarray, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.subarray(); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/length.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/length.js new file mode 100644 index 000000000..7d6bb6297 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.26 +description: > + %TypedArray%.prototype.subarray.length is 2. +info: | + %TypedArray%.prototype.subarray( [ begin [ , end ] ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.subarray.length, 2); + +verifyNotEnumerable(TypedArray.prototype.subarray, "length"); +verifyNotWritable(TypedArray.prototype.subarray, "length"); +verifyConfigurable(TypedArray.prototype.subarray, "length"); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/minus-zero.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/minus-zero.js new file mode 100644 index 000000000..a0349c375 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/minus-zero.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: -0 values on begin and end +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + + assert( + compareArray(sample.subarray(-0), convertToBigInt([40, 41, 42, 43])), + "begin == -0" + ); + assert( + compareArray(sample.subarray(-0, 4), convertToBigInt([40, 41, 42, 43])), + "being == -0, end == length" + ); + assert( + compareArray(sample.subarray(0, -0), []), + "being == 0, end == -0" + ); + assert( + compareArray(sample.subarray(-0, -0), []), + "being == -0, end == -0" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/name.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/name.js new file mode 100644 index 000000000..d5d11e1b5 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.26 +description: > + %TypedArray%.prototype.subarray.name is "subarray". +info: | + %TypedArray%.prototype.subarray( [ begin [ , end ] ] ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.subarray.name, "subarray"); + +verifyNotEnumerable(TypedArray.prototype.subarray, "name"); +verifyNotWritable(TypedArray.prototype.subarray, "name"); +verifyConfigurable(TypedArray.prototype.subarray, "name"); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/prop-desc.js new file mode 100644 index 000000000..23353fadb --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/prop-desc.js @@ -0,0 +1,18 @@ +// 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.3.26 +description: > + "subarray" property of TypedArrayPrototype +info: | + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'subarray'); +verifyWritable(TypedArrayPrototype, 'subarray'); +verifyConfigurable(TypedArrayPrototype, 'subarray'); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/result-does-not-copy-ordinary-properties.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/result-does-not-copy-ordinary-properties.js new file mode 100644 index 000000000..17f2b3a4c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/result-does-not-copy-ordinary-properties.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: Subarray result does not import own property +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 17. Return ? TypedArraySpeciesCreate(O, argumentsList). +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([41, 42, 43, 44])); + var result; + + sample.foo = 42; + + result = sample.subarray(0); + assert.sameValue( + result.hasOwnProperty("foo"), + false, + "does not import own property" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-from-same-ctor.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-from-same-ctor.js new file mode 100644 index 000000000..d4b9a09a7 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-from-same-ctor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: Returns a new instance from the same constructor +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 17. Return ? TypedArraySpeciesCreate(O, argumentsList). +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var result = sample.subarray(1); + + assert.sameValue( + Object.getPrototypeOf(result), + Object.getPrototypeOf(sample), + "prototype" + ); + assert.sameValue(result.constructor, sample.constructor, "constructor"); + assert(result instanceof TA, "instanceof"); + + assert( + compareArray(sample, convertToBigInt([40, 41, 42, 43])), + "original sample remains the same" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-with-shared-buffer.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-with-shared-buffer.js new file mode 100644 index 000000000..87801c85e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-with-shared-buffer.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: Returns a new instance sharing the same buffer +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 17. Return ? TypedArraySpeciesCreate(O, argumentsList). +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var buffer = sample.buffer; + var result = sample.subarray(1); + + assert.notSameValue(result, sample, "returns a new instance"); + assert.sameValue(result.buffer, sample.buffer, "shared buffer"); + assert.sameValue(sample.buffer, buffer, "original buffer is preserved"); + + sample[1] = convertToBigInt(100); + assert( + compareArray(result, convertToBigInt([100, 42, 43])), + "changes on the original sample values affect the new instance" + ); + + result[1] = convertToBigInt(111); + assert( + compareArray(sample, convertToBigInt([40, 100, 111, 43])), + "changes on the new instance values affect the original sample" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-different-length.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-different-length.js new file mode 100644 index 000000000..3be58ad56 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-different-length.js @@ -0,0 +1,58 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: Subarray may return a new instance with a smaller length +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 17. Return ? TypedArraySpeciesCreate(O, argumentsList). +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + + function testRes(result, expected, msg) { + assert(compareArray(result, expected), msg + ", result: [" + result + "]"); + } + + testRes(sample.subarray(1), convertToBigInt([41, 42, 43]), "begin == 1"); + testRes(sample.subarray(2), convertToBigInt([42, 43]), "begin == 2"); + testRes(sample.subarray(3), convertToBigInt([43]), "begin == 3"); + + testRes(sample.subarray(1, 4), convertToBigInt([41, 42, 43]), "begin == 1, end == length"); + testRes(sample.subarray(2, 4), convertToBigInt([42, 43]), "begin == 2, end == length"); + testRes(sample.subarray(3, 4), convertToBigInt([43]), "begin == 3, end == length"); + + testRes(sample.subarray(0, 1), convertToBigInt([40]), "begin == 0, end == 1"); + testRes(sample.subarray(0, 2), convertToBigInt([40, 41]), "begin == 0, end == 2"); + testRes(sample.subarray(0, 3), convertToBigInt([40, 41, 42]), "begin == 0, end == 3"); + + testRes(sample.subarray(-1), convertToBigInt([43]), "begin == -1"); + testRes(sample.subarray(-2), convertToBigInt([42, 43]), "begin == -2"); + testRes(sample.subarray(-3), convertToBigInt([41, 42, 43]), "begin == -3"); + + testRes(sample.subarray(-1, 4), convertToBigInt([43]), "begin == -1, end == length"); + testRes(sample.subarray(-2, 4), convertToBigInt([42, 43]), "begin == -2, end == length"); + testRes(sample.subarray(-3, 4), convertToBigInt([41, 42, 43]), "begin == -3, end == length"); + + testRes(sample.subarray(0, -1), convertToBigInt([40, 41, 42]), "begin == 0, end == -1"); + testRes(sample.subarray(0, -2), convertToBigInt([40, 41]), "begin == 0, end == -2"); + testRes(sample.subarray(0, -3), convertToBigInt([40]), "begin == 0, end == -3"); + + testRes(sample.subarray(-0, -1), convertToBigInt([40, 41, 42]), "begin == -0, end == -1"); + testRes(sample.subarray(-0, -2), convertToBigInt([40, 41]), "begin == -0, end == -2"); + testRes(sample.subarray(-0, -3), convertToBigInt([40]), "begin == -0, end == -3"); + + testRes(sample.subarray(-2, -1), convertToBigInt([42]), "length == 4, begin == -2, end == -1"); + testRes(sample.subarray(1, -1), convertToBigInt([41, 42]), "length == 4, begin == 1, end == -1"); + testRes(sample.subarray(1, -2), convertToBigInt([41]), "length == 4, begin == 1, end == -2"); + testRes(sample.subarray(2, -1), convertToBigInt([42]), "length == 4, begin == 2, end == -1"); + + testRes(sample.subarray(-1, 5), convertToBigInt([43]), "begin == -1, end > length"); + testRes(sample.subarray(-2, 4), convertToBigInt([42, 43]), "begin == -2, end > length"); + testRes(sample.subarray(-3, 4), convertToBigInt([41, 42, 43]), "begin == -3, end > length"); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-empty-length.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-empty-length.js new file mode 100644 index 000000000..f31ec8448 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-empty-length.js @@ -0,0 +1,57 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: Subarray may return a new empty instance +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 17. Return ? TypedArraySpeciesCreate(O, argumentsList). +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + + function testRes(result, msg) { + assert.sameValue(result.length, 0, msg); + assert.sameValue( + result.hasOwnProperty(0), + false, + msg + " & result.hasOwnProperty(0) === false" + ); + } + + testRes(sample.subarray(4), "begin == length"); + testRes(sample.subarray(5), "begin > length"); + + testRes(sample.subarray(4, 4), "begin == length, end == length"); + testRes(sample.subarray(5, 4), "begin > length, end == length"); + + testRes(sample.subarray(4, 4), "begin == length, end > length"); + testRes(sample.subarray(5, 4), "begin > length, end > length"); + + testRes(sample.subarray(0, 0), "begin == 0, end == 0"); + testRes(sample.subarray(-0, -0), "begin == -0, end == -0"); + testRes(sample.subarray(1, 0), "begin > 0, end == 0"); + testRes(sample.subarray(-1, 0), "being < 0, end == 0"); + + testRes(sample.subarray(2, 1), "begin > 0, begin < length, begin > end, end > 0"); + testRes(sample.subarray(2, 2), "begin > 0, begin < length, begin == end"); + + testRes(sample.subarray(2, -2), "begin > 0, begin < length, end == -2"); + + testRes(sample.subarray(-1, -1), "length = 4, begin == -1, end == -1"); + testRes(sample.subarray(-1, -2), "length = 4, begin == -1, end == -2"); + testRes(sample.subarray(-2, -2), "length = 4, begin == -2, end == -2"); + + testRes(sample.subarray(0, -4), "begin == 0, end == -length"); + testRes(sample.subarray(-4, -4), "begin == -length, end == -length"); + testRes(sample.subarray(-5, -4), "begin < -length, end == -length"); + + testRes(sample.subarray(0, -5), "begin == 0, end < -length"); + testRes(sample.subarray(-4, -5), "begin == -length, end < -length"); + testRes(sample.subarray(-5, -5), "begin < -length, end < -length"); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-same-length.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-same-length.js new file mode 100644 index 000000000..8e51f899f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-same-length.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: Subarray may return a new instance with the same length +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 17. Return ? TypedArraySpeciesCreate(O, argumentsList). +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + + function testRes(result, msg) { + assert.sameValue(result.length, 4, msg); + assert.sameValue(result[0], convertToBigInt(40), msg + " & result[0] === 40"); + assert.sameValue(result[1], convertToBigInt(41), msg + " & result[1] === 41"); + assert.sameValue(result[2], convertToBigInt(42), msg + " & result[2] === 42"); + assert.sameValue(result[3], convertToBigInt(43), msg + " & result[3] === 43"); + } + + testRes(sample.subarray(0), "begin == 0"); + testRes(sample.subarray(-4), "begin == -srcLength"); + testRes(sample.subarray(-5), "begin < -srcLength"); + + testRes(sample.subarray(0, 4), "begin == 0, end == srcLength"); + testRes(sample.subarray(-4, 4), "begin == -srcLength, end == srcLength"); + testRes(sample.subarray(-5, 4), "begin < -srcLength, end == srcLength"); + + testRes(sample.subarray(0, 5), "begin == 0, end > srcLength"); + testRes(sample.subarray(-4, 5), "begin == -srcLength, end > srcLength"); + testRes(sample.subarray(-5, 5), "begin < -srcLength, end > srcLength"); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-begin-symbol.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-begin-symbol.js new file mode 100644 index 000000000..a05ad6261 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-begin-symbol.js @@ -0,0 +1,24 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: Return abrupt from ToInteger(begin), begin is symbol +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 7. Let relativeBegin be ? ToInteger(begin). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var s = Symbol("1"); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + + assert.throws(TypeError, function() { + sample.subarray(s); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-begin.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-begin.js new file mode 100644 index 000000000..edff4831f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-begin.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: Return abrupt from ToInteger(begin) +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 7. Let relativeBegin be ? ToInteger(begin). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var o1 = { + valueOf: function() { + throw new Test262Error(); + } +}; + +var o2 = { + toString: function() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + + assert.throws(Test262Error, function() { + sample.subarray(o1); + }); + + assert.throws(Test262Error, function() { + sample.subarray(o2); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-end-symbol.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-end-symbol.js new file mode 100644 index 000000000..29f517746 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-end-symbol.js @@ -0,0 +1,25 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: Return abrupt from ToInteger(end), end is symbol +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 9. If end is undefined, let relativeEnd be srcLength; else, let relativeEnd + be ? ToInteger(end). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var s = Symbol("1"); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + + assert.throws(TypeError, function() { + sample.subarray(0, s); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-end.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-end.js new file mode 100644 index 000000000..d9f1bf3b5 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/return-abrupt-from-end.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: Return abrupt from ToInteger(end) +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 9. If end is undefined, let relativeEnd be srcLength; else, let relativeEnd + be ? ToInteger(end). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var o1 = { + valueOf: function() { + throw new Test262Error(); + } +}; + +var o2 = { + toString: function() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + + assert.throws(Test262Error, function() { + sample.subarray(0, o1); + }); + + assert.throws(Test262Error, function() { + sample.subarray(0, o2); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-abrupt.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-abrupt.js new file mode 100644 index 000000000..5f66e654f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-abrupt.js @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: Return abrupt from SpeciesConstructor's get Constructor +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 17. Return ? TypedArraySpeciesCreate(O, argumentsList). + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + 1. Assert: Type(O) is Object. + 2. Let C be ? Get(O, "constructor"). + 3. If C is undefined, return defaultConstructor. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + + Object.defineProperty(sample, "constructor", { + get: function() { + throw new Test262Error(); + } + }); + + assert.throws(Test262Error, function() { + sample.subarray(0); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-inherited.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-inherited.js new file mode 100644 index 000000000..0e70b7051 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-inherited.js @@ -0,0 +1,61 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: get inherited constructor on SpeciesConstructor +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 17. Return ? TypedArraySpeciesCreate(O, argumentsList). + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + 1. Assert: Type(O) is Object. + 2. Let C be ? Get(O, "constructor"). + 3. If C is undefined, return defaultConstructor. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var calls = 0; + var result; + + Object.defineProperty(TA.prototype, "constructor", { + get: function() { + calls++; + } + }); + + result = sample.subarray(0); + + assert.sameValue(calls, 1, "called custom ctor get accessor once"); + + assert.sameValue( + Object.getPrototypeOf(result), + Object.getPrototypeOf(sample), + "use defaultCtor on an undefined return - getPrototypeOf check" + ); + assert.sameValue( + result.constructor, + undefined, + "used defaultCtor but still checks the inherited .constructor" + ); + + calls = 6; + result.constructor; + assert.sameValue( + calls, + 7, + "result.constructor triggers the inherited accessor property" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-returns-throws.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-returns-throws.js new file mode 100644 index 000000000..fc8c9cad0 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-returns-throws.js @@ -0,0 +1,62 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: > + Throws if O.constructor returns a non-Object and non-undefined value +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 17. Return ? TypedArraySpeciesCreate(O, argumentsList). + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + 1. Assert: Type(O) is Object. + 2. Let C be ? Get(O, "constructor"). + 3. If C is undefined, return defaultConstructor. + 4. If Type(C) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + + sample.constructor = 42; + assert.throws(TypeError, function() { + sample.subarray(0); + }, "42"); + + sample.constructor = "1"; + assert.throws(TypeError, function() { + sample.subarray(0); + }, "string"); + + sample.constructor = null; + assert.throws(TypeError, function() { + sample.subarray(0); + }, "null"); + + sample.constructor = NaN; + assert.throws(TypeError, function() { + sample.subarray(0); + }, "NaN"); + + sample.constructor = false; + assert.throws(TypeError, function() { + sample.subarray(0); + }, "false"); + + sample.constructor = Symbol("1"); + assert.throws(TypeError, function() { + sample.subarray(0); + }, "symbol"); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor.js new file mode 100644 index 000000000..e552af771 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: get constructor on SpeciesConstructor +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 17. Return ? TypedArraySpeciesCreate(O, argumentsList). + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + 1. Assert: Type(O) is Object. + 2. Let C be ? Get(O, "constructor"). + 3. If C is undefined, return defaultConstructor. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var calls = 0; + var result; + + Object.defineProperty(sample, "constructor", { + get: function() { + calls++; + } + }); + + result = sample.subarray(0); + + assert.sameValue(calls, 1, "called custom ctor get accessor once"); + + assert.sameValue( + Object.getPrototypeOf(result), + Object.getPrototypeOf(sample), + "use defaultCtor on an undefined return - getPrototypeOf check" + ); + assert.sameValue( + result.constructor, + TA, + "use defaultCtor on an undefined return - .constructor check" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-abrupt.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-abrupt.js new file mode 100644 index 000000000..c1b64586d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-abrupt.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: > + Returns abrupt from get @@species on found constructor +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 17. Return ? TypedArraySpeciesCreate(O, argumentsList). + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + 1. Assert: Type(O) is Object. + 2. Let C be ? Get(O, "constructor"). + ... + 5. Let S be ? Get(C, @@species). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + + sample.constructor = {}; + + Object.defineProperty(sample.constructor, Symbol.species, { + get: function() { + throw new Test262Error(); + } + }); + + assert.throws(Test262Error, function() { + sample.subarray(0); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-invocation.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-invocation.js new file mode 100644 index 000000000..1747a44ea --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-invocation.js @@ -0,0 +1,61 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: > + Verify arguments on custom @@species construct call +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 17. Return ? TypedArraySpeciesCreate(O, argumentsList). + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + 4. Return ? TypedArrayCreate(constructor, argumentList). + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + ... + 7. If IsConstructor(S) is true, return S. + ... + + 22.2.4.6 TypedArrayCreate ( constructor, argumentList ) + + 1. Let newTypedArray be ? Construct(constructor, argumentList). + 2. Perform ? ValidateTypedArray(newTypedArray). + 3. If argumentList is a List of a single Number, then + ... + 4. Return newTypedArray. +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42])); + var expectedOffset = TA.BYTES_PER_ELEMENT; + var result, ctorThis; + + sample.constructor = {}; + sample.constructor[Symbol.species] = function(buffer, offset, length) { + result = arguments; + ctorThis = this; + return new TA(buffer, offset, length); + }; + + sample.subarray(1); + + assert.sameValue(result.length, 3, "called with 3 arguments"); + assert.sameValue(result[0], sample.buffer, "[0] is sample.buffer"); + assert.sameValue(result[1], expectedOffset, "[1] is the byte offset pos"); + assert.sameValue(result[2], 2, "[2] is expected length"); + + assert( + ctorThis instanceof sample.constructor[Symbol.species], + "`this` value in the @@species fn is an instance of the function itself" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js new file mode 100644 index 000000000..1993db3f6 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js @@ -0,0 +1,52 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: > + Custom @@species constructor may return a totally different TypedArray +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 17. Return ? TypedArraySpeciesCreate(O, argumentsList). + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + 4. Return ? TypedArrayCreate(constructor, argumentList). + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + ... + 7. If IsConstructor(S) is true, return S. + ... + + 22.2.4.6 TypedArrayCreate ( constructor, argumentList ) + + 1. Let newTypedArray be ? Construct(constructor, argumentList). + 2. Perform ? ValidateTypedArray(newTypedArray). + 3. If argumentList is a List of a single Number, then + ... + 4. Return newTypedArray. +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40])); + var other = new Int8Array([1, 0, 1]); + var result; + + sample.constructor = {}; + sample.constructor[Symbol.species] = function() { + return other; + }; + + result = sample.subarray(0, 0); + + assert.sameValue(result, other, "returned another typedarray"); + assert(compareArray(result, [1, 0, 1]), "the returned object is preserved"); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-throws.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-throws.js new file mode 100644 index 000000000..958378556 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-throws.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: > + Custom @@species constructor throws if it does not return a compatible object +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 17. Return ? TypedArraySpeciesCreate(O, argumentsList). + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + 4. Return ? TypedArrayCreate(constructor, argumentList). + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + ... + 7. If IsConstructor(S) is true, return S. + ... + + 22.2.4.6 TypedArrayCreate ( constructor, argumentList ) + + 1. Let newTypedArray be ? Construct(constructor, argumentList). + 2. Perform ? ValidateTypedArray(newTypedArray). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + var ctor = function() {}; + + sample.constructor = {}; + sample.constructor[Symbol.species] = ctor; + + assert.throws(TypeError, function() { + sample.subarray(0); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor.js new file mode 100644 index 000000000..7b11bb596 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: > + Use custom @@species constructor if available +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 17. Return ? TypedArraySpeciesCreate(O, argumentsList). + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + 4. Return ? TypedArrayCreate(constructor, argumentList). + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + ... + 7. If IsConstructor(S) is true, return S. + ... + + 22.2.4.6 TypedArrayCreate ( constructor, argumentList ) + + 1. Let newTypedArray be ? Construct(constructor, argumentList). + 2. Perform ? ValidateTypedArray(newTypedArray). + 3. If argumentList is a List of a single Number, then + ... + 4. Return newTypedArray. +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42])); + var calls = 0; + var result; + + sample.constructor = {}; + sample.constructor[Symbol.species] = function(buffer, offset, length) { + calls++; + return new TA(buffer, offset, length); + }; + + result = sample.subarray(1); + + assert.sameValue(calls, 1, "ctor called once"); + assert(compareArray(result, convertToBigInt([41, 42])), "expected subarray"); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-returns-throws.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-returns-throws.js new file mode 100644 index 000000000..1a01c0460 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-returns-throws.js @@ -0,0 +1,65 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: > + Throws if returned @@species is not a constructor, null or undefined. +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 17. Return ? TypedArraySpeciesCreate(O, argumentsList). + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + 7. If IsConstructor(S) is true, return S. + 8. Throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + + sample.constructor = {}; + + sample.constructor[Symbol.species] = 0; + assert.throws(TypeError, function() { + sample.subarray(0); + }, "0"); + + sample.constructor[Symbol.species] = "string"; + assert.throws(TypeError, function() { + sample.subarray(0); + }, "string"); + + sample.constructor[Symbol.species] = {}; + assert.throws(TypeError, function() { + sample.subarray(0); + }, "{}"); + + sample.constructor[Symbol.species] = NaN; + assert.throws(TypeError, function() { + sample.subarray(0); + }, "NaN"); + + sample.constructor[Symbol.species] = false; + assert.throws(TypeError, function() { + sample.subarray(0); + }, "false"); + + sample.constructor[Symbol.species] = true; + assert.throws(TypeError, function() { + sample.subarray(0); + }, "true"); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-use-default-ctor.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-use-default-ctor.js new file mode 100644 index 000000000..1b1a4e46f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-use-default-ctor.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: > + Use defaultConstructor if @@species is either undefined or null +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 17. Return ? TypedArraySpeciesCreate(O, argumentsList). + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + var result; + + sample.constructor = {}; + + result = sample.subarray(0); + + assert.sameValue( + Object.getPrototypeOf(result), + Object.getPrototypeOf(sample), + "undefined @@species - prototype check " + ); + assert.sameValue(result.constructor, TA, "undefined @@species - ctor check"); + + sample.constructor[Symbol.species] = null; + result = sample.subarray(0); + + assert.sameValue( + Object.getPrototypeOf(result), + Object.getPrototypeOf(sample), + "null @@species - prototype check " + ); + assert.sameValue(result.constructor, TA, "null @@species - ctor check"); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species.js new file mode 100644 index 000000000..01f3427bf --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: > + get @@species from found constructor +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 17. Return ? TypedArraySpeciesCreate(O, argumentsList). + + 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) + + ... + 3. Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + 1. Assert: Type(O) is Object. + 2. Let C be ? Get(O, "constructor"). + ... + 5. Let S be ? Get(C, @@species). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + var calls = 0; + + sample.constructor = {}; + + Object.defineProperty(sample.constructor, Symbol.species, { + get: function() { + calls++; + } + }); + + sample.subarray(0); + + assert.sameValue(calls, 1); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/this-is-not-object.js new file mode 100644 index 000000000..976731c66 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/this-is-not-object.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + The following steps are taken: + + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var subarray = TypedArray.prototype.subarray; + +assert.throws(TypeError, function() { + subarray.call(undefined, 0, 0); +}, "this is undefined"); + +assert.throws(TypeError, function() { + subarray.call(null, 0, 0); +}, "this is null"); + +assert.throws(TypeError, function() { + subarray.call(42, 0, 0); +}, "this is 42"); + +assert.throws(TypeError, function() { + subarray.call("1", 0, 0); +}, "this is a string"); + +assert.throws(TypeError, function() { + subarray.call(true, 0, 0); +}, "this is true"); + +assert.throws(TypeError, function() { + subarray.call(false, 0, 0); +}, "this is false"); + +var s = Symbol("s"); +assert.throws(TypeError, function() { + subarray.call(s, 0, 0); +}, "this is a Symbol"); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..275f5e2bd --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.9 %TypedArray%.prototype.subarray( begin , end ) + + The following steps are taken: + + 1. Let O be the this value. + 2. If Type(O) is not Object, throw a TypeError exception. + 3. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var subarray = TypedArray.prototype.subarray; + +assert.throws(TypeError, function() { + subarray.call({}, 0, 0); +}, "this is an Object"); + +assert.throws(TypeError, function() { + subarray.call([], 0, 0); +}, "this is an Array"); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + subarray.call(ab, 0, 0); +}, "this is an ArrayBuffer instance"); + +var dv = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + subarray.call(dv, 0, 0); +}, "this is a DataView instance"); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-begin.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-begin.js new file mode 100644 index 000000000..6a7885155 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-begin.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: ToInteger(begin) +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 7. Let relativeBegin be ? ToInteger(begin). + ... +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +var obj = { + valueOf: function() { + return 2; + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + + assert(compareArray(sample.subarray(false), convertToBigInt([40, 41, 42, 43])), "false"); + assert(compareArray(sample.subarray(true), convertToBigInt([41, 42, 43])), "true"); + + assert(compareArray(sample.subarray(NaN), convertToBigInt([40, 41, 42, 43])), "NaN"); + assert(compareArray(sample.subarray(null), convertToBigInt([40, 41, 42, 43])), "null"); + assert(compareArray(sample.subarray(undefined), convertToBigInt([40, 41, 42, 43])), "undefined"); + + assert(compareArray(sample.subarray(1.1), convertToBigInt([41, 42, 43])), "1.1"); + assert(compareArray(sample.subarray(1.5), convertToBigInt([41, 42, 43])), "1.5"); + assert(compareArray(sample.subarray(0.6), convertToBigInt([40, 41, 42, 43])), "0.6"); + + assert(compareArray(sample.subarray(-1.5), convertToBigInt([43])), "-1.5"); + assert(compareArray(sample.subarray(-1.1), convertToBigInt([43])), "-1.1"); + assert(compareArray(sample.subarray(-0.6), convertToBigInt([40, 41, 42, 43])), "-0.6"); + + assert(compareArray(sample.subarray("3"), convertToBigInt([43])), "string"); + assert( + compareArray( + sample.subarray(obj), + convertToBigInt([42, 43]) + ), + "object" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-end.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-end.js new file mode 100644 index 000000000..f847b6d27 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-end.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: ToInteger(end) +info: | + 22.2.3.27 %TypedArray%.prototype.subarray( begin , end ) + + ... + 9. If end is undefined, let relativeEnd be srcLength; else, let relativeEnd be + ? ToInteger(end). + ... +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +var obj = { + valueOf: function() { + return 2; + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([40, 41, 42, 43])); + + assert(compareArray(sample.subarray(0, false), []), "false"); + assert(compareArray(sample.subarray(0, true), convertToBigInt([40])), "true"); + + assert(compareArray(sample.subarray(0, NaN), []), "NaN"); + assert(compareArray(sample.subarray(0, null), []), "null"); + assert(compareArray(sample.subarray(0, undefined), convertToBigInt([40, 41, 42, 43])), "undefined"); + + assert(compareArray(sample.subarray(0, 0.6), []), "0.6"); + assert(compareArray(sample.subarray(0, 1.1), convertToBigInt([40])), "1.1"); + assert(compareArray(sample.subarray(0, 1.5), convertToBigInt([40])), "1.5"); + assert(compareArray(sample.subarray(0, -0.6), []), "-0.6"); + assert(compareArray(sample.subarray(0, -1.1), convertToBigInt([40, 41, 42])), "-1.1"); + assert(compareArray(sample.subarray(0, -1.5), convertToBigInt([40, 41, 42])), "-1.5"); + + assert(compareArray(sample.subarray(0, "3"), convertToBigInt([40, 41, 42])), "string"); + assert( + compareArray( + sample.subarray(0, obj), + convertToBigInt([40, 41]) + ), + "object" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tolocalestring-from-each-value.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tolocalestring-from-each-value.js new file mode 100644 index 000000000..c40f36561 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tolocalestring-from-each-value.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.tolocalestring +description: Calls toLocaleString from each property's value +info: | + 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) + + %TypedArray%.prototype.toLocaleString is a distinct function that implements + the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27 + except that the this object's [[ArrayLength]] internal slot is accessed in + place of performing a [[Get]] of "length". + + 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] ) + + ... + 5. Let firstElement be ? Get(array, "0"). + 6. If firstElement is undefined or null, then + a. Let R be the empty String. + 7. Else, + a. Let R be ? ToString(? Invoke(firstElement, "toLocaleString")). + 8. Let k be 1. + 9.Repeat, while k < len + a. Let S be a String value produced by concatenating R and separator. + b. Let nextElement be ? Get(array, ! ToString(k)). + c. If nextElement is undefined or null, then + i. Let R be the empty String. + d. Else, + i. Let R be ? ToString(? Invoke(nextElement, "toLocaleString")). +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] +---*/ + +var separator = ["", ""].toLocaleString(); +var calls; + +BigInt.prototype.toLocaleString = function() { + calls.push(this); + return "hacks" + calls.length; +}; + +var arr = [42, 0]; +var expected = ["hacks1", "hacks2"].join(separator); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt(arr)); + calls = []; + assert.sameValue(sample.toLocaleString(), expected, "returns expected value"); + assert( + compareArray(new TA(convertToBigInt(calls)), sample), + "toLocaleString called for each item" + ); +}); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tostring-from-each-value.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tostring-from-each-value.js new file mode 100644 index 000000000..9a9fe93d0 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tostring-from-each-value.js @@ -0,0 +1,58 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.tolocalestring +description: > + Calls toString from each property's value return from toLocaleString +info: | + 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) + + %TypedArray%.prototype.toLocaleString is a distinct function that implements + the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27 + except that the this object's [[ArrayLength]] internal slot is accessed in + place of performing a [[Get]] of "length". + + 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] ) + + ... + 5. Let firstElement be ? Get(array, "0"). + 6. If firstElement is undefined or null, then + a. Let R be the empty String. + 7. Else, + a. Let R be ? ToString(? Invoke(firstElement, "toLocaleString")). + 8. Let k be 1. + 9.Repeat, while k < len + a. Let S be a String value produced by concatenating R and separator. + b. Let nextElement be ? Get(array, ! ToString(k)). + c. If nextElement is undefined or null, then + i. Let R be the empty String. + d. Else, + i. Let R be ? ToString(? Invoke(nextElement, "toLocaleString")). +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var separator = ["", ""].toLocaleString(); +var calls; + +BigInt.prototype.toLocaleString = function() { + return { + toString: function() { + calls++; + return "hacks" + calls; + }, + valueOf: function() { + throw new Test262Error("should not call valueOf if toString is present"); + } + }; +}; + +var arr = [42, 0]; +var expected = ["hacks1", "hacks2"].join(separator); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt(arr)); + calls = 0; + assert.sameValue(sample.toLocaleString(), expected, "returns expected value"); + assert.sameValue(calls, 2, "toString called once for each item"); +}); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-valueof-from-each-value.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-valueof-from-each-value.js new file mode 100644 index 000000000..b01c60feb --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-valueof-from-each-value.js @@ -0,0 +1,56 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.tolocalestring +description: > + Calls valueOf from each property's value return from toLocaleString +info: | + 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) + + %TypedArray%.prototype.toLocaleString is a distinct function that implements + the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27 + except that the this object's [[ArrayLength]] internal slot is accessed in + place of performing a [[Get]] of "length". + + 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] ) + + ... + 5. Let firstElement be ? Get(array, "0"). + 6. If firstElement is undefined or null, then + a. Let R be the empty String. + 7. Else, + a. Let R be ? ToString(? Invoke(firstElement, "toLocaleString")). + 8. Let k be 1. + 9.Repeat, while k < len + a. Let S be a String value produced by concatenating R and separator. + b. Let nextElement be ? Get(array, ! ToString(k)). + c. If nextElement is undefined or null, then + i. Let R be the empty String. + d. Else, + i. Let R be ? ToString(? Invoke(nextElement, "toLocaleString")). +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var separator = ["", ""].toLocaleString(); +var calls; + +BigInt.prototype.toLocaleString = function() { + return { + toString: undefined, + valueOf: function() { + calls++; + return "hacks" + calls; + } + }; +}; + +var arr = [42, 0]; +var expected = ["hacks1", "hacks2"].join(separator); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt(arr)); + calls = 0; + assert.sameValue(sample.toLocaleString(), expected, "returns expected value"); + assert.sameValue(calls, 2, "valueOf called once for each item"); +}); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/detached-buffer.js new file mode 100644 index 000000000..debd112e6 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/detached-buffer.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.tolocalestring +description: Throws a TypeError if this has a detached buffer +info: | + 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + ... + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.toLocaleString(); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/empty-instance-returns-empty-string.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/empty-instance-returns-empty-string.js new file mode 100644 index 000000000..e933bce82 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/empty-instance-returns-empty-string.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.tolocalestring +description: Returns an empty string if called on an empty instance +info: | + 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) + + %TypedArray%.prototype.toLocaleString is a distinct function that implements + the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27 + except that the this object's [[ArrayLength]] internal slot is accessed in + place of performing a [[Get]] of "length". + + 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] ) + + ... + 4. If len is zero, return the empty String. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + assert.sameValue(sample.toLocaleString(), ""); +}); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/get-length-uses-internal-arraylength.js new file mode 100644 index 000000000..f1662225c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/get-length-uses-internal-arraylength.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.tolocalestring +description: Get "length" uses internal ArrayLength +info: | + 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) + + %TypedArray%.prototype.toLocaleString is a distinct function that implements + the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27 + except that the this object's [[ArrayLength]] internal slot is accessed in + place of performing a [[Get]] of "length". + + 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] ) + + 1. Let array be ? ToObject(this value). + 2.Let len be ? ToLength(? Get(array, "length")). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var getCalls = 0; +var desc = { + get: function getLen() { + getCalls++; + return 0; + } +}; + +Object.defineProperty(TypedArray.prototype, "length", desc); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + + Object.defineProperty(TA.prototype, "length", desc); + Object.defineProperty(sample, "length", desc); + + sample.toLocaleString(); + + assert.sameValue(getCalls, 0, "ignores length properties"); +}); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-func.js new file mode 100644 index 000000000..b124aaf26 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-func.js @@ -0,0 +1,31 @@ +// 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.3.27 +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.27 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) + + ... + + This function is not generic. ValidateTypedArray is applied to the this + value prior to evaluating the algorithm. If its result is an abrupt + completion that exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var toLocaleString = TypedArray.prototype.toLocaleString; + +assert.sameValue(typeof toLocaleString, 'function'); + +assert.throws(TypeError, function() { + toLocaleString(); +}); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-method.js new file mode 100644 index 000000000..27ad4e2bc --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-method.js @@ -0,0 +1,31 @@ +// 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.3.27 +description: Requires a [[TypedArrayName]] internal slot. +info: | + 22.2.3.27 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) + + ... + + This function is not generic. ValidateTypedArray is applied to the this + value prior to evaluating the algorithm. If its result is an abrupt + completion that exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.toLocaleString, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.toLocaleString(); +}); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/length.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/length.js new file mode 100644 index 000000000..20f6962ef --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.27 +description: > + %TypedArray%.prototype.toLocaleString.length is 0. +info: | + %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.toLocaleString.length, 0); + +verifyNotEnumerable(TypedArray.prototype.toLocaleString, "length"); +verifyNotWritable(TypedArray.prototype.toLocaleString, "length"); +verifyConfigurable(TypedArray.prototype.toLocaleString, "length"); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/name.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/name.js new file mode 100644 index 000000000..2899e7f6c --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.27 +description: > + %TypedArray%.prototype.toLocaleString.name is "toLocaleString". +info: | + %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.toLocaleString.name, "toLocaleString"); + +verifyNotEnumerable(TypedArray.prototype.toLocaleString, "name"); +verifyNotWritable(TypedArray.prototype.toLocaleString, "name"); +verifyConfigurable(TypedArray.prototype.toLocaleString, "name"); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/prop-desc.js new file mode 100644 index 000000000..784268170 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/prop-desc.js @@ -0,0 +1,18 @@ +// 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.3.27 +description: > + "toLocaleString" property of TypedArrayPrototype +info: | + ES6 section 17: Every other data property described in clauses 18 through 26 + and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'toLocaleString'); +verifyWritable(TypedArrayPrototype, 'toLocaleString'); +verifyConfigurable(TypedArrayPrototype, 'toLocaleString'); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tolocalestring.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tolocalestring.js new file mode 100644 index 000000000..378b4e5b8 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tolocalestring.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.tolocalestring +description: Returns abrupt from firstElement's toLocaleString +info: | + 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) + + %TypedArray%.prototype.toLocaleString is a distinct function that implements + the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27 + except that the this object's [[ArrayLength]] internal slot is accessed in + place of performing a [[Get]] of "length". + + 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] ) + + ... + 4. If len is zero, return the empty String. + 5. Let firstElement be ? Get(array, "0"). + 6. If firstElement is undefined or null, then + a. Let R be the empty String. + 7. Else, + a. Let R be ? ToString(? Invoke(firstElement, "toLocaleString")). +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var calls; + +BigInt.prototype.toLocaleString = function() { + calls++; + throw new Test262Error(); +}; + +var arr = [42, 0]; + +testWithBigIntTypedArrayConstructors(function(TA) { + calls = 0; + var sample = new TA(convertToBigInt(arr)); + assert.throws(Test262Error, function() { + sample.toLocaleString(); + }); + assert.sameValue(calls, 1, "abrupt from first element"); +}); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tostring.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tostring.js new file mode 100644 index 000000000..3398b29ef --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tostring.js @@ -0,0 +1,55 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.tolocalestring +description: > + Return abrupt from firstElement's toLocaleString => toString +info: | + 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) + + %TypedArray%.prototype.toLocaleString is a distinct function that implements + the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27 + except that the this object's [[ArrayLength]] internal slot is accessed in + place of performing a [[Get]] of "length". + + 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] ) + + ... + 5. Let firstElement be ? Get(array, "0"). + 6. If firstElement is undefined or null, then + a. Let R be the empty String. + 7. Else, + a. Let R be ? ToString(? Invoke(firstElement, "toLocaleString")). + 8. Let k be 1. + 9.Repeat, while k < len + a. Let S be a String value produced by concatenating R and separator. + b. Let nextElement be ? Get(array, ! ToString(k)). + c. If nextElement is undefined or null, then + i. Let R be the empty String. + d. Else, + i. Let R be ? ToString(? Invoke(nextElement, "toLocaleString")). +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var calls = 0; + +BigInt.prototype.toLocaleString = function() { + return { + toString: function() { + calls++; + throw new Test262Error(); + } + }; +}; + +var arr = [42, 0]; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt(arr)); + calls = 0; + assert.throws(Test262Error, function() { + sample.toLocaleString(); + }); + assert.sameValue(calls, 1, "toString called once"); +}); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-valueof.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-valueof.js new file mode 100644 index 000000000..fceea34ef --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-valueof.js @@ -0,0 +1,56 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.tolocalestring +description: > + Return abrupt from firstElement's toLocaleString => valueOf +info: | + 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) + + %TypedArray%.prototype.toLocaleString is a distinct function that implements + the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27 + except that the this object's [[ArrayLength]] internal slot is accessed in + place of performing a [[Get]] of "length". + + 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] ) + + ... + 5. Let firstElement be ? Get(array, "0"). + 6. If firstElement is undefined or null, then + a. Let R be the empty String. + 7. Else, + a. Let R be ? ToString(? Invoke(firstElement, "toLocaleString")). + 8. Let k be 1. + 9.Repeat, while k < len + a. Let S be a String value produced by concatenating R and separator. + b. Let nextElement be ? Get(array, ! ToString(k)). + c. If nextElement is undefined or null, then + i. Let R be the empty String. + d. Else, + i. Let R be ? ToString(? Invoke(nextElement, "toLocaleString")). +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var calls = 0; + +BigInt.prototype.toLocaleString = function() { + return { + toString: undefined, + valueOf: function() { + calls++; + throw new Test262Error(); + } + }; +}; + +var arr = [42, 0]; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt(arr)); + calls = 0; + assert.throws(Test262Error, function() { + sample.toLocaleString(); + }); + assert.sameValue(calls, 1, "toString called once"); +}); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tolocalestring.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tolocalestring.js new file mode 100644 index 000000000..1bac9b691 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tolocalestring.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.tolocalestring +description: Returns abrupt from a nextElement's toLocaleString +info: | + 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) + + %TypedArray%.prototype.toLocaleString is a distinct function that implements + the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27 + except that the this object's [[ArrayLength]] internal slot is accessed in + place of performing a [[Get]] of "length". + + 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] ) + + ... + 9.Repeat, while k < len + a. Let S be a String value produced by concatenating R and separator. + b. Let nextElement be ? Get(array, ! ToString(k)). + c. If nextElement is undefined or null, then + i. Let R be the empty String. + d. Else, + i. Let R be ? ToString(? Invoke(nextElement, "toLocaleString")). +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var calls = 0; + +BigInt.prototype.toLocaleString = function() { + calls++; + if (calls > 1) { + throw new Test262Error(); + } +}; + +var arr = [42, 0]; + +testWithBigIntTypedArrayConstructors(function(TA) { + calls = 0; + var sample = new TA(convertToBigInt(arr)); + assert.throws(Test262Error, function() { + sample.toLocaleString(); + }); + assert.sameValue(calls, 2, "abrupt from a next element"); +}); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tostring.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tostring.js new file mode 100644 index 000000000..3c45b81c1 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tostring.js @@ -0,0 +1,57 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.tolocalestring +description: > + Return abrupt from nextElement's toLocaleString => valueOf +info: | + 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) + + %TypedArray%.prototype.toLocaleString is a distinct function that implements + the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27 + except that the this object's [[ArrayLength]] internal slot is accessed in + place of performing a [[Get]] of "length". + + 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] ) + + ... + 5. Let firstElement be ? Get(array, "0"). + 6. If firstElement is undefined or null, then + a. Let R be the empty String. + 7. Else, + a. Let R be ? ToString(? Invoke(firstElement, "toLocaleString")). + 8. Let k be 1. + 9.Repeat, while k < len + a. Let S be a String value produced by concatenating R and separator. + b. Let nextElement be ? Get(array, ! ToString(k)). + c. If nextElement is undefined or null, then + i. Let R be the empty String. + d. Else, + i. Let R be ? ToString(? Invoke(nextElement, "toLocaleString")). +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var calls = 0; + +BigInt.prototype.toLocaleString = function() { + return { + toString: function() { + calls++; + if (calls > 1) { + throw new Test262Error(); + } + } + }; +}; + +var arr = [42, 0]; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt(arr)); + calls = 0; + assert.throws(Test262Error, function() { + sample.toLocaleString(); + }); + assert.sameValue(calls, 2, "abrupt from a nextElement"); +}); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-valueof.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-valueof.js new file mode 100644 index 000000000..f683ad285 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-valueof.js @@ -0,0 +1,58 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.tolocalestring +description: > + Return abrupt from nextElement's toLocaleString => valueOf +info: | + 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) + + %TypedArray%.prototype.toLocaleString is a distinct function that implements + the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27 + except that the this object's [[ArrayLength]] internal slot is accessed in + place of performing a [[Get]] of "length". + + 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] ) + + ... + 5. Let firstElement be ? Get(array, "0"). + 6. If firstElement is undefined or null, then + a. Let R be the empty String. + 7. Else, + a. Let R be ? ToString(? Invoke(firstElement, "toLocaleString")). + 8. Let k be 1. + 9.Repeat, while k < len + a. Let S be a String value produced by concatenating R and separator. + b. Let nextElement be ? Get(array, ! ToString(k)). + c. If nextElement is undefined or null, then + i. Let R be the empty String. + d. Else, + i. Let R be ? ToString(? Invoke(nextElement, "toLocaleString")). +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var calls = 0; + +BigInt.prototype.toLocaleString = function() { + return { + toString: undefined, + valueOf: function() { + calls++; + if (calls > 1) { + throw new Test262Error(); + } + } + }; +}; + +var arr = [42, 0]; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt(arr)); + calls = 0; + assert.throws(Test262Error, function() { + sample.toLocaleString(); + }); + assert.sameValue(calls, 2, "abrupt from a nextElement"); +}); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-result.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-result.js new file mode 100644 index 000000000..c3588c70f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-result.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.tolocalestring +description: Returns a string +info: | + 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) + + %TypedArray%.prototype.toLocaleString is a distinct function that implements + the same algorithm as Array.prototype.toLocaleString as defined in 22.1.3.27 + except that the this object's [[ArrayLength]] internal slot is accessed in + place of performing a [[Get]] of "length". + + 22.1.3.27 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] ) + + ... + 5. Let firstElement be ? Get(array, "0"). + 6. If firstElement is undefined or null, then + a. Let R be the empty String. + 7. Else, + a. Let R be ? ToString(? Invoke(firstElement, "toLocaleString")). + 8. Let k be 1. + 9.Repeat, while k < len + a. Let S be a String value produced by concatenating R and separator. + b. Let nextElement be ? Get(array, ! ToString(k)). + c. If nextElement is undefined or null, then + i. Let R be the empty String. + d. Else, + i. Let R be ? ToString(? Invoke(nextElement, "toLocaleString")). +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var separator = ["", ""].toLocaleString(); + +var arr = [42, 0, 43]; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt(arr)); + var expected = + sample[0].toLocaleString().toString() + + separator + + sample[1].toLocaleString().toString() + + separator + + sample[2].toLocaleString().toString(); + assert.sameValue(sample.toLocaleString(), expected); +}); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/this-is-not-object.js new file mode 100644 index 000000000..b67bf77c4 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/this-is-not-object.js @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.tolocalestring +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var toLocaleString = TypedArray.prototype.toLocaleString; + +assert.throws(TypeError, function() { + toLocaleString.call(undefined); +}, "this is undefined"); + +assert.throws(TypeError, function() { + toLocaleString.call(null); +}, "this is null"); + +assert.throws(TypeError, function() { + toLocaleString.call(42); +}, "this is 42"); + +assert.throws(TypeError, function() { + toLocaleString.call("1"); +}, "this is a string"); + +assert.throws(TypeError, function() { + toLocaleString.call(true); +}, "this is true"); + +assert.throws(TypeError, function() { + toLocaleString.call(false); +}, "this is false"); + +var s = Symbol("s"); +assert.throws(TypeError, function() { + toLocaleString.call(s); +}, "this is a Symbol"); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..f98c9b5c0 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.tolocalestring +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var toLocaleString = TypedArray.prototype.toLocaleString; + +assert.throws(TypeError, function() { + toLocaleString.call({}); +}, "this is an Object"); + +assert.throws(TypeError, function() { + toLocaleString.call([]); +}, "this is an Array"); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + toLocaleString.call(ab); +}, "this is an ArrayBuffer instance"); + +var dv = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + toLocaleString.call(dv); +}, "this is a DataView instance"); diff --git a/test/built-ins/TypedArray/prototype/toString/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/toString/BigInt/detached-buffer.js new file mode 100644 index 000000000..5b9e0cedc --- /dev/null +++ b/test/built-ins/TypedArray/prototype/toString/BigInt/detached-buffer.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.tostring +description: Throws a TypeError if this has a detached buffer +info: | + 22.2.3.29 %TypedArray%.prototype.toString () + + ... + + 22.2.3.15 %TypedArray%.prototype.join ( separator ) + + This function is not generic. ValidateTypedArray is applied to the this value + prior to evaluating the algorithm. If its result is an abrupt completion that + exception is thrown instead of evaluating the algorithm. + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + ... + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.toString(); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/values/BigInt/detached-buffer.js new file mode 100644 index 000000000..6c31b6bce --- /dev/null +++ b/test/built-ins/TypedArray/prototype/values/BigInt/detached-buffer.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.values +description: Throws a TypeError if this has a detached buffer +info: | + 22.2.3.30 %TypedArray%.prototype.values ( ) + + 1. Let O be the this value. + 2. Perform ? ValidateTypedArray(O). + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + ... + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + assert.throws(TypeError, function() { + sample.values(); + }); +}); diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-func.js new file mode 100644 index 000000000..f9e994aa3 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-func.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. +/*--- +es6id: 22.2.3.29 +description: Throws a TypeError exception when invoked as a function +info: | + 22.2.3.29 %TypedArray%.prototype.values ( ) + + 1. Let O be the this value. + 2. Let valid be ValidateTypedArray(O). + 3. ReturnIfAbrupt(valid). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var values = TypedArray.prototype.values; + +assert.sameValue(typeof values, 'function'); + +assert.throws(TypeError, function() { + values(); +}); diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-method.js new file mode 100644 index 000000000..5ec17b0f4 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-method.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. +/*--- +es6id: 22.2.3.29 +description: Requires a [[TypedArrayName]] internal slot. +info: | + 22.2.3.29 %TypedArray%.prototype.values ( ) + + 1. Let O be the this value. + 2. Let valid be ValidateTypedArray(O). + 3. ReturnIfAbrupt(valid). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +assert.sameValue(typeof TypedArrayPrototype.values, 'function'); + +assert.throws(TypeError, function() { + TypedArrayPrototype.values(); +}); diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/iter-prototype.js b/test/built-ins/TypedArray/prototype/values/BigInt/iter-prototype.js new file mode 100644 index 000000000..72b1bd610 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/values/BigInt/iter-prototype.js @@ -0,0 +1,25 @@ +// 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.3.30 +esid: sec-%typedarray%.prototype.values +description: > + The prototype of the returned iterator is ArrayIteratorPrototype +info: | + 22.2.3.30 %TypedArray%.prototype.values ( ) + + ... + 3. Return CreateArrayIterator(O, "value"). +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.iterator, TypedArray] +---*/ + +var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]()); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([0, 42, 64])); + var iter = sample.values(); + + assert.sameValue(Object.getPrototypeOf(iter), ArrayIteratorProto); +}); diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/length.js b/test/built-ins/TypedArray/prototype/values/BigInt/length.js new file mode 100644 index 000000000..0e3da84d8 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/values/BigInt/length.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.29 +description: > + %TypedArray%.prototype.values.length is 0. +info: | + %TypedArray%.prototype.values ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.values.length, 0); + +verifyNotEnumerable(TypedArray.prototype.values, "length"); +verifyNotWritable(TypedArray.prototype.values, "length"); +verifyConfigurable(TypedArray.prototype.values, "length"); diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/name.js b/test/built-ins/TypedArray/prototype/values/BigInt/name.js new file mode 100644 index 000000000..3f2139028 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/values/BigInt/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 22.2.3.29 +description: > + %TypedArray%.prototype.values.name is "values". +info: | + %TypedArray%.prototype.values ( ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +assert.sameValue(TypedArray.prototype.values.name, "values"); + +verifyNotEnumerable(TypedArray.prototype.values, "name"); +verifyNotWritable(TypedArray.prototype.values, "name"); +verifyConfigurable(TypedArray.prototype.values, "name"); diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/values/BigInt/prop-desc.js new file mode 100644 index 000000000..0a1c9796f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/values/BigInt/prop-desc.js @@ -0,0 +1,18 @@ +// 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.3.29 +description: > + "values" property of TypedArrayPrototype +info: | + ES6 section 17: Every other data property described in clauses 18 through + 26 and in Annex B.2 has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js, testBigIntTypedArray.js] +---*/ + +var TypedArrayPrototype = TypedArray.prototype; + +verifyNotEnumerable(TypedArrayPrototype, 'values'); +verifyWritable(TypedArrayPrototype, 'values'); +verifyConfigurable(TypedArrayPrototype, 'values'); diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/return-itor.js b/test/built-ins/TypedArray/prototype/values/BigInt/return-itor.js new file mode 100644 index 000000000..576a97a0e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/values/BigInt/return-itor.js @@ -0,0 +1,37 @@ +// 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.3.30 +esid: sec-%typedarray%.prototype.values +description: Return an iterator for the values. +info: | + 22.2.3.30 %TypedArray%.prototype.values ( ) + + ... + 3. Return CreateArrayIterator(O, "value"). +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var sample = [0, 42, 64]; + +testWithBigIntTypedArrayConstructors(function(TA) { + var typedArray = new TA(convertToBigInt(sample)); + var itor = typedArray.values(); + + var next = itor.next(); + assert.sameValue(next.value, convertToBigInt(0)); + assert.sameValue(next.done, false); + + next = itor.next(); + assert.sameValue(next.value, convertToBigInt(42)); + assert.sameValue(next.done, false); + + next = itor.next(); + assert.sameValue(next.value, convertToBigInt(64)); + assert.sameValue(next.done, false); + + next = itor.next(); + assert.sameValue(next.value, undefined); + assert.sameValue(next.done, true); +}); diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/values/BigInt/this-is-not-object.js new file mode 100644 index 000000000..57b57a78b --- /dev/null +++ b/test/built-ins/TypedArray/prototype/values/BigInt/this-is-not-object.js @@ -0,0 +1,52 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.values +description: Throws a TypeError exception when `this` is not Object +info: | + 22.2.3.30 %TypedArray%.prototype.values ( ) + + The following steps are taken: + + 1. Let O be the this value. + 2. Perform ? ValidateTypedArray(O). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var values = TypedArray.prototype.values; + +assert.throws(TypeError, function() { + values.call(undefined); +}, "this is undefined"); + +assert.throws(TypeError, function() { + values.call(null); +}, "this is null"); + +assert.throws(TypeError, function() { + values.call(42); +}, "this is 42"); + +assert.throws(TypeError, function() { + values.call("1"); +}, "this is a string"); + +assert.throws(TypeError, function() { + values.call(true); +}, "this is true"); + +assert.throws(TypeError, function() { + values.call(false); +}, "this is false"); + +var s = Symbol("s"); +assert.throws(TypeError, function() { + values.call(s); +}, "this is a Symbol"); diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/values/BigInt/this-is-not-typedarray-instance.js new file mode 100644 index 000000000..68b78aedd --- /dev/null +++ b/test/built-ins/TypedArray/prototype/values/BigInt/this-is-not-typedarray-instance.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.values +description: > + Throws a TypeError exception when `this` is not a TypedArray instance +info: | + 22.2.3.30 %TypedArray%.prototype.values ( ) + + The following steps are taken: + + 1. Let O be the this value. + 2. Perform ? ValidateTypedArray(O). + ... + + 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + + 1. If Type(O) is not Object, throw a TypeError exception. + 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var values = TypedArray.prototype.values; + +assert.throws(TypeError, function() { + values.call({}); +}, "this is an Object"); + +assert.throws(TypeError, function() { + values.call([]); +}, "this is an Array"); + +var ab = new ArrayBuffer(8); +assert.throws(TypeError, function() { + values.call(ab); +}, "this is an ArrayBuffer instance"); + +var dv = new DataView(new ArrayBuffer(8), 0, 1); +assert.throws(TypeError, function() { + values.call(dv); +}, "this is a DataView instance"); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/bufferbyteoffset-throws-from-modulo-element-size-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/bufferbyteoffset-throws-from-modulo-element-size-sab.js new file mode 100644 index 000000000..2f86cd9c2 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/bufferbyteoffset-throws-from-modulo-element-size-sab.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if bufferByteLength modulo elementSize ≠ 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 13. If length is undefined, then + a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(1); + +testWithTypedArrayConstructors(function(TA) { + if (TA.BYTES_PER_ELEMENT === 1) { + // Impossible to trigger this step here. + return; + } + + assert.throws(RangeError, function() { + new TA(buffer); + }); + + assert.throws(RangeError, function() { + new TA(buffer, 0, undefined); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/bufferbyteoffset-throws-from-modulo-element-size.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/bufferbyteoffset-throws-from-modulo-element-size.js new file mode 100644 index 000000000..67f3f8871 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/bufferbyteoffset-throws-from-modulo-element-size.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if bufferByteLength modulo elementSize ≠ 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 13. If length is undefined, then + a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var buffer = new ArrayBuffer(1); + +testWithTypedArrayConstructors(function(TA) { + if (TA.BYTES_PER_ELEMENT === 1) { + // Impossible to trigger this step here. + return; + } + + assert.throws(RangeError, function() { + new TA(buffer); + }); + + assert.throws(RangeError, function() { + new TA(buffer, 0, undefined); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-negative-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-negative-throws-sab.js new file mode 100644 index 000000000..9c590f859 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-negative-throws-sab.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if ToInteger(byteOffset) is < 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToInteger(byteOffset). + 8. If offset < 0, throw a RangeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(RangeError, function() { + new TA(buffer, -1); + }); + assert.throws(RangeError, function() { + new TA(buffer, -Infinity); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-negative-throws.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-negative-throws.js new file mode 100644 index 000000000..d0c70d669 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-negative-throws.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if ToInteger(byteOffset) is < 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToInteger(byteOffset). + 8. If offset < 0, throw a RangeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(RangeError, function() { + new TA(buffer, -1); + }); + assert.throws(RangeError, function() { + new TA(buffer, -Infinity); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-negative-zero-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-negative-zero-sab.js new file mode 100644 index 000000000..bfae5fa4c --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-negative-zero-sab.js @@ -0,0 +1,23 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + TypedArray's [[ByteOffset]] internal slot is always a positive number, test with negative zero. +info: | + %TypedArray% ( buffer [ , byteOffset [ , length ] ] ) + + ... + 6. Let offset be ? ToInteger(byteOffset). + 7. If offset < 0, throw a RangeError exception. + 8. If offset is -0, let offset be +0. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TAConstructor) { + var typedArray = new TAConstructor(new SharedArrayBuffer(8), -0); + assert.sameValue(typedArray.byteOffset, +0); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-negative-zero.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-negative-zero.js new file mode 100644 index 000000000..14cca2584 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-negative-zero.js @@ -0,0 +1,23 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + TypedArray's [[ByteOffset]] internal slot is always a positive number, test with negative zero. +info: | + %TypedArray% ( buffer [ , byteOffset [ , length ] ] ) + + ... + 6. Let offset be ? ToInteger(byteOffset). + 7. If offset < 0, throw a RangeError exception. + 8. If offset is -0, let offset be +0. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TAConstructor) { + var typedArray = new TAConstructor(new ArrayBuffer(8), -0); + assert.sameValue(typedArray.byteOffset, +0); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-symbol-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-symbol-throws-sab.js new file mode 100644 index 000000000..cef10b698 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-symbol-throws-sab.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return abrupt from parsing integer value from byteOffset as a symbol +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToInteger(byteOffset). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, SharedArrayBuffer, TypedArray] +---*/ + +var byteOffset = Symbol("1"); +var buffer = new SharedArrayBuffer(8); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + new TA(buffer, byteOffset); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-symbol-throws.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-symbol-throws.js new file mode 100644 index 000000000..a3c12fd01 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-is-symbol-throws.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return abrupt from parsing integer value from byteOffset as a symbol +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToInteger(byteOffset). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var byteOffset = Symbol("1"); +var buffer = new ArrayBuffer(8); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + new TA(buffer, byteOffset); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-throws-from-modulo-element-size-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-throws-from-modulo-element-size-sab.js new file mode 100644 index 000000000..b70167e3b --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-throws-from-modulo-element-size-sab.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if ToInteger(byteOffset) modulo elementSize is not 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 10. If offset modulo elementSize ≠ 0, throw a RangeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); + +testWithTypedArrayConstructors(function(TA) { + if (TA.BYTES_PER_ELEMENT === 1) { + // Impossible to trigger this step here. + return; + } + + assert.throws(RangeError, function() { + new TA(buffer, 7); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-throws-from-modulo-element-size.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-throws-from-modulo-element-size.js new file mode 100644 index 000000000..2a3a79303 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-throws-from-modulo-element-size.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if ToInteger(byteOffset) modulo elementSize is not 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 10. If offset modulo elementSize ≠ 0, throw a RangeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); + +testWithTypedArrayConstructors(function(TA) { + if (TA.BYTES_PER_ELEMENT === 1) { + // Impossible to trigger this step here. + return; + } + + assert.throws(RangeError, function() { + new TA(buffer, 7); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-to-number-detachbuffer.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-to-number-detachbuffer.js new file mode 100644 index 000000000..89430e6ab --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-to-number-detachbuffer.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: If TypedArray() is passed a detached buffer, throw +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + ... + 9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var offset = TA.BYTES_PER_ELEMENT; + var buffer = new ArrayBuffer(3 * offset); + var byteOffset = { valueOf() { $DETACHBUFFER(buffer); return offset; } }; + assert.throws(TypeError, () => new TA(buffer, byteOffset)); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-to-number-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-to-number-throws-sab.js new file mode 100644 index 000000000..a80143c26 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-to-number-throws-sab.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return abrupt from parsing integer value from byteOffset +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToInteger(byteOffset). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); +var byteOffset = { + valueOf: function() { + throw new Test262Error(); + } +}; + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + new TA(buffer, byteOffset); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-to-number-throws.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-to-number-throws.js new file mode 100644 index 000000000..f30cc2584 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/byteoffset-to-number-throws.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return abrupt from parsing integer value from byteOffset +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToInteger(byteOffset). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); +var byteOffset = { + valueOf: function() { + throw new Test262Error(); + } +}; + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + new TA(buffer, byteOffset); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/custom-proto-access-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/custom-proto-access-throws-sab.js new file mode 100644 index 000000000..fbb038d25 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/custom-proto-access-throws-sab.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return abrupt completion getting newTarget's prototype +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + ... + + 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) + + ... + 3. Let proto be ? Get(constructor, "prototype"). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); + +var newTarget = function() {}.bind(null); +Object.defineProperty(newTarget, "prototype", { + get() { + throw new Test262Error(); + } +}); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + Reflect.construct(TA, [buffer], newTarget); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/custom-proto-access-throws.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/custom-proto-access-throws.js new file mode 100644 index 000000000..88c98eebf --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/custom-proto-access-throws.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return abrupt completion getting newTarget's prototype +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + ... + + 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) + + ... + 3. Let proto be ? Get(constructor, "prototype"). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); + +var newTarget = function() {}.bind(null); +Object.defineProperty(newTarget, "prototype", { + get() { + throw new Test262Error(); + } +}); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + Reflect.construct(TA, [buffer], newTarget); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-length-and-offset-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-length-and-offset-sab.js new file mode 100644 index 000000000..2f153de63 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-length-and-offset-sab.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from defined length and offset +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. +includes: [testBigIntTypedArray.js] +features: [BigInt, SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var offset = TA.BYTES_PER_ELEMENT; + var buffer = new SharedArrayBuffer(3 * offset); + + var ta1 = new TA(buffer, offset, 2); + assert.sameValue(ta1.length, 2, "ta1.length"); + assert.sameValue(ta1.buffer, buffer, "ta1.buffer"); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var ta2 = new TA(buffer, offset, 0); + assert.sameValue(ta2.length, 0, "ta2.length"); + assert.sameValue(ta2.buffer, buffer, "ta2.buffer"); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-length-and-offset.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-length-and-offset.js new file mode 100644 index 000000000..7e27248f8 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-length-and-offset.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from defined length and offset +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var offset = TA.BYTES_PER_ELEMENT; + var buffer = new ArrayBuffer(3 * offset); + + var ta1 = new TA(buffer, offset, 2); + assert.sameValue(ta1.length, 2, "ta1.length"); + assert.sameValue(ta1.buffer, buffer, "ta1.buffer"); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var ta2 = new TA(buffer, offset, 0); + assert.sameValue(ta2.length, 0, "ta2.length"); + assert.sameValue(ta2.buffer, buffer, "ta2.buffer"); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-length-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-length-sab.js new file mode 100644 index 000000000..916858939 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-length-sab.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from defined length +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + +includes: [testBigIntTypedArray.js] +features: [BigInt, SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var length = 4; + var buffer = new SharedArrayBuffer(bpe * length * 4); + + var ta1 = new TA(buffer, 0, length); + assert.sameValue(ta1.length, length); + assert.sameValue(ta1.buffer, buffer); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var ta2 = new TA(buffer, 0, 0); + assert.sameValue(ta2.length, 0); + assert.sameValue(ta2.buffer, buffer); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-length.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-length.js new file mode 100644 index 000000000..711aeb53a --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-length.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from defined length +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var length = 4; + var buffer = new ArrayBuffer(bpe * length * 4); + + var ta1 = new TA(buffer, 0, length); + assert.sameValue(ta1.length, length); + assert.sameValue(ta1.buffer, buffer); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var ta2 = new TA(buffer, 0, 0); + assert.sameValue(ta2.length, 0); + assert.sameValue(ta2.buffer, buffer); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-negative-length-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-negative-length-sab.js new file mode 100644 index 000000000..2138f4a81 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-negative-length-sab.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws RangeError for negative ToInteger(length) +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + +includes: [testBigIntTypedArray.js] +features: [BigInt, SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(16); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(RangeError, function() { + new TA(buffer, 0, -1); + }); + + assert.throws(RangeError, function() { + new TA(buffer, 0, -Infinity); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-negative-length.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-negative-length.js new file mode 100644 index 000000000..f422a54d5 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-negative-length.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws RangeError for negative ToInteger(length) +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var buffer = new ArrayBuffer(16); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(RangeError, function() { + new TA(buffer, 0, -1); + }); + + assert.throws(RangeError, function() { + new TA(buffer, 0, -Infinity); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-offset-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-offset-sab.js new file mode 100644 index 000000000..8cf9c14fe --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-offset-sab.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from defined offset +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. +includes: [testBigIntTypedArray.js] +features: [BigInt, SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var buffer = new SharedArrayBuffer(bpe * 4); + + var ta1 = new TA(buffer, bpe * 2); + assert.sameValue(ta1.length, 2); + assert.sameValue(ta1.buffer, buffer); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var ta2 = new TA(buffer, 0); + assert.sameValue(ta2.length, 4); + assert.sameValue(ta2.buffer, buffer); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-offset.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-offset.js new file mode 100644 index 000000000..a8005eb0b --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/defined-offset.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from defined offset +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var buffer = new ArrayBuffer(bpe * 4); + + var ta1 = new TA(buffer, bpe * 2); + assert.sameValue(ta1.length, 2); + assert.sameValue(ta1.buffer, buffer); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var ta2 = new TA(buffer, 0); + assert.sameValue(ta2.length, 4); + assert.sameValue(ta2.buffer, buffer); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/detachedbuffer.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/detachedbuffer.js new file mode 100644 index 000000000..26cf08ae9 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/detachedbuffer.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: If TypedArray() is passed a detached buffer, throw +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + ... + 9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var offset = TA.BYTES_PER_ELEMENT; + var buffer = new ArrayBuffer(3 * offset); + $DETACHBUFFER(buffer); + assert.throws(TypeError, () => new TA(buffer)); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/excessive-length-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/excessive-length-throws-sab.js new file mode 100644 index 000000000..64d726466 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/excessive-length-throws-sab.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + If offset + newByteLength > bufferByteLength, throw a RangeError exception. +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 14. Else, + a. Let newLength be ? ToLength(length). + b. Let newByteLength be newLength × elementSize. + c. If offset+newByteLength > bufferByteLength, throw a RangeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var buffer = new SharedArrayBuffer(bpe); + + assert.throws(RangeError, function() { + new TA(buffer, 0, bpe * 2); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/excessive-length-throws.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/excessive-length-throws.js new file mode 100644 index 000000000..1f2378625 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/excessive-length-throws.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + If offset + newByteLength > bufferByteLength, throw a RangeError exception. +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 14. Else, + a. Let newLength be ? ToLength(length). + b. Let newByteLength be newLength × elementSize. + c. If offset+newByteLength > bufferByteLength, throw a RangeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var buffer = new ArrayBuffer(bpe); + + assert.throws(RangeError, function() { + new TA(buffer, 0, bpe * 2); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/excessive-offset-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/excessive-offset-throws-sab.js new file mode 100644 index 000000000..2b78d7926 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/excessive-offset-throws-sab.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if bufferByteLength - ToInteger(byteOffset) < 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 13. If length is undefined, then + a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception. + b. Let newByteLength be bufferByteLength - offset. + c. If newByteLength < 0, throw a RangeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var buffer = new SharedArrayBuffer(bpe); + + assert.throws(RangeError, function() { + new TA(buffer, bpe * 2); + }); + + assert.throws(RangeError, function() { + new TA(buffer, bpe * 2, undefined); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/excessive-offset-throws.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/excessive-offset-throws.js new file mode 100644 index 000000000..81454fba7 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/excessive-offset-throws.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if bufferByteLength - ToInteger(byteOffset) < 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 13. If length is undefined, then + a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception. + b. Let newByteLength be bufferByteLength - offset. + c. If newByteLength < 0, throw a RangeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var buffer = new ArrayBuffer(bpe); + + assert.throws(RangeError, function() { + new TA(buffer, bpe * 2); + }); + + assert.throws(RangeError, function() { + new TA(buffer, bpe * 2, undefined); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/invoked-with-undefined-newtarget-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/invoked-with-undefined-newtarget-sab.js new file mode 100644 index 000000000..7b3b9c9e2 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/invoked-with-undefined-newtarget-sab.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a TypeError if NewTarget is undefined. +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 2. If NewTarget is undefined, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var buffer = new SharedArrayBuffer(4); + assert.throws(TypeError, function() { + TA(buffer); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/invoked-with-undefined-newtarget.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/invoked-with-undefined-newtarget.js new file mode 100644 index 000000000..0301136c0 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/invoked-with-undefined-newtarget.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a TypeError if NewTarget is undefined. +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 2. If NewTarget is undefined, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var buffer = new ArrayBuffer(4); + assert.throws(TypeError, function() { + TA(buffer); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/is-referenced-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/is-referenced-sab.js new file mode 100644 index 000000000..bdff85d02 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/is-referenced-sab.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Reuse buffer argument instead of making a new clone +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 15. Set O's [[ViewedArrayBuffer]] internal slot to buffer. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + + var buffer = new SharedArrayBuffer(bpe); + + var ta1 = new TA(buffer); + var ta2 = new TA(buffer); + + assert.sameValue(ta1.buffer, buffer); + assert.sameValue(ta2.buffer, buffer); + assert.sameValue(ta1.buffer, ta2.buffer); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/is-referenced.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/is-referenced.js new file mode 100644 index 000000000..1b609117f --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/is-referenced.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Reuse buffer argument instead of making a new clone +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 15. Set O's [[ViewedArrayBuffer]] internal slot to buffer. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + + var buffer = new ArrayBuffer(bpe); + + var ta1 = new TA(buffer); + var ta2 = new TA(buffer); + + assert.sameValue(ta1.buffer, buffer); + assert.sameValue(ta2.buffer, buffer); + assert.sameValue(ta1.buffer, ta2.buffer); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/length-access-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/length-access-throws-sab.js new file mode 100644 index 000000000..792101566 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/length-access-throws-sab.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Returns abrupt from ToLength(length) +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 14. Else, + a. Let newLength be ? ToLength(length). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); +var len = { + valueOf() { + throw new Test262Error(); + } +}; + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + new TA(buffer, 0, len); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/length-access-throws.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/length-access-throws.js new file mode 100644 index 000000000..373311d0c --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/length-access-throws.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Returns abrupt from ToLength(length) +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 14. Else, + a. Let newLength be ? ToLength(length). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); +var len = { + valueOf() { + throw new Test262Error(); + } +}; + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + new TA(buffer, 0, len); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/length-is-symbol-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/length-is-symbol-throws-sab.js new file mode 100644 index 000000000..d0619a3f8 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/length-is-symbol-throws-sab.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a TypeError if length is a Symbol +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 14. Else, + a. Let newLength be ? ToLength(length). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); +var s = Symbol("1"); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + new TA(buffer, 0, s); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/length-is-symbol-throws.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/length-is-symbol-throws.js new file mode 100644 index 000000000..978e01e7d --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/length-is-symbol-throws.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a TypeError if length is a Symbol +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 14. Else, + a. Let newLength be ? ToLength(length). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); +var s = Symbol("1"); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + new TA(buffer, 0, s); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/length-to-number-detachbuffer.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/length-to-number-detachbuffer.js new file mode 100644 index 000000000..9bf8105f0 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/length-to-number-detachbuffer.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: If TypedArray() is passed a detached buffer, throw +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + ... + 9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var offset = TA.BYTES_PER_ELEMENT; + var buffer = new ArrayBuffer(3 * offset); + var length = { valueOf() { $DETACHBUFFER(buffer); return 1; } }; + assert.throws(TypeError, () => new TA(buffer, 0, length)); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/new-instance-extensibility-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/new-instance-extensibility-sab.js new file mode 100644 index 000000000..5d5976424 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/new-instance-extensibility-sab.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + The new typedArray instance from a buffer argument is extensible +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%"). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + ... + 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 11. Set the [[Extensible]] internal slot of A to true. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var buffer = new SharedArrayBuffer(8); + var sample = new TA(buffer); + + assert(Object.isExtensible(sample)); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/new-instance-extensibility.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/new-instance-extensibility.js new file mode 100644 index 000000000..6f7c8b7f4 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/new-instance-extensibility.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + The new typedArray instance from a buffer argument is extensible +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%"). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + ... + 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 11. Set the [[Extensible]] internal slot of A to true. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var buffer = new ArrayBuffer(8); + var sample = new TA(buffer); + + assert(Object.isExtensible(sample)); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/proto-from-ctor-realm-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/proto-from-ctor-realm-sab.js new file mode 100644 index 000000000..86374357e --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/proto-from-ctor-realm-sab.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: Default [[Prototype]] value derived from realm of the newTarget +info: | + [...] + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%"). + [...] + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + [...] + + 9.1.14 GetPrototypeFromConstructor + + [...] + 3. Let proto be ? Get(constructor, "prototype"). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Let proto be realm's intrinsic object named intrinsicDefaultProto. + 5. Return proto. +includes: [testBigIntTypedArray.js] +features: [BigInt, cross-realm, SharedArrayBuffer, Reflect, TypedArray] +---*/ + +var other = $262.createRealm().global; +var C = new other.Function(); +C.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [new SharedArrayBuffer(8)], C); + + assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/proto-from-ctor-realm.js new file mode 100644 index 000000000..8e5f4b12f --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/proto-from-ctor-realm.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: Default [[Prototype]] value derived from realm of the newTarget +info: | + [...] + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%"). + [...] + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + [...] + + 9.1.14 GetPrototypeFromConstructor + + [...] + 3. Let proto be ? Get(constructor, "prototype"). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Let proto be realm's intrinsic object named intrinsicDefaultProto. + 5. Return proto. +includes: [testBigIntTypedArray.js] +features: [BigInt, cross-realm, Reflect, TypedArray] +---*/ + +var other = $262.createRealm().global; +var C = new other.Function(); +C.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [new ArrayBuffer(8)], C); + + assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/returns-new-instance-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/returns-new-instance-sab.js new file mode 100644 index 000000000..4067b836f --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/returns-new-instance-sab.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from undefined offset and length +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. +includes: [testBigIntTypedArray.js] +features: [BigInt, SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + + var buffer1 = new SharedArrayBuffer(bpe * 4); + var ta1 = new TA(buffer1); + assert.sameValue(ta1.length, 4); + assert.sameValue(ta1.buffer, buffer1); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var buffer2 = new SharedArrayBuffer(0); + var ta2 = new TA(buffer2); + assert.sameValue(ta2.length, 0); + assert.sameValue(ta2.buffer, buffer2); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/returns-new-instance.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/returns-new-instance.js new file mode 100644 index 000000000..d6fb802b9 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/returns-new-instance.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from undefined offset and length +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + + var buffer1 = new ArrayBuffer(bpe * 4); + var ta1 = new TA(buffer1); + assert.sameValue(ta1.length, 4); + assert.sameValue(ta1.buffer, buffer1); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var buffer2 = new ArrayBuffer(0); + var ta2 = new TA(buffer2); + assert.sameValue(ta2.length, 0); + assert.sameValue(ta2.buffer, buffer2); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/toindex-bytelength-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/toindex-bytelength-sab.js new file mode 100644 index 000000000..3a9d2490e --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/toindex-bytelength-sab.js @@ -0,0 +1,73 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + ToIndex(length) operations +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 11. If length is either not present or undefined, then + ... + 12. Else, + a. Let newLength be ? ToIndex(length). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(16); + +var obj1 = { + valueOf: function() { + return 1; + } +}; + +var obj2 = { + toString: function() { + return 1; + } +}; + +var items = [ + [-0, 0, "-0"], + [obj1, 1, "object's valueOf"], + [obj2, 1, "object's toString"], + ["", 0, "the Empty string"], + ["0", 0, "string '0'"], + ["1", 1, "string '1'"], + [false, 0, "false"], + [true, 1, "true"], + [NaN, 0, "NaN"], + [null, 0, "null"], + [0.1, 0, "0.1"], + [0.9, 0, "0.9"], + [1.1, 1, "1.1"], + [1.9, 1, "1.9"], + [-0.1, 0, "-0.1"], + [-0.99999, 0, "-0.99999"] +]; + +testWithTypedArrayConstructors(function(TA) { + items.forEach(function(item) { + var len = item[0]; + var expected = item[1]; + var name = item[2]; + + var typedArray = new TA(buffer, 0, len); + assert.sameValue(typedArray.length, expected, name + " length"); + assert.sameValue(typedArray.constructor, TA, name + " constructor"); + assert.sameValue( + Object.getPrototypeOf(typedArray), + TA.prototype, + name + " prototype" + ); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/toindex-bytelength.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/toindex-bytelength.js new file mode 100644 index 000000000..8155a4479 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/toindex-bytelength.js @@ -0,0 +1,72 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + ToIndex(length) operations +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 11. If length is either not present or undefined, then + ... + 12. Else, + a. Let newLength be ? ToIndex(length). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var buffer = new ArrayBuffer(16); + +var obj1 = { + valueOf: function() { + return 1; + } +}; + +var obj2 = { + toString: function() { + return 1; + } +}; + +var items = [ + [-0, 0, "-0"], + [obj1, 1, "object's valueOf"], + [obj2, 1, "object's toString"], + ["", 0, "the Empty string"], + ["0", 0, "string '0'"], + ["1", 1, "string '1'"], + [false, 0, "false"], + [true, 1, "true"], + [NaN, 0, "NaN"], + [null, 0, "null"], + [0.1, 0, "0.1"], + [0.9, 0, "0.9"], + [1.1, 1, "1.1"], + [1.9, 1, "1.9"], + [-0.1, 0, "-0.1"], + [-0.99999, 0, "-0.99999"] +]; + +testWithTypedArrayConstructors(function(TA) { + items.forEach(function(item) { + var len = item[0]; + var expected = item[1]; + var name = item[2]; + + var typedArray = new TA(buffer, 0, len); + assert.sameValue(typedArray.length, expected, name + " length"); + assert.sameValue(typedArray.constructor, TA, name + " constructor"); + assert.sameValue( + Object.getPrototypeOf(typedArray), + TA.prototype, + name + " prototype" + ); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/toindex-byteoffset-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/toindex-byteoffset-sab.js new file mode 100644 index 000000000..e6085da48 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/toindex-byteoffset-sab.js @@ -0,0 +1,87 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + ToIndex(byteOffset) operations +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToIndex(byteOffset). + 8. If offset modulo elementSize ≠ 0, throw a RangeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(16); + +var obj1 = { + valueOf: function() { + return 8; + } +}; + +var obj2 = { + toString: function() { + return 8; + } +}; + +var items = [ + [-0, 0, "-0"], + [obj1, 8, "object's valueOf"], + [obj2, 8, "object's toString"], + ["", 0, "the Empty string"], + ["0", 0, "string '0'"], + ["8", 8, "string '8'"], + [false, 0, "false"], + [NaN, 0, "NaN"], + [null, 0, "null"], + [undefined, 0, "undefined"], + [0.1, 0, "0.1"], + [0.9, 0, "0.9"], + [8.1, 8, "8.1"], + [8.9, 8, "8.9"], + [-0.1, 0, "-0.1"], + [-0.99999, 0, "-0.99999"] +]; + +testWithTypedArrayConstructors(function(TA) { + items.forEach(function(item) { + var offset = item[0]; + var expected = item[1]; + var name = item[2]; + + var typedArray = new TA(buffer, offset); + assert.sameValue(typedArray.byteOffset, expected, name + " byteOffset"); + assert.sameValue(typedArray.constructor, TA, name + " constructor"); + assert.sameValue( + Object.getPrototypeOf(typedArray), + TA.prototype, + name + " prototype" + ); + }); + + // Testing `true`. See step 8 + if (TA.BYTES_PER_ELEMENT === 1) { + var typedArray = new TA(buffer, true); + assert.sameValue(typedArray.byteOffset, 1, "true => 1 byteOffset"); + assert.sameValue(typedArray.constructor, TA, "true => 1 constructor"); + assert.sameValue( + Object.getPrototypeOf(typedArray), + TA.prototype, + "true => 1 prototype" + ); + } else { + assert.throws(RangeError, function() { + new TA(buffer, true); + }, "1 modulo elementSize ≠ 0, throws a RangeError"); + } +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/toindex-byteoffset.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/toindex-byteoffset.js new file mode 100644 index 000000000..216f9cfdb --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/toindex-byteoffset.js @@ -0,0 +1,86 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + ToIndex(byteOffset) operations +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToIndex(byteOffset). + 8. If offset modulo elementSize ≠ 0, throw a RangeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var buffer = new ArrayBuffer(16); + +var obj1 = { + valueOf: function() { + return 8; + } +}; + +var obj2 = { + toString: function() { + return 8; + } +}; + +var items = [ + [-0, 0, "-0"], + [obj1, 8, "object's valueOf"], + [obj2, 8, "object's toString"], + ["", 0, "the Empty string"], + ["0", 0, "string '0'"], + ["8", 8, "string '8'"], + [false, 0, "false"], + [NaN, 0, "NaN"], + [null, 0, "null"], + [undefined, 0, "undefined"], + [0.1, 0, "0.1"], + [0.9, 0, "0.9"], + [8.1, 8, "8.1"], + [8.9, 8, "8.9"], + [-0.1, 0, "-0.1"], + [-0.99999, 0, "-0.99999"] +]; + +testWithTypedArrayConstructors(function(TA) { + items.forEach(function(item) { + var offset = item[0]; + var expected = item[1]; + var name = item[2]; + + var typedArray = new TA(buffer, offset); + assert.sameValue(typedArray.byteOffset, expected, name + " byteOffset"); + assert.sameValue(typedArray.constructor, TA, name + " constructor"); + assert.sameValue( + Object.getPrototypeOf(typedArray), + TA.prototype, + name + " prototype" + ); + }); + + // Testing `true`. See step 8 + if (TA.BYTES_PER_ELEMENT === 1) { + var typedArray = new TA(buffer, true); + assert.sameValue(typedArray.byteOffset, 1, "true => 1 byteOffset"); + assert.sameValue(typedArray.constructor, TA, "true => 1 constructor"); + assert.sameValue( + Object.getPrototypeOf(typedArray), + TA.prototype, + "true => 1 prototype" + ); + } else { + assert.throws(RangeError, function() { + new TA(buffer, true); + }, "1 modulo elementSize ≠ 0, throws a RangeError"); + } +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/typedarray-backed-by-sharedarraybuffer.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/typedarray-backed-by-sharedarraybuffer.js new file mode 100644 index 000000000..6a25a0aa9 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/typedarray-backed-by-sharedarraybuffer.js @@ -0,0 +1,23 @@ +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-typedarray-typedarray +description: > + Passing a SharedArrayBuffer-backed TypedArray to a TypedArray constructor + produces an ArrayBuffer-backed TypedArray. +includes: [testBigIntTypedArray.js] +features: [BigInt, SharedArrayBuffer, TypedArray] +---*/ + +var sab = new SharedArrayBuffer(4); +var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; + +testWithTypedArrayConstructors(function(View1) { + var ta1 = new View1(sab); + testWithTypedArrayConstructors(function(View2) { + var ta2 = new View2(ta1); + assert.sameValue(ta2.buffer.constructor, ArrayBuffer, + "TypedArray of SharedArrayBuffer-backed TypedArray is ArrayBuffer-backed"); + }, int_views); +}, int_views); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/use-custom-proto-if-object-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/use-custom-proto-if-object-sab.js new file mode 100644 index 000000000..b14fd3c4f --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/use-custom-proto-if-object-sab.js @@ -0,0 +1,49 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Use prototype from new target if it's an Object +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testBigIntTypedArray.js] +features: [BigInt, SharedArrayBuffer, Reflect, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); + +function newTarget() {} +var proto = {}; +newTarget.prototype = proto; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [buffer], newTarget); + + assert.sameValue(ta.constructor, Object); + assert.sameValue(Object.getPrototypeOf(ta), proto); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/use-custom-proto-if-object.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/use-custom-proto-if-object.js new file mode 100644 index 000000000..0cbbb87f6 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/use-custom-proto-if-object.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Use prototype from new target if it's an Object +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); + +function newTarget() {} +var proto = {}; +newTarget.prototype = proto; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [buffer], newTarget); + + assert.sameValue(ta.constructor, Object); + assert.sameValue(Object.getPrototypeOf(ta), proto); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/use-default-proto-if-custom-proto-is-not-object-sab.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/use-default-proto-if-custom-proto-is-not-object-sab.js new file mode 100644 index 000000000..9e7a51901 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/use-default-proto-if-custom-proto-is-not-object-sab.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Use prototype from %TypedArray% if newTarget's prototype is not an Object +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testBigIntTypedArray.js] +features: [BigInt, SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); + +function newTarget() {} +newTarget.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [buffer], newTarget); + + assert.sameValue(ta.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/use-default-proto-if-custom-proto-is-not-object.js new file mode 100644 index 000000000..7e8a5770a --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/buffer-arg/use-default-proto-if-custom-proto-is-not-object.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Use prototype from %TypedArray% if newTarget's prototype is not an Object +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); + +function newTarget() {} +newTarget.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [buffer], newTarget); + + assert.sameValue(ta.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size-sab.js deleted file mode 100644 index 707aa00be..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size-sab.js +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a RangeError if bufferByteLength modulo elementSize ≠ 0 -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 13. If length is undefined, then - a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(1); - -testWithTypedArrayConstructors(function(TA) { - if (TA.BYTES_PER_ELEMENT === 1) { - // Impossible to trigger this step here. - return; - } - - assert.throws(RangeError, function() { - new TA(buffer); - }); - - assert.throws(RangeError, function() { - new TA(buffer, 0, undefined); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size.js deleted file mode 100644 index a886e5afd..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size.js +++ /dev/null @@ -1,37 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a RangeError if bufferByteLength modulo elementSize ≠ 0 -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 13. If length is undefined, then - a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var buffer = new ArrayBuffer(1); - -testWithTypedArrayConstructors(function(TA) { - if (TA.BYTES_PER_ELEMENT === 1) { - // Impossible to trigger this step here. - return; - } - - assert.throws(RangeError, function() { - new TA(buffer); - }); - - assert.throws(RangeError, function() { - new TA(buffer, 0, undefined); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-throws-sab.js deleted file mode 100644 index 89f58a1cd..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-throws-sab.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a RangeError if ToInteger(byteOffset) is < 0 -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 7. Let offset be ? ToInteger(byteOffset). - 8. If offset < 0, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(8); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(RangeError, function() { - new TA(buffer, -1); - }); - assert.throws(RangeError, function() { - new TA(buffer, -Infinity); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-throws.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-throws.js deleted file mode 100644 index 058892465..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-throws.js +++ /dev/null @@ -1,31 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a RangeError if ToInteger(byteOffset) is < 0 -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 7. Let offset be ? ToInteger(byteOffset). - 8. If offset < 0, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var buffer = new ArrayBuffer(8); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(RangeError, function() { - new TA(buffer, -1); - }); - assert.throws(RangeError, function() { - new TA(buffer, -Infinity); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-zero-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-zero-sab.js deleted file mode 100644 index 1073b5af8..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-zero-sab.js +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2015 André Bargull. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: pending -description: > - TypedArray's [[ByteOffset]] internal slot is always a positive number, test with negative zero. -info: | - %TypedArray% ( buffer [ , byteOffset [ , length ] ] ) - - ... - 6. Let offset be ? ToInteger(byteOffset). - 7. If offset < 0, throw a RangeError exception. - 8. If offset is -0, let offset be +0. - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TAConstructor) { - var typedArray = new TAConstructor(new SharedArrayBuffer(8), -0); - assert.sameValue(typedArray.byteOffset, +0); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-zero.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-zero.js deleted file mode 100644 index 13d0a3e14..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-negative-zero.js +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2015 André Bargull. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: pending -description: > - TypedArray's [[ByteOffset]] internal slot is always a positive number, test with negative zero. -info: | - %TypedArray% ( buffer [ , byteOffset [ , length ] ] ) - - ... - 6. Let offset be ? ToInteger(byteOffset). - 7. If offset < 0, throw a RangeError exception. - 8. If offset is -0, let offset be +0. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TAConstructor) { - var typedArray = new TAConstructor(new ArrayBuffer(8), -0); - assert.sameValue(typedArray.byteOffset, +0); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-symbol-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-symbol-throws-sab.js deleted file mode 100644 index b5fc270c9..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-symbol-throws-sab.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return abrupt from parsing integer value from byteOffset as a symbol -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 7. Let offset be ? ToInteger(byteOffset). - ... -includes: [testTypedArray.js] -features: [Symbol, SharedArrayBuffer, TypedArray] ----*/ - -var byteOffset = Symbol("1"); -var buffer = new SharedArrayBuffer(8); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(TypeError, function() { - new TA(buffer, byteOffset); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-symbol-throws.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-symbol-throws.js deleted file mode 100644 index 60039a1f5..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-is-symbol-throws.js +++ /dev/null @@ -1,28 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return abrupt from parsing integer value from byteOffset as a symbol -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 7. Let offset be ? ToInteger(byteOffset). - ... -includes: [testTypedArray.js] -features: [Symbol, TypedArray] ----*/ - -var byteOffset = Symbol("1"); -var buffer = new ArrayBuffer(8); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(TypeError, function() { - new TA(buffer, byteOffset); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-throws-from-modulo-element-size-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-throws-from-modulo-element-size-sab.js deleted file mode 100644 index 79b398ccf..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-throws-from-modulo-element-size-sab.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a RangeError if ToInteger(byteOffset) modulo elementSize is not 0 -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 10. If offset modulo elementSize ≠ 0, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(8); - -testWithTypedArrayConstructors(function(TA) { - if (TA.BYTES_PER_ELEMENT === 1) { - // Impossible to trigger this step here. - return; - } - - assert.throws(RangeError, function() { - new TA(buffer, 7); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-throws-from-modulo-element-size.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-throws-from-modulo-element-size.js deleted file mode 100644 index 479f0d5dc..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-throws-from-modulo-element-size.js +++ /dev/null @@ -1,32 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a RangeError if ToInteger(byteOffset) modulo elementSize is not 0 -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 10. If offset modulo elementSize ≠ 0, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var buffer = new ArrayBuffer(8); - -testWithTypedArrayConstructors(function(TA) { - if (TA.BYTES_PER_ELEMENT === 1) { - // Impossible to trigger this step here. - return; - } - - assert.throws(RangeError, function() { - new TA(buffer, 7); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-detachbuffer.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-detachbuffer.js deleted file mode 100644 index b8936e8cd..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-detachbuffer.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2017 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: If TypedArray() is passed a detached buffer, throw -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - ... - 9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. - ... -includes: [testTypedArray.js, detachArrayBuffer.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var offset = TA.BYTES_PER_ELEMENT; - var buffer = new ArrayBuffer(3 * offset); - var byteOffset = { valueOf() { $DETACHBUFFER(buffer); return offset; } }; - assert.throws(TypeError, () => new TA(buffer, byteOffset)); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-throws-sab.js deleted file mode 100644 index e7b336c5e..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-throws-sab.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return abrupt from parsing integer value from byteOffset -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 7. Let offset be ? ToInteger(byteOffset). - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(8); -var byteOffset = { - valueOf: function() { - throw new Test262Error(); - } -}; - -testWithTypedArrayConstructors(function(TA) { - assert.throws(Test262Error, function() { - new TA(buffer, byteOffset); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-throws.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-throws.js deleted file mode 100644 index 20cd4b796..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-byteoffset-to-number-throws.js +++ /dev/null @@ -1,32 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return abrupt from parsing integer value from byteOffset -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 7. Let offset be ? ToInteger(byteOffset). - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var buffer = new ArrayBuffer(8); -var byteOffset = { - valueOf: function() { - throw new Test262Error(); - } -}; - -testWithTypedArrayConstructors(function(TA) { - assert.throws(Test262Error, function() { - new TA(buffer, byteOffset); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-custom-proto-access-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-custom-proto-access-throws-sab.js deleted file mode 100644 index b3ff8c56e..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-custom-proto-access-throws-sab.js +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return abrupt completion getting newTarget's prototype -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - ... - - 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) - - ... - 3. Let proto be ? Get(constructor, "prototype"). - ... -includes: [testTypedArray.js] -features: [Reflect, SharedArrayBuffer, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(8); - -var newTarget = function() {}.bind(null); -Object.defineProperty(newTarget, "prototype", { - get() { - throw new Test262Error(); - } -}); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(Test262Error, function() { - Reflect.construct(TA, [buffer], newTarget); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-custom-proto-access-throws.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-custom-proto-access-throws.js deleted file mode 100644 index a1b823317..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-custom-proto-access-throws.js +++ /dev/null @@ -1,47 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return abrupt completion getting newTarget's prototype -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - ... - - 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) - - ... - 3. Let proto be ? Get(constructor, "prototype"). - ... -includes: [testTypedArray.js] -features: [Reflect, TypedArray] ----*/ - -var buffer = new ArrayBuffer(8); - -var newTarget = function() {}.bind(null); -Object.defineProperty(newTarget, "prototype", { - get() { - throw new Test262Error(); - } -}); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(Test262Error, function() { - Reflect.construct(TA, [buffer], newTarget); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-and-offset-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-and-offset-sab.js deleted file mode 100644 index 2107146b1..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-and-offset-sab.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return new typedArray from defined length and offset -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var offset = TA.BYTES_PER_ELEMENT; - var buffer = new SharedArrayBuffer(3 * offset); - - var ta1 = new TA(buffer, offset, 2); - assert.sameValue(ta1.length, 2, "ta1.length"); - assert.sameValue(ta1.buffer, buffer, "ta1.buffer"); - assert.sameValue(ta1.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); - - var ta2 = new TA(buffer, offset, 0); - assert.sameValue(ta2.length, 0, "ta2.length"); - assert.sameValue(ta2.buffer, buffer, "ta2.buffer"); - assert.sameValue(ta2.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-and-offset.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-and-offset.js deleted file mode 100644 index aefd48b55..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-and-offset.js +++ /dev/null @@ -1,32 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return new typedArray from defined length and offset -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var offset = TA.BYTES_PER_ELEMENT; - var buffer = new ArrayBuffer(3 * offset); - - var ta1 = new TA(buffer, offset, 2); - assert.sameValue(ta1.length, 2, "ta1.length"); - assert.sameValue(ta1.buffer, buffer, "ta1.buffer"); - assert.sameValue(ta1.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); - - var ta2 = new TA(buffer, offset, 0); - assert.sameValue(ta2.length, 0, "ta2.length"); - assert.sameValue(ta2.buffer, buffer, "ta2.buffer"); - assert.sameValue(ta2.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-sab.js deleted file mode 100644 index a06e530d0..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length-sab.js +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return new typedArray from defined length -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - var length = 4; - var buffer = new SharedArrayBuffer(bpe * length * 4); - - var ta1 = new TA(buffer, 0, length); - assert.sameValue(ta1.length, length); - assert.sameValue(ta1.buffer, buffer); - assert.sameValue(ta1.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); - - var ta2 = new TA(buffer, 0, 0); - assert.sameValue(ta2.length, 0); - assert.sameValue(ta2.buffer, buffer); - assert.sameValue(ta2.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length.js deleted file mode 100644 index 11fb1c4a4..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-length.js +++ /dev/null @@ -1,34 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return new typedArray from defined length -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - var length = 4; - var buffer = new ArrayBuffer(bpe * length * 4); - - var ta1 = new TA(buffer, 0, length); - assert.sameValue(ta1.length, length); - assert.sameValue(ta1.buffer, buffer); - assert.sameValue(ta1.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); - - var ta2 = new TA(buffer, 0, 0); - assert.sameValue(ta2.length, 0); - assert.sameValue(ta2.buffer, buffer); - assert.sameValue(ta2.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-negative-length-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-negative-length-sab.js deleted file mode 100644 index 4d1b1d29c..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-negative-length-sab.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws RangeError for negative ToInteger(length) -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(16); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(RangeError, function() { - new TA(buffer, 0, -1); - }); - - assert.throws(RangeError, function() { - new TA(buffer, 0, -Infinity); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-negative-length.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-negative-length.js deleted file mode 100644 index d57d466d9..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-negative-length.js +++ /dev/null @@ -1,28 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws RangeError for negative ToInteger(length) -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var buffer = new ArrayBuffer(16); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(RangeError, function() { - new TA(buffer, 0, -1); - }); - - assert.throws(RangeError, function() { - new TA(buffer, 0, -Infinity); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-offset-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-offset-sab.js deleted file mode 100644 index 515d822c1..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-offset-sab.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return new typedArray from defined offset -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - var buffer = new SharedArrayBuffer(bpe * 4); - - var ta1 = new TA(buffer, bpe * 2); - assert.sameValue(ta1.length, 2); - assert.sameValue(ta1.buffer, buffer); - assert.sameValue(ta1.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); - - var ta2 = new TA(buffer, 0); - assert.sameValue(ta2.length, 4); - assert.sameValue(ta2.buffer, buffer); - assert.sameValue(ta2.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-offset.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-offset.js deleted file mode 100644 index 89e290b52..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-defined-offset.js +++ /dev/null @@ -1,32 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return new typedArray from defined offset -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - var buffer = new ArrayBuffer(bpe * 4); - - var ta1 = new TA(buffer, bpe * 2); - assert.sameValue(ta1.length, 2); - assert.sameValue(ta1.buffer, buffer); - assert.sameValue(ta1.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); - - var ta2 = new TA(buffer, 0); - assert.sameValue(ta2.length, 4); - assert.sameValue(ta2.buffer, buffer); - assert.sameValue(ta2.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-detachedbuffer.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-detachedbuffer.js deleted file mode 100644 index b015d4c34..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-detachedbuffer.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2017 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: If TypedArray() is passed a detached buffer, throw -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - ... - 9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. - ... -includes: [testTypedArray.js, detachArrayBuffer.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var offset = TA.BYTES_PER_ELEMENT; - var buffer = new ArrayBuffer(3 * offset); - $DETACHBUFFER(buffer); - assert.throws(TypeError, () => new TA(buffer)); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-length-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-length-throws-sab.js deleted file mode 100644 index 2549e93fd..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-length-throws-sab.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - If offset + newByteLength > bufferByteLength, throw a RangeError exception. -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 14. Else, - a. Let newLength be ? ToLength(length). - b. Let newByteLength be newLength × elementSize. - c. If offset+newByteLength > bufferByteLength, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - var buffer = new SharedArrayBuffer(bpe); - - assert.throws(RangeError, function() { - new TA(buffer, 0, bpe * 2); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-length-throws.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-length-throws.js deleted file mode 100644 index 3ff3a6d61..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-length-throws.js +++ /dev/null @@ -1,31 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - If offset + newByteLength > bufferByteLength, throw a RangeError exception. -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 14. Else, - a. Let newLength be ? ToLength(length). - b. Let newByteLength be newLength × elementSize. - c. If offset+newByteLength > bufferByteLength, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - var buffer = new ArrayBuffer(bpe); - - assert.throws(RangeError, function() { - new TA(buffer, 0, bpe * 2); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-offset-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-offset-throws-sab.js deleted file mode 100644 index 62cf41145..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-offset-throws-sab.js +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a RangeError if bufferByteLength - ToInteger(byteOffset) < 0 -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 13. If length is undefined, then - a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception. - b. Let newByteLength be bufferByteLength - offset. - c. If newByteLength < 0, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - var buffer = new SharedArrayBuffer(bpe); - - assert.throws(RangeError, function() { - new TA(buffer, bpe * 2); - }); - - assert.throws(RangeError, function() { - new TA(buffer, bpe * 2, undefined); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-offset-throws.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-offset-throws.js deleted file mode 100644 index 5daf40ce7..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-excessive-offset-throws.js +++ /dev/null @@ -1,35 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a RangeError if bufferByteLength - ToInteger(byteOffset) < 0 -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 13. If length is undefined, then - a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception. - b. Let newByteLength be bufferByteLength - offset. - c. If newByteLength < 0, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - var buffer = new ArrayBuffer(bpe); - - assert.throws(RangeError, function() { - new TA(buffer, bpe * 2); - }); - - assert.throws(RangeError, function() { - new TA(buffer, bpe * 2, undefined); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-invoked-with-undefined-newtarget-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-invoked-with-undefined-newtarget-sab.js deleted file mode 100644 index 24061049a..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-invoked-with-undefined-newtarget-sab.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a TypeError if NewTarget is undefined. -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 2. If NewTarget is undefined, throw a TypeError exception. - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var buffer = new SharedArrayBuffer(4); - assert.throws(TypeError, function() { - TA(buffer); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-invoked-with-undefined-newtarget.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-invoked-with-undefined-newtarget.js deleted file mode 100644 index 218b7c2c0..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-invoked-with-undefined-newtarget.js +++ /dev/null @@ -1,26 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a TypeError if NewTarget is undefined. -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 2. If NewTarget is undefined, throw a TypeError exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var buffer = new ArrayBuffer(4); - assert.throws(TypeError, function() { - TA(buffer); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-is-referenced-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-is-referenced-sab.js deleted file mode 100644 index 44c29229c..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-is-referenced-sab.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Reuse buffer argument instead of making a new clone -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 15. Set O's [[ViewedArrayBuffer]] internal slot to buffer. - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - - var buffer = new SharedArrayBuffer(bpe); - - var ta1 = new TA(buffer); - var ta2 = new TA(buffer); - - assert.sameValue(ta1.buffer, buffer); - assert.sameValue(ta2.buffer, buffer); - assert.sameValue(ta1.buffer, ta2.buffer); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-is-referenced.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-is-referenced.js deleted file mode 100644 index 0154deaf4..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-is-referenced.js +++ /dev/null @@ -1,32 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Reuse buffer argument instead of making a new clone -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 15. Set O's [[ViewedArrayBuffer]] internal slot to buffer. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - - var buffer = new ArrayBuffer(bpe); - - var ta1 = new TA(buffer); - var ta2 = new TA(buffer); - - assert.sameValue(ta1.buffer, buffer); - assert.sameValue(ta2.buffer, buffer); - assert.sameValue(ta1.buffer, ta2.buffer); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-access-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-access-throws-sab.js deleted file mode 100644 index 16872f860..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-access-throws-sab.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Returns abrupt from ToLength(length) -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 14. Else, - a. Let newLength be ? ToLength(length). - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(8); -var len = { - valueOf() { - throw new Test262Error(); - } -}; - -testWithTypedArrayConstructors(function(TA) { - assert.throws(Test262Error, function() { - new TA(buffer, 0, len); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-access-throws.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-access-throws.js deleted file mode 100644 index ea99b8b40..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-access-throws.js +++ /dev/null @@ -1,33 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Returns abrupt from ToLength(length) -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 14. Else, - a. Let newLength be ? ToLength(length). - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var buffer = new ArrayBuffer(8); -var len = { - valueOf() { - throw new Test262Error(); - } -}; - -testWithTypedArrayConstructors(function(TA) { - assert.throws(Test262Error, function() { - new TA(buffer, 0, len); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-is-symbol-throws-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-is-symbol-throws-sab.js deleted file mode 100644 index 8b77b806d..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-is-symbol-throws-sab.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a TypeError if length is a Symbol -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 14. Else, - a. Let newLength be ? ToLength(length). - ... -includes: [testTypedArray.js] -features: [Symbol, SharedArrayBuffer, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(8); -var s = Symbol("1"); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(TypeError, function() { - new TA(buffer, 0, s); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-is-symbol-throws.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-is-symbol-throws.js deleted file mode 100644 index db8ac8303..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-is-symbol-throws.js +++ /dev/null @@ -1,29 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Throws a TypeError if length is a Symbol -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 14. Else, - a. Let newLength be ? ToLength(length). - ... -includes: [testTypedArray.js] -features: [Symbol, TypedArray] ----*/ - -var buffer = new ArrayBuffer(8); -var s = Symbol("1"); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(TypeError, function() { - new TA(buffer, 0, s); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-to-number-detachbuffer.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-to-number-detachbuffer.js deleted file mode 100644 index c8c3eb34b..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-length-to-number-detachbuffer.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2017 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: If TypedArray() is passed a detached buffer, throw -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - ... - 9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. - ... -includes: [testTypedArray.js, detachArrayBuffer.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var offset = TA.BYTES_PER_ELEMENT; - var buffer = new ArrayBuffer(3 * offset); - var length = { valueOf() { $DETACHBUFFER(buffer); return 1; } }; - assert.throws(TypeError, () => new TA(buffer, 0, length)); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-new-instance-extensibility-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-new-instance-extensibility-sab.js deleted file mode 100644 index 2b765a78f..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-new-instance-extensibility-sab.js +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - The new typedArray instance from a buffer argument is extensible -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - ... - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - "%TypedArrayPrototype%"). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - ... - 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 11. Set the [[Extensible]] internal slot of A to true. - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var buffer = new SharedArrayBuffer(8); - var sample = new TA(buffer); - - assert(Object.isExtensible(sample)); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-new-instance-extensibility.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-new-instance-extensibility.js deleted file mode 100644 index 74336215f..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-new-instance-extensibility.js +++ /dev/null @@ -1,37 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - The new typedArray instance from a buffer argument is extensible -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - ... - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - "%TypedArrayPrototype%"). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - ... - 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 11. Set the [[Extensible]] internal slot of A to true. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var buffer = new ArrayBuffer(8); - var sample = new TA(buffer); - - assert(Object.isExtensible(sample)); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-proto-from-ctor-realm-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-proto-from-ctor-realm-sab.js deleted file mode 100644 index 9cab95b47..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-proto-from-ctor-realm-sab.js +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: Default [[Prototype]] value derived from realm of the newTarget -info: | - [...] - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - "%TypedArrayPrototype%"). - [...] - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - [...] - - 9.1.14 GetPrototypeFromConstructor - - [...] - 3. Let proto be ? Get(constructor, "prototype"). - 4. If Type(proto) is not Object, then - a. Let realm be ? GetFunctionRealm(constructor). - b. Let proto be realm's intrinsic object named intrinsicDefaultProto. - 5. Return proto. -includes: [testTypedArray.js] -features: [cross-realm, SharedArrayBuffer, Reflect, TypedArray] ----*/ - -var other = $262.createRealm().global; -var C = new other.Function(); -C.prototype = null; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [new SharedArrayBuffer(8)], C); - - assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-proto-from-ctor-realm.js deleted file mode 100644 index d93538db4..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-proto-from-ctor-realm.js +++ /dev/null @@ -1,37 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: Default [[Prototype]] value derived from realm of the newTarget -info: | - [...] - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - "%TypedArrayPrototype%"). - [...] - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - [...] - - 9.1.14 GetPrototypeFromConstructor - - [...] - 3. Let proto be ? Get(constructor, "prototype"). - 4. If Type(proto) is not Object, then - a. Let realm be ? GetFunctionRealm(constructor). - b. Let proto be realm's intrinsic object named intrinsicDefaultProto. - 5. Return proto. -includes: [testTypedArray.js] -features: [cross-realm, Reflect, TypedArray] ----*/ - -var other = $262.createRealm().global; -var C = new other.Function(); -C.prototype = null; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [new ArrayBuffer(8)], C); - - assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-returns-new-instance-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-returns-new-instance-sab.js deleted file mode 100644 index 52de96252..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-returns-new-instance-sab.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return new typedArray from undefined offset and length -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - - var buffer1 = new SharedArrayBuffer(bpe * 4); - var ta1 = new TA(buffer1); - assert.sameValue(ta1.length, 4); - assert.sameValue(ta1.buffer, buffer1); - assert.sameValue(ta1.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); - - var buffer2 = new SharedArrayBuffer(0); - var ta2 = new TA(buffer2); - assert.sameValue(ta2.length, 0); - assert.sameValue(ta2.buffer, buffer2); - assert.sameValue(ta2.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-returns-new-instance.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-returns-new-instance.js deleted file mode 100644 index 4723e75f9..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-returns-new-instance.js +++ /dev/null @@ -1,33 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Return new typedArray from undefined offset and length -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var bpe = TA.BYTES_PER_ELEMENT; - - var buffer1 = new ArrayBuffer(bpe * 4); - var ta1 = new TA(buffer1); - assert.sameValue(ta1.length, 4); - assert.sameValue(ta1.buffer, buffer1); - assert.sameValue(ta1.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); - - var buffer2 = new ArrayBuffer(0); - var ta2 = new TA(buffer2); - assert.sameValue(ta2.length, 0); - assert.sameValue(ta2.buffer, buffer2); - assert.sameValue(ta2.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-bytelength-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-bytelength-sab.js deleted file mode 100644 index 5fd87715f..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-bytelength-sab.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - ToIndex(length) operations -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 11. If length is either not present or undefined, then - ... - 12. Else, - a. Let newLength be ? ToIndex(length). - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(16); - -var obj1 = { - valueOf: function() { - return 1; - } -}; - -var obj2 = { - toString: function() { - return 1; - } -}; - -var items = [ - [-0, 0, "-0"], - [obj1, 1, "object's valueOf"], - [obj2, 1, "object's toString"], - ["", 0, "the Empty string"], - ["0", 0, "string '0'"], - ["1", 1, "string '1'"], - [false, 0, "false"], - [true, 1, "true"], - [NaN, 0, "NaN"], - [null, 0, "null"], - [0.1, 0, "0.1"], - [0.9, 0, "0.9"], - [1.1, 1, "1.1"], - [1.9, 1, "1.9"], - [-0.1, 0, "-0.1"], - [-0.99999, 0, "-0.99999"] -]; - -testWithTypedArrayConstructors(function(TA) { - items.forEach(function(item) { - var len = item[0]; - var expected = item[1]; - var name = item[2]; - - var typedArray = new TA(buffer, 0, len); - assert.sameValue(typedArray.length, expected, name + " length"); - assert.sameValue(typedArray.constructor, TA, name + " constructor"); - assert.sameValue( - Object.getPrototypeOf(typedArray), - TA.prototype, - name + " prototype" - ); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-bytelength.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-bytelength.js deleted file mode 100644 index ae660b820..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-bytelength.js +++ /dev/null @@ -1,72 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - ToIndex(length) operations -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 11. If length is either not present or undefined, then - ... - 12. Else, - a. Let newLength be ? ToIndex(length). - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var buffer = new ArrayBuffer(16); - -var obj1 = { - valueOf: function() { - return 1; - } -}; - -var obj2 = { - toString: function() { - return 1; - } -}; - -var items = [ - [-0, 0, "-0"], - [obj1, 1, "object's valueOf"], - [obj2, 1, "object's toString"], - ["", 0, "the Empty string"], - ["0", 0, "string '0'"], - ["1", 1, "string '1'"], - [false, 0, "false"], - [true, 1, "true"], - [NaN, 0, "NaN"], - [null, 0, "null"], - [0.1, 0, "0.1"], - [0.9, 0, "0.9"], - [1.1, 1, "1.1"], - [1.9, 1, "1.9"], - [-0.1, 0, "-0.1"], - [-0.99999, 0, "-0.99999"] -]; - -testWithTypedArrayConstructors(function(TA) { - items.forEach(function(item) { - var len = item[0]; - var expected = item[1]; - var name = item[2]; - - var typedArray = new TA(buffer, 0, len); - assert.sameValue(typedArray.length, expected, name + " length"); - assert.sameValue(typedArray.constructor, TA, name + " constructor"); - assert.sameValue( - Object.getPrototypeOf(typedArray), - TA.prototype, - name + " prototype" - ); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-byteoffset-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-byteoffset-sab.js deleted file mode 100644 index 43ae9f601..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-byteoffset-sab.js +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - ToIndex(byteOffset) operations -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 7. Let offset be ? ToIndex(byteOffset). - 8. If offset modulo elementSize ≠ 0, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(16); - -var obj1 = { - valueOf: function() { - return 8; - } -}; - -var obj2 = { - toString: function() { - return 8; - } -}; - -var items = [ - [-0, 0, "-0"], - [obj1, 8, "object's valueOf"], - [obj2, 8, "object's toString"], - ["", 0, "the Empty string"], - ["0", 0, "string '0'"], - ["8", 8, "string '8'"], - [false, 0, "false"], - [NaN, 0, "NaN"], - [null, 0, "null"], - [undefined, 0, "undefined"], - [0.1, 0, "0.1"], - [0.9, 0, "0.9"], - [8.1, 8, "8.1"], - [8.9, 8, "8.9"], - [-0.1, 0, "-0.1"], - [-0.99999, 0, "-0.99999"] -]; - -testWithTypedArrayConstructors(function(TA) { - items.forEach(function(item) { - var offset = item[0]; - var expected = item[1]; - var name = item[2]; - - var typedArray = new TA(buffer, offset); - assert.sameValue(typedArray.byteOffset, expected, name + " byteOffset"); - assert.sameValue(typedArray.constructor, TA, name + " constructor"); - assert.sameValue( - Object.getPrototypeOf(typedArray), - TA.prototype, - name + " prototype" - ); - }); - - // Testing `true`. See step 8 - if (TA.BYTES_PER_ELEMENT === 1) { - var typedArray = new TA(buffer, true); - assert.sameValue(typedArray.byteOffset, 1, "true => 1 byteOffset"); - assert.sameValue(typedArray.constructor, TA, "true => 1 constructor"); - assert.sameValue( - Object.getPrototypeOf(typedArray), - TA.prototype, - "true => 1 prototype" - ); - } else { - assert.throws(RangeError, function() { - new TA(buffer, true); - }, "1 modulo elementSize ≠ 0, throws a RangeError"); - } -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-byteoffset.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-byteoffset.js deleted file mode 100644 index 35a087aaf..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-toindex-byteoffset.js +++ /dev/null @@ -1,86 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - ToIndex(byteOffset) operations -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 7. Let offset be ? ToIndex(byteOffset). - 8. If offset modulo elementSize ≠ 0, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var buffer = new ArrayBuffer(16); - -var obj1 = { - valueOf: function() { - return 8; - } -}; - -var obj2 = { - toString: function() { - return 8; - } -}; - -var items = [ - [-0, 0, "-0"], - [obj1, 8, "object's valueOf"], - [obj2, 8, "object's toString"], - ["", 0, "the Empty string"], - ["0", 0, "string '0'"], - ["8", 8, "string '8'"], - [false, 0, "false"], - [NaN, 0, "NaN"], - [null, 0, "null"], - [undefined, 0, "undefined"], - [0.1, 0, "0.1"], - [0.9, 0, "0.9"], - [8.1, 8, "8.1"], - [8.9, 8, "8.9"], - [-0.1, 0, "-0.1"], - [-0.99999, 0, "-0.99999"] -]; - -testWithTypedArrayConstructors(function(TA) { - items.forEach(function(item) { - var offset = item[0]; - var expected = item[1]; - var name = item[2]; - - var typedArray = new TA(buffer, offset); - assert.sameValue(typedArray.byteOffset, expected, name + " byteOffset"); - assert.sameValue(typedArray.constructor, TA, name + " constructor"); - assert.sameValue( - Object.getPrototypeOf(typedArray), - TA.prototype, - name + " prototype" - ); - }); - - // Testing `true`. See step 8 - if (TA.BYTES_PER_ELEMENT === 1) { - var typedArray = new TA(buffer, true); - assert.sameValue(typedArray.byteOffset, 1, "true => 1 byteOffset"); - assert.sameValue(typedArray.constructor, TA, "true => 1 constructor"); - assert.sameValue( - Object.getPrototypeOf(typedArray), - TA.prototype, - "true => 1 prototype" - ); - } else { - assert.throws(RangeError, function() { - new TA(buffer, true); - }, "1 modulo elementSize ≠ 0, throws a RangeError"); - } -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-typedarray-backed-by-sharedarraybuffer.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-typedarray-backed-by-sharedarraybuffer.js deleted file mode 100644 index 739d1cdd2..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-typedarray-backed-by-sharedarraybuffer.js +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-typedarray-typedarray -description: > - Passing a SharedArrayBuffer-backed TypedArray to a TypedArray constructor - produces an ArrayBuffer-backed TypedArray. -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -var sab = new SharedArrayBuffer(4); -var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; - -testWithTypedArrayConstructors(function(View1) { - var ta1 = new View1(sab); - testWithTypedArrayConstructors(function(View2) { - var ta2 = new View2(ta1); - assert.sameValue(ta2.buffer.constructor, ArrayBuffer, - "TypedArray of SharedArrayBuffer-backed TypedArray is ArrayBuffer-backed"); - }, int_views); -}, int_views); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-custom-proto-if-object-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-custom-proto-if-object-sab.js deleted file mode 100644 index c963b6bb1..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-custom-proto-if-object-sab.js +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Use prototype from new target if it's an Object -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 10. Set the [[Prototype]] internal slot of A to prototype. - ... - 12. Return A. -includes: [testTypedArray.js] -features: [SharedArrayBuffer, Reflect, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(8); - -function newTarget() {} -var proto = {}; -newTarget.prototype = proto; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [buffer], newTarget); - - assert.sameValue(ta.constructor, Object); - assert.sameValue(Object.getPrototypeOf(ta), proto); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-custom-proto-if-object.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-custom-proto-if-object.js deleted file mode 100644 index 9eefdf56d..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-custom-proto-if-object.js +++ /dev/null @@ -1,48 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Use prototype from new target if it's an Object -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 10. Set the [[Prototype]] internal slot of A to prototype. - ... - 12. Return A. -includes: [testTypedArray.js] -features: [Reflect, TypedArray] ----*/ - -var buffer = new ArrayBuffer(8); - -function newTarget() {} -var proto = {}; -newTarget.prototype = proto; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [buffer], newTarget); - - assert.sameValue(ta.constructor, Object); - assert.sameValue(Object.getPrototypeOf(ta), proto); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object-sab.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object-sab.js deleted file mode 100644 index 8c91aa84d..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object-sab.js +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2016 the V8 project authors. All rights reserved. -// Copyright (C) 2017 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Use prototype from %TypedArray% if newTarget's prototype is not an Object -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 10. Set the [[Prototype]] internal slot of A to prototype. - ... - 12. Return A. -includes: [testTypedArray.js] -features: [SharedArrayBuffer, TypedArray] ----*/ - -var buffer = new SharedArrayBuffer(8); - -function newTarget() {} -newTarget.prototype = null; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [buffer], newTarget); - - assert.sameValue(ta.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object.js deleted file mode 100644 index df4909dab..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/butter-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object.js +++ /dev/null @@ -1,47 +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. -/*--- -esid: sec-typedarray-buffer-byteoffset-length -description: > - Use prototype from %TypedArray% if newTarget's prototype is not an Object -info: | - 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has an [[ArrayBufferData]] internal slot. - - ... - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 10. Set the [[Prototype]] internal slot of A to prototype. - ... - 12. Return A. -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var buffer = new ArrayBuffer(8); - -function newTarget() {} -newTarget.prototype = null; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [buffer], newTarget); - - assert.sameValue(ta.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/custom-proto-access-throws.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/custom-proto-access-throws.js new file mode 100644 index 000000000..3cc746cd1 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/custom-proto-access-throws.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + Return abrupt completion getting newTarget's prototype +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 8. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, elementLength). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + ... + + 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) + + ... + 3. Let proto be ? Get(constructor, "prototype"). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +var newTarget = function() {}.bind(null); +Object.defineProperty(newTarget, "prototype", { + get() { + throw new Test262Error(); + } +}); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + Reflect.construct(TA, [1], newTarget); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/init-zeros.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/init-zeros.js new file mode 100644 index 000000000..41bb0a8e2 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/init-zeros.js @@ -0,0 +1,55 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: All bytes are initialized to zero +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 8. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, elementLength). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 5. If length was not passed, then + ... + 6. Else, + a. Perform ? AllocateTypedArrayBuffer(obj, length). + + 22.2.4.2.2 Runtime Semantics: AllocateTypedArrayBuffer + + 7. Let data be ? AllocateArrayBuffer(%ArrayBuffer%, byteLength). + + 24.1.1.1 AllocateArrayBuffer + + 3. Let block be ? CreateByteDataBlock(byteLength). + + 6.2.6.1 CreateByteDataBlock + + 1. Assert: size≥0. + 2. Let db be a new Data Block value consisting of size bytes. If it is + impossible to create such a Data Block, throw a RangeError exception. + 3. Set all of the bytes of db to 0. + 4. Return db. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var subject = new TA(9); + + assert.sameValue(subject[0], convertToBigInt(0), 'index 0'); + assert.sameValue(subject[1], convertToBigInt(0), 'index 1'); + assert.sameValue(subject[2], convertToBigInt(0), 'index 2'); + assert.sameValue(subject[3], convertToBigInt(0), 'index 3'); + assert.sameValue(subject[4], convertToBigInt(0), 'index 4'); + assert.sameValue(subject[5], convertToBigInt(0), 'index 5'); + assert.sameValue(subject[6], convertToBigInt(0), 'index 6'); + assert.sameValue(subject[7], convertToBigInt(0), 'index 7'); + assert.sameValue(subject[8], convertToBigInt(0), 'index 8'); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/is-infinity-throws-rangeerror.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/is-infinity-throws-rangeerror.js new file mode 100644 index 000000000..4e1b50f26 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/is-infinity-throws-rangeerror.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + Throws a RangeError if length is a Infinity value +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 4. Let numberLength be ? ToNumber(length). + 5. Let elementLength be ToLength(numberLength). + 6. If SameValueZero(numberLength, elementLength) is false, throw a RangeError + exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.throws(RangeError, function() { + new TA(Infinity); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/is-negative-integer-throws-rangeerror.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/is-negative-integer-throws-rangeerror.js new file mode 100644 index 000000000..8c634fd7b --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/is-negative-integer-throws-rangeerror.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + Throws a RangeError if ToInteger(length) is a negative value +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 3. Let elementLength be ? ToIndex(length). + ... + + 7.1.17 ToIndex ( value ) + + 1. If value is undefined, then + ... + 2. Else, + a. Let integerIndex be ? ToInteger(value). + b. If integerIndex < 0, throw a RangeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.throws(RangeError, function() { + new TA(-1); + }); + + assert.throws(RangeError, function() { + new TA(-Infinity); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/is-symbol-throws.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/is-symbol-throws.js new file mode 100644 index 000000000..fd3767781 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/is-symbol-throws.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + If length is a Symbol, throw a TypeError exception. +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 4. Let numberLength be ? ToNumber(length). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var s = Symbol('1'); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + new TA(s); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-custom-proto-access-throws.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-custom-proto-access-throws.js deleted file mode 100644 index 6ad49fdab..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-custom-proto-access-throws.js +++ /dev/null @@ -1,43 +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. -/*--- -esid: sec-typedarray-length -description: > - Return abrupt completion getting newTarget's prototype -info: | - 22.2.4.2 TypedArray ( length ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is not Object. - - ... - 8. Return ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%, elementLength). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - ... - - 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) - - ... - 3. Let proto be ? Get(constructor, "prototype"). - ... -includes: [testTypedArray.js] -features: [Reflect, TypedArray] ----*/ - -var newTarget = function() {}.bind(null); -Object.defineProperty(newTarget, "prototype", { - get() { - throw new Test262Error(); - } -}); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(Test262Error, function() { - Reflect.construct(TA, [1], newTarget); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-init-zeros.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-init-zeros.js deleted file mode 100644 index 384e2399b..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-init-zeros.js +++ /dev/null @@ -1,55 +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. -/*--- -esid: sec-typedarray-length -description: All bytes are initialized to zero -info: | - 22.2.4.2 TypedArray ( length ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is not Object. - - ... - 8. Return ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%, elementLength). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 5. If length was not passed, then - ... - 6. Else, - a. Perform ? AllocateTypedArrayBuffer(obj, length). - - 22.2.4.2.2 Runtime Semantics: AllocateTypedArrayBuffer - - 7. Let data be ? AllocateArrayBuffer(%ArrayBuffer%, byteLength). - - 24.1.1.1 AllocateArrayBuffer - - 3. Let block be ? CreateByteDataBlock(byteLength). - - 6.2.6.1 CreateByteDataBlock - - 1. Assert: size≥0. - 2. Let db be a new Data Block value consisting of size bytes. If it is - impossible to create such a Data Block, throw a RangeError exception. - 3. Set all of the bytes of db to 0. - 4. Return db. -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA, N) { - var subject = new TA(9); - - assert.sameValue(subject[0], N(0), 'index 0'); - assert.sameValue(subject[1], N(0), 'index 1'); - assert.sameValue(subject[2], N(0), 'index 2'); - assert.sameValue(subject[3], N(0), 'index 3'); - assert.sameValue(subject[4], N(0), 'index 4'); - assert.sameValue(subject[5], N(0), 'index 5'); - assert.sameValue(subject[6], N(0), 'index 6'); - assert.sameValue(subject[7], N(0), 'index 7'); - assert.sameValue(subject[8], N(0), 'index 8'); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-infinity-throws-rangeerror.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-infinity-throws-rangeerror.js deleted file mode 100644 index 0084d5d6a..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-infinity-throws-rangeerror.js +++ /dev/null @@ -1,27 +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. -/*--- -esid: sec-typedarray-length -description: > - Throws a RangeError if length is a Infinity value -info: | - 22.2.4.2 TypedArray ( length ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is not Object. - - ... - 4. Let numberLength be ? ToNumber(length). - 5. Let elementLength be ToLength(numberLength). - 6. If SameValueZero(numberLength, elementLength) is false, throw a RangeError - exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - assert.throws(RangeError, function() { - new TA(Infinity); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-negative-integer-throws-rangeerror.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-negative-integer-throws-rangeerror.js deleted file mode 100644 index 0ff5d5a3f..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-negative-integer-throws-rangeerror.js +++ /dev/null @@ -1,37 +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. -/*--- -esid: sec-typedarray-length -description: > - Throws a RangeError if ToInteger(length) is a negative value -info: | - 22.2.4.2 TypedArray ( length ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is not Object. - - ... - 3. Let elementLength be ? ToIndex(length). - ... - - 7.1.17 ToIndex ( value ) - - 1. If value is undefined, then - ... - 2. Else, - a. Let integerIndex be ? ToInteger(value). - b. If integerIndex < 0, throw a RangeError exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - assert.throws(RangeError, function() { - new TA(-1); - }); - - assert.throws(RangeError, function() { - new TA(-Infinity); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-symbol-throws.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-symbol-throws.js deleted file mode 100644 index 797dd4922..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-is-symbol-throws.js +++ /dev/null @@ -1,26 +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. -/*--- -esid: sec-typedarray-length -description: > - If length is a Symbol, throw a TypeError exception. -info: | - 22.2.4.2 TypedArray ( length ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is not Object. - - ... - 4. Let numberLength be ? ToNumber(length). - ... -includes: [testTypedArray.js] -features: [Symbol, TypedArray] ----*/ - -var s = Symbol('1'); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(TypeError, function() { - new TA(s); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-new-instance-extensibility.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-new-instance-extensibility.js deleted file mode 100644 index d9b03deca..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-new-instance-extensibility.js +++ /dev/null @@ -1,38 +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. -/*--- -esid: sec-typedarray-length -description: > - The new typedArray instance from a length argument is extensible -info: | - 22.2.4.2 TypedArray ( length ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is not Object. - - ... - 8. Return ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%, elementLength). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - ... - 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 11. Set the [[Extensible]] internal slot of A to true. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var sample = new TA(4); - - assert(Object.isExtensible(sample)); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-proto-from-ctor-realm.js deleted file mode 100644 index f4effc208..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-proto-from-ctor-realm.js +++ /dev/null @@ -1,36 +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. -/*--- -esid: sec-typedarray-length -description: Default [[Prototype]] value derived from realm of the newTarget -info: | - [...] - 8. Return ? AllocateTypedArray(constructorName, NewTarget, - "%TypedArrayPrototype%", elementLength). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - [...] - - 9.1.14 GetPrototypeFromConstructor - - [...] - 3. Let proto be ? Get(constructor, "prototype"). - 4. If Type(proto) is not Object, then - a. Let realm be ? GetFunctionRealm(constructor). - b. Let proto be realm's intrinsic object named intrinsicDefaultProto. - 5. Return proto. -includes: [testTypedArray.js] -features: [cross-realm, Reflect, TypedArray] ----*/ - -var other = $262.createRealm().global; -var C = new other.Function(); -C.prototype = null; - -testWithTypedArrayConstructors(function(TA, N) { - var ta = Reflect.construct(TA, [0], C); - - assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-returns-object.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-returns-object.js deleted file mode 100644 index 8a9121d88..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-returns-object.js +++ /dev/null @@ -1,33 +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. -/*--- -esid: sec-typedarray-length -description: > - Return a TypedArray object -info: | - 22.2.4.2 TypedArray ( length ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is not Object. - - ... - 8. Return ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%, elementLength). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - ... - 7. Return obj -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var typedArray = new TA(4); - var length = typedArray.length; - - assert.sameValue(length, 4, "length"); - assert.sameValue(typedArray.constructor, TA); - assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-toindex-length.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-toindex-length.js deleted file mode 100644 index 4d16ff711..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-toindex-length.js +++ /dev/null @@ -1,53 +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. -/*--- -esid: sec-typedarray-length -description: > - ToIndex(length) operations -info: | - 22.2.4.2 TypedArray ( length ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is not Object. - - ... - 3. Let elementLength be ? ToIndex(length). - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var items = [ - [-0, 0, "-0"], - ["", 0, "the Empty string"], - ["0", 0, "string '0'"], - ["1", 1, "string '1'"], - [true, 1, "true"], - [false, 0, "false"], - [NaN, 0, "NaN"], - [null, 0, "null"], - [undefined, 0, "undefined"], - [0.1, 0, "0.1"], - [0.9, 0, "0.9"], - [1.1, 1, "1.1"], - [1.9, 1, "1.9"], - [-0.1, 0, "-0.1"], - [-0.99999, 0, "-0.99999"] -]; - -testWithTypedArrayConstructors(function(TA) { - items.forEach(function(item) { - var len = item[0]; - var expected = item[1]; - var name = item[2]; - - var typedArray = new TA(len); - assert.sameValue(typedArray.length, expected, name + " length"); - assert.sameValue(typedArray.constructor, TA, name + " constructor"); - assert.sameValue( - Object.getPrototypeOf(typedArray), - TA.prototype, - name + " prototype" - ); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-undefined-newtarget-throws.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-undefined-newtarget-throws.js deleted file mode 100644 index 6a238255e..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-undefined-newtarget-throws.js +++ /dev/null @@ -1,28 +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. -/*--- -esid: sec-typedarray-length -description: > - Throws a TypeError if NewTarget is undefined. -info: | - 22.2.4.2 TypedArray ( length ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is not Object. - - ... - 2. If NewTarget is undefined, throw a TypeError exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - assert.throws(TypeError, function() { - TA(0); - }); - - assert.throws(TypeError, function() { - TA(Infinity); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-use-custom-proto-if-object.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-use-custom-proto-if-object.js deleted file mode 100644 index b36ff7014..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-use-custom-proto-if-object.js +++ /dev/null @@ -1,44 +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. -/*--- -esid: sec-typedarray-length -description: > - Use prototype from new target if it's an Object -info: | - 22.2.4.2 TypedArray ( length ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is not Object. - - ... - 8. Return ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%, elementLength). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 10. Set the [[Prototype]] internal slot of A to prototype. - ... - 12. Return A. -includes: [testTypedArray.js] -features: [Reflect, TypedArray] ----*/ - -function newTarget() {} -var proto = {}; -newTarget.prototype = proto; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [1], newTarget); - - assert.sameValue(ta.constructor, Object); - assert.sameValue(Object.getPrototypeOf(ta), proto); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-use-default-proto-if-custom-proto-is-not-object.js deleted file mode 100644 index e5fc367c0..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/length-arg/length-arg-use-default-proto-if-custom-proto-is-not-object.js +++ /dev/null @@ -1,43 +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. -/*--- -esid: sec-typedarray-length -description: > - Use prototype from %TypedArray% if newTarget's prototype is not an Object -info: | - 22.2.4.2 TypedArray ( length ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is not Object. - - ... - 8. Return ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%, elementLength). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 10. Set the [[Prototype]] internal slot of A to prototype. - ... - 12. Return A. -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -function newTarget() {} -newTarget.prototype = null; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [1], newTarget); - - assert.sameValue(ta.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/new-instance-extensibility.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/new-instance-extensibility.js new file mode 100644 index 000000000..740dff1f3 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/new-instance-extensibility.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + The new typedArray instance from a length argument is extensible +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 8. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, elementLength). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + ... + 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 11. Set the [[Extensible]] internal slot of A to true. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(4); + + assert(Object.isExtensible(sample)); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/proto-from-ctor-realm.js new file mode 100644 index 000000000..7df294357 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/proto-from-ctor-realm.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: Default [[Prototype]] value derived from realm of the newTarget +info: | + [...] + 8. Return ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%", elementLength). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + [...] + + 9.1.14 GetPrototypeFromConstructor + + [...] + 3. Let proto be ? Get(constructor, "prototype"). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Let proto be realm's intrinsic object named intrinsicDefaultProto. + 5. Return proto. +includes: [testBigIntTypedArray.js] +features: [BigInt, cross-realm, Reflect, TypedArray] +---*/ + +var other = $262.createRealm().global; +var C = new other.Function(); +C.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [0], C); + + assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/returns-object.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/returns-object.js new file mode 100644 index 000000000..09aa6d7d6 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/returns-object.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + Return a TypedArray object +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 8. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, elementLength). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + ... + 7. Return obj +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var typedArray = new TA(4); + var length = typedArray.length; + + assert.sameValue(length, 4, "length"); + assert.sameValue(typedArray.constructor, TA); + assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/toindex-length.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/toindex-length.js new file mode 100644 index 000000000..22c1bba4d --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/toindex-length.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + ToIndex(length) operations +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 3. Let elementLength be ? ToIndex(length). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var items = [ + [-0, 0, "-0"], + ["", 0, "the Empty string"], + ["0", 0, "string '0'"], + ["1", 1, "string '1'"], + [true, 1, "true"], + [false, 0, "false"], + [NaN, 0, "NaN"], + [null, 0, "null"], + [undefined, 0, "undefined"], + [0.1, 0, "0.1"], + [0.9, 0, "0.9"], + [1.1, 1, "1.1"], + [1.9, 1, "1.9"], + [-0.1, 0, "-0.1"], + [-0.99999, 0, "-0.99999"] +]; + +testWithTypedArrayConstructors(function(TA) { + items.forEach(function(item) { + var len = item[0]; + var expected = item[1]; + var name = item[2]; + + var typedArray = new TA(len); + assert.sameValue(typedArray.length, expected, name + " length"); + assert.sameValue(typedArray.constructor, TA, name + " constructor"); + assert.sameValue( + Object.getPrototypeOf(typedArray), + TA.prototype, + name + " prototype" + ); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/undefined-newtarget-throws.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/undefined-newtarget-throws.js new file mode 100644 index 000000000..347b0deb8 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/undefined-newtarget-throws.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + Throws a TypeError if NewTarget is undefined. +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 2. If NewTarget is undefined, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + TA(0); + }); + + assert.throws(TypeError, function() { + TA(Infinity); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/use-custom-proto-if-object.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/use-custom-proto-if-object.js new file mode 100644 index 000000000..338672559 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/use-custom-proto-if-object.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + Use prototype from new target if it's an Object +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 8. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, elementLength). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +function newTarget() {} +var proto = {}; +newTarget.prototype = proto; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [1], newTarget); + + assert.sameValue(ta.constructor, Object); + assert.sameValue(Object.getPrototypeOf(ta), proto); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/use-default-proto-if-custom-proto-is-not-object.js new file mode 100644 index 000000000..b5651d31f --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/use-default-proto-if-custom-proto-is-not-object.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + Use prototype from %TypedArray% if newTarget's prototype is not an Object +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 8. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, elementLength). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +function newTarget() {} +newTarget.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [1], newTarget); + + assert.sameValue(ta.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/no-args/custom-proto-access-throws.js b/test/built-ins/TypedArrays/ctors-bigint/no-args/custom-proto-access-throws.js new file mode 100644 index 000000000..20325c97c --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/no-args/custom-proto-access-throws.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray +description: > + Return abrupt completion getting newTarget's prototype +info: | + 22.2.4.1 TypedArray( ) + + This description applies only if the TypedArray function is called with no + arguments. + + ... + 3. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, 0). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + ... + + 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) + + ... + 3. Let proto be ? Get(constructor, "prototype"). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +var newTarget = function() {}.bind(null); +Object.defineProperty(newTarget, "prototype", { + get() { + throw new Test262Error(); + } +}); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + Reflect.construct(TA, [], newTarget); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/no-args/new-instance-extensibility.js b/test/built-ins/TypedArrays/ctors-bigint/no-args/new-instance-extensibility.js new file mode 100644 index 000000000..6fe9d4757 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/no-args/new-instance-extensibility.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray +description: > + The new typedArray instance is extensible +info: | + 22.2.4.1 TypedArray( ) + + This description applies only if the TypedArray function is called with no + arguments. + + ... + 3. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, 0). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + ... + 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 11. Set the [[Extensible]] internal slot of A to true. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(); + + assert(Object.isExtensible(sample)); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-custom-proto-access-throws.js b/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-custom-proto-access-throws.js deleted file mode 100644 index 6b383e32e..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-custom-proto-access-throws.js +++ /dev/null @@ -1,43 +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. -/*--- -esid: sec-typedarray -description: > - Return abrupt completion getting newTarget's prototype -info: | - 22.2.4.1 TypedArray( ) - - This description applies only if the TypedArray function is called with no - arguments. - - ... - 3. Return ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%, 0). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - ... - - 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) - - ... - 3. Let proto be ? Get(constructor, "prototype"). - ... -includes: [testTypedArray.js] -features: [Reflect, TypedArray] ----*/ - -var newTarget = function() {}.bind(null); -Object.defineProperty(newTarget, "prototype", { - get() { - throw new Test262Error(); - } -}); - -testWithTypedArrayConstructors(function(TA) { - assert.throws(Test262Error, function() { - Reflect.construct(TA, [], newTarget); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-new-instance-extensibility.js b/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-new-instance-extensibility.js deleted file mode 100644 index cced58d2e..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-new-instance-extensibility.js +++ /dev/null @@ -1,38 +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. -/*--- -esid: sec-typedarray -description: > - The new typedArray instance is extensible -info: | - 22.2.4.1 TypedArray( ) - - This description applies only if the TypedArray function is called with no - arguments. - - ... - 3. Return ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%, 0). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - ... - 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 11. Set the [[Extensible]] internal slot of A to true. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var sample = new TA(); - - assert(Object.isExtensible(sample)); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-proto-from-ctor-realm.js deleted file mode 100644 index c69922185..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-proto-from-ctor-realm.js +++ /dev/null @@ -1,36 +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. -/*--- -esid: sec-typedarray -description: Default [[Prototype]] value derived from realm of the newTarget -info: | - [...] - 3. Return ? AllocateTypedArray(constructorName, NewTarget, - "%TypedArrayPrototype%", 0). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - [...] - - 9.1.14 GetPrototypeFromConstructor - - [...] - 3. Let proto be ? Get(constructor, "prototype"). - 4. If Type(proto) is not Object, then - a. Let realm be ? GetFunctionRealm(constructor). - b. Let proto be realm's intrinsic object named intrinsicDefaultProto. - 5. Return proto. -includes: [testTypedArray.js] -features: [cross-realm, Reflect, TypedArray] ----*/ - -var other = $262.createRealm().global; -var C = new other.Function(); -C.prototype = null; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [], C); - - assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-returns-object.js b/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-returns-object.js deleted file mode 100644 index c7274e5f9..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-returns-object.js +++ /dev/null @@ -1,32 +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. -/*--- -esid: sec-typedarray -description: > - Return a TypedArray object -info: | - 22.2.4.1 TypedArray( ) - - This description applies only if the TypedArray function is called with no - arguments. - - ... - 3. Return ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%, 0). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - ... - 7. Return obj -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - var typedArray = new TA(); - - assert.sameValue(typedArray.length, 0); - assert.sameValue(typedArray.constructor, TA); - assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-undefined-newtarget-throws.js b/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-undefined-newtarget-throws.js deleted file mode 100644 index a06139865..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-undefined-newtarget-throws.js +++ /dev/null @@ -1,23 +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. -/*--- -esid: sec-typedarray -description: > - Throws a TypeError if NewTarget is undefined. -info: | - 22.2.4.1 TypedArray( ) - - This description applies only if the TypedArray function is called with no - arguments. - - 1. If NewTarget is undefined, throw a TypeError exception. - ... -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -testWithTypedArrayConstructors(function(TA) { - assert.throws(TypeError, function() { - TA(); - }); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-use-custom-proto-if-object.js b/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-use-custom-proto-if-object.js deleted file mode 100644 index 4266724f0..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-use-custom-proto-if-object.js +++ /dev/null @@ -1,44 +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. -/*--- -esid: sec-typedarray -description: > - Use prototype from new target if it's an Object -info: | - 22.2.4.1 TypedArray( ) - - This description applies only if the TypedArray function is called with no - arguments. - - ... - 3. Return ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%, 0). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 10. Set the [[Prototype]] internal slot of A to prototype. - ... - 12. Return A. -includes: [testTypedArray.js] -features: [Reflect, TypedArray] ----*/ - -function newTarget() {} -var proto = {}; -newTarget.prototype = proto; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [], newTarget); - - assert.sameValue(ta.constructor, Object); - assert.sameValue(Object.getPrototypeOf(ta), proto); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-use-default-proto-if-custom-proto-is-not-object.js deleted file mode 100644 index e76ef585e..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/no-args/no-args-use-default-proto-if-custom-proto-is-not-object.js +++ /dev/null @@ -1,43 +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. -/*--- -esid: sec-typedarray -description: > - Use prototype from %TypedArray% if newTarget's prototype is not an Object -info: | - 22.2.4.1 TypedArray( ) - - This description applies only if the TypedArray function is called with no - arguments. - - ... - 3. Return ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%, 0). - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 10. Set the [[Prototype]] internal slot of A to prototype. - ... - 12. Return A. -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -function newTarget() {} -newTarget.prototype = null; - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [], newTarget); - - assert.sameValue(ta.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); -}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/no-args/proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors-bigint/no-args/proto-from-ctor-realm.js new file mode 100644 index 000000000..80460f1d4 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/no-args/proto-from-ctor-realm.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray +description: Default [[Prototype]] value derived from realm of the newTarget +info: | + [...] + 3. Return ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%", 0). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + [...] + + 9.1.14 GetPrototypeFromConstructor + + [...] + 3. Let proto be ? Get(constructor, "prototype"). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Let proto be realm's intrinsic object named intrinsicDefaultProto. + 5. Return proto. +includes: [testBigIntTypedArray.js] +features: [BigInt, cross-realm, Reflect, TypedArray] +---*/ + +var other = $262.createRealm().global; +var C = new other.Function(); +C.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [], C); + + assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/no-args/returns-object.js b/test/built-ins/TypedArrays/ctors-bigint/no-args/returns-object.js new file mode 100644 index 000000000..4751a27b1 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/no-args/returns-object.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray +description: > + Return a TypedArray object +info: | + 22.2.4.1 TypedArray( ) + + This description applies only if the TypedArray function is called with no + arguments. + + ... + 3. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, 0). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + ... + 7. Return obj +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var typedArray = new TA(); + + assert.sameValue(typedArray.length, 0); + assert.sameValue(typedArray.constructor, TA); + assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/no-args/undefined-newtarget-throws.js b/test/built-ins/TypedArrays/ctors-bigint/no-args/undefined-newtarget-throws.js new file mode 100644 index 000000000..c26e881c8 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/no-args/undefined-newtarget-throws.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray +description: > + Throws a TypeError if NewTarget is undefined. +info: | + 22.2.4.1 TypedArray( ) + + This description applies only if the TypedArray function is called with no + arguments. + + 1. If NewTarget is undefined, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + TA(); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/no-args/use-custom-proto-if-object.js b/test/built-ins/TypedArrays/ctors-bigint/no-args/use-custom-proto-if-object.js new file mode 100644 index 000000000..9d44c6125 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/no-args/use-custom-proto-if-object.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray +description: > + Use prototype from new target if it's an Object +info: | + 22.2.4.1 TypedArray( ) + + This description applies only if the TypedArray function is called with no + arguments. + + ... + 3. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, 0). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +function newTarget() {} +var proto = {}; +newTarget.prototype = proto; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [], newTarget); + + assert.sameValue(ta.constructor, Object); + assert.sameValue(Object.getPrototypeOf(ta), proto); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/no-args/use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/ctors-bigint/no-args/use-default-proto-if-custom-proto-is-not-object.js new file mode 100644 index 000000000..339a4a757 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors-bigint/no-args/use-default-proto-if-custom-proto-is-not-object.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray +description: > + Use prototype from %TypedArray% if newTarget's prototype is not an Object +info: | + 22.2.4.1 TypedArray( ) + + This description applies only if the TypedArray function is called with no + arguments. + + ... + 3. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, 0). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +function newTarget() {} +newTarget.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [], newTarget); + + assert.sameValue(ta.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-array-returns.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-array-returns.js index 6e15b4ea4..84ada078a 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-array-returns.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-array-returns.js @@ -12,17 +12,17 @@ info: | object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] internal slot. -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var obj = [7, 42]; -testWithTypedArrayConstructors(function(TA, N) { - var typedArray = new TA(N(obj)); +testWithTypedArrayConstructors(function(TA) { + var typedArray = new TA(convertToBigInt(obj)); assert.sameValue(typedArray.length, 2); - assert.sameValue(typedArray[0], N(7)); - assert.sameValue(typedArray[1], N(42)); + assert.sameValue(typedArray[0], convertToBigInt(7)); + assert.sameValue(typedArray[1], convertToBigInt(42)); assert.sameValue(typedArray.constructor, TA); assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); }); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-generator-iterable-returns.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-generator-iterable-returns.js index 7e2876294..db9597546 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-generator-iterable-returns.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-generator-iterable-returns.js @@ -12,19 +12,19 @@ info: | object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] internal slot. -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var obj = (function *() { - yield N(7); yield N(42); + yield convertToBigInt(7); yield convertToBigInt(42); })(); var typedArray = new TA(obj); assert.sameValue(typedArray.length, 2); - assert.sameValue(typedArray[0], N(7)); - assert.sameValue(typedArray[1], N(42)); + assert.sameValue(typedArray[0], convertToBigInt(7)); + assert.sameValue(typedArray[1], convertToBigInt(42)); assert.sameValue(typedArray.constructor, TA); assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); }); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation-consistent-nan.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation-consistent-nan.js index a81d4c504..c3adc0642 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation-consistent-nan.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation-consistent-nan.js @@ -45,7 +45,7 @@ info: | encoding. An implementation must always choose the same encoding for each implementation distinguishable NaN value. ... -includes: [nans.js, testTypedArray.js, compareArray.js] +includes: [nans.js, testBigIntTypedArray.js, compareArray.js] ---*/ function body(FloatArray) { diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation.js index d14a14023..472cdccc0 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation.js @@ -42,7 +42,7 @@ info: | ... e. Else, ... -includes: [byteConversionValues.js, testTypedArray.js] +includes: [byteConversionValues.js, testBigIntTypedArray.js] ---*/ testTypedArrayConversions(byteConversionValues, function(TA, value, expected) { diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-custom-proto-access-throws.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-custom-proto-access-throws.js index f5ced4ea4..750e65dab 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-custom-proto-access-throws.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-custom-proto-access-throws.js @@ -28,8 +28,8 @@ info: | ... 3. Let proto be ? Get(constructor, "prototype"). ... -includes: [testTypedArray.js] -features: [Reflect, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] ---*/ var newTarget = function() {}.bind(null); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterating-throws.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterating-throws.js index 41fc55509..0575a9901 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterating-throws.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterating-throws.js @@ -15,8 +15,8 @@ info: | ... 4. Let arrayLike be ? IterableToArrayLike(object). ... -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterator-not-callable-throws.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterator-not-callable-throws.js index ad6db0877..f51d37e49 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterator-not-callable-throws.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterator-not-callable-throws.js @@ -15,8 +15,8 @@ info: | ... 4. Let arrayLike be ? IterableToArrayLike(object). ... -includes: [testTypedArray.js] -features: [Symbol.iterator, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.iterator, TypedArray] ---*/ var obj = function () {}; diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterator-throws.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterator-throws.js index 571ad77ad..03e08ee24 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterator-throws.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-iterator-throws.js @@ -15,8 +15,8 @@ info: | ... 4. Let arrayLike be ? IterableToArrayLike(object). ... -includes: [testTypedArray.js] -features: [Symbol.iterator, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.iterator, TypedArray] ---*/ var obj = function () {}; diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-excessive-throws.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-excessive-throws.js index f8279f50a..a0ff4e705 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-excessive-throws.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-excessive-throws.js @@ -15,8 +15,8 @@ info: | ... 6. Perform ? AllocateTypedArrayBuffer(O, len). ... -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var obj = { diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-is-symbol-throws.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-is-symbol-throws.js index b452dea03..53976243e 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-is-symbol-throws.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-is-symbol-throws.js @@ -15,8 +15,8 @@ info: | ... 5. Let len be ? ToLength(? Get(arrayLike, "length")). ... -includes: [testTypedArray.js] -features: [Symbol, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] ---*/ var obj = { diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-throws.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-throws.js index 08f8cd130..d3147dc4c 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-throws.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-length-throws.js @@ -15,8 +15,8 @@ info: | ... 5. Let len be ? ToLength(? Get(arrayLike, "length")). ... -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var obj = {}; diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-new-instance-extensibility.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-new-instance-extensibility.js index bd335774b..9536f2456 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-new-instance-extensibility.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-new-instance-extensibility.js @@ -25,15 +25,15 @@ info: | ... 11. Set the [[Extensible]] internal slot of A to true. ... -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var obj = { - "0": N(0), - "1": N(1), - "2": N(2), + "0": convertToBigInt(0), + "1": convertToBigInt(1), + "2": convertToBigInt(2), length: 3 }; diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-proto-from-ctor-realm.js index a92ceee00..3b3c5cb86 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-proto-from-ctor-realm.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-proto-from-ctor-realm.js @@ -22,8 +22,8 @@ info: | a. Let realm be ? GetFunctionRealm(constructor). b. Let proto be realm's intrinsic object named intrinsicDefaultProto. 5. Return proto. -includes: [testTypedArray.js] -features: [cross-realm, Reflect, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, cross-realm, Reflect, TypedArray] ---*/ var other = $262.createRealm().global; diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-returns.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-returns.js deleted file mode 100644 index cb06ba220..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-returns.js +++ /dev/null @@ -1,47 +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. -/*--- -esid: sec-typedarray-object -description: > - Return typedArray from object argument -info: | - 22.2.4.4 TypedArray ( object ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] - internal slot. - -includes: [testTypedArray.js] -features: [Symbol, TypedArray] ----*/ - -var obj = { - "0": null, - "2": 42, - "3": "7", - "4": NaN, - "5": Symbol("1"), - length: 5 -}; - -testWithTypedArrayConstructors(function(TA) { - var typedArray = new TA(obj); - assert.sameValue(typedArray.length, 5); - assert.sameValue(typedArray[0], 0); - assert.sameValue(typedArray[2], 42); - assert.sameValue(typedArray[3], 7); - assert.sameValue(typedArray[5], undefined); - assert.sameValue(typedArray.constructor, TA); - assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); - - if (TA === Float32Array || TA === Float64Array) { - assert.sameValue(typedArray[1], NaN); - assert.sameValue(typedArray[4], NaN); - } else { - assert.sameValue(typedArray[1], 0); - assert.sameValue(typedArray[4], 0); - } -}, - // Cannot create Big*64Arrays from non-safe integers. - numericTypedArrayConstructors); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-from-property.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-from-property.js index 4a0d60825..41e153911 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-from-property.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-from-property.js @@ -17,8 +17,8 @@ info: | ... b. Let kValue be ? Get(arrayLike, Pk). ... -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var obj = { @@ -31,9 +31,9 @@ Object.defineProperty(obj, "2", { } }); -testWithTypedArrayConstructors(function(TA, N) { - obj[0] = N(0); - obj[1] = N(0); +testWithTypedArrayConstructors(function(TA) { + obj[0] = convertToBigInt(0); + obj[1] = convertToBigInt(0); assert.throws(Test262Error, function() { new TA(obj); }); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive-typeerror.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive-typeerror.js index 3aee05e56..50dd3b1a3 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive-typeerror.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive-typeerror.js @@ -50,11 +50,11 @@ info: | b. If Type(result) is not Object, return result. c. Throw a TypeError exception. ... -includes: [testTypedArray.js] -features: [Symbol.toPrimitive, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.toPrimitive, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample = new Int8Array(1); var toPrimitive = 0; var valueOf = 0; @@ -69,7 +69,7 @@ testWithTypedArrayConstructors(function(TA, N) { }; assert.throws(TypeError, function() { - new TA([N(8), sample]); + new TA([convertToBigInt(8), sample]); }, "abrupt completion from sample @@toPrimitive"); assert.sameValue(toPrimitive, 1, "toPrimitive was called once"); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive.js index 516586863..f468bdea7 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive.js @@ -48,11 +48,11 @@ info: | 5. If exoticToPrim is not undefined, then a. Let result be ? Call(exoticToPrim, input, « hint »). ... -includes: [testTypedArray.js] -features: [Symbol.toPrimitive, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.toPrimitive, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample = new Int8Array(1); var toPrimitive = 0; var valueOf = 0; @@ -67,7 +67,7 @@ testWithTypedArrayConstructors(function(TA, N) { }; assert.throws(Test262Error, function() { - new TA([N(8), sample]); + new TA([convertToBigInt(8), sample]); }, "abrupt completion from sample @@toPrimitive"); assert.sameValue(toPrimitive, 1, "toPrimitive was called once"); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-tostring.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-tostring.js index 3e2d84e75..1b507ccbf 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-tostring.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-tostring.js @@ -60,11 +60,11 @@ info: | b. If IsCallable(method) is true, then i. Let result be ? Call(method, O). ... -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample = new Int8Array(1); var valueOf = 0; var toString = 0; @@ -80,7 +80,7 @@ testWithTypedArrayConstructors(function(TA, N) { }; assert.throws(Test262Error, function() { - new TA([N(8), sample]); + new TA([convertToBigInt(8), sample]); }, "abrupt completion from ToNumber(sample)"); assert.sameValue(valueOf, 1, "valueOf called once"); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof-typeerror.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof-typeerror.js index c58fe2425..aeb3eb632 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof-typeerror.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof-typeerror.js @@ -61,11 +61,11 @@ info: | i. Let result be ? Call(method, O). ii. If Type(result) is not Object, return result. 6. Throw a TypeError exception. -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample = new Int8Array(1); var valueOf = 0; var toString = 0; @@ -81,7 +81,7 @@ testWithTypedArrayConstructors(function(TA, N) { }; assert.throws(TypeError, function() { - new TA([N(8), sample]); + new TA([convertToBigInt(8), sample]); }, "abrupt completion from ToNumber(sample)"); assert.sameValue(valueOf, 1, "valueOf called once"); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof.js index ae4515f34..361426d2c 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof.js @@ -61,11 +61,11 @@ info: | i. Let result be ? Call(method, O). ii. If Type(result) is not Object, return result. 6. Throw a TypeError exception. -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample = new Int8Array(1); var valueOf = 0; @@ -75,7 +75,7 @@ testWithTypedArrayConstructors(function(TA, N) { }; assert.throws(Test262Error, function() { - new TA([N(8), sample]); + new TA([convertToBigInt(8), sample]); }, "abrupt completion from ToNumber(sample)"); assert.sameValue(valueOf, 1, "valueOf called once"); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-property.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-property.js index 489234c90..df7564b9d 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-property.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-property.js @@ -18,8 +18,8 @@ info: | b. Let kValue be ? Get(arrayLike, Pk). c. Perform ? Set(O, Pk, kValue, true). ... -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var obj = { @@ -31,9 +31,9 @@ var obj = { length: 4 }; -testWithTypedArrayConstructors(function(TA, N) { - obj[0] = N(0); - obj[1] = N(0); +testWithTypedArrayConstructors(function(TA) { + obj[0] = convertToBigInt(0); + obj[1] = convertToBigInt(0); assert.throws(Test262Error, function() { new TA(obj); }); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-symbol-property.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-symbol-property.js index 42b4a54b8..64de7b8c6 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-symbol-property.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-symbol-property.js @@ -18,8 +18,8 @@ info: | b. Let kValue be ? Get(arrayLike, Pk). c. Perform ? Set(O, Pk, kValue, true). ... -includes: [testTypedArray.js] -features: [Symbol, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] ---*/ var obj = { diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-undefined-newtarget-throws.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-undefined-newtarget-throws.js index 36f68493a..df5996746 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-undefined-newtarget-throws.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-undefined-newtarget-throws.js @@ -15,8 +15,8 @@ info: | ... 2. If NewTarget is undefined, throw a TypeError exception. ... -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-use-custom-proto-if-object.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-use-custom-proto-if-object.js index bb5754a9c..1d688fac9 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-use-custom-proto-if-object.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-use-custom-proto-if-object.js @@ -31,8 +31,8 @@ info: | 10. Set the [[Prototype]] internal slot of A to prototype. ... 12. Return A. -includes: [testTypedArray.js] -features: [Reflect, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] ---*/ function newTarget() {} diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-use-default-proto-if-custom-proto-is-not-object.js index 6aba187c2..5f8355d12 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-use-default-proto-if-custom-proto-is-not-object.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-use-default-proto-if-custom-proto-is-not-object.js @@ -31,8 +31,8 @@ info: | 10. Set the [[Prototype]] internal slot of A to prototype. ... 12. Return A. -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ function newTarget() {} diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-custom-proto-access-throws.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-custom-proto-access-throws.js index 281d09353..e77230e44 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-custom-proto-access-throws.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-custom-proto-access-throws.js @@ -27,8 +27,8 @@ info: | ... 3. Let proto be ? Get(constructor, "prototype"). ... -includes: [testTypedArray.js] -features: [Reflect, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] ---*/ var newTarget = function() {}.bind(null); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-detached-when-species-retrieved-different-type.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-detached-when-species-retrieved-different-type.js index 8ee2fba54..a3c275ef1 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-detached-when-species-retrieved-different-type.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-detached-when-species-retrieved-different-type.js @@ -26,8 +26,8 @@ info: | 1. Let obj be ? OrdinaryCreateFromConstructor(constructor, "%ArrayBufferPrototype%", « [[ArrayBufferData]], [[ArrayBufferByteLength]] »). ... -includes: [testTypedArray.js, detachArrayBuffer.js] -features: [TypedArray, Symbol.species] +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray, Symbol.species] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-detached-when-species-retrieved-same-type.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-detached-when-species-retrieved-same-type.js index 978f42af6..6a24fae75 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-detached-when-species-retrieved-same-type.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-detached-when-species-retrieved-same-type.js @@ -30,8 +30,8 @@ info: | 1. Let obj be ? OrdinaryCreateFromConstructor(constructor, "%ArrayBufferPrototype%", « [[ArrayBufferData]], [[ArrayBufferByteLength]] »). ... -includes: [testTypedArray.js, detachArrayBuffer.js] -features: [TypedArray, Symbol.species] +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray, Symbol.species] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-new-instance-extensibility.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-new-instance-extensibility.js index d29848bf8..4483d6f3b 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-new-instance-extensibility.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-new-instance-extensibility.js @@ -25,8 +25,8 @@ info: | ... 11. Set the [[Extensible]] internal slot of A to true. ... -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var typedArraySample1 = new Int8Array(); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-access-throws.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-access-throws.js index b8976d696..776a56713 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-access-throws.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-access-throws.js @@ -21,8 +21,8 @@ info: | ... 2. Let C be ? Get(O, "constructor"). ... -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species-proto-from-ctor-realm.js index 03860d1a7..279dbf34b 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species-proto-from-ctor-realm.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species-proto-from-ctor-realm.js @@ -33,8 +33,8 @@ info: | a. Let realm be ? GetFunctionRealm(constructor). b. Let proto be realm's intrinsic object named intrinsicDefaultProto. ... -includes: [testTypedArray.js] -features: [cross-realm, Symbol.species, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, cross-realm, Symbol.species, TypedArray] ---*/ var sample1 = new Int8Array(); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species.js index a510d7806..f31427329 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species.js @@ -25,8 +25,8 @@ info: | 7. If IsConstructor(S) is true, return S. ... -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] ---*/ var sample1 = new Int8Array(); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-not-object-throws.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-not-object-throws.js index cfb79f1a9..d538503a3 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-not-object-throws.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-not-object-throws.js @@ -23,8 +23,8 @@ info: | ... 4. If Type(C) is not Object, throw a TypeError exception. ... -includes: [testTypedArray.js] -features: [Symbol, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] ---*/ var sample1 = new Int8Array(); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-access-throws.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-access-throws.js index 4b0b19aca..0cf6e2965 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-access-throws.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-access-throws.js @@ -21,8 +21,8 @@ info: | ... 5. Let S be ? Get(C, @@species). ... -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] ---*/ var sample1 = new Int8Array(); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-not-ctor-throws.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-not-ctor-throws.js index c485cae13..4419406c6 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-not-ctor-throws.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-not-ctor-throws.js @@ -23,8 +23,8 @@ info: | 6. If S is either undefined or null, return defaultConstructor. 7. If IsConstructor(S) is true, return S. 8. Throw a TypeError exception. -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] ---*/ var sample1 = new Int8Array(); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-null.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-null.js index 96ba9009d..34b3a12df 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-null.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-null.js @@ -22,8 +22,8 @@ info: | 5. Let S be ? Get(C, @@species). 6. If S is either undefined or null, return defaultConstructor. ... -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-prototype-throws.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-prototype-throws.js index 135634646..16bfe8d87 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-prototype-throws.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-prototype-throws.js @@ -31,8 +31,8 @@ info: | 1. Let obj be ? OrdinaryCreateFromConstructor(constructor, "%ArrayBufferPrototype%", « [[ArrayBufferData]], [[ArrayBufferByteLength]] » ) ... -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] ---*/ var sample1 = new Int8Array(); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-undefined.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-undefined.js index 32e78a37d..a6cfd230f 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-undefined.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-undefined.js @@ -22,8 +22,8 @@ info: | 5. Let S be ? Get(C, @@species). 6. If S is either undefined or null, return defaultConstructor. ... -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-returns-new-typedarray.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-returns-new-typedarray.js index 34cb4dee6..abbabc666 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-returns-new-typedarray.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-other-ctor-returns-new-typedarray.js @@ -10,8 +10,8 @@ info: | This description applies only if the TypedArray function is called with at least one argument and the Type of the first argument is Object and that object has a [[TypedArrayName]] internal slot. -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var sample1 = new Int8Array(7); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-proto-from-ctor-realm.js index 6e58746cd..45acca594 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-proto-from-ctor-realm.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-proto-from-ctor-realm.js @@ -22,8 +22,8 @@ info: | a. Let realm be ? GetFunctionRealm(constructor). b. Let proto be realm's intrinsic object named intrinsicDefaultProto. 5. Return proto. -includes: [testTypedArray.js] -features: [cross-realm, Reflect, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, cross-realm, Reflect, TypedArray] ---*/ var other = $262.createRealm().global; diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-returns-new-instance.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-returns-new-instance.js deleted file mode 100644 index 128ec4021..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-returns-new-instance.js +++ /dev/null @@ -1,31 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Return a TypedArray object -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 20. Return O. - -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -var len = 10; -var typedArraySample = new Int8Array(len); - -testWithTypedArrayConstructors(function(TA) { - var typedArray = new TA(typedArraySample); - - assert.notSameValue(typedArray, typedArraySample); - assert.sameValue(typedArray.length, len); - assert.sameValue(typedArray.constructor, TA); - assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); -}, numericTypedArrayConstructors); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-access-throws.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-access-throws.js index f8e75d209..c5d663909 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-access-throws.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-access-throws.js @@ -28,8 +28,8 @@ info: | ... 2. Let C be ? Get(O, "constructor"). ... -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom-proto-from-ctor-realm.js index 43743b956..ae21a381b 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom-proto-from-ctor-realm.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom-proto-from-ctor-realm.js @@ -45,8 +45,8 @@ info: | a. Let realm be ? GetFunctionRealm(constructor). b. Let proto be realm's intrinsic object named intrinsicDefaultProto. ... -includes: [testTypedArray.js] -features: [cross-realm, Symbol.species, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, cross-realm, Symbol.species, TypedArray] ---*/ var other = $262.createRealm().global; diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom.js index 7ed3aca0d..cac5edc53 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom.js @@ -36,8 +36,8 @@ info: | ... 8. Let targetBuffer be ? AllocateArrayBuffer(cloneConstructor, cloneLength). ... -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-not-ctor.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-not-ctor.js index 2072aa96d..f8487280c 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-not-ctor.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-not-ctor.js @@ -30,8 +30,8 @@ info: | 6. If S is either undefined or null, return defaultConstructor. 7. If IsConstructor(S) is true, return S. 8. Throw a TypeError exception. -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-null.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-null.js index e42780610..ff86f04d6 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-null.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-null.js @@ -29,8 +29,8 @@ info: | 5. Let S be ? Get(C, @@species). 6. If S is either undefined or null, return defaultConstructor. ... -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-prototype-throws.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-prototype-throws.js index b171826cf..9de4e9b3b 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-prototype-throws.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-prototype-throws.js @@ -39,8 +39,8 @@ info: | 1. Let obj be ? OrdinaryCreateFromConstructor(constructor, "%ArrayBufferPrototype%", « [[ArrayBufferData]], [[ArrayBufferByteLength]] » ) ... -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-throws.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-throws.js index ec2aaf3c1..36fdbe8da 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-throws.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-throws.js @@ -28,8 +28,8 @@ info: | ... 5. Let S be ? Get(C, @@species). ... -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-undefined.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-undefined.js index 339d3041b..f040fe16e 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-undefined.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-undefined.js @@ -29,8 +29,8 @@ info: | 5. Let S be ? Get(C, @@species). 6. If S is either undefined or null, return defaultConstructor. ... -includes: [testTypedArray.js] -features: [Symbol.species, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.species, TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-value-not-obj-throws.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-value-not-obj-throws.js index ef9709749..758eef5c0 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-value-not-obj-throws.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-value-not-obj-throws.js @@ -30,8 +30,8 @@ info: | ... 4. If Type(C) is not Object, throw a TypeError exception. ... -includes: [testTypedArray.js] -features: [Symbol, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-returns-new-cloned-typedarray.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-returns-new-cloned-typedarray.js index 4d9b442c9..3321aa5b4 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-returns-new-cloned-typedarray.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-same-ctor-returns-new-cloned-typedarray.js @@ -16,8 +16,8 @@ info: | a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). ... 23. Return O. -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-undefined-newtarget-throws.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-undefined-newtarget-throws.js index 12839b2d7..de0e9fdc2 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-undefined-newtarget-throws.js +++ b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-undefined-newtarget-throws.js @@ -14,8 +14,8 @@ info: | ... 2. If NewTarget is undefined, throw a TypeError exception. ... -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-use-custom-proto-if-object.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-use-custom-proto-if-object.js deleted file mode 100644 index 2745fc5e2..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-use-custom-proto-if-object.js +++ /dev/null @@ -1,48 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Use prototype from new target if it's an Object -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 10. Set the [[Prototype]] internal slot of A to prototype. - ... - 12. Return A. -includes: [testTypedArray.js] -features: [Reflect, TypedArray] ----*/ - -function newTarget() {} -var proto = {}; -newTarget.prototype = proto; - -var sample = new Int8Array(8); - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [sample], newTarget); - - assert.sameValue(ta.constructor, Object); - assert.sameValue(Object.getPrototypeOf(ta), proto); -}, numericTypedArrayConstructors); diff --git a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-use-default-proto-if-custom-proto-is-not-object.js deleted file mode 100644 index ec1997e91..000000000 --- a/test/built-ins/TypedArrays/ctors-bigint/typedarray-arg/typedarray-arg-use-default-proto-if-custom-proto-is-not-object.js +++ /dev/null @@ -1,47 +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. -/*--- -esid: sec-typedarray-typedarray -description: > - Use prototype from %TypedArray% if newTarget's prototype is not an Object -info: | - 22.2.4.3 TypedArray ( typedArray ) - - This description applies only if the TypedArray function is called with at - least one argument and the Type of the first argument is Object and that - object has a [[TypedArrayName]] internal slot. - - ... - 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, - %TypedArrayPrototype%). - ... - - 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, - defaultProto [ , length ]) - - 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). - 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], - [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). - ... - - 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) - - ... - 10. Set the [[Prototype]] internal slot of A to prototype. - ... - 12. Return A. -includes: [testTypedArray.js] -features: [TypedArray] ----*/ - -function newTarget() {} -newTarget.prototype = null; - -var sample = new Int8Array(8); - -testWithTypedArrayConstructors(function(TA) { - var ta = Reflect.construct(TA, [sample], newTarget); - - assert.sameValue(ta.constructor, TA); - assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); -}, numericTypedArrayConstructors); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size-sab.js new file mode 100644 index 000000000..707aa00be --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size-sab.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if bufferByteLength modulo elementSize ≠ 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 13. If length is undefined, then + a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(1); + +testWithTypedArrayConstructors(function(TA) { + if (TA.BYTES_PER_ELEMENT === 1) { + // Impossible to trigger this step here. + return; + } + + assert.throws(RangeError, function() { + new TA(buffer); + }); + + assert.throws(RangeError, function() { + new TA(buffer, 0, undefined); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size.js new file mode 100644 index 000000000..a886e5afd --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-bufferbyteoffset-throws-from-modulo-element-size.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if bufferByteLength modulo elementSize ≠ 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 13. If length is undefined, then + a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var buffer = new ArrayBuffer(1); + +testWithTypedArrayConstructors(function(TA) { + if (TA.BYTES_PER_ELEMENT === 1) { + // Impossible to trigger this step here. + return; + } + + assert.throws(RangeError, function() { + new TA(buffer); + }); + + assert.throws(RangeError, function() { + new TA(buffer, 0, undefined); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-negative-throws-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-negative-throws-sab.js new file mode 100644 index 000000000..89f58a1cd --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-negative-throws-sab.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if ToInteger(byteOffset) is < 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToInteger(byteOffset). + 8. If offset < 0, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(RangeError, function() { + new TA(buffer, -1); + }); + assert.throws(RangeError, function() { + new TA(buffer, -Infinity); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-negative-throws.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-negative-throws.js new file mode 100644 index 000000000..058892465 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-negative-throws.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if ToInteger(byteOffset) is < 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToInteger(byteOffset). + 8. If offset < 0, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(RangeError, function() { + new TA(buffer, -1); + }); + assert.throws(RangeError, function() { + new TA(buffer, -Infinity); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-negative-zero-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-negative-zero-sab.js new file mode 100644 index 000000000..1073b5af8 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-negative-zero-sab.js @@ -0,0 +1,23 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + TypedArray's [[ByteOffset]] internal slot is always a positive number, test with negative zero. +info: | + %TypedArray% ( buffer [ , byteOffset [ , length ] ] ) + + ... + 6. Let offset be ? ToInteger(byteOffset). + 7. If offset < 0, throw a RangeError exception. + 8. If offset is -0, let offset be +0. + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TAConstructor) { + var typedArray = new TAConstructor(new SharedArrayBuffer(8), -0); + assert.sameValue(typedArray.byteOffset, +0); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-negative-zero.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-negative-zero.js new file mode 100644 index 000000000..13d0a3e14 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-negative-zero.js @@ -0,0 +1,23 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: pending +description: > + TypedArray's [[ByteOffset]] internal slot is always a positive number, test with negative zero. +info: | + %TypedArray% ( buffer [ , byteOffset [ , length ] ] ) + + ... + 6. Let offset be ? ToInteger(byteOffset). + 7. If offset < 0, throw a RangeError exception. + 8. If offset is -0, let offset be +0. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TAConstructor) { + var typedArray = new TAConstructor(new ArrayBuffer(8), -0); + assert.sameValue(typedArray.byteOffset, +0); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-symbol-throws-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-symbol-throws-sab.js new file mode 100644 index 000000000..b5fc270c9 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-symbol-throws-sab.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return abrupt from parsing integer value from byteOffset as a symbol +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToInteger(byteOffset). + ... +includes: [testTypedArray.js] +features: [Symbol, SharedArrayBuffer, TypedArray] +---*/ + +var byteOffset = Symbol("1"); +var buffer = new SharedArrayBuffer(8); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + new TA(buffer, byteOffset); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-symbol-throws.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-symbol-throws.js new file mode 100644 index 000000000..60039a1f5 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-is-symbol-throws.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return abrupt from parsing integer value from byteOffset as a symbol +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToInteger(byteOffset). + ... +includes: [testTypedArray.js] +features: [Symbol, TypedArray] +---*/ + +var byteOffset = Symbol("1"); +var buffer = new ArrayBuffer(8); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + new TA(buffer, byteOffset); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-throws-from-modulo-element-size-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-throws-from-modulo-element-size-sab.js new file mode 100644 index 000000000..79b398ccf --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-throws-from-modulo-element-size-sab.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if ToInteger(byteOffset) modulo elementSize is not 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 10. If offset modulo elementSize ≠ 0, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); + +testWithTypedArrayConstructors(function(TA) { + if (TA.BYTES_PER_ELEMENT === 1) { + // Impossible to trigger this step here. + return; + } + + assert.throws(RangeError, function() { + new TA(buffer, 7); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-throws-from-modulo-element-size.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-throws-from-modulo-element-size.js new file mode 100644 index 000000000..479f0d5dc --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-throws-from-modulo-element-size.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if ToInteger(byteOffset) modulo elementSize is not 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 10. If offset modulo elementSize ≠ 0, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); + +testWithTypedArrayConstructors(function(TA) { + if (TA.BYTES_PER_ELEMENT === 1) { + // Impossible to trigger this step here. + return; + } + + assert.throws(RangeError, function() { + new TA(buffer, 7); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-to-number-detachbuffer.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-to-number-detachbuffer.js new file mode 100644 index 000000000..b8936e8cd --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-to-number-detachbuffer.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: If TypedArray() is passed a detached buffer, throw +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + ... + 9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testTypedArray.js, detachArrayBuffer.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var offset = TA.BYTES_PER_ELEMENT; + var buffer = new ArrayBuffer(3 * offset); + var byteOffset = { valueOf() { $DETACHBUFFER(buffer); return offset; } }; + assert.throws(TypeError, () => new TA(buffer, byteOffset)); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-to-number-throws-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-to-number-throws-sab.js new file mode 100644 index 000000000..e7b336c5e --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-to-number-throws-sab.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return abrupt from parsing integer value from byteOffset +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToInteger(byteOffset). + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); +var byteOffset = { + valueOf: function() { + throw new Test262Error(); + } +}; + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + new TA(buffer, byteOffset); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-to-number-throws.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-to-number-throws.js new file mode 100644 index 000000000..20cd4b796 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-byteoffset-to-number-throws.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return abrupt from parsing integer value from byteOffset +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToInteger(byteOffset). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); +var byteOffset = { + valueOf: function() { + throw new Test262Error(); + } +}; + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + new TA(buffer, byteOffset); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-custom-proto-access-throws-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-custom-proto-access-throws-sab.js new file mode 100644 index 000000000..b3ff8c56e --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-custom-proto-access-throws-sab.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return abrupt completion getting newTarget's prototype +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + ... + + 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) + + ... + 3. Let proto be ? Get(constructor, "prototype"). + ... +includes: [testTypedArray.js] +features: [Reflect, SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); + +var newTarget = function() {}.bind(null); +Object.defineProperty(newTarget, "prototype", { + get() { + throw new Test262Error(); + } +}); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + Reflect.construct(TA, [buffer], newTarget); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-custom-proto-access-throws.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-custom-proto-access-throws.js new file mode 100644 index 000000000..a1b823317 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-custom-proto-access-throws.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return abrupt completion getting newTarget's prototype +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + ... + + 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) + + ... + 3. Let proto be ? Get(constructor, "prototype"). + ... +includes: [testTypedArray.js] +features: [Reflect, TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); + +var newTarget = function() {}.bind(null); +Object.defineProperty(newTarget, "prototype", { + get() { + throw new Test262Error(); + } +}); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + Reflect.construct(TA, [buffer], newTarget); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-length-and-offset-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-length-and-offset-sab.js new file mode 100644 index 000000000..2107146b1 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-length-and-offset-sab.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from defined length and offset +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var offset = TA.BYTES_PER_ELEMENT; + var buffer = new SharedArrayBuffer(3 * offset); + + var ta1 = new TA(buffer, offset, 2); + assert.sameValue(ta1.length, 2, "ta1.length"); + assert.sameValue(ta1.buffer, buffer, "ta1.buffer"); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var ta2 = new TA(buffer, offset, 0); + assert.sameValue(ta2.length, 0, "ta2.length"); + assert.sameValue(ta2.buffer, buffer, "ta2.buffer"); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-length-and-offset.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-length-and-offset.js new file mode 100644 index 000000000..aefd48b55 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-length-and-offset.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from defined length and offset +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var offset = TA.BYTES_PER_ELEMENT; + var buffer = new ArrayBuffer(3 * offset); + + var ta1 = new TA(buffer, offset, 2); + assert.sameValue(ta1.length, 2, "ta1.length"); + assert.sameValue(ta1.buffer, buffer, "ta1.buffer"); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var ta2 = new TA(buffer, offset, 0); + assert.sameValue(ta2.length, 0, "ta2.length"); + assert.sameValue(ta2.buffer, buffer, "ta2.buffer"); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-length-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-length-sab.js new file mode 100644 index 000000000..a06e530d0 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-length-sab.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from defined length +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var length = 4; + var buffer = new SharedArrayBuffer(bpe * length * 4); + + var ta1 = new TA(buffer, 0, length); + assert.sameValue(ta1.length, length); + assert.sameValue(ta1.buffer, buffer); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var ta2 = new TA(buffer, 0, 0); + assert.sameValue(ta2.length, 0); + assert.sameValue(ta2.buffer, buffer); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-length.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-length.js new file mode 100644 index 000000000..11fb1c4a4 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-length.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from defined length +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var length = 4; + var buffer = new ArrayBuffer(bpe * length * 4); + + var ta1 = new TA(buffer, 0, length); + assert.sameValue(ta1.length, length); + assert.sameValue(ta1.buffer, buffer); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var ta2 = new TA(buffer, 0, 0); + assert.sameValue(ta2.length, 0); + assert.sameValue(ta2.buffer, buffer); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-negative-length-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-negative-length-sab.js new file mode 100644 index 000000000..4d1b1d29c --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-negative-length-sab.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws RangeError for negative ToInteger(length) +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(16); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(RangeError, function() { + new TA(buffer, 0, -1); + }); + + assert.throws(RangeError, function() { + new TA(buffer, 0, -Infinity); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-negative-length.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-negative-length.js new file mode 100644 index 000000000..d57d466d9 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-negative-length.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws RangeError for negative ToInteger(length) +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var buffer = new ArrayBuffer(16); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(RangeError, function() { + new TA(buffer, 0, -1); + }); + + assert.throws(RangeError, function() { + new TA(buffer, 0, -Infinity); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-offset-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-offset-sab.js new file mode 100644 index 000000000..515d822c1 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-offset-sab.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from defined offset +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var buffer = new SharedArrayBuffer(bpe * 4); + + var ta1 = new TA(buffer, bpe * 2); + assert.sameValue(ta1.length, 2); + assert.sameValue(ta1.buffer, buffer); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var ta2 = new TA(buffer, 0); + assert.sameValue(ta2.length, 4); + assert.sameValue(ta2.buffer, buffer); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-offset.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-offset.js new file mode 100644 index 000000000..89e290b52 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-defined-offset.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from defined offset +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var buffer = new ArrayBuffer(bpe * 4); + + var ta1 = new TA(buffer, bpe * 2); + assert.sameValue(ta1.length, 2); + assert.sameValue(ta1.buffer, buffer); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var ta2 = new TA(buffer, 0); + assert.sameValue(ta2.length, 4); + assert.sameValue(ta2.buffer, buffer); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-detachedbuffer.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-detachedbuffer.js new file mode 100644 index 000000000..b015d4c34 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-detachedbuffer.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: If TypedArray() is passed a detached buffer, throw +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + ... + 9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testTypedArray.js, detachArrayBuffer.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var offset = TA.BYTES_PER_ELEMENT; + var buffer = new ArrayBuffer(3 * offset); + $DETACHBUFFER(buffer); + assert.throws(TypeError, () => new TA(buffer)); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-excessive-length-throws-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-excessive-length-throws-sab.js new file mode 100644 index 000000000..2549e93fd --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-excessive-length-throws-sab.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + If offset + newByteLength > bufferByteLength, throw a RangeError exception. +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 14. Else, + a. Let newLength be ? ToLength(length). + b. Let newByteLength be newLength × elementSize. + c. If offset+newByteLength > bufferByteLength, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var buffer = new SharedArrayBuffer(bpe); + + assert.throws(RangeError, function() { + new TA(buffer, 0, bpe * 2); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-excessive-length-throws.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-excessive-length-throws.js new file mode 100644 index 000000000..3ff3a6d61 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-excessive-length-throws.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + If offset + newByteLength > bufferByteLength, throw a RangeError exception. +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 14. Else, + a. Let newLength be ? ToLength(length). + b. Let newByteLength be newLength × elementSize. + c. If offset+newByteLength > bufferByteLength, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var buffer = new ArrayBuffer(bpe); + + assert.throws(RangeError, function() { + new TA(buffer, 0, bpe * 2); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-excessive-offset-throws-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-excessive-offset-throws-sab.js new file mode 100644 index 000000000..62cf41145 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-excessive-offset-throws-sab.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if bufferByteLength - ToInteger(byteOffset) < 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 13. If length is undefined, then + a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception. + b. Let newByteLength be bufferByteLength - offset. + c. If newByteLength < 0, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var buffer = new SharedArrayBuffer(bpe); + + assert.throws(RangeError, function() { + new TA(buffer, bpe * 2); + }); + + assert.throws(RangeError, function() { + new TA(buffer, bpe * 2, undefined); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-excessive-offset-throws.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-excessive-offset-throws.js new file mode 100644 index 000000000..5daf40ce7 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-excessive-offset-throws.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a RangeError if bufferByteLength - ToInteger(byteOffset) < 0 +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 13. If length is undefined, then + a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception. + b. Let newByteLength be bufferByteLength - offset. + c. If newByteLength < 0, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + var buffer = new ArrayBuffer(bpe); + + assert.throws(RangeError, function() { + new TA(buffer, bpe * 2); + }); + + assert.throws(RangeError, function() { + new TA(buffer, bpe * 2, undefined); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-invoked-with-undefined-newtarget-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-invoked-with-undefined-newtarget-sab.js new file mode 100644 index 000000000..24061049a --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-invoked-with-undefined-newtarget-sab.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a TypeError if NewTarget is undefined. +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 2. If NewTarget is undefined, throw a TypeError exception. + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var buffer = new SharedArrayBuffer(4); + assert.throws(TypeError, function() { + TA(buffer); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-invoked-with-undefined-newtarget.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-invoked-with-undefined-newtarget.js new file mode 100644 index 000000000..218b7c2c0 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-invoked-with-undefined-newtarget.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a TypeError if NewTarget is undefined. +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 2. If NewTarget is undefined, throw a TypeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var buffer = new ArrayBuffer(4); + assert.throws(TypeError, function() { + TA(buffer); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-is-referenced-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-is-referenced-sab.js new file mode 100644 index 000000000..44c29229c --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-is-referenced-sab.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Reuse buffer argument instead of making a new clone +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 15. Set O's [[ViewedArrayBuffer]] internal slot to buffer. + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + + var buffer = new SharedArrayBuffer(bpe); + + var ta1 = new TA(buffer); + var ta2 = new TA(buffer); + + assert.sameValue(ta1.buffer, buffer); + assert.sameValue(ta2.buffer, buffer); + assert.sameValue(ta1.buffer, ta2.buffer); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-is-referenced.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-is-referenced.js new file mode 100644 index 000000000..0154deaf4 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-is-referenced.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Reuse buffer argument instead of making a new clone +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 15. Set O's [[ViewedArrayBuffer]] internal slot to buffer. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + + var buffer = new ArrayBuffer(bpe); + + var ta1 = new TA(buffer); + var ta2 = new TA(buffer); + + assert.sameValue(ta1.buffer, buffer); + assert.sameValue(ta2.buffer, buffer); + assert.sameValue(ta1.buffer, ta2.buffer); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-length-access-throws-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-length-access-throws-sab.js new file mode 100644 index 000000000..16872f860 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-length-access-throws-sab.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Returns abrupt from ToLength(length) +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 14. Else, + a. Let newLength be ? ToLength(length). + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); +var len = { + valueOf() { + throw new Test262Error(); + } +}; + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + new TA(buffer, 0, len); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-length-access-throws.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-length-access-throws.js new file mode 100644 index 000000000..ea99b8b40 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-length-access-throws.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Returns abrupt from ToLength(length) +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 14. Else, + a. Let newLength be ? ToLength(length). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); +var len = { + valueOf() { + throw new Test262Error(); + } +}; + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + new TA(buffer, 0, len); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-length-is-symbol-throws-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-length-is-symbol-throws-sab.js new file mode 100644 index 000000000..8b77b806d --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-length-is-symbol-throws-sab.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a TypeError if length is a Symbol +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 14. Else, + a. Let newLength be ? ToLength(length). + ... +includes: [testTypedArray.js] +features: [Symbol, SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); +var s = Symbol("1"); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + new TA(buffer, 0, s); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-length-is-symbol-throws.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-length-is-symbol-throws.js new file mode 100644 index 000000000..db8ac8303 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-length-is-symbol-throws.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Throws a TypeError if length is a Symbol +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 14. Else, + a. Let newLength be ? ToLength(length). + ... +includes: [testTypedArray.js] +features: [Symbol, TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); +var s = Symbol("1"); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + new TA(buffer, 0, s); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-length-to-number-detachbuffer.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-length-to-number-detachbuffer.js new file mode 100644 index 000000000..c8c3eb34b --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-length-to-number-detachbuffer.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: If TypedArray() is passed a detached buffer, throw +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + ... + 9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testTypedArray.js, detachArrayBuffer.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var offset = TA.BYTES_PER_ELEMENT; + var buffer = new ArrayBuffer(3 * offset); + var length = { valueOf() { $DETACHBUFFER(buffer); return 1; } }; + assert.throws(TypeError, () => new TA(buffer, 0, length)); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-new-instance-extensibility-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-new-instance-extensibility-sab.js new file mode 100644 index 000000000..2b765a78f --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-new-instance-extensibility-sab.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + The new typedArray instance from a buffer argument is extensible +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%"). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + ... + 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 11. Set the [[Extensible]] internal slot of A to true. + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var buffer = new SharedArrayBuffer(8); + var sample = new TA(buffer); + + assert(Object.isExtensible(sample)); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-new-instance-extensibility.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-new-instance-extensibility.js new file mode 100644 index 000000000..74336215f --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-new-instance-extensibility.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + The new typedArray instance from a buffer argument is extensible +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%"). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + ... + 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 11. Set the [[Extensible]] internal slot of A to true. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var buffer = new ArrayBuffer(8); + var sample = new TA(buffer); + + assert(Object.isExtensible(sample)); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-proto-from-ctor-realm-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-proto-from-ctor-realm-sab.js new file mode 100644 index 000000000..9cab95b47 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-proto-from-ctor-realm-sab.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: Default [[Prototype]] value derived from realm of the newTarget +info: | + [...] + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%"). + [...] + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + [...] + + 9.1.14 GetPrototypeFromConstructor + + [...] + 3. Let proto be ? Get(constructor, "prototype"). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Let proto be realm's intrinsic object named intrinsicDefaultProto. + 5. Return proto. +includes: [testTypedArray.js] +features: [cross-realm, SharedArrayBuffer, Reflect, TypedArray] +---*/ + +var other = $262.createRealm().global; +var C = new other.Function(); +C.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [new SharedArrayBuffer(8)], C); + + assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-proto-from-ctor-realm.js new file mode 100644 index 000000000..d93538db4 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-proto-from-ctor-realm.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: Default [[Prototype]] value derived from realm of the newTarget +info: | + [...] + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%"). + [...] + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + [...] + + 9.1.14 GetPrototypeFromConstructor + + [...] + 3. Let proto be ? Get(constructor, "prototype"). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Let proto be realm's intrinsic object named intrinsicDefaultProto. + 5. Return proto. +includes: [testTypedArray.js] +features: [cross-realm, Reflect, TypedArray] +---*/ + +var other = $262.createRealm().global; +var C = new other.Function(); +C.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [new ArrayBuffer(8)], C); + + assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-returns-new-instance-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-returns-new-instance-sab.js new file mode 100644 index 000000000..52de96252 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-returns-new-instance-sab.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from undefined offset and length +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + + var buffer1 = new SharedArrayBuffer(bpe * 4); + var ta1 = new TA(buffer1); + assert.sameValue(ta1.length, 4); + assert.sameValue(ta1.buffer, buffer1); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var buffer2 = new SharedArrayBuffer(0); + var ta2 = new TA(buffer2); + assert.sameValue(ta2.length, 0); + assert.sameValue(ta2.buffer, buffer2); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-returns-new-instance.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-returns-new-instance.js new file mode 100644 index 000000000..4723e75f9 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-returns-new-instance.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Return new typedArray from undefined offset and length +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var bpe = TA.BYTES_PER_ELEMENT; + + var buffer1 = new ArrayBuffer(bpe * 4); + var ta1 = new TA(buffer1); + assert.sameValue(ta1.length, 4); + assert.sameValue(ta1.buffer, buffer1); + assert.sameValue(ta1.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype); + + var buffer2 = new ArrayBuffer(0); + var ta2 = new TA(buffer2); + assert.sameValue(ta2.length, 0); + assert.sameValue(ta2.buffer, buffer2); + assert.sameValue(ta2.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-toindex-bytelength-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-toindex-bytelength-sab.js new file mode 100644 index 000000000..5fd87715f --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-toindex-bytelength-sab.js @@ -0,0 +1,73 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + ToIndex(length) operations +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 11. If length is either not present or undefined, then + ... + 12. Else, + a. Let newLength be ? ToIndex(length). + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(16); + +var obj1 = { + valueOf: function() { + return 1; + } +}; + +var obj2 = { + toString: function() { + return 1; + } +}; + +var items = [ + [-0, 0, "-0"], + [obj1, 1, "object's valueOf"], + [obj2, 1, "object's toString"], + ["", 0, "the Empty string"], + ["0", 0, "string '0'"], + ["1", 1, "string '1'"], + [false, 0, "false"], + [true, 1, "true"], + [NaN, 0, "NaN"], + [null, 0, "null"], + [0.1, 0, "0.1"], + [0.9, 0, "0.9"], + [1.1, 1, "1.1"], + [1.9, 1, "1.9"], + [-0.1, 0, "-0.1"], + [-0.99999, 0, "-0.99999"] +]; + +testWithTypedArrayConstructors(function(TA) { + items.forEach(function(item) { + var len = item[0]; + var expected = item[1]; + var name = item[2]; + + var typedArray = new TA(buffer, 0, len); + assert.sameValue(typedArray.length, expected, name + " length"); + assert.sameValue(typedArray.constructor, TA, name + " constructor"); + assert.sameValue( + Object.getPrototypeOf(typedArray), + TA.prototype, + name + " prototype" + ); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-toindex-bytelength.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-toindex-bytelength.js new file mode 100644 index 000000000..ae660b820 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-toindex-bytelength.js @@ -0,0 +1,72 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + ToIndex(length) operations +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 11. If length is either not present or undefined, then + ... + 12. Else, + a. Let newLength be ? ToIndex(length). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var buffer = new ArrayBuffer(16); + +var obj1 = { + valueOf: function() { + return 1; + } +}; + +var obj2 = { + toString: function() { + return 1; + } +}; + +var items = [ + [-0, 0, "-0"], + [obj1, 1, "object's valueOf"], + [obj2, 1, "object's toString"], + ["", 0, "the Empty string"], + ["0", 0, "string '0'"], + ["1", 1, "string '1'"], + [false, 0, "false"], + [true, 1, "true"], + [NaN, 0, "NaN"], + [null, 0, "null"], + [0.1, 0, "0.1"], + [0.9, 0, "0.9"], + [1.1, 1, "1.1"], + [1.9, 1, "1.9"], + [-0.1, 0, "-0.1"], + [-0.99999, 0, "-0.99999"] +]; + +testWithTypedArrayConstructors(function(TA) { + items.forEach(function(item) { + var len = item[0]; + var expected = item[1]; + var name = item[2]; + + var typedArray = new TA(buffer, 0, len); + assert.sameValue(typedArray.length, expected, name + " length"); + assert.sameValue(typedArray.constructor, TA, name + " constructor"); + assert.sameValue( + Object.getPrototypeOf(typedArray), + TA.prototype, + name + " prototype" + ); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-toindex-byteoffset-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-toindex-byteoffset-sab.js new file mode 100644 index 000000000..43ae9f601 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-toindex-byteoffset-sab.js @@ -0,0 +1,87 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + ToIndex(byteOffset) operations +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToIndex(byteOffset). + 8. If offset modulo elementSize ≠ 0, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(16); + +var obj1 = { + valueOf: function() { + return 8; + } +}; + +var obj2 = { + toString: function() { + return 8; + } +}; + +var items = [ + [-0, 0, "-0"], + [obj1, 8, "object's valueOf"], + [obj2, 8, "object's toString"], + ["", 0, "the Empty string"], + ["0", 0, "string '0'"], + ["8", 8, "string '8'"], + [false, 0, "false"], + [NaN, 0, "NaN"], + [null, 0, "null"], + [undefined, 0, "undefined"], + [0.1, 0, "0.1"], + [0.9, 0, "0.9"], + [8.1, 8, "8.1"], + [8.9, 8, "8.9"], + [-0.1, 0, "-0.1"], + [-0.99999, 0, "-0.99999"] +]; + +testWithTypedArrayConstructors(function(TA) { + items.forEach(function(item) { + var offset = item[0]; + var expected = item[1]; + var name = item[2]; + + var typedArray = new TA(buffer, offset); + assert.sameValue(typedArray.byteOffset, expected, name + " byteOffset"); + assert.sameValue(typedArray.constructor, TA, name + " constructor"); + assert.sameValue( + Object.getPrototypeOf(typedArray), + TA.prototype, + name + " prototype" + ); + }); + + // Testing `true`. See step 8 + if (TA.BYTES_PER_ELEMENT === 1) { + var typedArray = new TA(buffer, true); + assert.sameValue(typedArray.byteOffset, 1, "true => 1 byteOffset"); + assert.sameValue(typedArray.constructor, TA, "true => 1 constructor"); + assert.sameValue( + Object.getPrototypeOf(typedArray), + TA.prototype, + "true => 1 prototype" + ); + } else { + assert.throws(RangeError, function() { + new TA(buffer, true); + }, "1 modulo elementSize ≠ 0, throws a RangeError"); + } +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-toindex-byteoffset.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-toindex-byteoffset.js new file mode 100644 index 000000000..35a087aaf --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-toindex-byteoffset.js @@ -0,0 +1,86 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + ToIndex(byteOffset) operations +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 7. Let offset be ? ToIndex(byteOffset). + 8. If offset modulo elementSize ≠ 0, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var buffer = new ArrayBuffer(16); + +var obj1 = { + valueOf: function() { + return 8; + } +}; + +var obj2 = { + toString: function() { + return 8; + } +}; + +var items = [ + [-0, 0, "-0"], + [obj1, 8, "object's valueOf"], + [obj2, 8, "object's toString"], + ["", 0, "the Empty string"], + ["0", 0, "string '0'"], + ["8", 8, "string '8'"], + [false, 0, "false"], + [NaN, 0, "NaN"], + [null, 0, "null"], + [undefined, 0, "undefined"], + [0.1, 0, "0.1"], + [0.9, 0, "0.9"], + [8.1, 8, "8.1"], + [8.9, 8, "8.9"], + [-0.1, 0, "-0.1"], + [-0.99999, 0, "-0.99999"] +]; + +testWithTypedArrayConstructors(function(TA) { + items.forEach(function(item) { + var offset = item[0]; + var expected = item[1]; + var name = item[2]; + + var typedArray = new TA(buffer, offset); + assert.sameValue(typedArray.byteOffset, expected, name + " byteOffset"); + assert.sameValue(typedArray.constructor, TA, name + " constructor"); + assert.sameValue( + Object.getPrototypeOf(typedArray), + TA.prototype, + name + " prototype" + ); + }); + + // Testing `true`. See step 8 + if (TA.BYTES_PER_ELEMENT === 1) { + var typedArray = new TA(buffer, true); + assert.sameValue(typedArray.byteOffset, 1, "true => 1 byteOffset"); + assert.sameValue(typedArray.constructor, TA, "true => 1 constructor"); + assert.sameValue( + Object.getPrototypeOf(typedArray), + TA.prototype, + "true => 1 prototype" + ); + } else { + assert.throws(RangeError, function() { + new TA(buffer, true); + }, "1 modulo elementSize ≠ 0, throws a RangeError"); + } +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-typedarray-backed-by-sharedarraybuffer.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-typedarray-backed-by-sharedarraybuffer.js new file mode 100644 index 000000000..739d1cdd2 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-typedarray-backed-by-sharedarraybuffer.js @@ -0,0 +1,23 @@ +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-typedarray-typedarray +description: > + Passing a SharedArrayBuffer-backed TypedArray to a TypedArray constructor + produces an ArrayBuffer-backed TypedArray. +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +var sab = new SharedArrayBuffer(4); +var int_views = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array]; + +testWithTypedArrayConstructors(function(View1) { + var ta1 = new View1(sab); + testWithTypedArrayConstructors(function(View2) { + var ta2 = new View2(ta1); + assert.sameValue(ta2.buffer.constructor, ArrayBuffer, + "TypedArray of SharedArrayBuffer-backed TypedArray is ArrayBuffer-backed"); + }, int_views); +}, int_views); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-use-custom-proto-if-object-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-use-custom-proto-if-object-sab.js new file mode 100644 index 000000000..c963b6bb1 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-use-custom-proto-if-object-sab.js @@ -0,0 +1,49 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Use prototype from new target if it's an Object +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [SharedArrayBuffer, Reflect, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); + +function newTarget() {} +var proto = {}; +newTarget.prototype = proto; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [buffer], newTarget); + + assert.sameValue(ta.constructor, Object); + assert.sameValue(Object.getPrototypeOf(ta), proto); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-use-custom-proto-if-object.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-use-custom-proto-if-object.js new file mode 100644 index 000000000..9eefdf56d --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-use-custom-proto-if-object.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Use prototype from new target if it's an Object +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [Reflect, TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); + +function newTarget() {} +var proto = {}; +newTarget.prototype = proto; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [buffer], newTarget); + + assert.sameValue(ta.constructor, Object); + assert.sameValue(Object.getPrototypeOf(ta), proto); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object-sab.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object-sab.js new file mode 100644 index 000000000..8c91aa84d --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object-sab.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Use prototype from %TypedArray% if newTarget's prototype is not an Object +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [SharedArrayBuffer, TypedArray] +---*/ + +var buffer = new SharedArrayBuffer(8); + +function newTarget() {} +newTarget.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [buffer], newTarget); + + assert.sameValue(ta.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object.js new file mode 100644 index 000000000..df4909dab --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/buffer-arg/buffer-arg-use-default-proto-if-custom-proto-is-not-object.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-buffer-byteoffset-length +description: > + Use prototype from %TypedArray% if newTarget's prototype is not an Object +info: | + 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has an [[ArrayBufferData]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var buffer = new ArrayBuffer(8); + +function newTarget() {} +newTarget.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [buffer], newTarget); + + assert.sameValue(ta.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/length-arg/length-arg-custom-proto-access-throws.js b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-custom-proto-access-throws.js new file mode 100644 index 000000000..6ad49fdab --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-custom-proto-access-throws.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + Return abrupt completion getting newTarget's prototype +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 8. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, elementLength). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + ... + + 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) + + ... + 3. Let proto be ? Get(constructor, "prototype"). + ... +includes: [testTypedArray.js] +features: [Reflect, TypedArray] +---*/ + +var newTarget = function() {}.bind(null); +Object.defineProperty(newTarget, "prototype", { + get() { + throw new Test262Error(); + } +}); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + Reflect.construct(TA, [1], newTarget); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/length-arg/length-arg-init-zeros.js b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-init-zeros.js new file mode 100644 index 000000000..b36131709 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-init-zeros.js @@ -0,0 +1,55 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: All bytes are initialized to zero +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 8. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, elementLength). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 5. If length was not passed, then + ... + 6. Else, + a. Perform ? AllocateTypedArrayBuffer(obj, length). + + 22.2.4.2.2 Runtime Semantics: AllocateTypedArrayBuffer + + 7. Let data be ? AllocateArrayBuffer(%ArrayBuffer%, byteLength). + + 24.1.1.1 AllocateArrayBuffer + + 3. Let block be ? CreateByteDataBlock(byteLength). + + 6.2.6.1 CreateByteDataBlock + + 1. Assert: size≥0. + 2. Let db be a new Data Block value consisting of size bytes. If it is + impossible to create such a Data Block, throw a RangeError exception. + 3. Set all of the bytes of db to 0. + 4. Return db. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var subject = new TA(9); + + assert.sameValue(subject[0], 0, 'index 0'); + assert.sameValue(subject[1], 0, 'index 1'); + assert.sameValue(subject[2], 0, 'index 2'); + assert.sameValue(subject[3], 0, 'index 3'); + assert.sameValue(subject[4], 0, 'index 4'); + assert.sameValue(subject[5], 0, 'index 5'); + assert.sameValue(subject[6], 0, 'index 6'); + assert.sameValue(subject[7], 0, 'index 7'); + assert.sameValue(subject[8], 0, 'index 8'); +}); diff --git a/test/built-ins/TypedArrays/ctors/length-arg/length-arg-is-infinity-throws-rangeerror.js b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-is-infinity-throws-rangeerror.js new file mode 100644 index 000000000..0084d5d6a --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-is-infinity-throws-rangeerror.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + Throws a RangeError if length is a Infinity value +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 4. Let numberLength be ? ToNumber(length). + 5. Let elementLength be ToLength(numberLength). + 6. If SameValueZero(numberLength, elementLength) is false, throw a RangeError + exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.throws(RangeError, function() { + new TA(Infinity); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/length-arg/length-arg-is-negative-integer-throws-rangeerror.js b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-is-negative-integer-throws-rangeerror.js new file mode 100644 index 000000000..0ff5d5a3f --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-is-negative-integer-throws-rangeerror.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + Throws a RangeError if ToInteger(length) is a negative value +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 3. Let elementLength be ? ToIndex(length). + ... + + 7.1.17 ToIndex ( value ) + + 1. If value is undefined, then + ... + 2. Else, + a. Let integerIndex be ? ToInteger(value). + b. If integerIndex < 0, throw a RangeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.throws(RangeError, function() { + new TA(-1); + }); + + assert.throws(RangeError, function() { + new TA(-Infinity); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/length-arg/length-arg-is-symbol-throws.js b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-is-symbol-throws.js new file mode 100644 index 000000000..797dd4922 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-is-symbol-throws.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + If length is a Symbol, throw a TypeError exception. +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 4. Let numberLength be ? ToNumber(length). + ... +includes: [testTypedArray.js] +features: [Symbol, TypedArray] +---*/ + +var s = Symbol('1'); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + new TA(s); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/length-arg/length-arg-new-instance-extensibility.js b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-new-instance-extensibility.js new file mode 100644 index 000000000..d9b03deca --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-new-instance-extensibility.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + The new typedArray instance from a length argument is extensible +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 8. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, elementLength). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + ... + 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 11. Set the [[Extensible]] internal slot of A to true. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(4); + + assert(Object.isExtensible(sample)); +}); diff --git a/test/built-ins/TypedArrays/ctors/length-arg/length-arg-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-proto-from-ctor-realm.js new file mode 100644 index 000000000..77cef2616 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-proto-from-ctor-realm.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: Default [[Prototype]] value derived from realm of the newTarget +info: | + [...] + 8. Return ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%", elementLength). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + [...] + + 9.1.14 GetPrototypeFromConstructor + + [...] + 3. Let proto be ? Get(constructor, "prototype"). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Let proto be realm's intrinsic object named intrinsicDefaultProto. + 5. Return proto. +includes: [testTypedArray.js] +features: [cross-realm, Reflect, TypedArray] +---*/ + +var other = $262.createRealm().global; +var C = new other.Function(); +C.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [0], C); + + assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/length-arg/length-arg-returns-object.js b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-returns-object.js new file mode 100644 index 000000000..8a9121d88 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-returns-object.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + Return a TypedArray object +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 8. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, elementLength). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + ... + 7. Return obj +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var typedArray = new TA(4); + var length = typedArray.length; + + assert.sameValue(length, 4, "length"); + assert.sameValue(typedArray.constructor, TA); + assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/length-arg/length-arg-toindex-length.js b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-toindex-length.js new file mode 100644 index 000000000..4d16ff711 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-toindex-length.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + ToIndex(length) operations +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 3. Let elementLength be ? ToIndex(length). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var items = [ + [-0, 0, "-0"], + ["", 0, "the Empty string"], + ["0", 0, "string '0'"], + ["1", 1, "string '1'"], + [true, 1, "true"], + [false, 0, "false"], + [NaN, 0, "NaN"], + [null, 0, "null"], + [undefined, 0, "undefined"], + [0.1, 0, "0.1"], + [0.9, 0, "0.9"], + [1.1, 1, "1.1"], + [1.9, 1, "1.9"], + [-0.1, 0, "-0.1"], + [-0.99999, 0, "-0.99999"] +]; + +testWithTypedArrayConstructors(function(TA) { + items.forEach(function(item) { + var len = item[0]; + var expected = item[1]; + var name = item[2]; + + var typedArray = new TA(len); + assert.sameValue(typedArray.length, expected, name + " length"); + assert.sameValue(typedArray.constructor, TA, name + " constructor"); + assert.sameValue( + Object.getPrototypeOf(typedArray), + TA.prototype, + name + " prototype" + ); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/length-arg/length-arg-undefined-newtarget-throws.js b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-undefined-newtarget-throws.js new file mode 100644 index 000000000..6a238255e --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-undefined-newtarget-throws.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + Throws a TypeError if NewTarget is undefined. +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 2. If NewTarget is undefined, throw a TypeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + TA(0); + }); + + assert.throws(TypeError, function() { + TA(Infinity); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/length-arg/length-arg-use-custom-proto-if-object.js b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-use-custom-proto-if-object.js new file mode 100644 index 000000000..b36ff7014 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-use-custom-proto-if-object.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + Use prototype from new target if it's an Object +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 8. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, elementLength). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [Reflect, TypedArray] +---*/ + +function newTarget() {} +var proto = {}; +newTarget.prototype = proto; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [1], newTarget); + + assert.sameValue(ta.constructor, Object); + assert.sameValue(Object.getPrototypeOf(ta), proto); +}); diff --git a/test/built-ins/TypedArrays/ctors/length-arg/length-arg-use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-use-default-proto-if-custom-proto-is-not-object.js new file mode 100644 index 000000000..e5fc367c0 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/length-arg/length-arg-use-default-proto-if-custom-proto-is-not-object.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-length +description: > + Use prototype from %TypedArray% if newTarget's prototype is not an Object +info: | + 22.2.4.2 TypedArray ( length ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is not Object. + + ... + 8. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, elementLength). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +function newTarget() {} +newTarget.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [1], newTarget); + + assert.sameValue(ta.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/no-args/no-args-custom-proto-access-throws.js b/test/built-ins/TypedArrays/ctors/no-args/no-args-custom-proto-access-throws.js new file mode 100644 index 000000000..6b383e32e --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/no-args/no-args-custom-proto-access-throws.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray +description: > + Return abrupt completion getting newTarget's prototype +info: | + 22.2.4.1 TypedArray( ) + + This description applies only if the TypedArray function is called with no + arguments. + + ... + 3. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, 0). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + ... + + 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) + + ... + 3. Let proto be ? Get(constructor, "prototype"). + ... +includes: [testTypedArray.js] +features: [Reflect, TypedArray] +---*/ + +var newTarget = function() {}.bind(null); +Object.defineProperty(newTarget, "prototype", { + get() { + throw new Test262Error(); + } +}); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + Reflect.construct(TA, [], newTarget); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/no-args/no-args-new-instance-extensibility.js b/test/built-ins/TypedArrays/ctors/no-args/no-args-new-instance-extensibility.js new file mode 100644 index 000000000..cced58d2e --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/no-args/no-args-new-instance-extensibility.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray +description: > + The new typedArray instance is extensible +info: | + 22.2.4.1 TypedArray( ) + + This description applies only if the TypedArray function is called with no + arguments. + + ... + 3. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, 0). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + ... + 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 11. Set the [[Extensible]] internal slot of A to true. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(); + + assert(Object.isExtensible(sample)); +}); diff --git a/test/built-ins/TypedArrays/ctors/no-args/no-args-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors/no-args/no-args-proto-from-ctor-realm.js new file mode 100644 index 000000000..c69922185 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/no-args/no-args-proto-from-ctor-realm.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray +description: Default [[Prototype]] value derived from realm of the newTarget +info: | + [...] + 3. Return ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%", 0). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + [...] + + 9.1.14 GetPrototypeFromConstructor + + [...] + 3. Let proto be ? Get(constructor, "prototype"). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Let proto be realm's intrinsic object named intrinsicDefaultProto. + 5. Return proto. +includes: [testTypedArray.js] +features: [cross-realm, Reflect, TypedArray] +---*/ + +var other = $262.createRealm().global; +var C = new other.Function(); +C.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [], C); + + assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/no-args/no-args-returns-object.js b/test/built-ins/TypedArrays/ctors/no-args/no-args-returns-object.js new file mode 100644 index 000000000..c7274e5f9 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/no-args/no-args-returns-object.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray +description: > + Return a TypedArray object +info: | + 22.2.4.1 TypedArray( ) + + This description applies only if the TypedArray function is called with no + arguments. + + ... + 3. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, 0). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + ... + 7. Return obj +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var typedArray = new TA(); + + assert.sameValue(typedArray.length, 0); + assert.sameValue(typedArray.constructor, TA); + assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/no-args/no-args-undefined-newtarget-throws.js b/test/built-ins/TypedArrays/ctors/no-args/no-args-undefined-newtarget-throws.js new file mode 100644 index 000000000..a06139865 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/no-args/no-args-undefined-newtarget-throws.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray +description: > + Throws a TypeError if NewTarget is undefined. +info: | + 22.2.4.1 TypedArray( ) + + This description applies only if the TypedArray function is called with no + arguments. + + 1. If NewTarget is undefined, throw a TypeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + TA(); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/no-args/no-args-use-custom-proto-if-object.js b/test/built-ins/TypedArrays/ctors/no-args/no-args-use-custom-proto-if-object.js new file mode 100644 index 000000000..4266724f0 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/no-args/no-args-use-custom-proto-if-object.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray +description: > + Use prototype from new target if it's an Object +info: | + 22.2.4.1 TypedArray( ) + + This description applies only if the TypedArray function is called with no + arguments. + + ... + 3. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, 0). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [Reflect, TypedArray] +---*/ + +function newTarget() {} +var proto = {}; +newTarget.prototype = proto; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [], newTarget); + + assert.sameValue(ta.constructor, Object); + assert.sameValue(Object.getPrototypeOf(ta), proto); +}); diff --git a/test/built-ins/TypedArrays/ctors/no-args/no-args-use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/ctors/no-args/no-args-use-default-proto-if-custom-proto-is-not-object.js new file mode 100644 index 000000000..e76ef585e --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/no-args/no-args-use-default-proto-if-custom-proto-is-not-object.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray +description: > + Use prototype from %TypedArray% if newTarget's prototype is not an Object +info: | + 22.2.4.1 TypedArray( ) + + This description applies only if the TypedArray function is called with no + arguments. + + ... + 3. Return ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%, 0). + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +function newTarget() {} +newTarget.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [], newTarget); + + assert.sameValue(ta.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-as-array-returns.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-as-array-returns.js new file mode 100644 index 000000000..a5e3c3bbc --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-as-array-returns.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return typedArray from array argument +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var obj = [7, 42]; + +testWithTypedArrayConstructors(function(TA) { + var typedArray = new TA(obj); + assert.sameValue(typedArray.length, 2); + assert.sameValue(typedArray[0], 7); + assert.sameValue(typedArray[1], 42); + assert.sameValue(typedArray.constructor, TA); + assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-as-generator-iterable-returns.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-as-generator-iterable-returns.js new file mode 100644 index 000000000..f9af0defe --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-as-generator-iterable-returns.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. +/*--- +esid: sec-typedarray-object +description: > + Return typedArray from iterable argument +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var obj = (function *() { + yield 7; yield 42; + })(); + + var typedArray = new TA(obj); + assert.sameValue(typedArray.length, 2); + assert.sameValue(typedArray[0], 7); + assert.sameValue(typedArray[1], 42); + assert.sameValue(typedArray.constructor, TA); + assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-conversion-operation-consistent-nan.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-conversion-operation-consistent-nan.js new file mode 100644 index 000000000..a81d4c504 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-conversion-operation-consistent-nan.js @@ -0,0 +1,60 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: Consistent canonicalization of NaN values +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 9. Repeat, while k < len + ... + c. Perform ? Set(O, Pk, kValue, true). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). + ... + + 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , + isLittleEndian ] ) + + ... + 8. If type is "Float32", then + a. Set rawBytes to a List containing the 4 bytes that are the result + of converting value to IEEE 754-2008 binary32 format using “Round to + nearest, ties to even” rounding mode. If isLittleEndian is false, the + bytes are arranged in big endian order. Otherwise, the bytes are + arranged in little endian order. If value is NaN, rawValue may be set + to any implementation chosen IEEE 754-2008 binary64 format Not-a-Number + encoding. An implementation must always choose the same encoding for + each implementation distinguishable NaN value. + 9. Else, if type is "Float64", then + a. Set rawBytes to a List containing the 8 bytes that are the IEEE + 754-2008 binary64 format encoding of value. If isLittleEndian is false, + the bytes are arranged in big endian order. Otherwise, the bytes are + arranged in little endian order. If value is NaN, rawValue may be set + to any implementation chosen IEEE 754-2008 binary32 format Not-a-Number + encoding. An implementation must always choose the same encoding for + each implementation distinguishable NaN value. + ... +includes: [nans.js, testTypedArray.js, compareArray.js] +---*/ + +function body(FloatArray) { + var first = new FloatArray(distinctNaNs); + var second = new FloatArray(distinctNaNs); + var firstBytes = new Uint8Array(first.buffer); + var secondBytes = new Uint8Array(second.buffer); + + assert(compareArray(firstBytes, secondBytes)); +} + +testWithTypedArrayConstructors(body, [Float32Array, Float64Array]); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-conversion-operation.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-conversion-operation.js new file mode 100644 index 000000000..d14a14023 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-conversion-operation.js @@ -0,0 +1,52 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-typedarray-object +description: > + Verify conversion values on returned instance +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 9. Repeat, while k < len + ... + c. Perform ? Set(O, Pk, kValue, true). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). + ... + + 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , + isLittleEndian ] ) + + ... + 8. If type is "Float32", then + ... + 9. Else, if type is "Float64", then + ... + 10. Else, + ... + b. Let convOp be the abstract operation named in the Conversion Operation + column in Table 50 for Element Type type. + c. Let intValue be convOp(value). + d. If intValue ≥ 0, then + ... + e. Else, + ... +includes: [byteConversionValues.js, testTypedArray.js] +---*/ + +testTypedArrayConversions(byteConversionValues, function(TA, value, expected) { + var sample = new TA([value]); + + assert.sameValue(sample[0], expected, value + " converts to " + expected); +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-custom-proto-access-throws.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-custom-proto-access-throws.js new file mode 100644 index 000000000..f5ced4ea4 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-custom-proto-access-throws.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt completion getting newTarget's prototype +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 3. Let O be ? AllocateTypedArray(TypedArray.[[TypedArrayConstructorName]], + NewTarget, "%TypedArrayPrototype%"). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + ... + + 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) + + ... + 3. Let proto be ? Get(constructor, "prototype"). + ... +includes: [testTypedArray.js] +features: [Reflect, TypedArray] +---*/ + +var newTarget = function() {}.bind(null); +Object.defineProperty(newTarget, "prototype", { + get() { + throw new Test262Error(); + } +}); + +var o = {}; + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + Reflect.construct(TA, [o], newTarget); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-iterating-throws.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-iterating-throws.js new file mode 100644 index 000000000..41fc55509 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-iterating-throws.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt from iterating object argument +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 4. Let arrayLike be ? IterableToArrayLike(object). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var obj = (function *() { + yield 0; + throw new Test262Error(); + })(); + + assert.throws(Test262Error, function() { + new TA(obj); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-iterator-not-callable-throws.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-iterator-not-callable-throws.js new file mode 100644 index 000000000..ad6db0877 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-iterator-not-callable-throws.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt when object @@iterator is not callable +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 4. Let arrayLike be ? IterableToArrayLike(object). + ... +includes: [testTypedArray.js] +features: [Symbol.iterator, TypedArray] +---*/ + +var obj = function () {}; + +testWithTypedArrayConstructors(function(TA) { + obj[Symbol.iterator] = {}; + assert.throws(TypeError, function() { + new TA(obj); + }); + + obj[Symbol.iterator] = true; + assert.throws(TypeError, function() { + new TA(obj); + }); + + obj[Symbol.iterator] = 42; + assert.throws(TypeError, function() { + new TA(obj); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-iterator-throws.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-iterator-throws.js new file mode 100644 index 000000000..571ad77ad --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-iterator-throws.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt from getting object @@iterator +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 4. Let arrayLike be ? IterableToArrayLike(object). + ... +includes: [testTypedArray.js] +features: [Symbol.iterator, TypedArray] +---*/ + +var obj = function () {}; + +Object.defineProperty(obj, Symbol.iterator, { + get() { + throw new Test262Error(); + } +}); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + new TA(obj); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-length-excessive-throws.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-length-excessive-throws.js new file mode 100644 index 000000000..f8279f50a --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-length-excessive-throws.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. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt from allocating array buffer with excessive length +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 6. Perform ? AllocateTypedArrayBuffer(O, len). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var obj = { + length: Math.pow(2, 53) +}; + +testWithTypedArrayConstructors(function(TA) { + assert.throws(RangeError, function() { + new TA(obj); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-length-is-symbol-throws.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-length-is-symbol-throws.js new file mode 100644 index 000000000..b452dea03 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-length-is-symbol-throws.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. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt from length property as a Symbol on the object argument +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 5. Let len be ? ToLength(? Get(arrayLike, "length")). + ... +includes: [testTypedArray.js] +features: [Symbol, TypedArray] +---*/ + +var obj = { + length: Symbol("1") +}; + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + new TA(obj); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-length-throws.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-length-throws.js new file mode 100644 index 000000000..08f8cd130 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-length-throws.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt from getting length property on the object argument +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 5. Let len be ? ToLength(? Get(arrayLike, "length")). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var obj = {}; + +Object.defineProperty(obj, "length", { + get() { + throw new Test262Error(); + } +}); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + new TA(obj); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-new-instance-extensibility.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-new-instance-extensibility.js new file mode 100644 index 000000000..86a2ac837 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-new-instance-extensibility.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + The new typedArray instance from an object argument is extensible +info: | + 22.2.4.4 TypedArray ( object ) + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%"). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + ... + 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 11. Set the [[Extensible]] internal slot of A to true. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var obj = { + "0": 0, + "1": 1, + "2": 2, + length: 3 +}; + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(obj); + + assert(Object.isExtensible(sample)); +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-proto-from-ctor-realm.js new file mode 100644 index 000000000..a92ceee00 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-proto-from-ctor-realm.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: Default [[Prototype]] value derived from realm of the newTarget +info: | + [...] + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%"). + [...] + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + [...] + + 9.1.14 GetPrototypeFromConstructor + + [...] + 3. Let proto be ? Get(constructor, "prototype"). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Let proto be realm's intrinsic object named intrinsicDefaultProto. + 5. Return proto. +includes: [testTypedArray.js] +features: [cross-realm, Reflect, TypedArray] +---*/ + +var other = $262.createRealm().global; +var C = new other.Function(); +C.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [{}], C); + + assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-returns.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-returns.js new file mode 100644 index 000000000..57eec9720 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-returns.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return typedArray from object argument +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + +includes: [testTypedArray.js] +features: [Symbol, TypedArray] +---*/ + +var obj = { + "0": null, + "2": 42, + "3": "7", + "4": NaN, + "5": Symbol("1"), + length: 5 +}; + +testWithTypedArrayConstructors(function(TA) { + var typedArray = new TA(obj); + assert.sameValue(typedArray.length, 5); + assert.sameValue(typedArray[0], 0); + assert.sameValue(typedArray[2], 42); + assert.sameValue(typedArray[3], 7); + assert.sameValue(typedArray[5], undefined); + assert.sameValue(typedArray.constructor, TA); + assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); + + if (TA === Float32Array || TA === Float64Array) { + assert.sameValue(typedArray[1], NaN); + assert.sameValue(typedArray[4], NaN); + } else { + assert.sameValue(typedArray[1], 0); + assert.sameValue(typedArray[4], 0); + } +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-from-property.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-from-property.js new file mode 100644 index 000000000..f9d384b5c --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-from-property.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt from getting object property +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 8. Repeat, while k < len + ... + b. Let kValue be ? Get(arrayLike, Pk). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var obj = { + length: 4 +}; + +Object.defineProperty(obj, "2", { + get() { + throw new Test262Error(); + } +}); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + new TA(obj); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-obj-to-primitive-typeerror.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-obj-to-primitive-typeerror.js new file mode 100644 index 000000000..215bf75fc --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-obj-to-primitive-typeerror.js @@ -0,0 +1,77 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Throw TypeError from @@toPrimitive returning an Object when setting a property +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 8. Repeat, while k < len + ... + b. Let kValue be ? Get(arrayLike, Pk). + c. Perform ? Set(O, Pk, kValue, true). + ... + + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String and if SameValue(O, Receiver) is true, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 3. Let numValue be ? ToNumber(value). + ... + + 7.1.3 ToNumber ( argument ) + + Object, Apply the following steps: + + 1. Let primValue be ? ToPrimitive(argument, hint Number). + 2. Return ? ToNumber(primValue). + + 7.1.1 ToPrimitive ( input [ , PreferredType ] ) + + ... + 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive). + 5. If exoticToPrim is not undefined, then + a. Let result be ? Call(exoticToPrim, input, « hint »). + b. If Type(result) is not Object, return result. + c. Throw a TypeError exception. + ... +includes: [testTypedArray.js] +features: [Symbol.toPrimitive, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new Int8Array(1); + var toPrimitive = 0; + var valueOf = 0; + + sample[Symbol.toPrimitive] = function() { + toPrimitive++; + return {}; + }; + + sample.valueOf = function() { + valueOf++; + }; + + assert.throws(TypeError, function() { + new TA([8, sample]); + }, "abrupt completion from sample @@toPrimitive"); + + assert.sameValue(toPrimitive, 1, "toPrimitive was called once"); + assert.sameValue(valueOf, 0, "sample.valueOf is not called"); +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-obj-to-primitive.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-obj-to-primitive.js new file mode 100644 index 000000000..7a7170b6f --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-obj-to-primitive.js @@ -0,0 +1,75 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt from @@toPrimitive when setting a property +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 8. Repeat, while k < len + ... + b. Let kValue be ? Get(arrayLike, Pk). + c. Perform ? Set(O, Pk, kValue, true). + ... + + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String and if SameValue(O, Receiver) is true, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 3. Let numValue be ? ToNumber(value). + ... + + 7.1.3 ToNumber ( argument ) + + Object, Apply the following steps: + + 1. Let primValue be ? ToPrimitive(argument, hint Number). + 2. Return ? ToNumber(primValue). + + 7.1.1 ToPrimitive ( input [ , PreferredType ] ) + + ... + 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive). + 5. If exoticToPrim is not undefined, then + a. Let result be ? Call(exoticToPrim, input, « hint »). + ... +includes: [testTypedArray.js] +features: [Symbol.toPrimitive, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new Int8Array(1); + var toPrimitive = 0; + var valueOf = 0; + + sample[Symbol.toPrimitive] = function() { + toPrimitive++; + throw new Test262Error(); + }; + + sample.valueOf = function() { + valueOf++; + }; + + assert.throws(Test262Error, function() { + new TA([8, sample]); + }, "abrupt completion from sample @@toPrimitive"); + + assert.sameValue(toPrimitive, 1, "toPrimitive was called once"); + assert.sameValue(valueOf, 0, "it does not call sample.valueOf"); +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-obj-tostring.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-obj-tostring.js new file mode 100644 index 000000000..482e11595 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-obj-tostring.js @@ -0,0 +1,88 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt from toString() when setting a property +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 8. Repeat, while k < len + ... + b. Let kValue be ? Get(arrayLike, Pk). + c. Perform ? Set(O, Pk, kValue, true). + ... + + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String and if SameValue(O, Receiver) is true, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 3. Let numValue be ? ToNumber(value). + ... + + 7.1.3 ToNumber ( argument ) + + Object, Apply the following steps: + + 1. Let primValue be ? ToPrimitive(argument, hint Number). + 2. Return ? ToNumber(primValue). + + 7.1.1 ToPrimitive ( input [ , PreferredType ] ) + + ... + 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive). + 5. If exoticToPrim is not undefined, then + a. Let result be ? Call(exoticToPrim, input, « hint »). + b. If Type(result) is not Object, return result. + c. Throw a TypeError exception. + ... + 7. Return ? OrdinaryToPrimitive(input, hint). + + OrdinaryToPrimitive + + ... + 5. For each name in methodNames in List order, do + a. Let method be ? Get(O, name). + b. If IsCallable(method) is true, then + i. Let result be ? Call(method, O). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new Int8Array(1); + var valueOf = 0; + var toString = 0; + + sample.valueOf = function() { + valueOf++; + return {}; + }; + + sample.toString = function() { + toString++; + throw new Test262Error(); + }; + + assert.throws(Test262Error, function() { + new TA([8, sample]); + }, "abrupt completion from ToNumber(sample)"); + + assert.sameValue(valueOf, 1, "valueOf called once"); + assert.sameValue(toString, 1, "toString called once"); +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-obj-valueof-typeerror.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-obj-valueof-typeerror.js new file mode 100644 index 000000000..767dd2182 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-obj-valueof-typeerror.js @@ -0,0 +1,89 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Throw TypeError from OrdinaryToPrimitive when setting a property +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 8. Repeat, while k < len + ... + b. Let kValue be ? Get(arrayLike, Pk). + c. Perform ? Set(O, Pk, kValue, true). + ... + + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String and if SameValue(O, Receiver) is true, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 3. Let numValue be ? ToNumber(value). + ... + + 7.1.3 ToNumber ( argument ) + + Object, Apply the following steps: + + 1. Let primValue be ? ToPrimitive(argument, hint Number). + 2. Return ? ToNumber(primValue). + + 7.1.1 ToPrimitive ( input [ , PreferredType ] ) + + ... + 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive). + 5. If exoticToPrim is not undefined, then + a. Let result be ? Call(exoticToPrim, input, « hint »). + b. If Type(result) is not Object, return result. + c. Throw a TypeError exception. + ... + 7. Return ? OrdinaryToPrimitive(input, hint). + + OrdinaryToPrimitive + + ... + 5. For each name in methodNames in List order, do + a. Let method be ? Get(O, name). + b. If IsCallable(method) is true, then + i. Let result be ? Call(method, O). + ii. If Type(result) is not Object, return result. + 6. Throw a TypeError exception. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new Int8Array(1); + var valueOf = 0; + var toString = 0; + + sample.valueOf = function() { + valueOf++; + return {}; + }; + + sample.toString = function() { + toString++; + return {}; + }; + + assert.throws(TypeError, function() { + new TA([8, sample]); + }, "abrupt completion from ToNumber(sample)"); + + assert.sameValue(valueOf, 1, "valueOf called once"); + assert.sameValue(toString, 1, "toString called once"); +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-obj-valueof.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-obj-valueof.js new file mode 100644 index 000000000..f9baf7758 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-obj-valueof.js @@ -0,0 +1,82 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt from valueOf() when setting a property +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 8. Repeat, while k < len + ... + b. Let kValue be ? Get(arrayLike, Pk). + c. Perform ? Set(O, Pk, kValue, true). + ... + + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String and if SameValue(O, Receiver) is true, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 3. Let numValue be ? ToNumber(value). + ... + + 7.1.3 ToNumber ( argument ) + + Object, Apply the following steps: + + 1. Let primValue be ? ToPrimitive(argument, hint Number). + 2. Return ? ToNumber(primValue). + + 7.1.1 ToPrimitive ( input [ , PreferredType ] ) + + ... + 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive). + 5. If exoticToPrim is not undefined, then + a. Let result be ? Call(exoticToPrim, input, « hint »). + b. If Type(result) is not Object, return result. + c. Throw a TypeError exception. + ... + 7. Return ? OrdinaryToPrimitive(input, hint). + + OrdinaryToPrimitive + + ... + 5. For each name in methodNames in List order, do + a. Let method be ? Get(O, name). + b. If IsCallable(method) is true, then + i. Let result be ? Call(method, O). + ii. If Type(result) is not Object, return result. + 6. Throw a TypeError exception. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new Int8Array(1); + var valueOf = 0; + + sample.valueOf = function() { + valueOf++; + throw new Test262Error(); + }; + + assert.throws(Test262Error, function() { + new TA([8, sample]); + }, "abrupt completion from ToNumber(sample)"); + + assert.sameValue(valueOf, 1, "valueOf called once"); +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-property.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-property.js new file mode 100644 index 000000000..93f85dc98 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-property.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt from setting property +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 8. Repeat, while k < len + ... + b. Let kValue be ? Get(arrayLike, Pk). + c. Perform ? Set(O, Pk, kValue, true). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var obj = { + "2": { + valueOf() { + throw new Test262Error(); + } + }, + length: 4 +}; + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + new TA(obj); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-symbol-property.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-symbol-property.js new file mode 100644 index 000000000..42b4a54b8 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-throws-setting-symbol-property.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Return abrupt from setting property +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 8. Repeat, while k < len + ... + b. Let kValue be ? Get(arrayLike, Pk). + c. Perform ? Set(O, Pk, kValue, true). + ... +includes: [testTypedArray.js] +features: [Symbol, TypedArray] +---*/ + +var obj = { + "2": Symbol("1"), + length: 4 +}; + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + new TA(obj); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-undefined-newtarget-throws.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-undefined-newtarget-throws.js new file mode 100644 index 000000000..36f68493a --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-undefined-newtarget-throws.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. +/*--- +esid: sec-typedarray-object +description: > + Throws a TypeError if NewTarget is undefined. +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 2. If NewTarget is undefined, throw a TypeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + TA({}); + }); + + assert.throws(TypeError, function() { + TA([]); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-use-custom-proto-if-object.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-use-custom-proto-if-object.js new file mode 100644 index 000000000..bb5754a9c --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-use-custom-proto-if-object.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Use prototype from new target if it's an Object +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 3. Let O be ? AllocateTypedArray(TypedArray.[[TypedArrayConstructorName]], + NewTarget, "%TypedArrayPrototype%"). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [Reflect, TypedArray] +---*/ + +function newTarget() {} +var proto = {}; +newTarget.prototype = proto; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [], newTarget); + + assert.sameValue(ta.constructor, Object); + assert.sameValue(Object.getPrototypeOf(ta), proto); +}); diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-use-default-proto-if-custom-proto-is-not-object.js new file mode 100644 index 000000000..6aba187c2 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-use-default-proto-if-custom-proto-is-not-object.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-object +description: > + Use prototype from %TypedArray% if newTarget's prototype is not an Object +info: | + 22.2.4.4 TypedArray ( object ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]] + internal slot. + + ... + 3. Let O be ? AllocateTypedArray(TypedArray.[[TypedArrayConstructorName]], + NewTarget, "%TypedArrayPrototype%"). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +function newTarget() {} +newTarget.prototype = null; +var o = []; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [o], newTarget); + + assert.sameValue(ta.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-custom-proto-access-throws.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-custom-proto-access-throws.js new file mode 100644 index 000000000..281d09353 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-custom-proto-access-throws.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt completion getting newTarget's prototype +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + ... + + 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) + + ... + 3. Let proto be ? Get(constructor, "prototype"). + ... +includes: [testTypedArray.js] +features: [Reflect, TypedArray] +---*/ + +var newTarget = function() {}.bind(null); +Object.defineProperty(newTarget, "prototype", { + get() { + throw new Test262Error(); + } +}); + +var sample = new Int8Array(); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + Reflect.construct(TA, [sample], newTarget); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-detached-when-species-retrieved-different-type.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-detached-when-species-retrieved-different-type.js new file mode 100644 index 000000000..8ee2fba54 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-detached-when-species-retrieved-different-type.js @@ -0,0 +1,61 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-typedarray-typedarray +description: > + When a TypedArray is created from another TypedArray with a different element-type + and SpeciesConstructor detaches the source buffer, AllocateArrayBuffer is still + executed. +info: | + 22.2.4.3 TypedArray ( typedArray ) + + ... + 16. If IsSharedArrayBuffer(srcData) is false, then + a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). + ... + 18. If SameValue(elementType, srcType) is true, then + ... + 19. Else, + a. Let data be ? AllocateArrayBuffer(bufferConstructor, byteLength). + b. If IsDetachedBuffer(srcData) is true, throw a TypeError exception. + ... + + 24.1.1.1 AllocateArrayBuffer ( constructor, byteLength ) + + 1. Let obj be ? OrdinaryCreateFromConstructor(constructor, "%ArrayBufferPrototype%", + « [[ArrayBufferData]], [[ArrayBufferByteLength]] »). + ... +includes: [testTypedArray.js, detachArrayBuffer.js] +features: [TypedArray, Symbol.species] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var speciesCallCount = 0; + var bufferConstructor = Object.defineProperty({}, Symbol.species, { + get: function() { + speciesCallCount += 1; + $DETACHBUFFER(ta.buffer); + return speciesConstructor; + } + }); + + var prototypeCallCount = 0; + var speciesConstructor = Object.defineProperty(function(){}.bind(), "prototype", { + get: function() { + prototypeCallCount += 1; + return null; + } + }); + + var ta = new TA(0); + ta.buffer.constructor = bufferConstructor; + + assert.throws(TypeError, function() { + var targetType = TA !== Int32Array ? Int32Array : Uint32Array; + new targetType(ta); + }, "TypeError thrown for detached source buffer"); + + assert.sameValue(speciesCallCount, 1, "@@species getter called once"); + assert.sameValue(prototypeCallCount, 1, "prototype getter called once"); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-detached-when-species-retrieved-same-type.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-detached-when-species-retrieved-same-type.js new file mode 100644 index 000000000..978f42af6 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-detached-when-species-retrieved-same-type.js @@ -0,0 +1,64 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-typedarray-typedarray +description: > + When a TypedArray is created from another TypedArray with the same element-type + and SpeciesConstructor detaches the source buffer, AllocateArrayBuffer is still + executed. +info: | + 22.2.4.3 TypedArray ( typedArray ) + + ... + 16. If IsSharedArrayBuffer(srcData) is false, then + a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). + ... + 18. If SameValue(elementType, srcType) is true, then + a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset, byteLength, bufferConstructor). + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset, srcLength, cloneConstructor ) + + ... + 3. Let targetBuffer be ? AllocateArrayBuffer(cloneConstructor, srcLength). + 4. If IsDetachedBuffer(srcBuffer) is true, throw a TypeError exception. + ... + + 24.1.1.1 AllocateArrayBuffer ( constructor, byteLength ) + + 1. Let obj be ? OrdinaryCreateFromConstructor(constructor, "%ArrayBufferPrototype%", + « [[ArrayBufferData]], [[ArrayBufferByteLength]] »). + ... +includes: [testTypedArray.js, detachArrayBuffer.js] +features: [TypedArray, Symbol.species] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var speciesCallCount = 0; + var bufferConstructor = Object.defineProperty({}, Symbol.species, { + get: function() { + speciesCallCount += 1; + $DETACHBUFFER(ta.buffer); + return speciesConstructor; + } + }); + + var prototypeCallCount = 0; + var speciesConstructor = Object.defineProperty(function(){}.bind(), "prototype", { + get: function() { + prototypeCallCount += 1; + return null; + } + }); + + var ta = new TA(0); + ta.buffer.constructor = bufferConstructor; + + assert.throws(TypeError, function() { + new TA(ta); + }, "TypeError thrown for detached source buffer"); + + assert.sameValue(speciesCallCount, 1, "@@species getter called once"); + assert.sameValue(prototypeCallCount, 1, "prototype getter called once"); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-new-instance-extensibility.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-new-instance-extensibility.js new file mode 100644 index 000000000..d29848bf8 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-new-instance-extensibility.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + The new typedArray instance from a typedArray argument is extensible +info: | + 22.2.4.3 TypedArray ( typedArray ) + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%"). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + ... + 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 11. Set the [[Extensible]] internal slot of A to true. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var typedArraySample1 = new Int8Array(); +var typedArraySample2 = new Int8Array(); +Object.preventExtensions(typedArraySample2); + +testWithTypedArrayConstructors(function(TA) { + var sample1 = new TA(typedArraySample1); + + assert(Object.isExtensible(sample1), "new instance is extensible"); + + var sample2 = new TA(typedArraySample2); + assert( + Object.isExtensible(sample2), + "new instance does not inherit extensibility from typedarray argument" + ); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-access-throws.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-access-throws.js new file mode 100644 index 000000000..b8976d696 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-access-throws.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt completion from getting typedArray argument's buffer.constructor +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 18. Else, + a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 2. Let C be ? Get(O, "constructor"). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var OtherCtor = TA === Int8Array ? Int16Array : Int8Array; + var sample = new OtherCtor(); + + Object.defineProperty(sample.buffer, "constructor", { + get() { + throw new Test262Error(); + } + }); + + assert.throws(Test262Error, function() { + new TA(sample); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species-proto-from-ctor-realm.js new file mode 100644 index 000000000..03860d1a7 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species-proto-from-ctor-realm.js @@ -0,0 +1,59 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Derive the ArrayBuffer prototype from the realm of the species constructor +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 18. Else, + a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). + b. Let data be ? AllocateArrayBuffer(bufferConstructor, byteLength). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + 7. If IsConstructor(S) is true, return S. + ... + + 9.1.14 GetPrototypeFromConstructor + + ... + 3. Let proto be ? Get(constructor, "prototype"). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Let proto be realm's intrinsic object named intrinsicDefaultProto. + ... +includes: [testTypedArray.js] +features: [cross-realm, Symbol.species, TypedArray] +---*/ + +var sample1 = new Int8Array(); +var sample2 = new Int16Array(); +var other = $262.createRealm().global; +var C = new other.Function(); +C.prototype = null; + + +testWithTypedArrayConstructors(function(TA) { + var sample = TA === Int8Array ? sample2 : sample1; + var ctor = {}; + + sample.buffer.constructor = ctor; + + ctor[Symbol.species] = C; + + var typedArray = new TA(sample); + assert.sameValue( + Object.getPrototypeOf(typedArray.buffer), other.ArrayBuffer.prototype + ); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species.js new file mode 100644 index 000000000..a510d7806 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-custom-species.js @@ -0,0 +1,52 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Use default ArrayBuffer constructor on undefined buffer.constructor.@@species +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 18. Else, + a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). + b. Let data be ? AllocateArrayBuffer(bufferConstructor, byteLength). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + 7. If IsConstructor(S) is true, return S. + ... + +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +var sample1 = new Int8Array(); +var sample2 = new Int16Array(); + +testWithTypedArrayConstructors(function(TA) { + var sample = TA === Int8Array ? sample2 : sample1; + var ctor = {}; + var called = 0; + var custom = {}; + + sample.buffer.constructor = ctor; + + ctor[Symbol.species] = function() { + called++; + }; + + ctor[Symbol.species].prototype = custom; + + var typedArray = new TA(sample); + assert.sameValue(Object.getPrototypeOf(typedArray.buffer), custom); + assert.sameValue(called, 0); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-not-object-throws.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-not-object-throws.js new file mode 100644 index 000000000..cfb79f1a9 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-not-object-throws.js @@ -0,0 +1,61 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt completion from typedArray argument's buffer.constructor's value +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 18. Else, + a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 2. Let C be ? Get(O, "constructor"). + ... + 4. If Type(C) is not Object, throw a TypeError exception. + ... +includes: [testTypedArray.js] +features: [Symbol, TypedArray] +---*/ + +var sample1 = new Int8Array(); +var sample2 = new Int16Array(); + +testWithTypedArrayConstructors(function(TA) { + var sample = TA === Int8Array ? sample2 : sample1; + + sample.buffer.constructor = 1; + assert.throws(TypeError, function() { + new TA(sample); + }); + + sample.buffer.constructor = true; + assert.throws(TypeError, function() { + new TA(sample); + }); + + sample.buffer.constructor = ""; + assert.throws(TypeError, function() { + new TA(sample); + }); + + sample.buffer.constructor = null; + assert.throws(TypeError, function() { + new TA(sample); + }); + + var s = Symbol("1"); + sample.buffer.constructor = s; + assert.throws(TypeError, function() { + new TA(sample); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-access-throws.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-access-throws.js new file mode 100644 index 000000000..4b0b19aca --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-access-throws.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt from getting typedArray argument's buffer.constructor.@@species +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 18. Else, + a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + ... +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +var sample1 = new Int8Array(); +var sample2 = new Int16Array(); + +testWithTypedArrayConstructors(function(TA) { + var sample = TA === Int8Array ? sample2 : sample1; + var ctor = {}; + + sample.buffer.constructor = ctor; + Object.defineProperty(ctor, Symbol.species, { + get: function() { + throw new Test262Error(); + } + }); + + assert.throws(Test262Error, function() { + new TA(sample); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-not-ctor-throws.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-not-ctor-throws.js new file mode 100644 index 000000000..c485cae13 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-not-ctor-throws.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt from buffer.constructor.@@species.prototype +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 18. Else, + a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + 7. If IsConstructor(S) is true, return S. + 8. Throw a TypeError exception. +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +var sample1 = new Int8Array(); +var sample2 = new Int16Array(); + +var ctor = function() { + throw new Test262Error(); +}; +var m = { m() {} }.m; +ctor[Symbol.species] = m; + +testWithTypedArrayConstructors(function(TA) { + var sample = TA === Int8Array ? sample2 : sample1; + + sample.buffer.constructor = ctor; + + assert.throws(TypeError, function() { + new TA(sample); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-null.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-null.js new file mode 100644 index 000000000..96ba9009d --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-null.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Use default ArrayBuffer constructor on null buffer.constructor.@@species +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 18. Else, + a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + ... +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var OtherCtor = TA === Int8Array ? Int16Array : Int8Array; + var sample = new OtherCtor(); + var ctor = {}; + + sample.buffer.constructor = ctor; + + ctor[Symbol.species] = null; + var typedArray = new TA(sample); + + assert.sameValue( + Object.getPrototypeOf(typedArray.buffer), + ArrayBuffer.prototype, + "buffer ctor is not called when species is null" + ); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-prototype-throws.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-prototype-throws.js new file mode 100644 index 000000000..135634646 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-prototype-throws.js @@ -0,0 +1,59 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt from buffer.constructor.@@species.prototype +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 18. Else, + a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). + b. Let data be ? AllocateArrayBuffer(bufferConstructor, byteLength). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + 7. If IsConstructor(S) is true, return S. + ... + + 24.1.1.1 AllocateArrayBuffer ( constructor, byteLength ) + + ... + 1. Let obj be ? OrdinaryCreateFromConstructor(constructor, + "%ArrayBufferPrototype%", « [[ArrayBufferData]], [[ArrayBufferByteLength]] » ) + ... +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +var sample1 = new Int8Array(); +var sample2 = new Int16Array(); + +testWithTypedArrayConstructors(function(TA) { + var sample = TA === Int8Array ? sample2 : sample1; + var ctor = {}; + var called = 0; + + sample.buffer.constructor = ctor; + + ctor[Symbol.species] = function() {called++;}.bind(null); + Object.defineProperty(ctor[Symbol.species], "prototype", { + get: function() { + throw new Test262Error(); + } + }); + + assert.throws(Test262Error, function() { + new TA(sample); + }); + assert.sameValue(called, 0); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-undefined.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-undefined.js new file mode 100644 index 000000000..32e78a37d --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-buffer-ctor-species-undefined.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Use default ArrayBuffer constructor on undefined buffer.constructor.@@species +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 18. Else, + a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + ... +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var OtherCtor = TA === Int8Array ? Int16Array : Int8Array; + var sample = new OtherCtor(); + var ctor = {}; + + sample.buffer.constructor = ctor; + + ctor[Symbol.species] = undefined; + var a = new TA(sample); + assert.sameValue( + Object.getPrototypeOf(a.buffer), + ArrayBuffer.prototype, + "buffer ctor is not called when species is undefined" + ); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-returns-new-typedarray.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-returns-new-typedarray.js new file mode 100644 index 000000000..411248ffd --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-other-ctor-returns-new-typedarray.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt from getting typedArray argument's buffer.constructor.@@species +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var sample1 = new Int8Array(7); +var sample2 = new Int16Array(7); + +testWithTypedArrayConstructors(function(TA) { + var sample = TA === Int8Array ? sample2 : sample1; + var typedArray = new TA(sample); + + assert.sameValue(typedArray.length, 7); + assert.notSameValue(typedArray, sample); + assert.sameValue(typedArray.constructor, TA); + assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-proto-from-ctor-realm.js new file mode 100644 index 000000000..6e58746cd --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-proto-from-ctor-realm.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: Default [[Prototype]] value derived from realm of the newTarget +info: | + [...] + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + "%TypedArrayPrototype%"). + [...] + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + [...] + + 9.1.14 GetPrototypeFromConstructor + + [...] + 3. Let proto be ? Get(constructor, "prototype"). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Let proto be realm's intrinsic object named intrinsicDefaultProto. + 5. Return proto. +includes: [testTypedArray.js] +features: [cross-realm, Reflect, TypedArray] +---*/ + +var other = $262.createRealm().global; +var C = new other.Function(); +C.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [new TA()], C); + + assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-returns-new-instance.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-returns-new-instance.js new file mode 100644 index 000000000..357730df5 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-returns-new-instance.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return a TypedArray object +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 20. Return O. + +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +var len = 10; +var typedArraySample = new Int8Array(len); + +testWithTypedArrayConstructors(function(TA) { + var typedArray = new TA(typedArraySample); + + assert.notSameValue(typedArray, typedArraySample); + assert.sameValue(typedArray.length, len); + assert.sameValue(typedArray.constructor, TA); + assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-access-throws.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-access-throws.js new file mode 100644 index 000000000..f8e75d209 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-access-throws.js @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt completion from getting typedArray argument's buffer.constructor +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 17. If SameValue(elementType, srcType) is true, then + a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) + + ... + 2. If cloneConstructor is not present, then + a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 2. Let C be ? Get(O, "constructor"). + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(); + Object.defineProperty(sample.buffer, "constructor", { + get: function() { + throw new Test262Error(); + } + }); + + assert.throws(Test262Error, function() { + new TA(sample); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom-proto-from-ctor-realm.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom-proto-from-ctor-realm.js new file mode 100644 index 000000000..43743b956 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom-proto-from-ctor-realm.js @@ -0,0 +1,68 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Derive the ArrayBuffer prototype from the realm of the species constructor +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 17. If SameValue(elementType, srcType) is true, then + a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) + + ... + 2. If cloneConstructor is not present, then + a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + 7. If IsConstructor(S) is true, return S. + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) + + ... + 8. Let targetBuffer be ? AllocateArrayBuffer(cloneConstructor, cloneLength). + ... + + 9.1.14 GetPrototypeFromConstructor + + ... + 3. Let proto be ? Get(constructor, "prototype"). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Let proto be realm's intrinsic object named intrinsicDefaultProto. + ... +includes: [testTypedArray.js] +features: [cross-realm, Symbol.species, TypedArray] +---*/ + +var other = $262.createRealm().global; +var C = new other.Function(); +C.prototype = null; + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(); + var ctor = {}; + + sample.buffer.constructor = ctor; + + ctor[Symbol.species] = C; + + var typedArray = new TA(sample); + assert.sameValue( + Object.getPrototypeOf(typedArray.buffer), other.ArrayBuffer.prototype + ); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom.js new file mode 100644 index 000000000..7ed3aca0d --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-custom.js @@ -0,0 +1,60 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Use default ArrayBuffer constructor on undefined buffer.constructor.@@species +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 17. If SameValue(elementType, srcType) is true, then + a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) + + ... + 2. If cloneConstructor is not present, then + a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + 7. If IsConstructor(S) is true, return S. + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) + + ... + 8. Let targetBuffer be ? AllocateArrayBuffer(cloneConstructor, cloneLength). + ... +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(); + var ctor = {}; + var called = 0; + var custom = {}; + + sample.buffer.constructor = ctor; + + ctor[Symbol.species] = function() { + called++; + }; + + ctor[Symbol.species].prototype = custom; + + var typedArray = new TA(sample); + assert.sameValue(Object.getPrototypeOf(typedArray.buffer), custom); + assert.sameValue(called, 0); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-not-ctor.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-not-ctor.js new file mode 100644 index 000000000..2072aa96d --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-not-ctor.js @@ -0,0 +1,49 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt from buffer.constructor.@@species.prototype +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 17. If SameValue(elementType, srcType) is true, then + a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) + + ... + 2. If cloneConstructor is not present, then + a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + 7. If IsConstructor(S) is true, return S. + 8. Throw a TypeError exception. +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(); + var ctor = {}; + var m = { m() {} }; + + sample.buffer.constructor = ctor; + + ctor[Symbol.species] = m; + + assert.throws(TypeError, function() { + new TA(sample); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-null.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-null.js new file mode 100644 index 000000000..e42780610 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-null.js @@ -0,0 +1,49 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Use default ArrayBuffer constructor on null buffer.constructor.@@species +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 17. If SameValue(elementType, srcType) is true, then + a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) + + ... + 2. If cloneConstructor is not present, then + a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + ... +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(4); + var ctor = {}; + + sample.buffer.constructor = ctor; + + ctor[Symbol.species] = null; + var typedArray = new TA(sample); + assert.sameValue( + Object.getPrototypeOf(typedArray.buffer), + ArrayBuffer.prototype, + "buffer ctor is not called when species is null" + ); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-prototype-throws.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-prototype-throws.js new file mode 100644 index 000000000..b171826cf --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-prototype-throws.js @@ -0,0 +1,62 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt from buffer.constructor.@@species.prototype +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 17. If SameValue(elementType, srcType) is true, then + a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) + + ... + 2. If cloneConstructor is not present, then + a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). + ... + 8. Let targetBuffer be ? AllocateArrayBuffer(cloneConstructor, cloneLength). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + 7. If IsConstructor(S) is true, return S. + ... + + 24.1.1.1 AllocateArrayBuffer ( constructor, byteLength ) + + ... + 1. Let obj be ? OrdinaryCreateFromConstructor(constructor, + "%ArrayBufferPrototype%", « [[ArrayBufferData]], [[ArrayBufferByteLength]] » ) + ... +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(); + var ctor = {}; + + sample.buffer.constructor = ctor; + + ctor[Symbol.species] = function(){}.bind(null); + Object.defineProperty(ctor[Symbol.species], "prototype", { + get() { + throw new Test262Error(); + } + }); + + assert.throws(Test262Error, function() { + new TA(sample); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-throws.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-throws.js new file mode 100644 index 000000000..ec2aaf3c1 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-throws.js @@ -0,0 +1,49 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt from getting typedArray argument's buffer.constructor.@@species +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 17. If SameValue(elementType, srcType) is true, then + a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) + + ... + 2. If cloneConstructor is not present, then + a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + ... +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(); + var ctor = {}; + + sample.buffer.constructor = ctor; + Object.defineProperty(ctor, Symbol.species, { + get() { + throw new Test262Error(); + } + }); + + assert.throws(Test262Error, function() { + new TA(sample); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-undefined.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-undefined.js new file mode 100644 index 000000000..339d3041b --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-species-undefined.js @@ -0,0 +1,49 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Use default ArrayBuffer constructor on undefined buffer.constructor.@@species +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 17. If SameValue(elementType, srcType) is true, then + a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) + + ... + 2. If cloneConstructor is not present, then + a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 5. Let S be ? Get(C, @@species). + 6. If S is either undefined or null, return defaultConstructor. + ... +includes: [testTypedArray.js] +features: [Symbol.species, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(4); + var ctor = {}; + + sample.buffer.constructor = ctor; + + ctor[Symbol.species] = undefined; + var typedArray = new TA(sample); + assert.sameValue( + Object.getPrototypeOf(typedArray.buffer), + ArrayBuffer.prototype, + "buffer ctor is not called when species is undefined" + ); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-value-not-obj-throws.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-value-not-obj-throws.js new file mode 100644 index 000000000..ef9709749 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-buffer-ctor-value-not-obj-throws.js @@ -0,0 +1,65 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Return abrupt completion from typedArray argument's buffer.constructor's value +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 17. If SameValue(elementType, srcType) is true, then + a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). + ... + + 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] ) + + ... + 2. If cloneConstructor is not present, then + a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%). + ... + + 7.3.20 SpeciesConstructor ( O, defaultConstructor ) + + ... + 2. Let C be ? Get(O, "constructor"). + ... + 4. If Type(C) is not Object, throw a TypeError exception. + ... +includes: [testTypedArray.js] +features: [Symbol, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(); + + sample.buffer.constructor = 1; + assert.throws(TypeError, function() { + new TA(sample); + }); + + sample.buffer.constructor = true; + assert.throws(TypeError, function() { + new TA(sample); + }); + + sample.buffer.constructor = ''; + assert.throws(TypeError, function() { + new TA(sample); + }); + + sample.buffer.constructor = null; + assert.throws(TypeError, function() { + new TA(sample); + }); + + var s = Symbol('1'); + sample.buffer.constructor = s; + assert.throws(TypeError, function() { + new TA(sample); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-returns-new-cloned-typedarray.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-returns-new-cloned-typedarray.js new file mode 100644 index 000000000..4d9b442c9 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-same-ctor-returns-new-cloned-typedarray.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Same typedArray ctor argument returns a new cloned typedArray +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 17. If SameValue(elementType, srcType) is true, then + a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset). + ... + 23. Return O. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(7); + var typedArray = new TA(sample); + + assert.sameValue(typedArray.length, 7); + assert.notSameValue(typedArray, sample); + assert.notSameValue(typedArray.buffer, sample.buffer); + assert.sameValue(typedArray.constructor, TA); + assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-undefined-newtarget-throws.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-undefined-newtarget-throws.js new file mode 100644 index 000000000..12839b2d7 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-undefined-newtarget-throws.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Throws a TypeError if NewTarget is undefined. +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 2. If NewTarget is undefined, throw a TypeError exception. + ... +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var typedArray = new TA(4); + + assert.throws(TypeError, function() { + TA(typedArray); + }); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-use-custom-proto-if-object.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-use-custom-proto-if-object.js new file mode 100644 index 000000000..8af612edc --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-use-custom-proto-if-object.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Use prototype from new target if it's an Object +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [Reflect, TypedArray] +---*/ + +function newTarget() {} +var proto = {}; +newTarget.prototype = proto; + +var sample = new Int8Array(8); + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [sample], newTarget); + + assert.sameValue(ta.constructor, Object); + assert.sameValue(Object.getPrototypeOf(ta), proto); +}); diff --git a/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-use-default-proto-if-custom-proto-is-not-object.js b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-use-default-proto-if-custom-proto-is-not-object.js new file mode 100644 index 000000000..b31bd96e4 --- /dev/null +++ b/test/built-ins/TypedArrays/ctors/typedarray-arg/typedarray-arg-use-default-proto-if-custom-proto-is-not-object.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typedarray-typedarray +description: > + Use prototype from %TypedArray% if newTarget's prototype is not an Object +info: | + 22.2.4.3 TypedArray ( typedArray ) + + This description applies only if the TypedArray function is called with at + least one argument and the Type of the first argument is Object and that + object has a [[TypedArrayName]] internal slot. + + ... + 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, + %TypedArrayPrototype%). + ... + + 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget, + defaultProto [ , length ]) + + 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]], + [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ). + ... + + 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) + + ... + 10. Set the [[Prototype]] internal slot of A to prototype. + ... + 12. Return A. +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +function newTarget() {} +newTarget.prototype = null; + +var sample = new Int8Array(8); + +testWithTypedArrayConstructors(function(TA) { + var ta = Reflect.construct(TA, [sample], newTarget); + + assert.sameValue(ta.constructor, TA); + assert.sameValue(Object.getPrototypeOf(ta), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/arylk-get-length-error.js b/test/built-ins/TypedArrays/from/BigInt/arylk-get-length-error.js new file mode 100644 index 000000000..2a1028aee --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/arylk-get-length-error.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: Returns error produced by accessing array-like's length +info: | + 22.2.2.1 %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] ) + + ... + 7. Let len be ? ToLength(? Get(arrayLike, "length")). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var arrayLike = {}; + +Object.defineProperty(arrayLike, "length", { + get: function() { + throw new Test262Error(); + } +}); + +testWithBigIntTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + TA.from(arrayLike); + }); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/arylk-to-length-error.js b/test/built-ins/TypedArrays/from/BigInt/arylk-to-length-error.js new file mode 100644 index 000000000..d000bac39 --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/arylk-to-length-error.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: Returns error produced by interpreting length property as a length +info: | + 22.2.2.1 %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] ) + + ... + 7. Let len be ? ToLength(? Get(arrayLike, "length")). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var arrayLike = { length: {} }; + +arrayLike.length = { + valueOf: function() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + TA.from(arrayLike); + }); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/custom-ctor-does-not-instantiate-ta-throws.js b/test/built-ins/TypedArrays/from/BigInt/custom-ctor-does-not-instantiate-ta-throws.js new file mode 100644 index 000000000..0571b9ac5 --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/custom-ctor-does-not-instantiate-ta-throws.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: > + Custom constructor needs to instantiate a TypedArray +info: | + 22.2.2.1 %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] ) + + ... + 8. Let targetObj be ? TypedArrayCreate(C, «len»). + ... + + 22.2.4.6 TypedArrayCreate ( constructor, argumentList ) + + 1. Let newTypedArray be ? Construct(constructor, argumentList). + 2. Perform ? ValidateTypedArray(newTypedArray). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var ctor = function() {}; + + assert.throws(TypeError, function() { + TA.from.call(ctor, []); + }); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/custom-ctor-returns-other-instance.js b/test/built-ins/TypedArrays/from/BigInt/custom-ctor-returns-other-instance.js new file mode 100644 index 000000000..14f59cfd4 --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/custom-ctor-returns-other-instance.js @@ -0,0 +1,53 @@ +// 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.2.1 +esid: sec-%typedarray%.from +description: > + Custom constructor can return any TypedArray instance with higher or same + length +info: | + %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] ) + + ... + 7. If usingIterator is not undefined, then + a. Let values be ? IterableToList(source, usingIterator). + b. Let len be the number of elements in values. + c. Let targetObj be ? TypedArrayCreate(C, «len»). + ... + 10. Let len be ? ToLength(? Get(arrayLike, "length")). + 11. Let targetObj be ? TypedArrayCreate(C, « len »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.iterator, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sourceItor = convertToBigInt([1, 2]); + var sourceObj = { + 0: convertToBigInt(0), + 1: convertToBigInt(0), + length: 2 + }; + + var result; + var custom = new TA(2); + var ctor = function() { + return custom; + }; + + result = TypedArray.from.call(ctor, sourceItor); + assert.sameValue(result, custom, "using iterator, same length"); + + result = TypedArray.from.call(ctor, sourceObj); + assert.sameValue(result, custom, "not using iterator, same length"); + + custom = new TA(3); + + result = TypedArray.from.call(ctor, sourceItor); + assert.sameValue(result, custom, "using iterator, higher length"); + + result = TypedArray.from.call(ctor, sourceObj); + assert.sameValue(result, custom, "not using iterator, higher length"); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/custom-ctor-returns-smaller-instance-throws.js b/test/built-ins/TypedArrays/from/BigInt/custom-ctor-returns-smaller-instance-throws.js new file mode 100644 index 000000000..8c2a128d0 --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/custom-ctor-returns-smaller-instance-throws.js @@ -0,0 +1,41 @@ +// 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.2.1 +esid: sec-%typedarray%.from +description: > + Throws a TypeError if a custom `this` returns a smaller instance +info: | + %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] ) + + ... + 7. If usingIterator is not undefined, then + a. Let values be ? IterableToList(source, usingIterator). + b. Let len be the number of elements in values. + c. Let targetObj be ? TypedArrayCreate(C, «len»). + ... + 10. Let len be ? ToLength(? Get(arrayLike, "length")). + 11. Let targetObj be ? TypedArrayCreate(C, « len »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.iterator, TypedArray] +---*/ + +var sourceItor = [1, 2]; +var sourceObj = { + length: 2 +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var ctor = function() { + return new TA(1); + }; + assert.throws(TypeError, function() { + TA.from.call(ctor, sourceItor); + }, "source is using iterator"); + + assert.throws(TypeError, function() { + TA.from.call(ctor, sourceObj); + }, "source is not using iterator"); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/custom-ctor.js b/test/built-ins/TypedArrays/from/BigInt/custom-ctor.js new file mode 100644 index 000000000..1b98c27cf --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/custom-ctor.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: > + Calls and return abrupt completion from custom constructor +info: | + 22.2.2.1 %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] ) + + ... + 8. Let targetObj be ? TypedArrayCreate(C, «len»). + ... + + 22.2.4.6 TypedArrayCreate ( constructor, argumentList ) + + 1. Let newTypedArray be ? Construct(constructor, argumentList). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var called = 0; + var ctor = function() { + called++; + throw new Test262Error(); + }; + + assert.throws(Test262Error, function() { + TA.from.call(ctor, []); + }); + + assert.sameValue(called, 1); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/inherited.js b/test/built-ins/TypedArrays/from/BigInt/inherited.js new file mode 100644 index 000000000..08c921147 --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/inherited.js @@ -0,0 +1,25 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: > + `from` is %TypedArray%.from +info: | + 22.2.1 The %TypedArray% Intrinsic Object + + The %TypedArray% intrinsic object is a constructor function object that all of + the TypedArray constructor object inherit from. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert.sameValue( + TA.from, TypedArray.from, + "method is inherited %TypedArray%.from" + ); + assert.sameValue( + TA.hasOwnProperty("from"), false, + "constructor does not define an own property named 'from'" + ); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/invoked-as-func.js b/test/built-ins/TypedArrays/from/BigInt/invoked-as-func.js new file mode 100644 index 000000000..b602a99fa --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/invoked-as-func.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: > + "from" cannot be invoked as a function +info: | + 22.2.2.1 %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] ) + + 1. Let C be the this value. + 2. If IsConstructor(C) is false, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var from = TA.from; + + assert.throws(TypeError, function() { + from([]); + }); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/iter-access-error.js b/test/built-ins/TypedArrays/from/BigInt/iter-access-error.js new file mode 100644 index 000000000..21090c3db --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/iter-access-error.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: Returns error produced by accessing @@iterator +info: | + 22.2.2.1 %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] ) + + ... + 6. Let arrayLike be ? IterableToArrayLike(source). + ... + + 22.2.2.1.1 Runtime Semantics: IterableToArrayLike( items ) + + 1. Let usingIterator be ? GetMethod(items, @@iterator). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.iterator, TypedArray] +---*/ + +var iter = {}; +Object.defineProperty(iter, Symbol.iterator, { + get: function() { + throw new Test262Error(); + } +}); + +testWithBigIntTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + TA.from(iter); + }); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/iter-invoke-error.js b/test/built-ins/TypedArrays/from/BigInt/iter-invoke-error.js new file mode 100644 index 000000000..552a6d728 --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/iter-invoke-error.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: Returns error produced by invoking @@iterator +info: | + 22.2.2.1 %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] ) + + ... + 6. Let arrayLike be ? IterableToArrayLike(source). + ... + + 22.2.2.1.1 Runtime Semantics: IterableToArrayLike( items ) + + 1. Let usingIterator be ? GetMethod(items, @@iterator). + 2. If usingIterator is not undefined, then + a. Let iterator be ? GetIterator(items, usingIterator). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.iterator, TypedArray] +---*/ + +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + TA.from(iter); + }); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/iter-next-error.js b/test/built-ins/TypedArrays/from/BigInt/iter-next-error.js new file mode 100644 index 000000000..836da920c --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/iter-next-error.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: Returns error produced by advancing the iterator +info: | + 22.2.2.1.1 Runtime Semantics: IterableToArrayLike( items ) + + 2. If usingIterator is not undefined, then + ... + d. Repeat, while next is not false + i. Let next be ? IteratorStep(iterator). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.iterator, TypedArray] +---*/ + +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + TA.from(iter); + }); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/iter-next-value-error.js b/test/built-ins/TypedArrays/from/BigInt/iter-next-value-error.js new file mode 100644 index 000000000..08936b4e1 --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/iter-next-value-error.js @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: Returns error produced by accessing iterated value +info: | + 22.2.2.1.1 Runtime Semantics: IterableToArrayLike( items ) + + 2. If usingIterator is not undefined, then + ... + d. Repeat, while next is not false + ... + ii. If next is not false, then + 1. Let nextValue be ? IteratorValue(next). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.iterator, TypedArray] +---*/ + +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + var result = {}; + Object.defineProperty(result, 'value', { + get: function() { + throw new Test262Error(); + } + }); + + return result; + } + }; +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + TA.from(iter); + }); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/mapfn-abrupt-completion.js b/test/built-ins/TypedArrays/from/BigInt/mapfn-abrupt-completion.js new file mode 100644 index 000000000..4efbf68fa --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/mapfn-abrupt-completion.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: > + Return abrupt from mapfn +info: | + 22.2.2.1 %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] ) + + ... + 10. Repeat, while k < len + ... + c. If mapping is true, then + i. Let mappedValue be ? Call(mapfn, T, « kValue, k »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var source = { + "0": 42, + length: 2 +}; +var mapfn = function() { + throw new Test262Error(); +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + TA.from(source, mapfn); + }); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/mapfn-arguments.js b/test/built-ins/TypedArrays/from/BigInt/mapfn-arguments.js new file mode 100644 index 000000000..a84021d47 --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/mapfn-arguments.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: > + Assert mapfn arguments +info: | + 22.2.2.1 %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] ) + + ... + 10. Repeat, while k < len + ... + c. If mapping is true, then + i. Let mappedValue be ? Call(mapfn, T, « kValue, k »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var source = [42, 43, 44]; + +testWithBigIntTypedArrayConstructors(function(TA) { + var results = []; + var mapfn = function(kValue, k) { + results.push({ + kValue: kValue, + k: k, + argsLength: arguments.length + }); + return convertToBigInt(0); + }; + + TA.from(source, mapfn); + + assert.sameValue(results.length, 3); + + assert.sameValue(results[0].kValue, 42); + assert.sameValue(results[0].k, 0); + assert.sameValue(results[0].argsLength, 2); + + assert.sameValue(results[1].kValue, 43); + assert.sameValue(results[1].k, 1); + assert.sameValue(results[1].argsLength, 2); + + assert.sameValue(results[2].kValue, 44); + assert.sameValue(results[2].k, 2); + assert.sameValue(results[2].argsLength, 2); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/mapfn-is-not-callable.js b/test/built-ins/TypedArrays/from/BigInt/mapfn-is-not-callable.js new file mode 100644 index 000000000..36565b495 --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/mapfn-is-not-callable.js @@ -0,0 +1,59 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: Throw a TypeError exception is mapfn is not callable +info: | + 22.2.2.1 %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] ) + + ... + 3. If mapfn was supplied and mapfn is not undefined, then + a. If IsCallable(mapfn) is false, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, Symbol.iterator, TypedArray] +---*/ + +var getIterator = 0; +var arrayLike = {}; +Object.defineProperty(arrayLike, Symbol.iterator, { + get: function() { + getIterator++; + } +}); + +testWithBigIntTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + TA.from(arrayLike, null); + }, "mapfn is null"); + + assert.throws(TypeError, function() { + TA.from(arrayLike, 42); + }, "mapfn is a number"); + + assert.throws(TypeError, function() { + TA.from(arrayLike, ""); + }, "mapfn is a string"); + + assert.throws(TypeError, function() { + TA.from(arrayLike, {}); + }, "mapfn is an ordinary object"); + + assert.throws(TypeError, function() { + TA.from(arrayLike, []); + }, "mapfn is an array"); + + assert.throws(TypeError, function() { + TA.from(arrayLike, true); + }, "mapfn is a boolean"); + + var s = Symbol("1"); + assert.throws(TypeError, function() { + TA.from(arrayLike, s); + }, "mapfn is a symbol"); + + assert.sameValue( + getIterator, 0, + "IsCallable(mapfn) check occurs before getting source[@@iterator]" + ); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/mapfn-this-with-thisarg.js b/test/built-ins/TypedArrays/from/BigInt/mapfn-this-with-thisarg.js new file mode 100644 index 000000000..b748126af --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/mapfn-this-with-thisarg.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: > + Assert mapfn `this` with thisArg +info: | + 22.2.2.1 %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] ) + + ... + 5. If thisArg was supplied, let T be thisArg; else let T be undefined. + ... + 10. Repeat, while k < len + ... + c. If mapping is true, then + i. Let mappedValue be ? Call(mapfn, T, « kValue, k »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var source = [42, 43]; +var thisArg = {}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var results = []; + var mapfn = function() { + results.push(this); + return convertToBigInt(0); + }; + + TA.from(source, mapfn, thisArg); + + assert.sameValue(results.length, 2); + assert.sameValue(results[0], thisArg); + assert.sameValue(results[1], thisArg); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/mapfn-this-without-thisarg-non-strict.js b/test/built-ins/TypedArrays/from/BigInt/mapfn-this-without-thisarg-non-strict.js new file mode 100644 index 000000000..b16d6f9cc --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/mapfn-this-without-thisarg-non-strict.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: > + Assert mapfn `this` without thisArg +info: | + 22.2.2.1 %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] ) + + ... + 5. If thisArg was supplied, let T be thisArg; else let T be undefined. + ... + 10. Repeat, while k < len + ... + c. If mapping is true, then + i. Let mappedValue be ? Call(mapfn, T, « kValue, k »). + ... +includes: [testBigIntTypedArray.js] +flags: [noStrict] +features: [BigInt, TypedArray] +---*/ + +var source = [42, 43]; +var global = this; + +testWithBigIntTypedArrayConstructors(function(TA) { + var results = []; + var mapfn = function(x) { + results.push(this); + return convertToBigInt(x); + }; + + TA.from(convertToBigInt(source), mapfn); + + assert.sameValue(results.length, 2); + assert.sameValue(results[0], global); + assert.sameValue(results[1], global); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/mapfn-this-without-thisarg-strict.js b/test/built-ins/TypedArrays/from/BigInt/mapfn-this-without-thisarg-strict.js new file mode 100644 index 000000000..9b575c2a9 --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/mapfn-this-without-thisarg-strict.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: > + Assert mapfn `this` without thisArg +info: | + 22.2.2.1 %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] ) + + ... + 5. If thisArg was supplied, let T be thisArg; else let T be undefined. + ... + 10. Repeat, while k < len + ... + c. If mapping is true, then + i. Let mappedValue be ? Call(mapfn, T, « kValue, k »). + ... +includes: [testBigIntTypedArray.js] +flags: [onlyStrict] +features: [BigInt, TypedArray] +---*/ + +var source = [42, 43]; + +testWithBigIntTypedArrayConstructors(function(TA) { + var results = []; + var mapfn = function() { + results.push(this); + return convertToBigInt(0); + }; + + TA.from(source, mapfn); + + assert.sameValue(results.length, 2); + assert.sameValue(results[0], undefined); + assert.sameValue(results[1], undefined); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/nan-conversion.js b/test/built-ins/TypedArrays/from/BigInt/nan-conversion.js new file mode 100644 index 000000000..a318c055a --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/nan-conversion.js @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: > + Test NaN conversions +info: | + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 3. Let numValue be ? ToNumber(value). + ... + + 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , + isLittleEndian ] ) +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var result = TA.from([NaN, undefined]); + assert.sameValue(result.length, 2); + assert.sameValue(result[0], NaN); + assert.sameValue(result[1], NaN); + assert.sameValue(result.constructor, TA); + assert.sameValue(Object.getPrototypeOf(result), TA.prototype); +}, +[ + Float32Array, + Float64Array +]); + +testWithBigIntTypedArrayConstructors(function(TA) { + var result = TA.from([NaN, undefined]); + assert.sameValue(result.length, 2); + assert.sameValue(result[0], 0); + assert.sameValue(result[1], 0); + assert.sameValue(result.constructor, TA); + assert.sameValue(Object.getPrototypeOf(result), TA.prototype); +}, +[ + Int8Array, + Int32Array, + Int16Array, + Int8Array, + Uint32Array, + Uint16Array, + Uint8Array, + Uint8ClampedArray +]); \ No newline at end of file diff --git a/test/built-ins/TypedArrays/from/BigInt/new-instance-empty.js b/test/built-ins/TypedArrays/from/BigInt/new-instance-empty.js new file mode 100644 index 000000000..e0cee67e2 --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/new-instance-empty.js @@ -0,0 +1,17 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: > + Return a new empty TypedArray +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + + +testWithBigIntTypedArrayConstructors(function(TA) { + var result = TA.from([]); + assert.sameValue(result.length, 0); + assert.sameValue(result.constructor, TA); + assert.sameValue(Object.getPrototypeOf(result), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/new-instance-from-ordinary-object.js b/test/built-ins/TypedArrays/from/BigInt/new-instance-from-ordinary-object.js new file mode 100644 index 000000000..22eff2856 --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/new-instance-from-ordinary-object.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: > + Return a new TypedArray from an ordinary object +includes: [testBigIntTypedArray.js] +features: [BigInt, Array.prototype.values, TypedArray] +---*/ + +var source = { + "0": 42, + "2": 44, + length: 4 +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var result = TA.from(source); + + assert.sameValue(result.length, 4); + assert.sameValue(result[0], 42); + assert.sameValue(result[1], NaN); + assert.sameValue(result[2], 44); + assert.sameValue(result[3], NaN); + assert.sameValue(result.constructor, TA); + assert.sameValue(Object.getPrototypeOf(result), TA.prototype); +}, +[ + Float32Array, + Float64Array +]); + +testWithBigIntTypedArrayConstructors(function(TA) { + var result = TA.from(source); + + assert.sameValue(result.length, 4); + assert.sameValue(result[0], 42); + assert.sameValue(result[1], 0); + assert.sameValue(result[2], 44); + assert.sameValue(result[3], 0); + assert.sameValue(result.constructor, TA); + assert.sameValue(Object.getPrototypeOf(result), TA.prototype); +}, +[ + Int8Array, + Int32Array, + Int16Array, + Int8Array, + Uint32Array, + Uint16Array, + Uint8Array, + Uint8ClampedArray +]); diff --git a/test/built-ins/TypedArrays/from/BigInt/new-instance-from-sparse-array.js b/test/built-ins/TypedArrays/from/BigInt/new-instance-from-sparse-array.js new file mode 100644 index 000000000..361edb9d6 --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/new-instance-from-sparse-array.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: > + Return a new TypedArray from a sparse array +includes: [testBigIntTypedArray.js] +features: [BigInt, Array.prototype.values, TypedArray] +---*/ + +var source = [,,42,,44,,]; + +testWithBigIntTypedArrayConstructors(function(TA) { + var result = TA.from(source); + + assert.sameValue(result.length, 6); + assert.sameValue(result[0], NaN); + assert.sameValue(result[1], NaN); + assert.sameValue(result[2], 42); + assert.sameValue(result[3], NaN); + assert.sameValue(result[4], 44); + assert.sameValue(result[5], NaN); + assert.sameValue(result.constructor, TA); + assert.sameValue(Object.getPrototypeOf(result), TA.prototype); +}, +[ + Float32Array, + Float64Array +]); + +testWithBigIntTypedArrayConstructors(function(TA) { + var result = TA.from(source); + + assert.sameValue(result.length, 6); + assert.sameValue(result[0], 0); + assert.sameValue(result[1], 0); + assert.sameValue(result[2], 42); + assert.sameValue(result[3], 0); + assert.sameValue(result[4], 44); + assert.sameValue(result[5], 0); + assert.sameValue(result.constructor, TA); + assert.sameValue(Object.getPrototypeOf(result), TA.prototype); +}, +[ + Int8Array, + Int32Array, + Int16Array, + Int8Array, + Uint32Array, + Uint16Array, + Uint8Array, + Uint8ClampedArray +]); diff --git a/test/built-ins/TypedArrays/from/BigInt/new-instance-from-zero.js b/test/built-ins/TypedArrays/from/BigInt/new-instance-from-zero.js new file mode 100644 index 000000000..cbca4484d --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/new-instance-from-zero.js @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: > + Return a new TypedArray using -0 and +0 +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var result = TA.from([-0, +0]); + assert.sameValue(result.length, 2); + assert.sameValue(result[0], -0, "-0 => -0"); + assert.sameValue(result[1], 0, "+0 => 0"); + assert.sameValue(result.constructor, TA); + assert.sameValue(Object.getPrototypeOf(result), TA.prototype); +}, +[ + Float32Array, + Float64Array +]); + +testWithBigIntTypedArrayConstructors(function(TA) { + var result = TA.from([-0, +0]); + assert.sameValue(result.length, 2); + assert.sameValue(result[0], 0, "-0 => 0"); + assert.sameValue(result[1], 0, "+0 => 0"); + assert.sameValue(result.constructor, TA); + assert.sameValue(Object.getPrototypeOf(result), TA.prototype); +}, +[ + Int16Array, + Int32Array, + Int8Array, + Uint16Array, + Uint32Array, + Uint8Array, + Uint8ClampedArray +]); \ No newline at end of file diff --git a/test/built-ins/TypedArrays/from/BigInt/new-instance-using-custom-ctor.js b/test/built-ins/TypedArrays/from/BigInt/new-instance-using-custom-ctor.js new file mode 100644 index 000000000..7e6bc6169 --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/new-instance-using-custom-ctor.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. +/*--- +esid: sec-%typedarray%.from +description: > + Return a new TypedArray using a custom Constructor +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var source = [42, 43, 42]; + +testWithBigIntTypedArrayConstructors(function(TA) { + var called = 0; + + var ctor = function(len) { + assert.sameValue(arguments.length, 1); + called++; + return new TA(len); + }; + + var result = TA.from.call(ctor, convertToBigInt(source)); + assert.sameValue(result.length, 3); + assert.sameValue(result[0], convertToBigInt(42)); + assert.sameValue(result[1], convertToBigInt(43)); + assert.sameValue(result[2], convertToBigInt(42)); + assert.sameValue(result.constructor, TA); + assert.sameValue(Object.getPrototypeOf(result), TA.prototype); + assert.sameValue(called, 1); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/new-instance-with-mapfn.js b/test/built-ins/TypedArrays/from/BigInt/new-instance-with-mapfn.js new file mode 100644 index 000000000..48ee4d285 --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/new-instance-with-mapfn.js @@ -0,0 +1,25 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: > + Return a new TypedArray using mapfn +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var source = [42, 43, 42]; + +testWithBigIntTypedArrayConstructors(function(TA) { + var mapfn = function(kValue) { + return convertToBigInt(kValue * 2); + }; + + var result = TA.from(source, mapfn); + assert.sameValue(result.length, 3); + assert.sameValue(result[0], convertToBigInt(84)); + assert.sameValue(result[1], convertToBigInt(86)); + assert.sameValue(result[2], convertToBigInt(84)); + assert.sameValue(result.constructor, TA); + assert.sameValue(Object.getPrototypeOf(result), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/new-instance-without-mapfn.js b/test/built-ins/TypedArrays/from/BigInt/new-instance-without-mapfn.js new file mode 100644 index 000000000..af95e8015 --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/new-instance-without-mapfn.js @@ -0,0 +1,21 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: > + Return a new TypedArray +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var source = [42, 43, 42]; + +testWithBigIntTypedArrayConstructors(function(TA) { + var result = TA.from(convertToBigInt(source)); + assert.sameValue(result.length, 3); + assert.sameValue(result[0], convertToBigInt(42)); + assert.sameValue(result[1], convertToBigInt(43)); + assert.sameValue(result[2], convertToBigInt(42)); + assert.sameValue(result.constructor, TA); + assert.sameValue(Object.getPrototypeOf(result), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/property-abrupt-completion.js b/test/built-ins/TypedArrays/from/BigInt/property-abrupt-completion.js new file mode 100644 index 000000000..a3bd8b446 --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/property-abrupt-completion.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: > + Return abrupt from source property +info: | + 22.2.2.1 %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] ) + + ... + 10. Repeat, while k < len + ... + b. Let kValue be ? Get(arrayLike, Pk). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var source = { + length: 2 +}; +Object.defineProperty(source, "0", { + get() { + throw new Test262Error(); + } +}); + +testWithBigIntTypedArrayConstructors(function(TA) { + assert.throws(Test262Error, function() { + TA.from(source); + }); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/set-value-abrupt-completion.js b/test/built-ins/TypedArrays/from/BigInt/set-value-abrupt-completion.js new file mode 100644 index 000000000..34ee679a5 --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/set-value-abrupt-completion.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: > + Return abrupt from setting a value on the new typedarray +info: | + 22.2.2.1 %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] ) + + ... + 10. Repeat, while k < len + ... + c. If mapping is true, then + i. Let mappedValue be ? Call(mapfn, T, « kValue, k »). + d. Else, let mappedValue be kValue. + e. Perform ? Set(targetObj, Pk, mappedValue, true). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var obj = { + valueOf() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var source = [convertToBigInt(42), obj, convertToBigInt(1)]; + var lastValue; + var mapfn = function(kValue) { + lastValue = kValue; + return kValue; + }; + + assert.throws(Test262Error, function() { + TA.from(source, mapfn); + }); + + assert.sameValue(lastValue, obj, "interrupted source iteration"); + + assert.throws(Test262Error, function() { + TA.from(source); + }); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/source-value-is-symbol-throws.js b/test/built-ins/TypedArrays/from/BigInt/source-value-is-symbol-throws.js new file mode 100644 index 000000000..cebc1b114 --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/source-value-is-symbol-throws.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: > + Throws a TypeError if argument is a Symbol +info: | + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 3. Let numValue be ? ToNumber(value). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var s = Symbol("1"); + +testWithBigIntTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + TA.from([s]); + }); +}); diff --git a/test/built-ins/TypedArrays/from/BigInt/this-is-not-constructor.js b/test/built-ins/TypedArrays/from/BigInt/this-is-not-constructor.js new file mode 100644 index 000000000..711f054a5 --- /dev/null +++ b/test/built-ins/TypedArrays/from/BigInt/this-is-not-constructor.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.from +description: > + Throws a TypeError exception if this is not a constructor +info: | + 22.2.2.1 %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] ) + + 1. Let C be the this value. + 2. If IsConstructor(C) is false, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var m = { m() {} }.m; + +testWithBigIntTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + TA.from.call(m, []); + }); +}); diff --git a/test/built-ins/TypedArrays/from/custom-ctor-returns-other-instance.js b/test/built-ins/TypedArrays/from/custom-ctor-returns-other-instance.js index b59bf2297..8a0117682 100644 --- a/test/built-ins/TypedArrays/from/custom-ctor-returns-other-instance.js +++ b/test/built-ins/TypedArrays/from/custom-ctor-returns-other-instance.js @@ -23,14 +23,12 @@ includes: [testTypedArray.js] features: [Symbol.iterator, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sourceItor = N([1, 2]); - var sourceObj = { - 0: N(0), - 1: N(0), - length: 2 - }; +var sourceItor = [1, 2]; +var sourceObj = { + length: 2 +}; +testWithTypedArrayConstructors(function(TA) { var result; var custom = new TA(2); var ctor = function() { diff --git a/test/built-ins/TypedArrays/from/mapfn-arguments.js b/test/built-ins/TypedArrays/from/mapfn-arguments.js index 65150c85b..6d102d1b6 100644 --- a/test/built-ins/TypedArrays/from/mapfn-arguments.js +++ b/test/built-ins/TypedArrays/from/mapfn-arguments.js @@ -19,7 +19,7 @@ features: [TypedArray] var source = [42, 43, 44]; -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var results = []; var mapfn = function(kValue, k) { results.push({ @@ -27,7 +27,6 @@ testWithTypedArrayConstructors(function(TA, N) { k: k, argsLength: arguments.length }); - return N(0); }; TA.from(source, mapfn); diff --git a/test/built-ins/TypedArrays/from/mapfn-this-with-thisarg.js b/test/built-ins/TypedArrays/from/mapfn-this-with-thisarg.js index 2df9a0efc..2fb965d08 100644 --- a/test/built-ins/TypedArrays/from/mapfn-this-with-thisarg.js +++ b/test/built-ins/TypedArrays/from/mapfn-this-with-thisarg.js @@ -22,11 +22,10 @@ features: [TypedArray] var source = [42, 43]; var thisArg = {}; -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var results = []; var mapfn = function() { results.push(this); - return N(0); }; TA.from(source, mapfn, thisArg); diff --git a/test/built-ins/TypedArrays/from/mapfn-this-without-thisarg-non-strict.js b/test/built-ins/TypedArrays/from/mapfn-this-without-thisarg-non-strict.js index e136207a3..02eeaba11 100644 --- a/test/built-ins/TypedArrays/from/mapfn-this-without-thisarg-non-strict.js +++ b/test/built-ins/TypedArrays/from/mapfn-this-without-thisarg-non-strict.js @@ -23,14 +23,13 @@ features: [TypedArray] var source = [42, 43]; var global = this; -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var results = []; - var mapfn = function(x) { + var mapfn = function() { results.push(this); - return N(x); }; - TA.from(N(source), mapfn); + TA.from(source, mapfn); assert.sameValue(results.length, 2); assert.sameValue(results[0], global); diff --git a/test/built-ins/TypedArrays/from/mapfn-this-without-thisarg-strict.js b/test/built-ins/TypedArrays/from/mapfn-this-without-thisarg-strict.js index ca2968c7a..61612fa35 100644 --- a/test/built-ins/TypedArrays/from/mapfn-this-without-thisarg-strict.js +++ b/test/built-ins/TypedArrays/from/mapfn-this-without-thisarg-strict.js @@ -22,11 +22,10 @@ features: [TypedArray] var source = [42, 43]; -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var results = []; var mapfn = function() { results.push(this); - return N(0); }; TA.from(source, mapfn); diff --git a/test/built-ins/TypedArrays/from/new-instance-using-custom-ctor.js b/test/built-ins/TypedArrays/from/new-instance-using-custom-ctor.js index bf8c34acf..2fe53a328 100644 --- a/test/built-ins/TypedArrays/from/new-instance-using-custom-ctor.js +++ b/test/built-ins/TypedArrays/from/new-instance-using-custom-ctor.js @@ -10,7 +10,7 @@ features: [TypedArray] var source = [42, 43, 42]; -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var called = 0; var ctor = function(len) { @@ -19,11 +19,11 @@ testWithTypedArrayConstructors(function(TA, N) { return new TA(len); }; - var result = TA.from.call(ctor, N(source)); + var result = TA.from.call(ctor, source); assert.sameValue(result.length, 3); - assert.sameValue(result[0], N(42)); - assert.sameValue(result[1], N(43)); - assert.sameValue(result[2], N(42)); + assert.sameValue(result[0], 42); + assert.sameValue(result[1], 43); + assert.sameValue(result[2], 42); assert.sameValue(result.constructor, TA); assert.sameValue(Object.getPrototypeOf(result), TA.prototype); assert.sameValue(called, 1); diff --git a/test/built-ins/TypedArrays/from/new-instance-with-mapfn.js b/test/built-ins/TypedArrays/from/new-instance-with-mapfn.js index 66536c623..ab8da0b98 100644 --- a/test/built-ins/TypedArrays/from/new-instance-with-mapfn.js +++ b/test/built-ins/TypedArrays/from/new-instance-with-mapfn.js @@ -10,16 +10,16 @@ features: [TypedArray] var source = [42, 43, 42]; -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var mapfn = function(kValue) { - return N(kValue * 2); + return kValue * 2; }; var result = TA.from(source, mapfn); assert.sameValue(result.length, 3); - assert.sameValue(result[0], N(84)); - assert.sameValue(result[1], N(86)); - assert.sameValue(result[2], N(84)); + assert.sameValue(result[0], 84); + assert.sameValue(result[1], 86); + assert.sameValue(result[2], 84); assert.sameValue(result.constructor, TA); assert.sameValue(Object.getPrototypeOf(result), TA.prototype); }); diff --git a/test/built-ins/TypedArrays/from/new-instance-without-mapfn.js b/test/built-ins/TypedArrays/from/new-instance-without-mapfn.js index ebedc93c8..d7ac6abc2 100644 --- a/test/built-ins/TypedArrays/from/new-instance-without-mapfn.js +++ b/test/built-ins/TypedArrays/from/new-instance-without-mapfn.js @@ -10,12 +10,12 @@ features: [TypedArray] var source = [42, 43, 42]; -testWithTypedArrayConstructors(function(TA, N) { - var result = TA.from(N(source)); +testWithTypedArrayConstructors(function(TA) { + var result = TA.from(source); assert.sameValue(result.length, 3); - assert.sameValue(result[0], N(42)); - assert.sameValue(result[1], N(43)); - assert.sameValue(result[2], N(42)); + assert.sameValue(result[0], 42); + assert.sameValue(result[1], 43); + assert.sameValue(result[2], 42); assert.sameValue(result.constructor, TA); assert.sameValue(Object.getPrototypeOf(result), TA.prototype); }); diff --git a/test/built-ins/TypedArrays/from/set-value-abrupt-completion.js b/test/built-ins/TypedArrays/from/set-value-abrupt-completion.js index efae38c90..ddde226a2 100644 --- a/test/built-ins/TypedArrays/from/set-value-abrupt-completion.js +++ b/test/built-ins/TypedArrays/from/set-value-abrupt-completion.js @@ -25,8 +25,9 @@ var obj = { } }; -testWithTypedArrayConstructors(function(TA, N) { - var source = [N(42), obj, N(1)]; +var source = [42, obj, 1]; + +testWithTypedArrayConstructors(function(TA) { var lastValue; var mapfn = function(kValue) { lastValue = kValue; diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/conversion-operation.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/conversion-operation.js new file mode 100644 index 000000000..9286ba6f5 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/conversion-operation.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-integer-indexed-exotic-objects-defineownproperty-p-desc +description: > + Verify conversion after defining value +info: | + 9.4.5.3 [[DefineOwnProperty]] ( P, Desc) + + ... + 3. If Type(P) is String, then + ... + b. If numericIndex is not undefined, then + ... + xi. If Desc has a [[Value]] field, then + 1. Let value be Desc.[[Value]]. + 2. Return ? IntegerIndexedElementSet(O, intIndex, value). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). + ... + + 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , + isLittleEndian ] ) + + ... + 8. If type is "Float32", then + ... + 9. Else, if type is "Float64", then + ... + 10. Else, + ... + b. Let convOp be the abstract operation named in the Conversion Operation + column in Table 50 for Element Type type. + c. Let intValue be convOp(value). + d. If intValue ≥ 0, then + ... + e. Else, + ... +includes: [byteConversionValues.js, testBigIntTypedArray.js] +---*/ + +testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { + var sample = new TA([initial]); + + Object.defineProperty(sample, "0", {value: value}); + + assert.sameValue(sample[0], expected, value + " converts to " + expected); +}); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/desc-value-throws.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/desc-value-throws.js new file mode 100644 index 000000000..016d41b63 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/desc-value-throws.js @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-defineownproperty-p-desc +description: > + Return abrupt from the evaluation of ToNumber(desc.value) +info: | + 9.4.5.3 [[DefineOwnProperty]] ( P, Desc) + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + xi. If Desc has a [[Value]] field, then + 1. Let value be Desc.[[Value]]. + 2. Return ? IntegerIndexedElementSet(O, intIndex, value). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 3. Let numValue be ? ToNumber(value). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var obj = { + valueOf: function() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42])); + + assert.throws(Test262Error, function() { + Object.defineProperty(sample, "0", {value: obj}); + }); +}); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/detached-buffer-realm.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/detached-buffer-realm.js new file mode 100644 index 000000000..3fa462103 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/detached-buffer-realm.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-defineownproperty-p-desc +description: > + Throws a TypeError if object has valid numeric index and a detached buffer + (honoring the Realm of the current execution context) +info: | + 9.4.5.3 [[DefineOwnProperty]] ( P, Desc) + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + xi. If Desc has a [[Value]] field, then + 1. Let value be Desc.[[Value]]. + 2. Return ? IntegerIndexedElementSet(O, intIndex, value). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 4. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot. + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, cross-realm, Reflect, TypedArray] +---*/ + +var other = $262.createRealm().global; +var desc = { + value: 0, + configurable: false, + enumerable: true, + writable: true +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var OtherTA = other[TA.name]; + var sample = new OtherTA(1); + + $DETACHBUFFER(sample.buffer); + + assert.throws(TypeError, function() { + Reflect.defineProperty(sample, '0', desc); + }); +}); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/detached-buffer.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/detached-buffer.js new file mode 100644 index 000000000..f20176156 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/detached-buffer.js @@ -0,0 +1,134 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-defineownproperty-p-desc +description: > + Throws a TypeError if object has valid numeric index and a detached buffer +info: | + 9.4.5.3 [[DefineOwnProperty]] ( P, Desc) + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + xi. If Desc has a [[Value]] field, then + 1. Let value be Desc.[[Value]]. + 2. Return ? IntegerIndexedElementSet(O, intIndex, value). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 4. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot. + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +var desc = { + value: 0, + configurable: false, + enumerable: true, + writable: true +}; + +var obj = { + valueOf: function() { + throw new Test262Error(); + } +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(42); + $DETACHBUFFER(sample.buffer); + + assert.throws(TypeError, function() { + Reflect.defineProperty(sample, "0", desc); + }, "Throws TypeError on valid numeric index if instance has a detached buffer"); + + assert.sameValue( + Reflect.defineProperty(sample, "-1", desc), + false, + "Return false before Detached Buffer check when value is a negative number" + ); + + assert.sameValue( + Reflect.defineProperty(sample, "1.1", desc), + false, + "Return false before Detached Buffer check when value is not an integer" + ); + + assert.sameValue( + Reflect.defineProperty(sample, "-0", desc), + false, + "Return false before Detached Buffer check when value is -0" + ); + + assert.sameValue( + Reflect.defineProperty(sample, "2", { + configurable: true, + enumerable: true, + writable: true, + value: obj + }), + false, + "Return false before Detached Buffer check when desc configurable is true" + ); + + assert.sameValue( + Reflect.defineProperty(sample, "3", { + configurable: false, + enumerable: false, + writable: true, + value: obj + }), + false, + "Return false before Detached Buffer check when desc enumerable is false" + ); + + assert.sameValue( + Reflect.defineProperty(sample, "4", { + writable: false, + configurable: false, + enumerable: true, + value: obj + }), + false, + "Return false before Detached Buffer check when desc writable is false" + ); + + assert.sameValue( + Reflect.defineProperty(sample, "42", desc), + false, + "Return false before Detached Buffer check when key == [[ArrayLength]]" + ); + + assert.sameValue( + Reflect.defineProperty(sample, "43", desc), + false, + "Return false before Detached Buffer check when key > [[ArrayLength]]" + ); + + assert.sameValue( + Reflect.defineProperty(sample, "5", { + get: function() {} + }), + false, + "Return false before Detached Buffer check with accessor descriptor" + ); + + assert.sameValue( + Reflect.defineProperty(sample, "6", { + configurable: false, + enumerable: true, + writable: true + }), + true, + "Return true before Detached Buffer check when desc value is not present" + ); + + assert.throws(Test262Error, function() { + Reflect.defineProperty(sample, "7", {value: obj}); + }, "Return Abrupt before Detached Buffer check from ToNumber(desc.value)"); +}); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-greater-than-last-index.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-greater-than-last-index.js new file mode 100644 index 000000000..d48eb4afb --- /dev/null +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-greater-than-last-index.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-defineownproperty-p-desc +description: > + Returns false if numericIndex is >= [[ArrayLength]] +info: | + 9.4.5.3 [[DefineOwnProperty]] ( P, Desc) + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + ii. Let intIndex be numericIndex. + ... + v. Let length be the value of O's [[ArrayLength]] internal slot. + vi. If intIndex ≥ length, return false. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + + assert.sameValue( + Reflect.defineProperty(sample, "2", { + value: 42, + configurable: false, + enumerable: true, + writable: true + }), + false, + "numericIndex == length" + ); + + assert.sameValue( + Reflect.defineProperty(sample, "3", { + value: 42, + configurable: false, + enumerable: true, + writable: true + }), + false, + "numericIndex > length" + ); +}); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-lower-than-zero.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-lower-than-zero.js new file mode 100644 index 000000000..faaf037c3 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-lower-than-zero.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-defineownproperty-p-desc +description: > + Returns false if numericIndex is < 0 +info: | + 9.4.5.3 [[DefineOwnProperty]] ( P, Desc) + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + ii. Let intIndex be numericIndex. + iv. If intIndex < 0, return false. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + + assert.sameValue( + Reflect.defineProperty(sample, "-1", { + value: 42, + configurable: false, + enumerable: true, + writable: true + }), + false, + "-1" + ); +}); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-minus-zero.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-minus-zero.js new file mode 100644 index 000000000..2c838c345 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-minus-zero.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-defineownproperty-p-desc +description: > + Returns false if numericIndex is "-0" +info: | + 9.4.5.3 [[DefineOwnProperty]] ( P, Desc) + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. If IsInteger(numericIndex) is false, return false. + ii. Let intIndex be numericIndex. + iii. If intIndex = -0, return false. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + + assert.sameValue( + Reflect.defineProperty(sample, "-0", { + value: 42, + configurable: false, + enumerable: true, + writable: true + }), + false, + "defineProperty returns false" + ); + assert.sameValue(sample[0], convertToBigInt(0), "does not change the value for [0]"); + assert.sameValue(sample["-0"], undefined, "does define a value for ['-0']"); +}); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-canonical-index.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-canonical-index.js new file mode 100644 index 000000000..c87d89cf9 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-canonical-index.js @@ -0,0 +1,98 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-defineownproperty-p-desc +description: > + Sets an ordinary property value if numeric key is not a CanonicalNumericIndex +info: | + 9.4.5.3 [[DefineOwnProperty]] ( P, Desc) + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + 4. Return OrdinaryDefineOwnProperty(O, P, Desc). + ... +includes: [testBigIntTypedArray.js, propertyHelper.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +var keys = [ + "1.0", + "+1", + "1000000000000000000000", + "0.0000001" +]; + +var fnset = function() {}; +var fnget = function() {}; + +var acDesc = { + get: fnget, + set: fnset, + enumerable: true, + configurable: false +}; + +testWithBigIntTypedArrayConstructors(function(TA) { + keys.forEach(function(key) { + var dataDesc = { + value: convertToBigInt(42), + writable: true, + configurable: true + }; + + var sample1 = new TA(); + + assert.sameValue( + Reflect.defineProperty(sample1, key, dataDesc), + true, + "return true after defining data property [" + key + "]" + ); + + assert.sameValue(sample1[key], convertToBigInt(42), "value is set to [" + key + "]"); + verifyNotEnumerable(sample1, key); + verifyWritable(sample1, key); + verifyConfigurable(sample1, key); + + assert.sameValue(sample1[0], undefined, "no value is set on sample1[0]"); + assert.sameValue(sample1.length, 0, "length is still 0"); + + var sample2 = new TA(); + + assert.sameValue( + Reflect.defineProperty(sample2, key, acDesc), + true, + "return true after defining accessors property [" + key + "]" + ); + + var desc = Object.getOwnPropertyDescriptor(sample2, key); + verifyEnumerable(sample2, key); + assert.sameValue(desc.get, fnget, "accessor's get [" + key + "]"); + assert.sameValue(desc.set, fnset, "accessor's set [" + key + "]"); + verifyNotConfigurable(sample2, key); + + assert.sameValue(sample2[0], undefined,"no value is set on sample2[0]"); + assert.sameValue(sample2.length, 0, "length is still 0"); + + var sample3 = new TA(); + Object.preventExtensions(sample3); + + assert.sameValue( + Reflect.defineProperty(sample3, key, dataDesc), + false, + "return false defining property on a non-extensible sample" + ); + assert.sameValue(Object.getOwnPropertyDescriptor(sample3, key), undefined); + + var sample4 = new TA(); + Object.preventExtensions(sample4); + + assert.sameValue( + Reflect.defineProperty(sample4, key, acDesc), + false, + "return false defining property on a non-extensible sample" + ); + assert.sameValue(Object.getOwnPropertyDescriptor(sample4, key), undefined); + }); +}); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-integer.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-integer.js new file mode 100644 index 000000000..0d3d3cc79 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-integer.js @@ -0,0 +1,124 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-defineownproperty-p-desc +description: > + Returns false if numericIndex is not an integer +info: | + 9.4.5.3 [[DefineOwnProperty]] ( P, Desc) + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. If IsInteger(numericIndex) is false, return false. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + + assert.sameValue( + Reflect.defineProperty(sample, "0.1", { + value: 42, + configurable: false, + enumerable: true, + writable: true + }), + false, + "0.1" + ); + assert.sameValue(sample[0], convertToBigInt(0), "'0.1' - does not change the value for [0]"); + assert.sameValue( + sample["0.1"], + undefined, + "'0.1' - does not define a value for ['0.1']" + ); + + assert.sameValue( + Reflect.defineProperty(sample, "0.000001", { + value: 42, + configurable: false, + enumerable: true, + writable: true + }), + false, + "0.000001" + ); + assert.sameValue( + sample[0], convertToBigInt(0), + "'0.000001' - does not change the value for [0]" + ); + assert.sameValue( + sample["0.000001"], + undefined, + "'0.000001' - does not define a value for ['0.000001']" + ); + + assert.sameValue( + Reflect.defineProperty(sample, "1.1", { + value: 42, + configurable: false, + enumerable: true, + writable: true + }), + false, + "1.1" + ); + assert.sameValue(sample[1], convertToBigInt(0), "'1.1' - does not change the value for [1]"); + assert.sameValue( + sample["1.1"], + undefined, + "'1.1' - does not define a value for ['1.1']" + ); + + assert.sameValue( + Reflect.defineProperty(sample, "Infinity", { + value: 42, + configurable: false, + enumerable: true, + writable: true + }), + false, + "Infinity" + ); + assert.sameValue( + sample[0], convertToBigInt(0), + "'Infinity' - does not change the value for [0]" + ); + assert.sameValue( + sample[1], convertToBigInt(0), + "'Infinity' - does not change the value for [1]" + ); + assert.sameValue( + sample["Infinity"], + undefined, + "'Infinity' - does not define a value for ['Infinity']" + ); + + assert.sameValue( + Reflect.defineProperty(sample, "-Infinity", { + value: 42, + configurable: false, + enumerable: true, + writable: true + }), + false, + "-Infinity" + ); + assert.sameValue( + sample[0], convertToBigInt(0), + "'-Infinity' - does not change the value for [0]" + ); + assert.sameValue( + sample[1], convertToBigInt(0), + "'-Infinity' - does not change the value for [1]" + ); + assert.sameValue( + sample["-Infinity"], + undefined, + "'-Infinity' - does not define a value for ['-Infinity']" + ); + +}); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-numeric-index.js new file mode 100644 index 000000000..8f262daeb --- /dev/null +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-numeric-index.js @@ -0,0 +1,52 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-defineownproperty-p-desc +description: > + Returns an ordinary property value if key is not a CanonicalNumericIndex +info: | + 9.4.5.3 [[DefineOwnProperty]] ( P, Desc) + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + 4. Return OrdinaryDefineOwnProperty(O, P, Desc). + ... +includes: [testBigIntTypedArray.js, propertyHelper.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + + assert.sameValue( + Reflect.defineProperty(sample, "foo", {value:42}), + true, + "return true after defining property" + ); + + assert.sameValue(sample.foo, 42); + verifyNotWritable(sample, "foo"); + verifyNotConfigurable(sample, "foo"); + verifyNotEnumerable(sample, "foo"); + + var fnset = function() {}; + var fnget = function() {}; + assert.sameValue( + Reflect.defineProperty(sample, "bar", { + get: fnget, + set: fnset, + enumerable: false, + configurable: true + }), + true, + "return true after defining property" + ); + + var desc = Object.getOwnPropertyDescriptor(sample, "bar"); + assert.sameValue(desc.get, fnget, "accessor's get"); + assert.sameValue(desc.set, fnset, "accessor's set"); + verifyNotEnumerable(sample, "bar"); + verifyConfigurable(sample, "bar"); +}); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-accessor-desc.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-accessor-desc.js new file mode 100644 index 000000000..21ab9cfc3 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-accessor-desc.js @@ -0,0 +1,58 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-defineownproperty-p-desc +description: > + Returns false if key is a numeric index and Descriptor is an + AccessorDescriptor +info: | + 9.4.5.3 [[DefineOwnProperty]] ( P, Desc) + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + vii. If IsAccessorDescriptor(Desc) is true, return false. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + + assert.sameValue( + Reflect.defineProperty(sample, "0", { + get: function() { + return 42; + }, + enumerable: true + }), + false, + "get accessor" + ); + assert.sameValue(sample[0], convertToBigInt(0), "get accessor - side effect check"); + + assert.sameValue( + Reflect.defineProperty(sample, "0", { + set: function() {}, + enumerable: true + }), + false, + "set accessor" + ); + assert.sameValue(sample[0], convertToBigInt(0), "set accessor - side effect check"); + + assert.sameValue( + Reflect.defineProperty(sample, "0", { + set: function() {}, + get: function() { + return 42; + }, + enumerable: true + }), + false, + "get and set accessors" + ); + assert.sameValue(sample[0], convertToBigInt(0), "get and set accessors - side effect check"); +}); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-configurable.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-configurable.js new file mode 100644 index 000000000..f928a3f93 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-configurable.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-defineownproperty-p-desc +description: > + Returns false if key is a numeric index and Desc.[[Configurable]] is true +info: | + 9.4.5.3 [[DefineOwnProperty]] ( P, Desc) + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + viii. If Desc has a [[Configurable]] field and if Desc.[[Configurable]] is + true, return false. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + + assert.sameValue( + Reflect.defineProperty(sample, "0", { + value: 42, + configurable: true, + enumerable: true, + writable: true + }), + false, + "defineProperty's result" + ); + assert.sameValue(sample[0], convertToBigInt(0), "side effect check"); +}); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-not-enumerable.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-not-enumerable.js new file mode 100644 index 000000000..79a56222a --- /dev/null +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-not-enumerable.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-defineownproperty-p-desc +description: > + Returns false if key is a numeric index and Desc.[[Enumerable]] is false +info: | + 9.4.5.3 [[DefineOwnProperty]] ( P, Desc) + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + ix. If Desc has an [[Enumerable]] field and if Desc.[[Enumerable]] is + false, return false. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + + assert.sameValue( + Reflect.defineProperty(sample, "0", { + value: 42, + configurable: false, + enumerable: false, + writable: true + }), + false, + "defineProperty's result" + ); + assert.sameValue(sample[0], convertToBigInt(0), "side effect check"); +}); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-not-writable.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-not-writable.js new file mode 100644 index 000000000..6f6483b90 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-not-writable.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-defineownproperty-p-desc +description: > + Returns false if key is a numeric index and Desc.[[Writable]] is false +info: | + 9.4.5.3 [[DefineOwnProperty]] ( P, Desc) + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + x. If Desc has a [[Writable]] field and if Desc.[[Writable]] is false, + return false. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(2); + + assert.sameValue( + Reflect.defineProperty(sample, "0", { + value: 42, + configurable: false, + enumerable: true, + writable: false + }), + false, + "defineProperty's result" + ); + assert.sameValue(sample[0], convertToBigInt(0), "side effect check"); +}); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex.js new file mode 100644 index 000000000..5f994cd86 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-defineownproperty-p-desc +description: > + Returns true after setting a valid numeric index key +info: | + 9.4.5.3 [[DefineOwnProperty]] ( P, Desc) + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + x. If Desc has a [[Writable]] field and if Desc.[[Writable]] is false, + return false. + ... +includes: [testBigIntTypedArray.js, propertyHelper.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 42])); + + assert.sameValue( + Reflect.defineProperty(sample, "0", { + value: convertToBigInt(8), + configurable: false, + enumerable: true, + writable: true + }), + true + ); + + assert.sameValue(sample[0], convertToBigInt(8), "property value was set"); + var desc = Object.getOwnPropertyDescriptor(sample, "0"); + + assert.sameValue(desc.value, convertToBigInt(8), "desc.value"); + assert.sameValue(desc.writable, true, "property is writable"); + + verifyEnumerable(sample, "0"); + verifyNotConfigurable(sample, "0"); +}); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-symbol.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-symbol.js new file mode 100644 index 000000000..467e89a93 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-symbol.js @@ -0,0 +1,54 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-defineownproperty-p-desc +description: > + Define an ordinary property value if key is a Symbol +info: | + 9.4.5.3 [[DefineOwnProperty]] ( P, Desc) + ... + 3. If Type(P) is String, then + ... + 4. Return OrdinaryDefineOwnProperty(O, P, Desc). + ... +includes: [testBigIntTypedArray.js, propertyHelper.js] +features: [BigInt, Reflect, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + + var s1 = Symbol("foo"); + assert.sameValue( + Reflect.defineProperty(sample, s1, { + value: 42, + configurable: true + }), + true, + "return true after defining property" + ); + + assert.sameValue(sample[s1], 42); + verifyNotWritable(sample, s1); + verifyNotEnumerable(sample, s1); + verifyConfigurable(sample, s1); + + var s2 = Symbol("bar"); + var fnset = function() {}; + var fnget = function() {}; + assert.sameValue( + Reflect.defineProperty(sample, s2, { + get: fnget, + set: fnset, + enumerable: true + }), + true, + "return true after defining property" + ); + + var desc = Object.getOwnPropertyDescriptor(sample, s2); + assert.sameValue(desc.get, fnget, "accessor's get"); + assert.sameValue(desc.set, fnset, "accessor's set"); + assert.sameValue(desc.enumerable, true); + verifyNotConfigurable(sample, s2); +}); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/non-extensible-new-key.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/non-extensible-new-key.js new file mode 100644 index 000000000..5357f3bc0 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/non-extensible-new-key.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-defineownproperty-p-desc +description: > + Can't define a new non-numerical key on a non-extensible instance +info: | + 9.4.5.3 [[DefineOwnProperty]] ( P, Desc) + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + 4. Return OrdinaryDefineOwnProperty(O, P, Desc). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + Object.preventExtensions(sample); + + assert.sameValue( + Reflect.defineProperty(sample, "foo", {value:42}), + false, + "return false on a non-extensible object - data descriptor" + ); + + assert.sameValue(Object.getOwnPropertyDescriptor(sample, "foo"), undefined); + + assert.sameValue( + Reflect.defineProperty(sample, "bar", { + get: function() {}, + set: function() {}, + enumerable: false, + configurable: true + }), + false, + "return false on a non-extensible object - accessor descriptor" + ); + + assert.sameValue(Object.getOwnPropertyDescriptor(sample, "bar"), undefined); +}); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/non-extensible-redefine-key.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/non-extensible-redefine-key.js new file mode 100644 index 000000000..eb6e41027 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/non-extensible-redefine-key.js @@ -0,0 +1,57 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-defineownproperty-p-desc +description: > + Redefine a non-numerical key on a non-extensible instance +info: | + 9.4.5.3 [[DefineOwnProperty]] ( P, Desc) + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + 4. Return OrdinaryDefineOwnProperty(O, P, Desc). + ... +includes: [testBigIntTypedArray.js, propertyHelper.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + sample.foo = true; + sample.bar = true; + + Object.preventExtensions(sample); + + assert.sameValue( + Reflect.defineProperty(sample, "foo", {value:42}), + true, + "data descriptor" + ); + + assert.sameValue(sample.foo, 42); + verifyEnumerable(sample, "foo"); + verifyWritable(sample, "foo"); + verifyConfigurable(sample, "foo"); + + var fnget = function() {}; + var fnset = function() {}; + + assert.sameValue( + Reflect.defineProperty(sample, "bar", { + get: fnget, + set: fnset, + enumerable: false, + configurable: false + }), + true, + "accessor descriptor" + ); + + var desc = Object.getOwnPropertyDescriptor(sample, "bar"); + assert.sameValue(desc.get, fnget, "accessor's get"); + assert.sameValue(desc.set, fnset, "accessor's set"); + verifyNotEnumerable(sample, "bar"); + verifyNotConfigurable(sample, "bar"); +}); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/set-value.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/set-value.js new file mode 100644 index 000000000..f17b06837 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/set-value.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-defineownproperty-p-desc +description: > + Set the value and return true +info: | + 9.4.5.3 [[DefineOwnProperty]] ( P, Desc) + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + xi. If Desc has a [[Value]] field, then + 1. Let value be Desc.[[Value]]. + 2. Return ? IntegerIndexedElementSet(O, intIndex, value). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). + 16. Return true. +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([0, 0])); + + assert.sameValue( + Reflect.defineProperty(sample, "0", {value: convertToBigInt(1)}), + true, + "set value for sample[0] returns true" + ); + + assert.sameValue( + Reflect.defineProperty(sample, "1", {value: convertToBigInt(2)}), + true, + "set value for sample[1] returns true" + ); + + assert.sameValue(sample[0], convertToBigInt(1), "sample[0]"); + assert.sameValue(sample[1], convertToBigInt(2), "sample[1]"); +}); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/this-is-not-extensible.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/this-is-not-extensible.js new file mode 100644 index 000000000..04664a126 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/this-is-not-extensible.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-defineownproperty-p-desc +description: > + Returns false for non-numeric index property value if `this` is not extensible +info: | + 9.4.5.3 [[DefineOwnProperty]] ( P, Desc) + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + 4. Return OrdinaryDefineOwnProperty(O, P, Desc). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + + Object.preventExtensions(sample); + + assert.sameValue(Reflect.defineProperty(sample, "foo", {value:42}), false); + assert.sameValue(Reflect.getOwnPropertyDescriptor(sample, "foo"), undefined); + + var s = Symbol("1"); + assert.sameValue(Reflect.defineProperty(sample, s, {value:42}), false); + assert.sameValue(Reflect.getOwnPropertyDescriptor(sample, s), undefined); +}); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/tonumber-value-detached-buffer.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/tonumber-value-detached-buffer.js new file mode 100644 index 000000000..26eb3526b --- /dev/null +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/tonumber-value-detached-buffer.js @@ -0,0 +1,55 @@ +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-integer-indexed-exotic-objects-defineownproperty-p-desc +description: > + Defining a typed array element to a value that, when converted to the typed + array element type, detaches the typed array's underlying buffer, should + throw a TypeError and not modify the typed array. +info: | + 9.4.5.3 [[DefineOwnProperty]] ( P, Desc ) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + x. If Desc has a [[Value]] field, then + 1. Let value be Desc.[[Value]]. + 2. Return ? IntegerIndexedElementSet(O, numericIndex, value). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). + 16. Return true. +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var ta = new TA([17]); + + var desc = + { + value: { + valueOf: function() { + $262.detachArrayBuffer(ta.buffer); + return 42; + } + } + }; + + assert.throws(TypeError, function() { + Reflect.defineProperty(ta, 0, desc); + }, + "detaching a ArrayBuffer during defining an element of a typed array " + + "viewing it should throw"); + + assert.throws(TypeError, function() { + ta[0]; + }); +}); + diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/desc-value-throws.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/desc-value-throws.js index ba658f221..6572c1f94 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/desc-value-throws.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/desc-value-throws.js @@ -31,8 +31,8 @@ var obj = { } }; -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42]); assert.throws(Test262Error, function() { Object.defineProperty(sample, "0", {value: obj}); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-greater-than-last-index.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-greater-than-last-index.js index 4cc13c6f5..afb5672b9 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-greater-than-last-index.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-greater-than-last-index.js @@ -20,8 +20,8 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); assert.sameValue( Reflect.defineProperty(sample, "2", { diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-lower-than-zero.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-lower-than-zero.js index 3c63a0ab7..ba21aec9c 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-lower-than-zero.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-lower-than-zero.js @@ -18,8 +18,8 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); assert.sameValue( Reflect.defineProperty(sample, "-1", { diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-minus-zero.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-minus-zero.js index 207344f83..c891f5cc1 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-minus-zero.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-minus-zero.js @@ -18,7 +18,7 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample = new TA(2); assert.sameValue( @@ -31,6 +31,6 @@ testWithTypedArrayConstructors(function(TA, N) { false, "defineProperty returns false" ); - assert.sameValue(sample[0], N(0), "does not change the value for [0]"); + assert.sameValue(sample[0], 0, "does not change the value for [0]"); assert.sameValue(sample["-0"], undefined, "does define a value for ['-0']"); }); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-canonical-index.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-canonical-index.js index 33511ca7b..193d91665 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-canonical-index.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-canonical-index.js @@ -24,6 +24,12 @@ var keys = [ "0.0000001" ]; +var dataDesc = { + value: 42, + writable: true, + configurable: true +}; + var fnset = function() {}; var fnget = function() {}; @@ -34,14 +40,8 @@ var acDesc = { configurable: false }; -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { keys.forEach(function(key) { - var dataDesc = { - value: N(42), - writable: true, - configurable: true - }; - var sample1 = new TA(); assert.sameValue( @@ -50,7 +50,7 @@ testWithTypedArrayConstructors(function(TA, N) { "return true after defining data property [" + key + "]" ); - assert.sameValue(sample1[key], N(42), "value is set to [" + key + "]"); + assert.sameValue(sample1[key], 42, "value is set to [" + key + "]"); verifyNotEnumerable(sample1, key); verifyWritable(sample1, key); verifyConfigurable(sample1, key); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-integer.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-integer.js index 4232ab638..b30fc17ec 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-integer.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-integer.js @@ -16,7 +16,7 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample = new TA(2); assert.sameValue( @@ -29,7 +29,7 @@ testWithTypedArrayConstructors(function(TA, N) { false, "0.1" ); - assert.sameValue(sample[0], N(0), "'0.1' - does not change the value for [0]"); + assert.sameValue(sample[0], 0, "'0.1' - does not change the value for [0]"); assert.sameValue( sample["0.1"], undefined, @@ -47,7 +47,7 @@ testWithTypedArrayConstructors(function(TA, N) { "0.000001" ); assert.sameValue( - sample[0], N(0), + sample[0], 0, "'0.000001' - does not change the value for [0]" ); assert.sameValue( @@ -66,7 +66,7 @@ testWithTypedArrayConstructors(function(TA, N) { false, "1.1" ); - assert.sameValue(sample[1], N(0), "'1.1' - does not change the value for [1]"); + assert.sameValue(sample[1], 0, "'1.1' - does not change the value for [1]"); assert.sameValue( sample["1.1"], undefined, @@ -84,11 +84,11 @@ testWithTypedArrayConstructors(function(TA, N) { "Infinity" ); assert.sameValue( - sample[0], N(0), + sample[0], 0, "'Infinity' - does not change the value for [0]" ); assert.sameValue( - sample[1], N(0), + sample[1], 0, "'Infinity' - does not change the value for [1]" ); assert.sameValue( @@ -108,11 +108,11 @@ testWithTypedArrayConstructors(function(TA, N) { "-Infinity" ); assert.sameValue( - sample[0], N(0), + sample[0], 0, "'-Infinity' - does not change the value for [0]" ); assert.sameValue( - sample[1], N(0), + sample[1], 0, "'-Infinity' - does not change the value for [1]" ); assert.sameValue( diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-numeric-index.js index b51e1f237..845a9afbe 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-numeric-index.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-numeric-index.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js, propertyHelper.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); assert.sameValue( Reflect.defineProperty(sample, "foo", {value:42}), diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-accessor-desc.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-accessor-desc.js index 0c9e90797..5d8be8a2a 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-accessor-desc.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-accessor-desc.js @@ -18,7 +18,7 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample = new TA(2); assert.sameValue( @@ -31,7 +31,7 @@ testWithTypedArrayConstructors(function(TA, N) { false, "get accessor" ); - assert.sameValue(sample[0], N(0), "get accessor - side effect check"); + assert.sameValue(sample[0], 0, "get accessor - side effect check"); assert.sameValue( Reflect.defineProperty(sample, "0", { @@ -41,7 +41,7 @@ testWithTypedArrayConstructors(function(TA, N) { false, "set accessor" ); - assert.sameValue(sample[0], N(0), "set accessor - side effect check"); + assert.sameValue(sample[0], 0, "set accessor - side effect check"); assert.sameValue( Reflect.defineProperty(sample, "0", { @@ -54,5 +54,5 @@ testWithTypedArrayConstructors(function(TA, N) { false, "get and set accessors" ); - assert.sameValue(sample[0], N(0), "get and set accessors - side effect check"); + assert.sameValue(sample[0], 0, "get and set accessors - side effect check"); }); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-configurable.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-configurable.js index 5b03b57bf..133f3343d 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-configurable.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-configurable.js @@ -18,7 +18,7 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample = new TA(2); assert.sameValue( @@ -31,5 +31,5 @@ testWithTypedArrayConstructors(function(TA, N) { false, "defineProperty's result" ); - assert.sameValue(sample[0], N(0), "side effect check"); + assert.sameValue(sample[0], 0, "side effect check"); }); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-not-enumerable.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-not-enumerable.js index 7bf886140..09526d11f 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-not-enumerable.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-not-enumerable.js @@ -18,7 +18,7 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample = new TA(2); assert.sameValue( @@ -31,5 +31,5 @@ testWithTypedArrayConstructors(function(TA, N) { false, "defineProperty's result" ); - assert.sameValue(sample[0], N(0), "side effect check"); + assert.sameValue(sample[0], 0, "side effect check"); }); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-not-writable.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-not-writable.js index ab460e4e6..08c9a1b3a 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-not-writable.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-not-writable.js @@ -18,7 +18,7 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample = new TA(2); assert.sameValue( @@ -31,5 +31,5 @@ testWithTypedArrayConstructors(function(TA, N) { false, "defineProperty's result" ); - assert.sameValue(sample[0], N(0), "side effect check"); + assert.sameValue(sample[0], 0, "side effect check"); }); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex.js index c6ddb1070..d815738b6 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex.js @@ -18,12 +18,12 @@ includes: [testTypedArray.js, propertyHelper.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 42]); assert.sameValue( Reflect.defineProperty(sample, "0", { - value: N(8), + value: 8, configurable: false, enumerable: true, writable: true @@ -31,10 +31,10 @@ testWithTypedArrayConstructors(function(TA, N) { true ); - assert.sameValue(sample[0], N(8), "property value was set"); + assert.sameValue(sample[0], 8, "property value was set"); var desc = Object.getOwnPropertyDescriptor(sample, "0"); - assert.sameValue(desc.value, N(8), "desc.value"); + assert.sameValue(desc.value, 8, "desc.value"); assert.sameValue(desc.writable, true, "property is writable"); verifyEnumerable(sample, "0"); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-symbol.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-symbol.js index 856997801..c5cff6eee 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/key-is-symbol.js @@ -15,8 +15,8 @@ includes: [testTypedArray.js, propertyHelper.js] features: [Reflect, Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); var s1 = Symbol("foo"); assert.sameValue( diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/non-extensible-new-key.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/non-extensible-new-key.js index 681630928..e74c95f12 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/non-extensible-new-key.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/non-extensible-new-key.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); Object.preventExtensions(sample); assert.sameValue( diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/non-extensible-redefine-key.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/non-extensible-redefine-key.js index 5983e6dfb..a0baaf57e 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/non-extensible-redefine-key.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/non-extensible-redefine-key.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js, propertyHelper.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); sample.foo = true; sample.bar = true; diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/set-value.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/set-value.js index 0571a46ea..ff71bee90 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/set-value.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/set-value.js @@ -25,21 +25,21 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([0, 0])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([0, 0]); assert.sameValue( - Reflect.defineProperty(sample, "0", {value: N(1)}), + Reflect.defineProperty(sample, "0", {value: 1}), true, "set value for sample[0] returns true" ); assert.sameValue( - Reflect.defineProperty(sample, "1", {value: N(2)}), + Reflect.defineProperty(sample, "1", {value: 2}), true, "set value for sample[1] returns true" ); - assert.sameValue(sample[0], N(1), "sample[0]"); - assert.sameValue(sample[1], N(2), "sample[1]"); + assert.sameValue(sample[0], 1, "sample[0]"); + assert.sameValue(sample[1], 2, "sample[1]"); }); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/this-is-not-extensible.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/this-is-not-extensible.js index e4f54b45e..5e586c775 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/this-is-not-extensible.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/this-is-not-extensible.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js] features: [Reflect, Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); Object.preventExtensions(sample); diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer-key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer-key-is-not-numeric-index.js new file mode 100644 index 000000000..b9caa2ddf --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer-key-is-not-numeric-index.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-get-p-receiver +description: > + Does not throw on an instance with a detached buffer if key is not a number +info: | + 9.4.5.4 [[Get]] (P, Receiver) + + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + 3. Return ? OrdinaryGet(O, P, Receiver +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + sample.foo = "test262"; + + $DETACHBUFFER(sample.buffer); + + assert.sameValue(sample.undef, undefined); + assert.sameValue(sample.foo, "test262"); +}); diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer-key-is-symbol.js b/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer-key-is-symbol.js new file mode 100644 index 000000000..9af111a76 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer-key-is-symbol.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-get-p-receiver +description: > + Does not throw on an instance with a detached buffer if key is a Symbol +info: | + 9.4.5.4 [[Get]] (P, Receiver) + + ... + 2. If Type(P) is String, then + ... + 3. Return ? OrdinaryGet(O, P, Receiver). +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + $DETACHBUFFER(sample.buffer); + + var s = Symbol("1"); + + assert.sameValue(sample[s], undefined); + + sample[s] = "test262"; + assert.sameValue(sample[s], "test262"); +}); diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer-realm.js b/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer-realm.js new file mode 100644 index 000000000..af52e3392 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer-realm.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-get-p-receiver +description: > + Throws a TypeError if key has a numeric index and object has a detached + buffer (honoring the Realm of the current execution context) +info: | + 9.4.5.4 [[Get]] (P, Receiver) + + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementGet(O, numericIndex). + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, cross-realm, TypedArray] +---*/ + +var other = $262.createRealm().global; + +testWithBigIntTypedArrayConstructors(function(TA) { + var OtherTA = other[TA.name]; + var sample = new OtherTA(1); + + $DETACHBUFFER(sample.buffer); + + assert.throws(TypeError, function() { + sample[0]; + }); +}); diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer.js b/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer.js new file mode 100644 index 000000000..74b9a69d8 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-get-p-receiver +description: > + Throws a TypeError if key has a numeric index and object has a detached buffer +info: | + 9.4.5.4 [[Get]] (P, Receiver) + + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementGet(O, numericIndex). + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42])); + $DETACHBUFFER(sample.buffer); + + assert.throws(TypeError, function() { + sample[0]; + }, "valid numeric index"); + + assert.throws(TypeError, function() { + sample["1.1"]; + }, "detach buffer runs before checking for 1.1"); + + assert.throws(TypeError, function() { + sample["-0"]; + }, "detach buffer runs before checking for -0"); + + assert.throws(TypeError, function() { + sample["-1"]; + }, "detach buffer runs before checking for -1"); + + assert.throws(TypeError, function() { + sample["1"]; + }, "detach buffer runs before checking for key == length"); + + assert.throws(TypeError, function() { + sample["2"]; + }, "detach buffer runs before checking for key > length"); +}); diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/indexed-value-sab.js b/test/built-ins/TypedArrays/internals/Get/BigInt/indexed-value-sab.js new file mode 100644 index 000000000..b599b430c --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/indexed-value-sab.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-get-p-receiver +description: > + Return value from valid numeric index, with SharedArrayBuffer +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray, SharedArrayBuffer] +---*/ + +var proto = TypedArray.prototype; +var throwDesc = { + get: function() { + throw new Test262Error("OrdinaryGet was called! Ref: 9.1.8.1 3.c"); + } +}; +Object.defineProperty(proto, "0", throwDesc); +Object.defineProperty(proto, "1", throwDesc); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sab = new SharedArrayBuffer(TA.BYTES_PER_ELEMENT * 2); + var sample = new TA(sab); + sample.set([convertToBigInt(42), convertToBigInt(1)]); + + assert.sameValue(sample["0"], convertToBigInt(42)); + assert.sameValue(sample["1"], convertToBigInt(1)); +}); diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/indexed-value.js b/test/built-ins/TypedArrays/internals/Get/BigInt/indexed-value.js new file mode 100644 index 000000000..d97004b83 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/indexed-value.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-get-p-receiver +description: > + Return value from valid numeric index +info: | + 9.4.5.4 [[Get]] (P, Receiver) + + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementGet(O, numericIndex). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var proto = TypedArray.prototype; +var throwDesc = { + get: function() { + throw new Test262Error("OrdinaryGet was called! Ref: 9.1.8.1 3.c"); + } +}; +Object.defineProperty(proto, "0", throwDesc); +Object.defineProperty(proto, "1", throwDesc); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 1])); + + assert.sameValue(sample["0"], convertToBigInt(42)); + assert.sameValue(sample["1"], convertToBigInt(1)); +}); diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/infinity-detached-buffer.js b/test/built-ins/TypedArrays/internals/Get/BigInt/infinity-detached-buffer.js new file mode 100644 index 000000000..1e04f9544 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/infinity-detached-buffer.js @@ -0,0 +1,40 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-integerindexedelementget +description: > + "Infinity" is a canonical numeric string, test with access on detached buffer. +info: | + 9.4.5.4 [[Get]] ( P, Receiver ) + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementGet(O, numericIndex). + ... + + 7.1.16 CanonicalNumericIndexString ( argument ) + ... + 3. Let n be ! ToNumber(argument). + 4. If SameValue(! ToString(n), argument) is false, return undefined. + 5. Return n. + + 9.4.5.8 IntegerIndexedElementGet ( O, index ) + ... + 3. Let buffer be O.[[ViewedArrayBuffer]]. + 4. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... + +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(0); + $DETACHBUFFER(sample.buffer); + + assert.throws(TypeError, function() { + sample.Infinity; + }); +}); diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-canonical-index.js b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-canonical-index.js new file mode 100644 index 000000000..5a599409a --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-canonical-index.js @@ -0,0 +1,61 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-get-p-receiver +description: > + Use OrginaryGet if numeric key is not a CanonicalNumericIndex +info: | + 9.4.5.4 [[Get]] (P, Receiver) + + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + 3. Return ? OrdinaryGet(O, P, Receiver). +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var keys = [ + "1.0", + "+1", + "1000000000000000000000", + "0.0000001" +]; + +testWithBigIntTypedArrayConstructors(function(TA) { + keys.forEach(function(key) { + var sample = new TA(); + + assert.sameValue( + sample[key], undefined, + "return undefined for inexistent properties [" + key + "]" + ); + + TypedArray.prototype[key] = "test262"; + + assert.sameValue( + sample[key], + "test262", + "return value from inherited key [" + key + "]" + ); + + sample[key] = "bar"; + assert.sameValue( + sample[key], "bar", + "return value from own key [" + key + "]" + ); + + Object.defineProperty(sample, key, { + get: function() { return "baz"; } + }); + + assert.sameValue( + sample[key], "baz", + "return value from get accessor [" + key + "]" + ); + + delete TypedArray.prototype[key]; + }); +}); diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-integer.js b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-integer.js new file mode 100644 index 000000000..8f844f550 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-integer.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-get-p-receiver +description: > + Return undefined if key is numeric index is not an integer. +info: | + 9.4.5.4 [[Get]] (P, Receiver) + + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementGet(O, numericIndex). + ... + + 9.4.5.8 IntegerIndexedElementGet ( O, index ) + + ... + 5. If IsInteger(index) is false, return undefined. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var proto = TypedArray.prototype; +Object.defineProperty(proto, "1.1", { + get: function() { + throw new Test262Error("OrdinaryGet was called! Ref: 9.1.8.1 3.c"); + } +}); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + + assert.sameValue(sample["1.1"], undefined); +}); diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-minus-zero.js b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-minus-zero.js new file mode 100644 index 000000000..30917db64 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-minus-zero.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-get-p-receiver +description: > + Return undefined if key is numeric index is -0. +info: | + 9.4.5.4 [[Get]] (P, Receiver) + + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementGet(O, numericIndex). + ... + + 9.4.5.8 IntegerIndexedElementGet ( O, index ) + + ... + 6. If index = -0, return undefined. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var proto = TypedArray.prototype; +Object.defineProperty(proto, "-0", { + get: function() { + throw new Test262Error("OrdinaryGet was called! Ref: 9.1.8.1 3.c"); + } +}); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + + assert.sameValue(sample["-0"], undefined); +}); diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-numeric-index-get-throws.js b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-numeric-index-get-throws.js new file mode 100644 index 000000000..a532b6cea --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-numeric-index-get-throws.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-get-p-receiver +description: > + Returns abrupt from OrginaryGet when key is not a numeric index +info: | + 9.4.5.4 [[Get]] (P, Receiver) + + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + 3. Return ? OrdinaryGet(O, P, Receiver). + + 9.1.8.1 OrdinaryGet (O, P, Receiver) + + ... + 8. Return ? Call(getter, Receiver). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + + Object.defineProperty(sample, "test262", { + get: function() { + throw new Test262Error(); + } + }); + + assert.throws(Test262Error, function() { + sample.test262; + }); +}); diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-numeric-index.js new file mode 100644 index 000000000..8eb2c0714 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-numeric-index.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-get-p-receiver +description: > + Use OrginaryGet if key is not a CanonicalNumericIndex +info: | + 9.4.5.4 [[Get]] (P, Receiver) + + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + 3. Return ? OrdinaryGet(O, P, Receiver). +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +TypedArray.prototype.baz = "test262"; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + + assert.sameValue( + sample.foo, undefined, + "return undefined for inexistent properties" + ); + + sample.foo = "bar"; + assert.sameValue(sample.foo, "bar", "return value"); + + Object.defineProperty(sample, "bar", { + get: function() { return "baz"; } + }); + assert.sameValue(sample.bar, "baz", "return value from get accessor"); + + assert.sameValue(sample.baz, "test262", "return value from inherited key"); +}); diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-out-of-bounds.js b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-out-of-bounds.js new file mode 100644 index 000000000..b8f0b02a6 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-out-of-bounds.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-get-p-receiver +description: > + Return undefined if key is numeric index < 0 or index ≥ [[ArrayLength]]. +info: | + 9.4.5.4 [[Get]] (P, Receiver) + + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementGet(O, numericIndex). + ... + + 9.4.5.8 IntegerIndexedElementGet ( O, index ) + + ... + 7. Let length be the value of O's [[ArrayLength]] internal slot. + 8. If index < 0 or index ≥ length, return undefined. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var proto = TypedArray.prototype; +var throwDesc = { + get: function() { + throw new Test262Error("OrdinaryGet was called! Ref: 9.1.8.1 3.c"); + } +}; +Object.defineProperty(proto, "-1", throwDesc); +Object.defineProperty(proto, "2", throwDesc); +Object.defineProperty(proto, "3", throwDesc); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + + assert.sameValue(sample["-1"], undefined); + assert.sameValue(sample["2"], undefined); + assert.sameValue(sample["3"], undefined); +}); diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-symbol.js b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-symbol.js new file mode 100644 index 000000000..52113ec86 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-symbol.js @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-get-p-receiver +description: > + Use OrginaryGet if key is a Symbol +info: | + 9.4.5.4 [[Get]] (P, Receiver) + + ... + 2. If Type(P) is String, then + ... + 3. Return ? OrdinaryGet(O, P, Receiver). +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var parentKey = Symbol("2"); +TypedArray.prototype[parentKey] = "test262"; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42])); + + var s1 = Symbol("1"); + + assert.sameValue( + sample[s1], undefined, + "return undefined if not property is present" + ); + + sample[s1] = "foo"; + assert.sameValue(sample[s1], "foo", "return value"); + + Object.defineProperty(sample, s1, { + get: function() { return "bar"; } + }); + assert.sameValue(sample[s1], "bar", "return value from get accessor"); + + assert.sameValue(sample[parentKey], "test262", "value from parent key"); +}); diff --git a/test/built-ins/TypedArrays/internals/Get/detached-buffer-key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/Get/detached-buffer-key-is-not-numeric-index.js index 4ebb82f7e..b0032bad7 100644 --- a/test/built-ins/TypedArrays/internals/Get/detached-buffer-key-is-not-numeric-index.js +++ b/test/built-ins/TypedArrays/internals/Get/detached-buffer-key-is-not-numeric-index.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js, detachArrayBuffer.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); sample.foo = "test262"; $DETACHBUFFER(sample.buffer); diff --git a/test/built-ins/TypedArrays/internals/Get/detached-buffer-key-is-symbol.js b/test/built-ins/TypedArrays/internals/Get/detached-buffer-key-is-symbol.js index 9910fe6eb..2b18a93ea 100644 --- a/test/built-ins/TypedArrays/internals/Get/detached-buffer-key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/Get/detached-buffer-key-is-symbol.js @@ -15,8 +15,8 @@ includes: [testTypedArray.js, detachArrayBuffer.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); $DETACHBUFFER(sample.buffer); var s = Symbol("1"); diff --git a/test/built-ins/TypedArrays/internals/Get/detached-buffer.js b/test/built-ins/TypedArrays/internals/Get/detached-buffer.js index 467aff7cf..4e52b1cf0 100644 --- a/test/built-ins/TypedArrays/internals/Get/detached-buffer.js +++ b/test/built-ins/TypedArrays/internals/Get/detached-buffer.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js, detachArrayBuffer.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42]); $DETACHBUFFER(sample.buffer); assert.throws(TypeError, function() { diff --git a/test/built-ins/TypedArrays/internals/Get/indexed-value-sab.js b/test/built-ins/TypedArrays/internals/Get/indexed-value-sab.js index c9e49d861..6145da9e2 100644 --- a/test/built-ins/TypedArrays/internals/Get/indexed-value-sab.js +++ b/test/built-ins/TypedArrays/internals/Get/indexed-value-sab.js @@ -18,11 +18,11 @@ var throwDesc = { Object.defineProperty(proto, "0", throwDesc); Object.defineProperty(proto, "1", throwDesc); -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sab = new SharedArrayBuffer(TA.BYTES_PER_ELEMENT * 2); var sample = new TA(sab); - sample.set([N(42), N(1)]); + sample.set([42, 1]); - assert.sameValue(sample["0"], N(42)); - assert.sameValue(sample["1"], N(1)); + assert.sameValue(sample["0"], 42); + assert.sameValue(sample["1"], 1); }); diff --git a/test/built-ins/TypedArrays/internals/Get/indexed-value.js b/test/built-ins/TypedArrays/internals/Get/indexed-value.js index cb761c6db..f58c528b6 100644 --- a/test/built-ins/TypedArrays/internals/Get/indexed-value.js +++ b/test/built-ins/TypedArrays/internals/Get/indexed-value.js @@ -26,9 +26,9 @@ var throwDesc = { Object.defineProperty(proto, "0", throwDesc); Object.defineProperty(proto, "1", throwDesc); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 1])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 1]); - assert.sameValue(sample["0"], N(42)); - assert.sameValue(sample["1"], N(1)); + assert.sameValue(sample["0"], 42); + assert.sameValue(sample["1"], 1); }); diff --git a/test/built-ins/TypedArrays/internals/Get/key-is-not-integer.js b/test/built-ins/TypedArrays/internals/Get/key-is-not-integer.js index 258f11193..5ad684b78 100644 --- a/test/built-ins/TypedArrays/internals/Get/key-is-not-integer.js +++ b/test/built-ins/TypedArrays/internals/Get/key-is-not-integer.js @@ -30,8 +30,8 @@ Object.defineProperty(proto, "1.1", { } }); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); assert.sameValue(sample["1.1"], undefined); }); diff --git a/test/built-ins/TypedArrays/internals/Get/key-is-not-minus-zero.js b/test/built-ins/TypedArrays/internals/Get/key-is-not-minus-zero.js index 45e7af40f..851cf72b4 100644 --- a/test/built-ins/TypedArrays/internals/Get/key-is-not-minus-zero.js +++ b/test/built-ins/TypedArrays/internals/Get/key-is-not-minus-zero.js @@ -30,8 +30,8 @@ Object.defineProperty(proto, "-0", { } }); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); assert.sameValue(sample["-0"], undefined); }); diff --git a/test/built-ins/TypedArrays/internals/Get/key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/Get/key-is-not-numeric-index.js index 116f04275..53824ad34 100644 --- a/test/built-ins/TypedArrays/internals/Get/key-is-not-numeric-index.js +++ b/test/built-ins/TypedArrays/internals/Get/key-is-not-numeric-index.js @@ -19,8 +19,8 @@ features: [TypedArray] TypedArray.prototype.baz = "test262"; -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); assert.sameValue( sample.foo, undefined, diff --git a/test/built-ins/TypedArrays/internals/Get/key-is-out-of-bounds.js b/test/built-ins/TypedArrays/internals/Get/key-is-out-of-bounds.js index dfb3d0411..a6eaa05df 100644 --- a/test/built-ins/TypedArrays/internals/Get/key-is-out-of-bounds.js +++ b/test/built-ins/TypedArrays/internals/Get/key-is-out-of-bounds.js @@ -34,8 +34,8 @@ Object.defineProperty(proto, "-1", throwDesc); Object.defineProperty(proto, "2", throwDesc); Object.defineProperty(proto, "3", throwDesc); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); assert.sameValue(sample["-1"], undefined); assert.sameValue(sample["2"], undefined); diff --git a/test/built-ins/TypedArrays/internals/Get/key-is-symbol.js b/test/built-ins/TypedArrays/internals/Get/key-is-symbol.js index 3454fd676..1d05d06bc 100644 --- a/test/built-ins/TypedArrays/internals/Get/key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/Get/key-is-symbol.js @@ -18,8 +18,8 @@ features: [Symbol, TypedArray] var parentKey = Symbol("2"); TypedArray.prototype[parentKey] = "test262"; -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42]); var s1 = Symbol("1"); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer-key-is-not-number.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer-key-is-not-number.js new file mode 100644 index 000000000..6148dbea1 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer-key-is-not-number.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-getownproperty-p +description: > + Does not throw on an instance with a detached buffer if key is not a number +info: | + 9.4.5.1 [[GetOwnProperty]] ( P ) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + 4. Return OrdinaryGetOwnProperty(O, P). +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + $DETACHBUFFER(sample.buffer); + + assert.sameValue( + Object.getOwnPropertyDescriptor(sample, "undef"), + undefined, + "undefined property" + ); + + // Tests for the property descriptor are defined on the tests for + // [[DefineOwnProperty]] calls + Object.defineProperty(sample, "foo", { value: "bar" }); + assert.sameValue( + Object.getOwnPropertyDescriptor(sample, "foo").value, + "bar", + "return value from a String key" + ); +}); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer-key-is-symbol.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer-key-is-symbol.js new file mode 100644 index 000000000..ecd044e13 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer-key-is-symbol.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-getownproperty-p +description: > + Does not throw on an instance with a detached buffer if key is a Symbol +info: | + 9.4.5.1 [[GetOwnProperty]] ( P ) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + 4. Return OrdinaryGetOwnProperty(O, P). +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + $DETACHBUFFER(sample.buffer); + + var s = Symbol("foo"); + Object.defineProperty(sample, s, { value: "baz" }); + assert.sameValue( + Object.getOwnPropertyDescriptor(sample, s).value, + "baz", + "return value from a Symbol key" + ); +}); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer-realm.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer-realm.js new file mode 100644 index 000000000..91c06732b --- /dev/null +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer-realm.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-getownproperty-p +description: > + Throws a TypeError if this has a detached buffer (honoring the Realm of the + current execution context) +info: | + 9.4.5.1 [[GetOwnProperty]] ( P ) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Let value be ? IntegerIndexedElementGet(O, numericIndex). + ... + + 9.4.5.8 IntegerIndexedElementGet ( O, index ) + + ... + 3. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot. + 4. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, cross-realm, TypedArray] +---*/ + +var other = $262.createRealm().global; + +testWithBigIntTypedArrayConstructors(function(TA) { + var OtherTA = other[TA.name]; + var sample = new OtherTA(1); + + $DETACHBUFFER(sample.buffer); + + assert.throws(TypeError, function() { + Object.getOwnPropertyDescriptor(sample, 0); + }); +}); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer.js new file mode 100644 index 000000000..5f14f0317 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-getownproperty-p +description: Throws a TypeError if this has a detached buffer +info: | + 9.4.5.1 [[GetOwnProperty]] ( P ) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Let value be ? IntegerIndexedElementGet(O, numericIndex). + ... + + 9.4.5.8 IntegerIndexedElementGet ( O, index ) + + ... + 3. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot. + 4. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + + assert.throws(TypeError, function() { + Object.getOwnPropertyDescriptor(sample, 0); + }); +}); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/enumerate-detached-buffer.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/enumerate-detached-buffer.js new file mode 100644 index 000000000..9523e3a5f --- /dev/null +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/enumerate-detached-buffer.js @@ -0,0 +1,42 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-integer-indexed-exotic-objects-getownproperty-p +description: Test for-in enumeration with detached buffer. +info: | + 9.4.5.1 [[GetOwnProperty]] ( P ) + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Let value be ? IntegerIndexedElementGet(O, numericIndex). + ... + + 9.4.5.8 IntegerIndexedElementGet ( O, index ) + ... + 3. Let buffer be O.[[ViewedArrayBuffer]]. + 4. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... + + 13.7.5.15 EnumerateObjectProperties (O) + ... + EnumerateObjectProperties must obtain the own property keys of the + target object by calling its [[OwnPropertyKeys]] internal method. + Property attributes of the target object must be obtained by + calling its [[GetOwnProperty]] internal method. + +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(42); + $DETACHBUFFER(sample.buffer); + + assert.throws(TypeError, function() { + for (var key in sample) { + throw new Test262Error(); + } + }); +}); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/index-prop-desc.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/index-prop-desc.js new file mode 100644 index 000000000..34c96bd49 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/index-prop-desc.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-getownproperty-p +description: > + Returns a descriptor object from an index property +info: | + 9.4.5.1 [[GetOwnProperty]] ( P ) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + iii. Return a PropertyDescriptor{[[Value]]: value, [[Writable]]: true, + [[Enumerable]]: true, [[Configurable]]: false}. + ... +includes: [testBigIntTypedArray.js, propertyHelper.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + + var desc0 = Object.getOwnPropertyDescriptor(sample, 0); + assert.sameValue(desc0.value, convertToBigInt(42), "value", "desc0.value === 42"); + assert.sameValue(desc0.writable, true, "index descriptor is writable [0]"); + verifyEnumerable(sample, "0", "index descriptor is enumerable [0]"); + verifyNotConfigurable(sample, "0", "index descriptor is not configurable [0]"); + + var desc1 = Object.getOwnPropertyDescriptor(sample, 1); + assert.sameValue(desc1.value, convertToBigInt(43), "value", "desc1.value === 43"); + assert.sameValue(desc1.writable, true, "index descriptor is writable [1]"); + verifyEnumerable(sample, "1", "index descriptor is enumerable [1]"); + verifyNotConfigurable(sample, "1", "index descriptor is not configurable [1]"); +}); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-minus-zero.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-minus-zero.js new file mode 100644 index 000000000..1b4f76c0f --- /dev/null +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-minus-zero.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-getownproperty-p +description: Returns undefined when P is -0. +info: | + 9.4.5.1 [[GetOwnProperty]] ( P ) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Let value be ? IntegerIndexedElementGet(O, numericIndex). + ii. If value is undefined, return undefined. + ... + + 7.1.16 CanonicalNumericIndexString ( argument ) + + ... + 2. If argument is "-0", return -0. + ... + + 9.4.5.8 IntegerIndexedElementGet ( O, index ) + + ... + 6. If index = -0, return undefined. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42])); + + // -0 as a number value is converted to "0" before calling [[GetOwnProperty]] + assert.sameValue(Object.getOwnPropertyDescriptor(sample, "-0"), undefined); +}); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-canonical-index.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-canonical-index.js new file mode 100644 index 000000000..b9a163b79 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-canonical-index.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-getownproperty-p +description: > + Returns an ordinary property value if numeric key is not a + CanonicalNumericIndex +info: | + 9.4.5.1 [[GetOwnProperty]] ( P ) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + 4. Return OrdinaryGetOwnProperty(O, P). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var keys = [ + "1.0", + "+1", + "1000000000000000000000", + "0.0000001" +]; + +testWithBigIntTypedArrayConstructors(function(TA) { + keys.forEach(function(key) { + var sample = new TA(convertToBigInt([42, 43])); + + assert.sameValue( + Object.getOwnPropertyDescriptor(sample, key), + undefined, + "undefined property [" + key + "]" + ); + + // Tests for the property descriptor are defined on the tests for + // [[DefineOwnProperty]] calls + Object.defineProperty(sample, key, {value: "bar"}); + assert.sameValue( + Object.getOwnPropertyDescriptor(sample, key).value, + "bar", + "return value from a ordinary property key [" + key + "]" + ); + }); +}); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-integer.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-integer.js new file mode 100644 index 000000000..bc8674429 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-integer.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-getownproperty-p +description: Returns undefined when P is not an integer. +info: | + 9.4.5.1 [[GetOwnProperty]] ( P ) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Let value be ? IntegerIndexedElementGet(O, numericIndex). + ii. If value is undefined, return undefined. + ... + + 9.4.5.8 IntegerIndexedElementGet ( O, index ) + + ... + 5. If IsInteger(index) is false, return undefined. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + + assert.sameValue(Object.getOwnPropertyDescriptor(sample, "1.1"), undefined); + assert.sameValue(Object.getOwnPropertyDescriptor(sample, "0.1"), undefined); +}); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-numeric-index.js new file mode 100644 index 000000000..d00d1a626 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-numeric-index.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-getownproperty-p +description: > + Returns an ordinary property value if key is not a CanonicalNumericIndex +info: | + 9.4.5.1 [[GetOwnProperty]] ( P ) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + 4. Return OrdinaryGetOwnProperty(O, P). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + + assert.sameValue( + Object.getOwnPropertyDescriptor(sample, "undef"), + undefined, + "undefined property" + ); + + // Tests for the property descriptor are defined on the tests for + // [[DefineOwnProperty]] calls + Object.defineProperty(sample, "foo", { value: "bar" }); + assert.sameValue( + Object.getOwnPropertyDescriptor(sample, "foo").value, + "bar", + "return value from a String key" + ); +}); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-out-of-bounds.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-out-of-bounds.js new file mode 100644 index 000000000..8bb915de6 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-out-of-bounds.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-getownproperty-p +description: Returns undefined when P is not a valid index number. +info: | + 9.4.5.1 [[GetOwnProperty]] ( P ) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Let value be ? IntegerIndexedElementGet(O, numericIndex). + ii. If value is undefined, return undefined. + ... + + 9.4.5.8 IntegerIndexedElementGet ( O, index ) + + ... + 7. Let length be the value of O's [[ArrayLength]] internal slot. + 8. If index < 0 or index ≥ length, return undefined. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42])); + + assert.sameValue(Object.getOwnPropertyDescriptor(sample, "-1"), undefined); + assert.sameValue(Object.getOwnPropertyDescriptor(sample, "-42"), undefined); + assert.sameValue(Object.getOwnPropertyDescriptor(sample, "1"), undefined); + assert.sameValue(Object.getOwnPropertyDescriptor(sample, "42"), undefined); +}); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-symbol.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-symbol.js new file mode 100644 index 000000000..dd1cbdfb5 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-symbol.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-getownproperty-p +description: > + Returns an ordinary property value if key is a Symbol +info: | + 9.4.5.1 [[GetOwnProperty]] ( P ) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + 4. Return OrdinaryGetOwnProperty(O, P). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + + var s = Symbol("foo"); + Object.defineProperty(sample, s, { value: "baz" }); + assert.sameValue( + Object.getOwnPropertyDescriptor(sample, s).value, + "baz", + "return value from a Symbol key" + ); +}); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/detached-buffer-key-is-not-number.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/detached-buffer-key-is-not-number.js index c0f54cd4a..81b274361 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/detached-buffer-key-is-not-number.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/detached-buffer-key-is-not-number.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js, detachArrayBuffer.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); $DETACHBUFFER(sample.buffer); assert.sameValue( diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/detached-buffer-key-is-symbol.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/detached-buffer-key-is-symbol.js index b637e6fe3..308a2973f 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/detached-buffer-key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/detached-buffer-key-is-symbol.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js, detachArrayBuffer.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); $DETACHBUFFER(sample.buffer); var s = Symbol("foo"); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/index-prop-desc.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/index-prop-desc.js index 0771ae51e..fe7f1eca2 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/index-prop-desc.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/index-prop-desc.js @@ -19,17 +19,17 @@ includes: [testTypedArray.js, propertyHelper.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); var desc0 = Object.getOwnPropertyDescriptor(sample, 0); - assert.sameValue(desc0.value, N(42), "value", "desc0.value === 42"); + assert.sameValue(desc0.value, 42, "value", "desc0.value === 42"); assert.sameValue(desc0.writable, true, "index descriptor is writable [0]"); verifyEnumerable(sample, "0", "index descriptor is enumerable [0]"); verifyNotConfigurable(sample, "0", "index descriptor is not configurable [0]"); var desc1 = Object.getOwnPropertyDescriptor(sample, 1); - assert.sameValue(desc1.value, N(43), "value", "desc1.value === 43"); + assert.sameValue(desc1.value, 43, "value", "desc1.value === 43"); assert.sameValue(desc1.writable, true, "index descriptor is writable [1]"); verifyEnumerable(sample, "1", "index descriptor is enumerable [1]"); verifyNotConfigurable(sample, "1", "index descriptor is not configurable [1]"); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-minus-zero.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-minus-zero.js index 93fb63a55..1b1c828ab 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-minus-zero.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-minus-zero.js @@ -29,8 +29,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42]); // -0 as a number value is converted to "0" before calling [[GetOwnProperty]] assert.sameValue(Object.getOwnPropertyDescriptor(sample, "-0"), undefined); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-canonical-index.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-canonical-index.js index e2f7352a0..35b6fa01c 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-canonical-index.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-canonical-index.js @@ -26,9 +26,9 @@ var keys = [ "0.0000001" ]; -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { keys.forEach(function(key) { - var sample = new TA(N([42, 43])); + var sample = new TA([42, 43]); assert.sameValue( Object.getOwnPropertyDescriptor(sample, key), diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-integer.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-integer.js index 78e7e5915..f77950d72 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-integer.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-integer.js @@ -23,8 +23,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); assert.sameValue(Object.getOwnPropertyDescriptor(sample, "1.1"), undefined); assert.sameValue(Object.getOwnPropertyDescriptor(sample, "0.1"), undefined); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-numeric-index.js index 32f68d2ce..57fd606ae 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-numeric-index.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-not-numeric-index.js @@ -18,8 +18,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); assert.sameValue( Object.getOwnPropertyDescriptor(sample, "undef"), diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-out-of-bounds.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-out-of-bounds.js index a02b44bb4..891bc7184 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-out-of-bounds.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-out-of-bounds.js @@ -24,8 +24,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42]); assert.sameValue(Object.getOwnPropertyDescriptor(sample, "-1"), undefined); assert.sameValue(Object.getOwnPropertyDescriptor(sample, "-42"), undefined); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-symbol.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-symbol.js index 2d31cb822..6b440e119 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/key-is-symbol.js @@ -18,8 +18,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); var s = Symbol("foo"); Object.defineProperty(sample, s, { value: "baz" }); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/BigInt/abrupt-from-ordinary-has-parent-hasproperty.js b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/abrupt-from-ordinary-has-parent-hasproperty.js new file mode 100644 index 000000000..5c788c69a --- /dev/null +++ b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/abrupt-from-ordinary-has-parent-hasproperty.js @@ -0,0 +1,63 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-hasproperty-p +description: Return abrupt from OrdinaryHasProperty parent's [[HasProperty]] +info: | + 9.4.5.2 [[HasProperty]](P) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot. + ii. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... + + 9.1.7.1 OrdinaryHasProperty (O, P) + + ... + 2. Let hasOwn be ? O.[[GetOwnProperty]](P). + 3. If hasOwn is not undefined, return true. + 4. Let parent be ? O.[[GetPrototypeOf]](). + 5. If parent is not null, then + a. Return ? parent.[[HasProperty]](P). + 6. Return false. +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, Reflect, Proxy, TypedArray] +---*/ + +var handler = { + has: function() { + throw new Test262Error(); + } +}; + +var proxy = new Proxy(TypedArray.prototype, handler); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + + Object.setPrototypeOf(sample, proxy); + + assert.sameValue( + Reflect.has(sample, 0), true, + "OrdinaryHasProperty does not affect numericIndex properties [0]" + ); + assert.sameValue( + Reflect.has(sample, 1), false, + "OrdinaryHasProperty does not affect numericIndex properties [1]" + ); + + assert.throws(Test262Error, function() { + Reflect.has(sample, "foo"); + }, "Return abrupt from parent's [[HasProperty]] 'foo'"); + + Object.defineProperty(sample, "foo", { value: 42 }); + + assert.sameValue( + Reflect.has(sample, "foo"), + true, + "trap is not triggered if [[GetOwnProperty]] returns a defined value" + ); +}); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer-key-is-not-number.js b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer-key-is-not-number.js new file mode 100644 index 000000000..d4495d2e1 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer-key-is-not-number.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-getproperty-p +description: > + Does not throw on an instance with a detached buffer if key is not a + CanonicalNumericIndexString +info: | + 9.4.5.2 [[HasProperty]](P) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + 4. Return ? OrdinaryHasProperty(O, P). +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + Object.defineProperty(sample, "bar", { value: 42 }); + + $DETACHBUFFER(sample.buffer); + + assert.sameValue(Reflect.has(sample, "foo"), false); + assert.sameValue(Reflect.has(sample, "bar"), true); +}); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer-key-is-symbol.js b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer-key-is-symbol.js new file mode 100644 index 000000000..50df7a49c --- /dev/null +++ b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer-key-is-symbol.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-hasproperty-p +description: > + Does not throw on an instance with a detached buffer if key is a Symbol +info: | + 9.4.5.2 [[HasProperty]](P) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + 4. Return ? OrdinaryHasProperty(O, P). +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, Reflect, Symbol, TypedArray] +---*/ + +var s1 = Symbol("foo"); +var s2 = Symbol("bar"); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + Object.defineProperty(sample, s1, { value: "baz" }); + + $DETACHBUFFER(sample.buffer); + + assert.sameValue(Reflect.has(sample, s1), true); + assert.sameValue(Reflect.has(sample, s2), false); +}); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer-realm.js b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer-realm.js new file mode 100644 index 000000000..3870e5282 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer-realm.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-hasproperty-p +description: > + Throws a TypeError if this has a detached buffer (honoring the Realm of the + current execution context) +info: | + 9.4.5.2 [[HasProperty]](P) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot. + ii. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, cross-realm, Reflect, TypedArray] +---*/ + +var other = $262.createRealm().global; + +testWithBigIntTypedArrayConstructors(function(TA) { + var OtherTA = other[TA.name]; + var sample = new OtherTA(1); + + $DETACHBUFFER(sample.buffer); + + assert.throws(TypeError, function() { + Reflect.has(sample, '0'); + }, '0'); +}); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer.js b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer.js new file mode 100644 index 000000000..d78265e35 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-hasproperty-p +description: Throws a TypeError if this has a detached buffer +info: | + 9.4.5.2 [[HasProperty]](P) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot. + ii. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + $DETACHBUFFER(sample.buffer); + + assert.throws(TypeError, function() { + Reflect.has(sample, "0"); + }, "0"); + + assert.throws(TypeError, function() { + Reflect.has(sample, "-0"); + }, "-0"); + + assert.throws(TypeError, function() { + Reflect.has(sample, "1.1"); + }, "1.1"); +}); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/BigInt/indexed-value.js b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/indexed-value.js new file mode 100644 index 000000000..f01eb8689 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/indexed-value.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-hasproperty-p +description: > + Return true for indexed properties +info: | + 9.4.5.2 [[HasProperty]](P) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot. + ii. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + iii. If IsInteger(numericIndex) is false, return false. + iv. If numericIndex = -0, return false. + v. If numericIndex < 0, return false. + vi. If numericIndex ≥ the value of O's [[ArrayLength]] internal slot, + return false. + vii. Return true. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + + assert.sameValue(Reflect.has(sample, 0), true); + assert.sameValue(Reflect.has(sample, 1), true); +}); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/BigInt/infinity-with-detached-buffer.js b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/infinity-with-detached-buffer.js new file mode 100644 index 000000000..2e4cdb7ae --- /dev/null +++ b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/infinity-with-detached-buffer.js @@ -0,0 +1,36 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-integer-indexed-exotic-objects-hasproperty-p +description: > + "Infinity" is a canonical numeric string, test with access on detached buffer. +info: | + 9.4.5.2 [[HasProperty]]( P ) + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Let buffer be O.[[ViewedArrayBuffer]]. + ii. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... + + 7.1.16 CanonicalNumericIndexString ( argument ) + ... + 3. Let n be ! ToNumber(argument). + 4. If SameValue(! ToString(n), argument) is false, return undefined. + 5. Return n. + +flags: [noStrict] +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(0); + $DETACHBUFFER(sample.buffer); + + assert.throws(TypeError, function() { + with (sample) Infinity; + }); +}); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/BigInt/inherited-property.js b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/inherited-property.js new file mode 100644 index 000000000..6407c2644 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/inherited-property.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-hasproperty-p +description: > + Find inherited properties if property is not a CanonicalNumericIndexString +info: | + 9.4.5.2 [[HasProperty]](P) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + 4. Return ? OrdinaryHasProperty(O, P). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +TypedArray.prototype.foo = 42; +TypedArray.prototype[42] = true; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + + TA.prototype.bar = 42; + + assert.sameValue(Reflect.has(sample, "subarray"), true, "subarray"); + assert.sameValue(Reflect.has(sample, "foo"), true, "foo"); + assert.sameValue(Reflect.has(sample, "bar"), true, "bar"); + assert.sameValue(Reflect.has(sample, "baz"), false, "baz"); + + assert.sameValue(Reflect.has(sample, "42"), false, "42"); +}); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-greater-than-last-index.js b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-greater-than-last-index.js new file mode 100644 index 000000000..c1d721348 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-greater-than-last-index.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-hasproperty-p +description: Return false if P's value is >= this's [[ArrayLength]] +info: | + 9.4.5.2 [[HasProperty]](P) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + vi. If numericIndex ≥ the value of O's [[ArrayLength]] internal slot, + return false. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +// Prevents false positives using OrdinaryHasProperty +TypedArray.prototype[1] = "test262"; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + + assert.sameValue(Reflect.has(sample, "1"), false, "1"); +}); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-lower-than-zero.js b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-lower-than-zero.js new file mode 100644 index 000000000..0048a4f97 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-lower-than-zero.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-hasproperty-p +description: Return false if P's value is < 0 +info: | + 9.4.5.2 [[HasProperty]](P) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + v. If numericIndex < 0, return false. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + + +// Prevents false positives using OrdinaryHasProperty +TypedArray.prototype[-1] = "test262"; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + + assert.sameValue(Reflect.has(sample, "-1"), false, "-1"); +}); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-minus-zero.js b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-minus-zero.js new file mode 100644 index 000000000..0d6a1515f --- /dev/null +++ b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-minus-zero.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-hasproperty-p +description: Return false if P's value is "-0" +info: | + 9.4.5.2 [[HasProperty]](P) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + iv. If numericIndex = -0, return false. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + + +// Prevents false positives using OrdinaryHasProperty +TypedArray.prototype["-0"] = "test262"; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + + assert.sameValue(Reflect.has(sample, "-0"), false, "-0"); +}); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-not-canonical-index.js b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-not-canonical-index.js new file mode 100644 index 000000000..ecd5dd725 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-not-canonical-index.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-hasproperty-p +description: > + Return boolean from numeric keys that are not a CanonicalNumericIndexString +info: | + 9.4.5.2 [[HasProperty]](P) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + 4. Return ? OrdinaryHasProperty(O, P). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +var keys = [ + "1.0", + "+1", + "1000000000000000000000", + "0.0000001" +]; + +testWithBigIntTypedArrayConstructors(function(TA) { + keys.forEach(function(key) { + var sample = new TA(1); + + assert.sameValue( + Reflect.has(sample, key), false, + "returns false without key [" + key + "]" + ); + + TypedArray.prototype[key] = 42; + + assert.sameValue( + Reflect.has(sample, key), true, + "returns true with inherited key [" + key + "]" + ); + + delete TypedArray.prototype[key]; + + Object.defineProperty(sample, key, {value: convertToBigInt(42)}); + + assert.sameValue( + Reflect.has(sample, key), true, + "returns true with own key [" + key + "]" + ); + }); +}); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-not-integer.js b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-not-integer.js new file mode 100644 index 000000000..303b60278 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-not-integer.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. +/*--- +esid: sec-integer-indexed-exotic-objects-hasproperty-p +description: Return false if P's value is not an integer +info: | + 9.4.5.2 [[HasProperty]](P) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + iii. If IsInteger(numericIndex) is false, return false. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + + +// Prevents false positives using OrdinaryHasProperty +TypedArray.prototype["1.1"] = "test262"; +TypedArray.prototype["0.000001"] = "test262"; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + + assert.sameValue(Reflect.has(sample, "1.1"), false, "1.1"); + assert.sameValue(Reflect.has(sample, "0.000001"), false, "0.000001"); +}); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-not-numeric-index.js new file mode 100644 index 000000000..d960abfdd --- /dev/null +++ b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-not-numeric-index.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-hasproperty-p +description: > + Return boolean from properties that are not a CanonicalNumericIndexString +info: | + 9.4.5.2 [[HasProperty]](P) + + ... + 3. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + 4. Return ? OrdinaryHasProperty(O, P). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + + assert.sameValue(Reflect.has(sample, "foo"), false); + + Object.defineProperty(sample, "foo", { value: 42 }); + + assert.sameValue(Reflect.has(sample, "foo"), true); +}); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-symbol.js b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-symbol.js new file mode 100644 index 000000000..0f6d74487 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-symbol.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-hasproperty-p +description: > + Return boolean from Symbol properties +info: | + 9.4.5.2 [[HasProperty]](P) + + ... + 3. If Type(P) is String, then + ... + 4. Return ? OrdinaryHasProperty(O, P). +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, Symbol, TypedArray] +---*/ + +var s = Symbol("foo"); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + + assert.sameValue(Reflect.has(sample, s), false); + + Object.defineProperty(sample, s, { value: 42 }); + + assert.sameValue(Reflect.has(sample, s), true); +}); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/detached-buffer-key-is-not-number.js b/test/built-ins/TypedArrays/internals/HasProperty/detached-buffer-key-is-not-number.js index 4a4b64540..011e80c0b 100644 --- a/test/built-ins/TypedArrays/internals/HasProperty/detached-buffer-key-is-not-number.js +++ b/test/built-ins/TypedArrays/internals/HasProperty/detached-buffer-key-is-not-number.js @@ -18,8 +18,8 @@ includes: [testTypedArray.js, detachArrayBuffer.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); Object.defineProperty(sample, "bar", { value: 42 }); $DETACHBUFFER(sample.buffer); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/detached-buffer-key-is-symbol.js b/test/built-ins/TypedArrays/internals/HasProperty/detached-buffer-key-is-symbol.js index abc2bf4e3..2c34c3caa 100644 --- a/test/built-ins/TypedArrays/internals/HasProperty/detached-buffer-key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/HasProperty/detached-buffer-key-is-symbol.js @@ -20,8 +20,8 @@ features: [Reflect, Symbol, TypedArray] var s1 = Symbol("foo"); var s2 = Symbol("bar"); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); Object.defineProperty(sample, s1, { value: "baz" }); $DETACHBUFFER(sample.buffer); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/indexed-value.js b/test/built-ins/TypedArrays/internals/HasProperty/indexed-value.js index 88aea9dc6..5a3b0482a 100644 --- a/test/built-ins/TypedArrays/internals/HasProperty/indexed-value.js +++ b/test/built-ins/TypedArrays/internals/HasProperty/indexed-value.js @@ -24,8 +24,8 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); assert.sameValue(Reflect.has(sample, 0), true); assert.sameValue(Reflect.has(sample, 1), true); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/key-is-not-canonical-index.js b/test/built-ins/TypedArrays/internals/HasProperty/key-is-not-canonical-index.js index 14ffa9072..7e20c5b24 100644 --- a/test/built-ins/TypedArrays/internals/HasProperty/key-is-not-canonical-index.js +++ b/test/built-ins/TypedArrays/internals/HasProperty/key-is-not-canonical-index.js @@ -25,7 +25,7 @@ var keys = [ "0.0000001" ]; -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { keys.forEach(function(key) { var sample = new TA(1); @@ -43,7 +43,7 @@ testWithTypedArrayConstructors(function(TA, N) { delete TypedArray.prototype[key]; - Object.defineProperty(sample, key, {value: N(42)}); + Object.defineProperty(sample, key, {value: 42}); assert.sameValue( Reflect.has(sample, key), true, diff --git a/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-and-symbol-keys-.js b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-and-symbol-keys-.js new file mode 100644 index 000000000..42adcfeba --- /dev/null +++ b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-and-symbol-keys-.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-integer-indexed-exotic-objects-ownpropertykeys +description: > + Return integer index + non numeric string keys +info: | + 9.4.5.6 [[OwnPropertyKeys]] () + + ... + 3. Let len be the value of O's [[ArrayLength]] internal slot. + 4. For each integer i starting with 0 such that i < len, in ascending order, + a. Add ! ToString(i) as the last element of keys. + ... +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, Reflect, Symbol, TypedArray] +---*/ + +var s1 = Symbol("1"); +var s2 = Symbol("2"); + +TypedArray.prototype[3] = 42; +TypedArray.prototype.bar = 42; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample1 = new TA(convertToBigInt([42, 42, 42])); + sample1[s1] = 42; + sample1[s2] = 42; + sample1.test262 = 42; + sample1.ecma262 = 42; + var result1 = Reflect.ownKeys(sample1); + assert( + compareArray(result1, ["0", "1", "2", "test262", "ecma262", s1, s2]), + "result1" + ); + + var sample2 = new TA(4).subarray(2); + sample2[s1] = 42; + sample2[s2] = 42; + sample2.test262 = 42; + sample2.ecma262 = 42; + var result2 = Reflect.ownKeys(sample2); + assert( + compareArray(result2, ["0", "1", "test262", "ecma262", s1, s2]), + "result2" + ); +}); diff --git a/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-keys.js b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-keys.js new file mode 100644 index 000000000..e3d78dac4 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-keys.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-integer-indexed-exotic-objects-ownpropertykeys +description: > + Return integer index + non numeric string keys +info: | + 9.4.5.6 [[OwnPropertyKeys]] () + + ... + 3. Let len be the value of O's [[ArrayLength]] internal slot. + 4. For each integer i starting with 0 such that i < len, in ascending order, + a. Add ! ToString(i) as the last element of keys. + ... +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +TypedArray.prototype[3] = 42; +TypedArray.prototype.bar = 42; + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample1 = new TA(convertToBigInt([42, 42, 42])); + sample1.test262 = 42; + sample1.ecma262 = 42; + var result1 = Reflect.ownKeys(sample1); + assert( + compareArray(result1, ["0", "1", "2", "test262", "ecma262"]), + "result1" + ); + + var sample2 = new TA(4).subarray(2); + sample2.test262 = 42; + sample2.ecma262 = 42; + var result2 = Reflect.ownKeys(sample2); + assert( + compareArray(result2, ["0", "1", "test262", "ecma262"]), + "result2" + ); +}); diff --git a/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes.js b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes.js new file mode 100644 index 000000000..9217b4627 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-integer-indexed-exotic-objects-ownpropertykeys +description: > + Return keys +info: | + 9.4.5.6 [[OwnPropertyKeys]] () + + ... + 3. Let len be the value of O's [[ArrayLength]] internal slot. + 4. For each integer i starting with 0 such that i < len, in ascending order, + a. Add ! ToString(i) as the last element of keys. + ... +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample1 = new TA(convertToBigInt([42, 42, 42])); + var result1 = Reflect.ownKeys(sample1); + assert(compareArray(result1, ["0", "1", "2"]), "result1"); + + var sample2 = new TA(4); + var result2 = Reflect.ownKeys(sample2); + assert(compareArray(result2, ["0", "1", "2", "3"]), "result2"); + + var sample3 = new TA(4).subarray(2); + var result3 = Reflect.ownKeys(sample3); + assert(compareArray(result3, ["0", "1"]), "result3"); + + var sample4 = new TA(); + var result4 = Reflect.ownKeys(sample4); + assert(compareArray(result4, []), "result4"); +}); diff --git a/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/not-enumerable-keys.js b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/not-enumerable-keys.js new file mode 100644 index 000000000..d50d2d20f --- /dev/null +++ b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/not-enumerable-keys.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-integer-indexed-exotic-objects-ownpropertykeys +description: > + List not-enumerable own keys +info: | + 9.4.5.6 [[OwnPropertyKeys]] () + + ... + 3. Let len be the value of O's [[ArrayLength]] internal slot. + 4. For each integer i starting with 0 such that i < len, in ascending order, + a. Add ! ToString(i) as the last element of keys. + ... +includes: [testBigIntTypedArray.js, compareArray.js] +features: [BigInt, Reflect, Symbol, TypedArray] +---*/ + +var s = Symbol("1"); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(); + + Object.defineProperty(sample, s, { + value: 42, + enumerable: false + }); + Object.defineProperty(sample, "test262", { + value: 42, + enumerable: false + }); + var result = Reflect.ownKeys(sample); + assert(compareArray(result, ["test262", s])); +}); diff --git a/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes-and-string-and-symbol-keys-.js b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes-and-string-and-symbol-keys-.js index d469c9ab1..9060bee4d 100644 --- a/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes-and-string-and-symbol-keys-.js +++ b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes-and-string-and-symbol-keys-.js @@ -23,8 +23,8 @@ var s2 = Symbol("2"); TypedArray.prototype[3] = 42; TypedArray.prototype.bar = 42; -testWithTypedArrayConstructors(function(TA, N) { - var sample1 = new TA(N([42, 42, 42])); +testWithTypedArrayConstructors(function(TA) { + var sample1 = new TA([42, 42, 42]); sample1[s1] = 42; sample1[s2] = 42; sample1.test262 = 42; diff --git a/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes-and-string-keys.js b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes-and-string-keys.js index 5f933e570..b227ef6f2 100644 --- a/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes-and-string-keys.js +++ b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes-and-string-keys.js @@ -20,8 +20,8 @@ features: [Reflect, TypedArray] TypedArray.prototype[3] = 42; TypedArray.prototype.bar = 42; -testWithTypedArrayConstructors(function(TA, N) { - var sample1 = new TA(N([42, 42, 42])); +testWithTypedArrayConstructors(function(TA) { + var sample1 = new TA([42, 42, 42]); sample1.test262 = 42; sample1.ecma262 = 42; var result1 = Reflect.ownKeys(sample1); diff --git a/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes.js b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes.js index 17c78ca5a..00e57de34 100644 --- a/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes.js +++ b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/integer-indexes.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js, compareArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample1 = new TA(N([42, 42, 42])); +testWithTypedArrayConstructors(function(TA) { + var sample1 = new TA([42, 42, 42]); var result1 = Reflect.ownKeys(sample1); assert(compareArray(result1, ["0", "1", "2"]), "result1"); diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/conversion-operation.js b/test/built-ins/TypedArrays/internals/Set/BigInt/conversion-operation.js new file mode 100644 index 000000000..4c8bff504 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/conversion-operation.js @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-integer-indexed-exotic-objects-set-p-v-receiver +description: > + Verify conversion after setting value +info: | + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String, then + ... + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). + ... + + 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , + isLittleEndian ] ) + + ... + 8. If type is "Float32", then + ... + 9. Else, if type is "Float64", then + ... + 10. Else, + ... + b. Let convOp be the abstract operation named in the Conversion Operation + column in Table 50 for Element Type type. + c. Let intValue be convOp(value). + d. If intValue ≥ 0, then + ... + e. Else, + ... +includes: [byteConversionValues.js, testBigIntTypedArray.js] +---*/ + +testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { + var sample = new TA([initial]); + + sample[0] = value; + + assert.sameValue(sample[0], expected, value + " converts to " + expected); +}); diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer-key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer-key-is-not-numeric-index.js new file mode 100644 index 000000000..e7980f308 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer-key-is-not-numeric-index.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-set-p-v-receiver +description: > + Does not throw on an instance with a detached buffer if key is not a number +info: | + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + 3. Return ? OrdinarySet(O, P, V, Receiver). +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + $DETACHBUFFER(sample.buffer); + + assert.sameValue(Reflect.set(sample, "foo", "test262"), true); + assert.sameValue(sample.foo, "test262"); +}); diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer-key-is-symbol.js b/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer-key-is-symbol.js new file mode 100644 index 000000000..c7311063b --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer-key-is-symbol.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-set-p-v-receiver +description: > + Does not throw on an instance with a detached buffer if key is a Symbol +info: | + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String, then + ... + 3. Return ? OrdinarySet(O, P, V, Receiver). +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, Symbol, Reflect, TypedArray] +---*/ + +var s = Symbol("1"); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + $DETACHBUFFER(sample.buffer); + + assert.sameValue(Reflect.set(sample, s, "test262"), true); + assert.sameValue(sample[s], "test262"); +}); diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer-realm.js b/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer-realm.js new file mode 100644 index 000000000..f7e71ff0e --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer-realm.js @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-set-p-v-receiver +description: > + Throws a TypeError if key has a numeric index and object has a detached + buffer (honoring the Realm of the current execution context) +info: | + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 3. Let numValue be ? ToNumber(value). + 4. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot. + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, cross-realm, TypedArray] +---*/ + +var other = $262.createRealm().global; + +testWithBigIntTypedArrayConstructors(function(TA) { + var OtherTA = other[TA.name]; + var sample = new OtherTA(1); + + $DETACHBUFFER(sample.buffer); + + assert.throws(TypeError, function() { + sample[0] = 0; + }); +}); diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer.js b/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer.js new file mode 100644 index 000000000..2a27fff80 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer.js @@ -0,0 +1,65 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-set-p-v-receiver +description: > + Throws a TypeError if key has a numeric index and object has a detached buffer +info: | + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 3. Let numValue be ? ToNumber(value). + 4. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot. + 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42])); + $DETACHBUFFER(sample.buffer); + + assert.throws(TypeError, function() { + sample[0] = convertToBigInt(1); + }, "valid numeric index"); + + assert.throws(TypeError, function() { + sample["1.1"] = convertToBigInt(1); + }, "detach buffer runs before checking for 1.1"); + + assert.throws(TypeError, function() { + sample["-0"] = convertToBigInt(1); + }, "detach buffer runs before checking for -0"); + + assert.throws(TypeError, function() { + sample["-1"] = convertToBigInt(1); + }, "detach buffer runs before checking for -1"); + + assert.throws(TypeError, function() { + sample["1"] = convertToBigInt(1); + }, "detach buffer runs before checking for key == length"); + + assert.throws(TypeError, function() { + sample["2"] = convertToBigInt(1); + }, "detach buffer runs before checking for key > length"); + + var obj = { + valueOf: function() { + throw new Test262Error(); + } + }; + + assert.throws(Test262Error, function() { + sample["0"] = obj; + }, "ToNumber(value) is called before detached buffer check"); +}); diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/indexed-value.js b/test/built-ins/TypedArrays/internals/Set/BigInt/indexed-value.js new file mode 100644 index 000000000..5203e21c9 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/indexed-value.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-set-p-v-receiver +description: > + Returns true after setting value +info: | + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). + 16. Return true. +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +var proto = TypedArray.prototype; +var throwDesc = { + set: function() { + throw new Test262Error("OrdinarySet was called! Ref: 9.1.9.1 3.b.i"); + } +}; +Object.defineProperty(proto, "0", throwDesc); +Object.defineProperty(proto, "1", throwDesc); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42, 43])); + + assert.sameValue(Reflect.set(sample, "0", convertToBigInt(1)), true, "sample[0]"); + assert.sameValue(sample[0], convertToBigInt(1), "sample[0] value is set"); + + assert.sameValue(Reflect.set(sample, "1", convertToBigInt(42)), true, "sample[1]"); + assert.sameValue(sample[1], convertToBigInt(42), "sample[1] value is set"); +}); diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-minus-zero.js b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-minus-zero.js new file mode 100644 index 000000000..6fcd8dead --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-minus-zero.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-set-p-v-receiver +description: > + Returns false if index is -0 +info: | + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 7. If index = -0, return false. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42])); + + assert.sameValue(Reflect.set(sample, "-0", 1), false, "-0"); + assert.sameValue(sample.hasOwnProperty("-0"), false, "has no property [-0]"); +}); diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-canonical-index.js b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-canonical-index.js new file mode 100644 index 000000000..f2760e7e1 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-canonical-index.js @@ -0,0 +1,58 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-set-p-v-receiver +description: > + Use OrginarySet if numeric key is not a CanonicalNumericIndex +info: | + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + 3. Return ? OrdinarySet(O, P, V, Receiver). +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +var keys = [ + "1.0", + "+1", + "1000000000000000000000", + "0.0000001" +]; + +testWithBigIntTypedArrayConstructors(function(TA) { + keys.forEach(function(key) { + var sample = new TA(convertToBigInt([42])); + + assert.sameValue( + Reflect.set(sample, key, "ecma262"), + true, + "Return true setting a new property [" + key + "]" + ); + assert.sameValue(sample[key], "ecma262"); + + assert.sameValue( + Reflect.set(sample, key, "es3000"), + true, + "Return true setting a value to a writable property [" + key + "]" + ); + assert.sameValue(sample[key], "es3000"); + + Object.defineProperty(sample, key, { + writable: false, + value: undefined + }); + assert.sameValue( + Reflect.set(sample, key, 42), + false, + "Return false setting a value to a non-writable property [" + key + "]" + ); + assert.sameValue( + sample[key], undefined, "non-writable [" + key + "] is preserved" + ); + }); +}); diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-integer.js b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-integer.js new file mode 100644 index 000000000..758cc1072 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-integer.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-set-p-v-receiver +description: > + Returns false if index is not integer +info: | + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 6. If IsInteger(index) is false, return false. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42])); + + assert.sameValue(Reflect.set(sample, "1.1", 1), false, "1.1"); + assert.sameValue(Reflect.set(sample, "0.0001", 1), false, "0.0001"); + + assert.sameValue(sample.hasOwnProperty("1.1"), false, "has no property [1.1]"); + assert.sameValue( + sample.hasOwnProperty("0.0001"), + false, + "has no property [0.0001]" + ); +}); diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-numeric-index-set-throws.js b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-numeric-index-set-throws.js new file mode 100644 index 000000000..1e55325f6 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-numeric-index-set-throws.js @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-set-p-v-receiver +description: > + Returns abrupt from OrginarySet when key is not a numeric index +info: | + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + 3. Return ? OrdinarySet(O, P, V, Receiver). + + 9.1.9.1 OrdinarySet (O, P, V, Receiver) + + ... + 8. Perform ? Call(setter, Receiver, « V »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(1); + + Object.defineProperty(sample, "test262", { + set: function() { + throw new Test262Error(); + } + }); + + assert.throws(Test262Error, function() { + sample.test262 = 1; + }); + + assert.sameValue(sample.test262, undefined); +}); diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-numeric-index.js new file mode 100644 index 000000000..842de9dd0 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-numeric-index.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-set-p-v-receiver +description: > + Use OrginarySet if key is not a CanonicalNumericIndex +info: | + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + ... + 3. Return ? OrdinarySet(O, P, V, Receiver). +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42])); + + assert.sameValue( + Reflect.set(sample, "test262", "ecma262"), + true, + "Return true setting a new property" + ); + assert.sameValue(sample.test262, "ecma262"); + + assert.sameValue( + Reflect.set(sample, "test262", "es3000"), + true, + "Return true setting a value to a writable property" + ); + assert.sameValue(sample.test262, "es3000"); + + Object.defineProperty(sample, "foo", { + writable: false, + value: undefined + }); + assert.sameValue( + Reflect.set(sample, "foo", 42), + false, + "Return false setting a value to a non-writable property" + ); + assert.sameValue(sample.foo, undefined); +}); diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-out-of-bounds.js b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-out-of-bounds.js new file mode 100644 index 000000000..3031a6ed9 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-out-of-bounds.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-set-p-v-receiver +description: > + Returns false if index is out of bounds +info: | + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 8. Let length be the value of O's [[ArrayLength]] internal slot. + 9. If index < 0 or index ≥ length, return false. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42])); + + assert.sameValue(Reflect.set(sample, "-1", 1), false, "-1"); + assert.sameValue(Reflect.set(sample, "1", 1), false, "1"); + assert.sameValue(Reflect.set(sample, "2", 1), false, "2"); + + assert.sameValue(sample.hasOwnProperty("-1"), false, "has no property [-1]"); + assert.sameValue(sample.hasOwnProperty("1"), false, "has no property [1]"); + assert.sameValue(sample.hasOwnProperty("2"), false, "has no property [2]"); +}); diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-symbol.js b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-symbol.js new file mode 100644 index 000000000..184ae7abc --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-symbol.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-set-p-v-receiver +description: > + Use OrginarySet if key is a Symbol +info: | + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String, then + ... + 3. Return ? OrdinarySet(O, P, V, Receiver). +includes: [testBigIntTypedArray.js] +features: [BigInt, Reflect, Symbol, TypedArray] +---*/ + +var s1 = Symbol("1"); +var s2 = Symbol("2"); + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42])); + + assert.sameValue( + Reflect.set(sample, s1, "ecma262"), + true, + "Return true setting a new property" + ); + assert.sameValue(sample[s1], "ecma262"); + + assert.sameValue( + Reflect.set(sample, s1, "es3000"), + true, + "Return true setting a value to a writable property" + ); + assert.sameValue(sample[s1], "es3000"); + + Object.defineProperty(sample, s2, { + writable: false, + value: undefined + }); + assert.sameValue( + Reflect.set(sample, s2, 42), + false, + "Return false setting a value to a non-writable property" + ); + assert.sameValue(sample[s2], undefined); +}); diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/tonumber-value-detached-buffer.js b/test/built-ins/TypedArrays/internals/Set/BigInt/tonumber-value-detached-buffer.js new file mode 100644 index 000000000..2111ef645 --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/tonumber-value-detached-buffer.js @@ -0,0 +1,46 @@ +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-integer-indexed-exotic-objects-set-p-v-receiver +description: > + Setting a typed array element to a value that, when converted to the typed + array element type, detaches the typed array's underlying buffer, should + throw a TypeError and not modify the typed array. +info: | + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). + 16. Return true. +includes: [testBigIntTypedArray.js, detachArrayBuffer.js] +features: [BigInt, Reflect, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var ta = new TA([17]); + + assert.throws(TypeError, function() { + Reflect.set(ta, 0, { + valueOf: function() { + $262.detachArrayBuffer(ta.buffer); + return 42; + } + }); + }, + "detaching a ArrayBuffer during setting an element of a typed array " + + "viewing it should throw"); + + assert.throws(TypeError, function() { + ta[0]; + }); +}); diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/tonumber-value-throws.js b/test/built-ins/TypedArrays/internals/Set/BigInt/tonumber-value-throws.js new file mode 100644 index 000000000..a967ec01c --- /dev/null +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/tonumber-value-throws.js @@ -0,0 +1,58 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-integer-indexed-exotic-objects-set-p-v-receiver +description: > + Returns abrupt from ToNumber(value) +info: | + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 3. Let numValue be ? ToNumber(value). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA(convertToBigInt([42])); + + var obj = { + valueOf: function() { + throw new Test262Error(); + } + }; + + assert.throws(Test262Error, function() { + sample["0"] = obj; + }, "ToNumber check with a valid index"); + + assert.throws(Test262Error, function() { + sample["1.1"] = obj; + }, "ToNumber runs before ToInteger(index)"); + + assert.throws(Test262Error, function() { + sample["-0"] = obj; + }, "ToNumber runs before -0 check"); + + assert.throws(Test262Error, function() { + sample["-1"] = obj; + }, "ToNumber runs before < 0 check"); + + assert.throws(Test262Error, function() { + sample["1"] = obj; + }, "ToNumber runs before index == length check"); + + assert.throws(Test262Error, function() { + sample["2"] = obj; + }, "ToNumber runs before index > length check"); +}); diff --git a/test/built-ins/TypedArrays/internals/Set/detached-buffer-key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/Set/detached-buffer-key-is-not-numeric-index.js index d802d2fd5..7382d626e 100644 --- a/test/built-ins/TypedArrays/internals/Set/detached-buffer-key-is-not-numeric-index.js +++ b/test/built-ins/TypedArrays/internals/Set/detached-buffer-key-is-not-numeric-index.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js, detachArrayBuffer.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); $DETACHBUFFER(sample.buffer); assert.sameValue(Reflect.set(sample, "foo", "test262"), true); diff --git a/test/built-ins/TypedArrays/internals/Set/detached-buffer-key-is-symbol.js b/test/built-ins/TypedArrays/internals/Set/detached-buffer-key-is-symbol.js index 18869f683..1fbe1b60c 100644 --- a/test/built-ins/TypedArrays/internals/Set/detached-buffer-key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/Set/detached-buffer-key-is-symbol.js @@ -17,8 +17,8 @@ features: [Symbol, Reflect, TypedArray] var s = Symbol("1"); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); $DETACHBUFFER(sample.buffer); assert.sameValue(Reflect.set(sample, s, "test262"), true); diff --git a/test/built-ins/TypedArrays/internals/Set/detached-buffer.js b/test/built-ins/TypedArrays/internals/Set/detached-buffer.js index 186259cee..a373f9fbe 100644 --- a/test/built-ins/TypedArrays/internals/Set/detached-buffer.js +++ b/test/built-ins/TypedArrays/internals/Set/detached-buffer.js @@ -25,32 +25,32 @@ includes: [testTypedArray.js, detachArrayBuffer.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42]); $DETACHBUFFER(sample.buffer); assert.throws(TypeError, function() { - sample[0] = N(1); + sample[0] = 1; }, "valid numeric index"); assert.throws(TypeError, function() { - sample["1.1"] = N(1); + sample["1.1"] = 1; }, "detach buffer runs before checking for 1.1"); assert.throws(TypeError, function() { - sample["-0"] = N(1); + sample["-0"] = 1; }, "detach buffer runs before checking for -0"); assert.throws(TypeError, function() { - sample["-1"] = N(1); + sample["-1"] = 1; }, "detach buffer runs before checking for -1"); assert.throws(TypeError, function() { - sample["1"] = N(1); + sample["1"] = 1; }, "detach buffer runs before checking for key == length"); assert.throws(TypeError, function() { - sample["2"] = N(1); + sample["2"] = 1; }, "detach buffer runs before checking for key > length"); var obj = { diff --git a/test/built-ins/TypedArrays/internals/Set/indexed-value.js b/test/built-ins/TypedArrays/internals/Set/indexed-value.js index bb325d11c..2333d4c44 100644 --- a/test/built-ins/TypedArrays/internals/Set/indexed-value.js +++ b/test/built-ins/TypedArrays/internals/Set/indexed-value.js @@ -32,12 +32,12 @@ var throwDesc = { Object.defineProperty(proto, "0", throwDesc); Object.defineProperty(proto, "1", throwDesc); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); - assert.sameValue(Reflect.set(sample, "0", N(1)), true, "sample[0]"); - assert.sameValue(sample[0], N(1), "sample[0] value is set"); + assert.sameValue(Reflect.set(sample, "0", 1), true, "sample[0]"); + assert.sameValue(sample[0], 1, "sample[0] value is set"); - assert.sameValue(Reflect.set(sample, "1", N(42)), true, "sample[1]"); - assert.sameValue(sample[1], N(42), "sample[1] value is set"); + assert.sameValue(Reflect.set(sample, "1", 42), true, "sample[1]"); + assert.sameValue(sample[1], 42, "sample[1] value is set"); }); diff --git a/test/built-ins/TypedArrays/internals/Set/key-is-minus-zero.js b/test/built-ins/TypedArrays/internals/Set/key-is-minus-zero.js index 5946ebc7c..a735e8baa 100644 --- a/test/built-ins/TypedArrays/internals/Set/key-is-minus-zero.js +++ b/test/built-ins/TypedArrays/internals/Set/key-is-minus-zero.js @@ -23,8 +23,8 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42]); assert.sameValue(Reflect.set(sample, "-0", 1), false, "-0"); assert.sameValue(sample.hasOwnProperty("-0"), false, "has no property [-0]"); diff --git a/test/built-ins/TypedArrays/internals/Set/key-is-not-canonical-index.js b/test/built-ins/TypedArrays/internals/Set/key-is-not-canonical-index.js index d89a0f1fb..1fb7a9ec6 100644 --- a/test/built-ins/TypedArrays/internals/Set/key-is-not-canonical-index.js +++ b/test/built-ins/TypedArrays/internals/Set/key-is-not-canonical-index.js @@ -24,9 +24,9 @@ var keys = [ "0.0000001" ]; -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { keys.forEach(function(key) { - var sample = new TA(N([42])); + var sample = new TA([42]); assert.sameValue( Reflect.set(sample, key, "ecma262"), diff --git a/test/built-ins/TypedArrays/internals/Set/key-is-not-integer.js b/test/built-ins/TypedArrays/internals/Set/key-is-not-integer.js index c513faefe..252220f61 100644 --- a/test/built-ins/TypedArrays/internals/Set/key-is-not-integer.js +++ b/test/built-ins/TypedArrays/internals/Set/key-is-not-integer.js @@ -23,8 +23,8 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42]); assert.sameValue(Reflect.set(sample, "1.1", 1), false, "1.1"); assert.sameValue(Reflect.set(sample, "0.0001", 1), false, "0.0001"); diff --git a/test/built-ins/TypedArrays/internals/Set/key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/Set/key-is-not-numeric-index.js index 03a181965..462eb752d 100644 --- a/test/built-ins/TypedArrays/internals/Set/key-is-not-numeric-index.js +++ b/test/built-ins/TypedArrays/internals/Set/key-is-not-numeric-index.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42]); assert.sameValue( Reflect.set(sample, "test262", "ecma262"), diff --git a/test/built-ins/TypedArrays/internals/Set/key-is-out-of-bounds.js b/test/built-ins/TypedArrays/internals/Set/key-is-out-of-bounds.js index 859bdee4f..e5a5d6da8 100644 --- a/test/built-ins/TypedArrays/internals/Set/key-is-out-of-bounds.js +++ b/test/built-ins/TypedArrays/internals/Set/key-is-out-of-bounds.js @@ -24,8 +24,8 @@ includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42]); assert.sameValue(Reflect.set(sample, "-1", 1), false, "-1"); assert.sameValue(Reflect.set(sample, "1", 1), false, "1"); diff --git a/test/built-ins/TypedArrays/internals/Set/key-is-symbol.js b/test/built-ins/TypedArrays/internals/Set/key-is-symbol.js index e27d501c0..838ab74e0 100644 --- a/test/built-ins/TypedArrays/internals/Set/key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/Set/key-is-symbol.js @@ -18,8 +18,8 @@ features: [Reflect, Symbol, TypedArray] var s1 = Symbol("1"); var s2 = Symbol("2"); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42]); assert.sameValue( Reflect.set(sample, s1, "ecma262"), diff --git a/test/built-ins/TypedArrays/internals/Set/tonumber-value-throws.js b/test/built-ins/TypedArrays/internals/Set/tonumber-value-throws.js index e90eb4798..08131f4bf 100644 --- a/test/built-ins/TypedArrays/internals/Set/tonumber-value-throws.js +++ b/test/built-ins/TypedArrays/internals/Set/tonumber-value-throws.js @@ -23,8 +23,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42]); var obj = { valueOf: function() { diff --git a/test/built-ins/TypedArrays/of/BigInt/argument-is-symbol-throws.js b/test/built-ins/TypedArrays/of/BigInt/argument-is-symbol-throws.js new file mode 100644 index 000000000..b59311849 --- /dev/null +++ b/test/built-ins/TypedArrays/of/BigInt/argument-is-symbol-throws.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.of +description: > + Throws a TypeError if argument is a Symbol +info: | + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 3. Let numValue be ? ToNumber(value). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol, TypedArray] +---*/ + +var s = Symbol("1"); + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + TA.of(s); + }); +}); diff --git a/test/built-ins/TypedArrays/of/BigInt/argument-number-value-throws.js b/test/built-ins/TypedArrays/of/BigInt/argument-number-value-throws.js new file mode 100644 index 000000000..fd22b08b1 --- /dev/null +++ b/test/built-ins/TypedArrays/of/BigInt/argument-number-value-throws.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.of +description: > + Return abrupt from object value +info: | + 22.2.2.2 %TypedArray%.of ( ...items ) + + ... + 7. Repeat, while k < len + ... + c. Perform ? Set(newObj, Pk, kValue, true). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var lastValue = false; + + var obj1 = { + valueOf() { + lastValue = "obj1"; + return convertToBigInt(42); + } + }; + var obj2 = { + valueOf() { + lastValue = "obj2"; + throw new Test262Error(); + } + }; + + assert.throws(Test262Error, function() { + TA.of(obj1, obj2, obj1); + }); + + assert.sameValue(lastValue, "obj2"); +}); + diff --git a/test/built-ins/TypedArrays/of/BigInt/custom-ctor-does-not-instantiate-ta-throws.js b/test/built-ins/TypedArrays/of/BigInt/custom-ctor-does-not-instantiate-ta-throws.js new file mode 100644 index 000000000..ca17d437e --- /dev/null +++ b/test/built-ins/TypedArrays/of/BigInt/custom-ctor-does-not-instantiate-ta-throws.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.of +description: > + Custom constructor needs to instantiate a TypedArray +info: | + 22.2.2.2 %TypedArray%.of ( ...items ) + + ... + 5. Let newObj be ? TypedArrayCreate(C, «len»). + ... + + 22.2.4.6 TypedArrayCreate ( constructor, argumentList ) + + 1. Let newTypedArray be ? Construct(constructor, argumentList). + 2. Perform ? ValidateTypedArray(newTypedArray). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var ctor = function() {}; + + assert.throws(TypeError, function() { + TA.of.call(ctor, 42); + }); +}); diff --git a/test/built-ins/TypedArrays/of/BigInt/custom-ctor-returns-other-instance.js b/test/built-ins/TypedArrays/of/BigInt/custom-ctor-returns-other-instance.js new file mode 100644 index 000000000..3c289e0a8 --- /dev/null +++ b/test/built-ins/TypedArrays/of/BigInt/custom-ctor-returns-other-instance.js @@ -0,0 +1,33 @@ +// 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.2.2 +esid: sec-%typedarray%.of +description: > + Custom constructor can return any TypedArray instance with higher or same + length +info: | + %TypedArray%.of ( ...items ) + + 1. Let len be the actual number of arguments passed to this function. + ... + 5. Let newObj be ? TypedArrayCreate(C, « len »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var result; + var custom = new TA(3); + var ctor = function() { + return custom; + }; + + result = TypedArray.of.call(ctor, convertToBigInt(1), convertToBigInt(2), convertToBigInt(3)); + assert.sameValue(result, custom, "using iterator, same length"); + + result = TypedArray.of.call(ctor, convertToBigInt(1), convertToBigInt(2)); + assert.sameValue(result, custom, "using iterator, higher length"); +}); diff --git a/test/built-ins/TypedArrays/of/BigInt/custom-ctor-returns-smaller-instance-throws.js b/test/built-ins/TypedArrays/of/BigInt/custom-ctor-returns-smaller-instance-throws.js new file mode 100644 index 000000000..cddf2c4cf --- /dev/null +++ b/test/built-ins/TypedArrays/of/BigInt/custom-ctor-returns-smaller-instance-throws.js @@ -0,0 +1,28 @@ +// 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.2.2 +esid: sec-%typedarray%.of +description: > + Throws a TypeError if a custom `this` returns a smaller instance +info: | + %TypedArray%.of ( ...items ) + + 1. Let len be the actual number of arguments passed to this function. + ... + 5. Let newObj be ? TypedArrayCreate(C, « len »). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var ctor = function() { + return new TA(1); + }; + + assert.throws(TypeError, function() { + TypedArray.of.call(ctor, 1, 2); + }); +}); diff --git a/test/built-ins/TypedArrays/of/BigInt/custom-ctor.js b/test/built-ins/TypedArrays/of/BigInt/custom-ctor.js new file mode 100644 index 000000000..e087cada3 --- /dev/null +++ b/test/built-ins/TypedArrays/of/BigInt/custom-ctor.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.of +description: > + Calls and return abrupt from custom constructor +info: | + 22.2.2.2 %TypedArray%.of ( ...items ) + + ... + 5. Let newObj be ? TypedArrayCreate(C, «len»). + ... + + 22.2.4.6 TypedArrayCreate ( constructor, argumentList ) + + 1. Let newTypedArray be ? Construct(constructor, argumentList). + 2. Perform ? ValidateTypedArray(newTypedArray). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var called = 0; + var ctor = function() { + called++; + throw new Test262Error(); + }; + + assert.throws(Test262Error, function() { + TA.of.call(ctor, 42); + }); + + assert.sameValue(called, 1); +}); diff --git a/test/built-ins/TypedArrays/of/BigInt/inherited.js b/test/built-ins/TypedArrays/of/BigInt/inherited.js new file mode 100644 index 000000000..677cb59fb --- /dev/null +++ b/test/built-ins/TypedArrays/of/BigInt/inherited.js @@ -0,0 +1,25 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.of +description: > + `of` is %TypedArray%.of +info: | + 22.2.1 The %TypedArray% Intrinsic Object + + The %TypedArray% intrinsic object is a constructor function object that all of + the TypedArray constructor object inherit from. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue( + TA.of, TypedArray.of, + "method is inherited %TypedArray%.of" + ); + assert.sameValue( + TA.hasOwnProperty("of"), false, + "constructor does not define an own property named 'of'" + ); +}); \ No newline at end of file diff --git a/test/built-ins/TypedArrays/of/BigInt/invoked-as-func.js b/test/built-ins/TypedArrays/of/BigInt/invoked-as-func.js new file mode 100644 index 000000000..7becb0d7d --- /dev/null +++ b/test/built-ins/TypedArrays/of/BigInt/invoked-as-func.js @@ -0,0 +1,25 @@ +// 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.2.2 +esid: sec-%typedarray%.of +description: > + "of" cannot be invoked as a function +info: | + 22.2.2.2 %TypedArray%.of ( ...items ) + + ... + 3. Let C be the this value. + 4. If IsConstructor(C) is false, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var of = TA.of; + + assert.throws(TypeError, function() { + of(); + }); +}); diff --git a/test/built-ins/TypedArrays/of/BigInt/nan-conversion.js b/test/built-ins/TypedArrays/of/BigInt/nan-conversion.js new file mode 100644 index 000000000..4158c3709 --- /dev/null +++ b/test/built-ins/TypedArrays/of/BigInt/nan-conversion.js @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.of +description: > + Test NaN conversions +info: | + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 3. Let numValue be ? ToNumber(value). + ... + + 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , + isLittleEndian ] ) +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var result = TA.of(NaN, undefined); + assert.sameValue(result.length, 2); + assert.sameValue(result[0], NaN); + assert.sameValue(result[1], NaN); + assert.sameValue(result.constructor, TA); + assert.sameValue(Object.getPrototypeOf(result), TA.prototype); +}, +[ + Float32Array, + Float64Array +]); + +testWithTypedArrayConstructors(function(TA) { + var result = TA.of(NaN, undefined); + assert.sameValue(result.length, 2); + assert.sameValue(result[0], 0); + assert.sameValue(result[1], 0); + assert.sameValue(result.constructor, TA); + assert.sameValue(Object.getPrototypeOf(result), TA.prototype); +}, +[ + Int8Array, + Int32Array, + Int16Array, + Int8Array, + Uint32Array, + Uint16Array, + Uint8Array, + Uint8ClampedArray +]); diff --git a/test/built-ins/TypedArrays/of/BigInt/new-instance-empty.js b/test/built-ins/TypedArrays/of/BigInt/new-instance-empty.js new file mode 100644 index 000000000..1891ae199 --- /dev/null +++ b/test/built-ins/TypedArrays/of/BigInt/new-instance-empty.js @@ -0,0 +1,16 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.of +description: > + Return a new empty TypedArray +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var result = TA.of(); + assert.sameValue(result.length, 0); + assert.sameValue(result.constructor, TA); + assert.sameValue(Object.getPrototypeOf(result), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/of/BigInt/new-instance-from-zero.js b/test/built-ins/TypedArrays/of/BigInt/new-instance-from-zero.js new file mode 100644 index 000000000..973753857 --- /dev/null +++ b/test/built-ins/TypedArrays/of/BigInt/new-instance-from-zero.js @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.of +description: > + Return a new TypedArray using -0 and +0 values +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var result = TA.of(-0, +0); + assert.sameValue(result.length, 2); + assert.sameValue(result[0], -0, "-0 => 0"); + assert.sameValue(result[1], 0, "+0 => 0"); + assert.sameValue(result.constructor, TA); + assert.sameValue(Object.getPrototypeOf(result), TA.prototype); +}, +[ + Float32Array, + Float64Array +]); + +testWithTypedArrayConstructors(function(TA) { + var result = TA.of(-0, +0); + assert.sameValue(result.length, 2); + assert.sameValue(result[0], 0, "-0 => 0"); + assert.sameValue(result[1], 0, "+0 => 0"); + assert.sameValue(result.constructor, TA); + assert.sameValue(Object.getPrototypeOf(result), TA.prototype); +}, +[ + Int16Array, + Int32Array, + Int8Array, + Uint16Array, + Uint32Array, + Uint8Array, + Uint8ClampedArray +]); diff --git a/test/built-ins/TypedArrays/of/BigInt/new-instance-using-custom-ctor.js b/test/built-ins/TypedArrays/of/BigInt/new-instance-using-custom-ctor.js new file mode 100644 index 000000000..58641f945 --- /dev/null +++ b/test/built-ins/TypedArrays/of/BigInt/new-instance-using-custom-ctor.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.of +description: > + Return a new TypedArray using a custom Constructor +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var called = 0; + + var ctor = function(len) { + assert.sameValue(arguments.length, 1); + called++; + return new TA(len); + }; + + + var result = TA.of.call(ctor, convertToBigInt(42), convertToBigInt(43), convertToBigInt(42)); + assert.sameValue(result.length, 3); + assert.sameValue(result[0], convertToBigInt(42)); + assert.sameValue(result[1], convertToBigInt(43)); + assert.sameValue(result[2], convertToBigInt(42)); + assert.sameValue(result.constructor, TA); + assert.sameValue(called, 1); +}); diff --git a/test/built-ins/TypedArrays/of/BigInt/new-instance.js b/test/built-ins/TypedArrays/of/BigInt/new-instance.js new file mode 100644 index 000000000..7e9cc745c --- /dev/null +++ b/test/built-ins/TypedArrays/of/BigInt/new-instance.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.of +description: > + Return a new TypedArray +info: | + 9.4.5.5 [[Set]] ( P, V, Receiver) + + ... + 2. If Type(P) is String and if SameValue(O, Receiver) is true, then + a. Let numericIndex be ! CanonicalNumericIndexString(P). + b. If numericIndex is not undefined, then + i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + ... + + 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + + ... + 3. Let numValue be ? ToNumber(value). + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + var result = TA.of(convertToBigInt(42), convertToBigInt(43), convertToBigInt(false)); + assert.sameValue(result.length, 3); + assert.sameValue(result[0], convertToBigInt(42)); + assert.sameValue(result[1], convertToBigInt(43)); + assert.sameValue(result[2], convertToBigInt(0)); + assert.sameValue(result.constructor, TA); + assert.sameValue(Object.getPrototypeOf(result), TA.prototype); +}); diff --git a/test/built-ins/TypedArrays/of/BigInt/this-is-not-constructor.js b/test/built-ins/TypedArrays/of/BigInt/this-is-not-constructor.js new file mode 100644 index 000000000..006b67404 --- /dev/null +++ b/test/built-ins/TypedArrays/of/BigInt/this-is-not-constructor.js @@ -0,0 +1,24 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.of +description: > + Throws a TypeError exception if this is not a constructor +info: | + 22.2.2.2 %TypedArray%.of ( ...items ) + + ... + 3. Let C be the this value. + 4. If IsConstructor(C) is false, throw a TypeError exception. + ... +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +var m = { m() {} }.m; + +testWithTypedArrayConstructors(function(TA) { + assert.throws(TypeError, function() { + TA.of.call(m, []); + }); +}); diff --git a/test/built-ins/TypedArrays/of/argument-number-value-throws.js b/test/built-ins/TypedArrays/of/argument-number-value-throws.js index 3d8a49ded..bda57f8cd 100644 --- a/test/built-ins/TypedArrays/of/argument-number-value-throws.js +++ b/test/built-ins/TypedArrays/of/argument-number-value-throws.js @@ -16,21 +16,23 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var lastValue = false; +var lastValue; - var obj1 = { - valueOf() { - lastValue = "obj1"; - return N(42); - } - }; - var obj2 = { - valueOf() { - lastValue = "obj2"; - throw new Test262Error(); - } - }; +var obj1 = { + valueOf() { + lastValue = "obj1"; + return 42; + } +}; +var obj2 = { + valueOf() { + lastValue = "obj2"; + throw new Test262Error(); + } +}; + +testWithTypedArrayConstructors(function(TA) { + lastValue = false; assert.throws(Test262Error, function() { TA.of(obj1, obj2, obj1); diff --git a/test/built-ins/TypedArrays/of/custom-ctor-returns-other-instance.js b/test/built-ins/TypedArrays/of/custom-ctor-returns-other-instance.js index 6417c73d5..e116b1db7 100644 --- a/test/built-ins/TypedArrays/of/custom-ctor-returns-other-instance.js +++ b/test/built-ins/TypedArrays/of/custom-ctor-returns-other-instance.js @@ -18,16 +18,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var result; var custom = new TA(3); var ctor = function() { return custom; }; - result = TypedArray.of.call(ctor, N(1), N(2), N(3)); + result = TypedArray.of.call(ctor, 1, 2, 3); assert.sameValue(result, custom, "using iterator, same length"); - result = TypedArray.of.call(ctor, N(1), N(2)); + result = TypedArray.of.call(ctor, 1, 2); assert.sameValue(result, custom, "using iterator, higher length"); }); diff --git a/test/built-ins/TypedArrays/of/new-instance-using-custom-ctor.js b/test/built-ins/TypedArrays/of/new-instance-using-custom-ctor.js index fbcc55b27..7cc95230e 100644 --- a/test/built-ins/TypedArrays/of/new-instance-using-custom-ctor.js +++ b/test/built-ins/TypedArrays/of/new-instance-using-custom-ctor.js @@ -8,7 +8,7 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var called = 0; var ctor = function(len) { @@ -18,11 +18,11 @@ testWithTypedArrayConstructors(function(TA, N) { }; - var result = TA.of.call(ctor, N(42), N(43), N(42)); + var result = TA.of.call(ctor, 42, 43, 42); assert.sameValue(result.length, 3); - assert.sameValue(result[0], N(42)); - assert.sameValue(result[1], N(43)); - assert.sameValue(result[2], N(42)); + assert.sameValue(result[0], 42); + assert.sameValue(result[1], 43); + assert.sameValue(result[2], 42); assert.sameValue(result.constructor, TA); assert.sameValue(called, 1); }); diff --git a/test/built-ins/TypedArrays/of/new-instance.js b/test/built-ins/TypedArrays/of/new-instance.js index a0fbe0150..e83ad648d 100644 --- a/test/built-ins/TypedArrays/of/new-instance.js +++ b/test/built-ins/TypedArrays/of/new-instance.js @@ -23,12 +23,12 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var result = TA.of(N(42), N(43), N(false)); +testWithTypedArrayConstructors(function(TA) { + var result = TA.of(42, 43, null); assert.sameValue(result.length, 3); - assert.sameValue(result[0], N(42)); - assert.sameValue(result[1], N(43)); - assert.sameValue(result[2], N(0)); + assert.sameValue(result[0], 42); + assert.sameValue(result[1], 43); + assert.sameValue(result[2], 0); assert.sameValue(result.constructor, TA); assert.sameValue(Object.getPrototypeOf(result), TA.prototype); }); diff --git a/test/built-ins/TypedArrays/prototype/Symbol.toStringTag/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/Symbol.toStringTag/bigint-inherited.js new file mode 100644 index 000000000..e0372adb7 --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/Symbol.toStringTag/bigint-inherited.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype-@@tostringtag +description: > + _TypedArray_.prototype[@@toStringTag] is inherited from %TypedArray% + _TypedArray_.prototype has no own property @@toStringTag +includes: [testTypedArray.js] +features: [Symbol.toStringTag, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty(Symbol.toStringTag), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/bigint-Symbol.iterator.js b/test/built-ins/TypedArrays/prototype/bigint-Symbol.iterator.js new file mode 100644 index 000000000..46590fe4d --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/bigint-Symbol.iterator.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype-@@iterator +description: > + _TypedArray_.prototype has no own property @@iterator +includes: [testTypedArray.js] +features: [Symbol.iterator, TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty(Symbol.iterator), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/buffer/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/buffer/bigint-inherited.js new file mode 100644 index 000000000..323b7476f --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/buffer/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype.buffer +description: > + _TypedArray_.prototype has no own property "buffer" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("buffer"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/byteLength/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/byteLength/bigint-inherited.js new file mode 100644 index 000000000..52b343265 --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/byteLength/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype.bytelength +description: > + _TypedArray_.prototype has no own property "byteLength" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("byteLength"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/byteOffset/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/byteOffset/bigint-inherited.js new file mode 100644 index 000000000..1d60311e0 --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/byteOffset/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype.byteoffset +description: > + _TypedArray_.prototype has no own property "byteOffset" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("byteOffset"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/copyWithin/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/copyWithin/bigint-inherited.js new file mode 100644 index 000000000..db5105ac6 --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/copyWithin/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.copywithin +description: > + _TypedArray_.prototype has no own property "copyWithin" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("copyWithin"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/entries/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/entries/bigint-inherited.js new file mode 100644 index 000000000..8601bc268 --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/entries/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.entries +description: > + _TypedArray_.prototype has no own property "entries" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("entries"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/every/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/every/bigint-inherited.js new file mode 100644 index 000000000..9b3da52bf --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/every/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.every +description: > + _TypedArray_.prototype has no own property "every" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("every"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/fill/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/fill/bigint-inherited.js new file mode 100644 index 000000000..b6862164e --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/fill/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.fill +description: > + _TypedArray_.prototype has no own property "fill" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("fill"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/filter/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/filter/bigint-inherited.js new file mode 100644 index 000000000..36d9019de --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/filter/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.filter +description: > + _TypedArray_.prototype has no own property "filter" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("filter"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/find/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/find/bigint-inherited.js new file mode 100644 index 000000000..828c4f4c4 --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/find/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.find +description: > + _TypedArray_.prototype has no own property "find" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("find"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/findIndex/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/findIndex/bigint-inherited.js new file mode 100644 index 000000000..63f6f2279 --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/findIndex/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.findindex +description: > + _TypedArray_.prototype has no own property "findIndex" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("findIndex"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/forEach/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/forEach/bigint-inherited.js new file mode 100644 index 000000000..de6e9371d --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/forEach/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.foreach +description: > + _TypedArray_.prototype has no own property "forEach" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("forEach"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/indexOf/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/indexOf/bigint-inherited.js new file mode 100644 index 000000000..362ef22a9 --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/indexOf/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.indexof +description: > + _TypedArray_.prototype has no own property "indexOf" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("indexOf"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/join/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/join/bigint-inherited.js new file mode 100644 index 000000000..cc649c89f --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/join/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.join +description: > + _TypedArray_.prototype has no own property "join" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("join"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/keys/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/keys/bigint-inherited.js new file mode 100644 index 000000000..f4c800c5e --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/keys/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.keys +description: > + _TypedArray_.prototype has no own property "keys" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("keys"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/lastIndexOf/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/lastIndexOf/bigint-inherited.js new file mode 100644 index 000000000..5a68f3fa3 --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/lastIndexOf/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.lastindexof +description: > + _TypedArray_.prototype has no own property "lastIndexOf" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("lastIndexOf"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/length/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/length/bigint-inherited.js new file mode 100644 index 000000000..b75ccb831 --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/length/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype.length +description: > + _TypedArray_.prototype has no own property "length" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("length"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/map/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/map/bigint-inherited.js new file mode 100644 index 000000000..2d5d48aae --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/map/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.map +description: > + _TypedArray_.prototype has no own property "map" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("map"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/reduce/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/reduce/bigint-inherited.js new file mode 100644 index 000000000..d01bda709 --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/reduce/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-get-%typedarray%.prototype.reduce +description: > + _TypedArray_.prototype has no own property "reduce" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("reduce"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/reduceRight/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/reduceRight/bigint-inherited.js new file mode 100644 index 000000000..784e4c2b7 --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/reduceRight/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reduceright +description: > + _TypedArray_.prototype has no own property "reduceRight" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("reduceRight"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/reverse/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/reverse/bigint-inherited.js new file mode 100644 index 000000000..7d8a7d6e2 --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/reverse/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.reverse +description: > + _TypedArray_.prototype has no own property "reverse" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("reverse"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/set/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/set/bigint-inherited.js new file mode 100644 index 000000000..411b66fda --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/set/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.set +description: > + _TypedArray_.prototype has no own property "set" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("set"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/slice/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/slice/bigint-inherited.js new file mode 100644 index 000000000..a1ae44026 --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/slice/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.slice +description: > + _TypedArray_.prototype has no own property "slice" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("slice"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/some/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/some/bigint-inherited.js new file mode 100644 index 000000000..4b75f87f2 --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/some/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.some +description: > + _TypedArray_.prototype has no own property "some" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("some"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/sort/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/sort/bigint-inherited.js new file mode 100644 index 000000000..37aab5255 --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/sort/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.sort +description: > + _TypedArray_.prototype has no own property "sort" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("sort"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/subarray/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/subarray/bigint-inherited.js new file mode 100644 index 000000000..2416208a3 --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/subarray/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.subarray +description: > + _TypedArray_.prototype has no own property "subarray" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("subarray"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/toLocaleString/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/toLocaleString/bigint-inherited.js new file mode 100644 index 000000000..d4a48e25d --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/toLocaleString/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.tolocalestring +description: > + _TypedArray_.prototype has no own property "toLocaleString" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("toLocaleString"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/toString/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/toString/bigint-inherited.js new file mode 100644 index 000000000..9f1b0e217 --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/toString/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.tostring +description: > + _TypedArray_.prototype has no own property "toString" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("toString"), false); +}); diff --git a/test/built-ins/TypedArrays/prototype/values/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/values/bigint-inherited.js new file mode 100644 index 000000000..bd4aaec70 --- /dev/null +++ b/test/built-ins/TypedArrays/prototype/values/bigint-inherited.js @@ -0,0 +1,13 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-%typedarray%.prototype.values +description: > + _TypedArray_.prototype has no own property "values" +includes: [testTypedArray.js] +features: [TypedArray] +---*/ + +testWithTypedArrayConstructors(function(TA) { + assert.sameValue(TA.prototype.hasOwnProperty("values"), false); +}); -- cgit v1.2.1 From 08c1f368280103bf679a19fefc7bb8c52413e7cb Mon Sep 17 00:00:00 2001 From: Leo Balter Date: Thu, 15 Feb 2018 12:07:25 -0500 Subject: Use esid tags on TypedArray/prototype/* --- test/built-ins/TypedArray/prototype/Symbol.iterator.js | 2 +- .../prototype/Symbol.toStringTag/BigInt/invoked-as-accessor.js | 2 +- .../TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-func.js | 2 +- .../built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/name.js | 2 +- .../TypedArray/prototype/Symbol.toStringTag/BigInt/prop-desc.js | 2 +- .../TypedArray/prototype/Symbol.toStringTag/invoked-as-accessor.js | 2 +- .../TypedArray/prototype/Symbol.toStringTag/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/Symbol.toStringTag/length.js | 2 +- test/built-ins/TypedArray/prototype/Symbol.toStringTag/name.js | 2 +- test/built-ins/TypedArray/prototype/Symbol.toStringTag/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/buffer/BigInt/return-buffer.js | 2 +- test/built-ins/TypedArray/prototype/buffer/invoked-as-accessor.js | 2 +- test/built-ins/TypedArray/prototype/buffer/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/buffer/length.js | 2 +- test/built-ins/TypedArray/prototype/buffer/name.js | 2 +- test/built-ins/TypedArray/prototype/buffer/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/buffer/return-buffer.js | 2 +- .../TypedArray/prototype/buffer/this-has-no-typedarrayname-internal.js | 1 - test/built-ins/TypedArray/prototype/buffer/this-is-not-object.js | 2 +- .../TypedArray/prototype/byteLength/BigInt/return-bytelength.js | 2 +- test/built-ins/TypedArray/prototype/byteLength/invoked-as-accessor.js | 2 +- test/built-ins/TypedArray/prototype/byteLength/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/byteLength/length.js | 2 +- test/built-ins/TypedArray/prototype/byteLength/name.js | 2 +- test/built-ins/TypedArray/prototype/byteLength/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/byteLength/return-bytelength.js | 2 +- .../prototype/byteLength/this-has-no-typedarrayname-internal.js | 1 - test/built-ins/TypedArray/prototype/byteLength/this-is-not-object.js | 2 +- .../TypedArray/prototype/byteOffset/BigInt/return-byteoffset.js | 2 +- test/built-ins/TypedArray/prototype/byteOffset/invoked-as-accessor.js | 2 +- test/built-ins/TypedArray/prototype/byteOffset/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/byteOffset/length.js | 2 +- test/built-ins/TypedArray/prototype/byteOffset/name.js | 2 +- test/built-ins/TypedArray/prototype/byteOffset/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/byteOffset/return-byteoffset.js | 2 +- .../prototype/byteOffset/this-has-no-typedarrayname-internal.js | 1 - test/built-ins/TypedArray/prototype/byteOffset/this-is-not-object.js | 2 +- test/built-ins/TypedArray/prototype/constructor.js | 2 +- .../TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js | 1 - .../TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js | 1 - .../TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js | 1 - .../prototype/copyWithin/BigInt/get-length-ignores-length-prop.js | 1 - .../TypedArray/prototype/copyWithin/BigInt/invoked-as-func.js | 2 +- .../TypedArray/prototype/copyWithin/BigInt/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js | 2 +- test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js | 1 - .../prototype/copyWithin/BigInt/negative-out-of-bounds-end.js | 1 - .../prototype/copyWithin/BigInt/negative-out-of-bounds-start.js | 1 - .../prototype/copyWithin/BigInt/negative-out-of-bounds-target.js | 1 - .../built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js | 1 - .../TypedArray/prototype/copyWithin/BigInt/negative-target.js | 1 - .../prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js | 1 - .../copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js | 1 - .../prototype/copyWithin/BigInt/non-negative-target-and-start.js | 1 - .../prototype/copyWithin/BigInt/non-negative-target-start-and-end.js | 1 - test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js | 2 +- .../prototype/copyWithin/BigInt/return-abrupt-from-end-is-symbol.js | 1 - .../TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end.js | 1 - .../prototype/copyWithin/BigInt/return-abrupt-from-start-is-symbol.js | 1 - .../TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start.js | 1 - .../prototype/copyWithin/BigInt/return-abrupt-from-target-is-symbol.js | 1 - .../prototype/copyWithin/BigInt/return-abrupt-from-target.js | 1 - test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js | 1 - test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js | 1 - test/built-ins/TypedArray/prototype/copyWithin/bit-precision.js | 1 - test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js | 1 - test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js | 1 - .../built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js | 1 - .../TypedArray/prototype/copyWithin/get-length-ignores-length-prop.js | 1 - test/built-ins/TypedArray/prototype/copyWithin/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/copyWithin/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/copyWithin/length.js | 2 +- test/built-ins/TypedArray/prototype/copyWithin/name.js | 2 +- test/built-ins/TypedArray/prototype/copyWithin/negative-end.js | 1 - .../TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js | 1 - .../TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js | 1 - .../TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js | 1 - test/built-ins/TypedArray/prototype/copyWithin/negative-start.js | 1 - test/built-ins/TypedArray/prototype/copyWithin/negative-target.js | 1 - .../TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js | 1 - .../copyWithin/non-negative-out-of-bounds-target-and-start.js | 1 - .../TypedArray/prototype/copyWithin/non-negative-target-and-start.js | 1 - .../prototype/copyWithin/non-negative-target-start-and-end.js | 1 - test/built-ins/TypedArray/prototype/copyWithin/prop-desc.js | 2 +- .../prototype/copyWithin/return-abrupt-from-end-is-symbol.js | 1 - .../TypedArray/prototype/copyWithin/return-abrupt-from-end.js | 1 - .../prototype/copyWithin/return-abrupt-from-start-is-symbol.js | 1 - .../TypedArray/prototype/copyWithin/return-abrupt-from-start.js | 1 - .../prototype/copyWithin/return-abrupt-from-target-is-symbol.js | 1 - .../TypedArray/prototype/copyWithin/return-abrupt-from-target.js | 1 - test/built-ins/TypedArray/prototype/copyWithin/return-this.js | 1 - test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js | 1 - test/built-ins/TypedArray/prototype/entries/BigInt/iter-prototype.js | 1 - test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js | 1 - test/built-ins/TypedArray/prototype/entries/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/entries/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/entries/iter-prototype.js | 1 - test/built-ins/TypedArray/prototype/entries/length.js | 2 +- test/built-ins/TypedArray/prototype/entries/name.js | 2 +- test/built-ins/TypedArray/prototype/entries/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/entries/return-itor.js | 1 - test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/every/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/every/BigInt/name.js | 2 +- test/built-ins/TypedArray/prototype/every/BigInt/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/every/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/every/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/every/length.js | 2 +- test/built-ins/TypedArray/prototype/every/name.js | 2 +- test/built-ins/TypedArray/prototype/every/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js | 1 - .../fill/BigInt/fill-values-conversion-operations-consistent-nan.js | 1 - .../prototype/fill/BigInt/fill-values-conversion-operations.js | 1 - .../prototype/fill/BigInt/fill-values-custom-start-and-end.js | 1 - .../TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js | 1 - .../TypedArray/prototype/fill/BigInt/fill-values-relative-end.js | 1 - .../TypedArray/prototype/fill/BigInt/fill-values-relative-start.js | 1 - .../TypedArray/prototype/fill/BigInt/fill-values-symbol-throws.js | 1 - test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js | 1 - .../TypedArray/prototype/fill/BigInt/get-length-ignores-length-prop.js | 1 - test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/fill/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/fill/BigInt/name.js | 2 +- test/built-ins/TypedArray/prototype/fill/BigInt/prop-desc.js | 2 +- .../prototype/fill/BigInt/return-abrupt-from-end-as-symbol.js | 1 - .../TypedArray/prototype/fill/BigInt/return-abrupt-from-end.js | 1 - .../TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js | 1 - .../prototype/fill/BigInt/return-abrupt-from-start-as-symbol.js | 1 - .../TypedArray/prototype/fill/BigInt/return-abrupt-from-start.js | 1 - test/built-ins/TypedArray/prototype/fill/BigInt/return-this.js | 1 - test/built-ins/TypedArray/prototype/fill/coerced-indexes.js | 1 - .../prototype/fill/fill-values-conversion-operations-consistent-nan.js | 1 - .../TypedArray/prototype/fill/fill-values-conversion-operations.js | 1 - .../TypedArray/prototype/fill/fill-values-custom-start-and-end.js | 1 - test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js | 1 - test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js | 1 - test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js | 1 - test/built-ins/TypedArray/prototype/fill/fill-values-symbol-throws.js | 1 - test/built-ins/TypedArray/prototype/fill/fill-values.js | 1 - .../TypedArray/prototype/fill/get-length-ignores-length-prop.js | 1 - test/built-ins/TypedArray/prototype/fill/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/fill/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/fill/length.js | 2 +- test/built-ins/TypedArray/prototype/fill/name.js | 2 +- test/built-ins/TypedArray/prototype/fill/prop-desc.js | 2 +- .../TypedArray/prototype/fill/return-abrupt-from-end-as-symbol.js | 1 - test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end.js | 1 - .../TypedArray/prototype/fill/return-abrupt-from-set-value.js | 1 - .../TypedArray/prototype/fill/return-abrupt-from-start-as-symbol.js | 1 - test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start.js | 1 - test/built-ins/TypedArray/prototype/fill/return-this.js | 1 - test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/filter/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/filter/BigInt/name.js | 2 +- test/built-ins/TypedArray/prototype/filter/BigInt/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/filter/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/filter/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/filter/length.js | 2 +- test/built-ins/TypedArray/prototype/filter/name.js | 2 +- test/built-ins/TypedArray/prototype/filter/prop-desc.js | 2 +- .../TypedArray/prototype/find/BigInt/get-length-ignores-length-prop.js | 1 - test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/find/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/find/BigInt/name.js | 2 +- .../TypedArray/prototype/find/BigInt/predicate-call-changes-value.js | 1 - .../TypedArray/prototype/find/BigInt/predicate-call-parameters.js | 1 - .../TypedArray/prototype/find/BigInt/predicate-call-this-non-strict.js | 1 - .../TypedArray/prototype/find/BigInt/predicate-call-this-strict.js | 1 - .../prototype/find/BigInt/predicate-is-not-callable-throws.js | 1 - .../TypedArray/prototype/find/BigInt/predicate-may-detach-buffer.js | 1 - .../prototype/find/BigInt/predicate-not-called-on-empty-array.js | 1 - test/built-ins/TypedArray/prototype/find/BigInt/prop-desc.js | 2 +- .../prototype/find/BigInt/return-abrupt-from-predicate-call.js | 1 - .../find/BigInt/return-found-value-predicate-result-is-true.js | 1 - .../find/BigInt/return-undefined-if-predicate-returns-false-value.js | 1 - .../TypedArray/prototype/find/get-length-ignores-length-prop.js | 1 - test/built-ins/TypedArray/prototype/find/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/find/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/find/length.js | 2 +- test/built-ins/TypedArray/prototype/find/name.js | 2 +- .../TypedArray/prototype/find/predicate-call-changes-value.js | 1 - test/built-ins/TypedArray/prototype/find/predicate-call-parameters.js | 1 - .../TypedArray/prototype/find/predicate-call-this-non-strict.js | 1 - test/built-ins/TypedArray/prototype/find/predicate-call-this-strict.js | 1 - .../TypedArray/prototype/find/predicate-is-not-callable-throws.js | 1 - .../built-ins/TypedArray/prototype/find/predicate-may-detach-buffer.js | 1 - .../TypedArray/prototype/find/predicate-not-called-on-empty-array.js | 1 - test/built-ins/TypedArray/prototype/find/prop-desc.js | 2 +- .../TypedArray/prototype/find/return-abrupt-from-predicate-call.js | 1 - .../prototype/find/return-found-value-predicate-result-is-true.js | 1 - .../find/return-undefined-if-predicate-returns-false-value.js | 1 - .../prototype/findIndex/BigInt/get-length-ignores-length-prop.js | 1 - .../built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-func.js | 2 +- .../TypedArray/prototype/findIndex/BigInt/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/findIndex/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/findIndex/BigInt/name.js | 2 +- .../prototype/findIndex/BigInt/predicate-call-changes-value.js | 1 - .../TypedArray/prototype/findIndex/BigInt/predicate-call-parameters.js | 1 - .../prototype/findIndex/BigInt/predicate-call-this-non-strict.js | 1 - .../prototype/findIndex/BigInt/predicate-call-this-strict.js | 1 - .../prototype/findIndex/BigInt/predicate-is-not-callable-throws.js | 1 - .../prototype/findIndex/BigInt/predicate-may-detach-buffer.js | 1 - .../prototype/findIndex/BigInt/predicate-not-called-on-empty-array.js | 1 - test/built-ins/TypedArray/prototype/findIndex/BigInt/prop-desc.js | 2 +- .../prototype/findIndex/BigInt/return-abrupt-from-predicate-call.js | 1 - .../findIndex/BigInt/return-index-predicate-result-is-true.js | 1 - .../BigInt/return-negative-one-if-predicate-returns-false-value.js | 1 - .../TypedArray/prototype/findIndex/get-length-ignores-length-prop.js | 1 - test/built-ins/TypedArray/prototype/findIndex/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/findIndex/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/findIndex/length.js | 2 +- test/built-ins/TypedArray/prototype/findIndex/name.js | 2 +- .../TypedArray/prototype/findIndex/predicate-call-changes-value.js | 1 - .../TypedArray/prototype/findIndex/predicate-call-parameters.js | 1 - .../TypedArray/prototype/findIndex/predicate-call-this-non-strict.js | 1 - .../TypedArray/prototype/findIndex/predicate-call-this-strict.js | 1 - .../TypedArray/prototype/findIndex/predicate-is-not-callable-throws.js | 1 - .../TypedArray/prototype/findIndex/predicate-may-detach-buffer.js | 1 - .../prototype/findIndex/predicate-not-called-on-empty-array.js | 1 - test/built-ins/TypedArray/prototype/findIndex/prop-desc.js | 2 +- .../prototype/findIndex/return-abrupt-from-predicate-call.js | 1 - .../prototype/findIndex/return-index-predicate-result-is-true.js | 1 - .../findIndex/return-negative-one-if-predicate-returns-false-value.js | 1 - test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-func.js | 2 +- .../built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/forEach/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/forEach/BigInt/name.js | 2 +- test/built-ins/TypedArray/prototype/forEach/BigInt/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/forEach/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/forEach/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/forEach/length.js | 2 +- test/built-ins/TypedArray/prototype/forEach/name.js | 2 +- test/built-ins/TypedArray/prototype/forEach/prop-desc.js | 2 +- .../TypedArray/prototype/includes/BigInt/this-is-not-object.js | 1 - test/built-ins/TypedArray/prototype/includes/this-is-not-object.js | 1 - test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-func.js | 2 +- .../built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/indexOf/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/indexOf/BigInt/name.js | 2 +- test/built-ins/TypedArray/prototype/indexOf/BigInt/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/indexOf/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/indexOf/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/indexOf/length.js | 2 +- test/built-ins/TypedArray/prototype/indexOf/name.js | 2 +- test/built-ins/TypedArray/prototype/indexOf/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/join/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/join/BigInt/name.js | 2 +- test/built-ins/TypedArray/prototype/join/BigInt/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/join/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/join/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/join/length.js | 2 +- test/built-ins/TypedArray/prototype/join/name.js | 2 +- test/built-ins/TypedArray/prototype/join/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/keys/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/keys/BigInt/name.js | 2 +- test/built-ins/TypedArray/prototype/keys/BigInt/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/keys/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/keys/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/keys/length.js | 2 +- test/built-ins/TypedArray/prototype/keys/name.js | 2 +- test/built-ins/TypedArray/prototype/keys/prop-desc.js | 2 +- .../TypedArray/prototype/lastIndexOf/BigInt/invoked-as-func.js | 2 +- .../TypedArray/prototype/lastIndexOf/BigInt/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/name.js | 2 +- test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/lastIndexOf/length.js | 2 +- test/built-ins/TypedArray/prototype/lastIndexOf/name.js | 2 +- test/built-ins/TypedArray/prototype/lastIndexOf/prop-desc.js | 2 +- .../TypedArray/prototype/length/BigInt/invoked-as-accessor.js | 2 +- test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/length/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/length/BigInt/name.js | 2 +- test/built-ins/TypedArray/prototype/length/BigInt/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/length/invoked-as-accessor.js | 2 +- test/built-ins/TypedArray/prototype/length/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/length/length.js | 2 +- test/built-ins/TypedArray/prototype/length/name.js | 2 +- test/built-ins/TypedArray/prototype/length/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/map/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/map/BigInt/name.js | 2 +- test/built-ins/TypedArray/prototype/map/BigInt/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/map/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/map/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/map/length.js | 2 +- test/built-ins/TypedArray/prototype/map/name.js | 2 +- test/built-ins/TypedArray/prototype/map/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/reduce/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/reduce/BigInt/name.js | 2 +- test/built-ins/TypedArray/prototype/reduce/BigInt/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/reduce/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/reduce/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/reduce/length.js | 2 +- test/built-ins/TypedArray/prototype/reduce/name.js | 2 +- test/built-ins/TypedArray/prototype/reduce/prop-desc.js | 2 +- .../TypedArray/prototype/reduceRight/BigInt/invoked-as-func.js | 2 +- .../TypedArray/prototype/reduceRight/BigInt/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/reduceRight/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/reduceRight/BigInt/name.js | 2 +- test/built-ins/TypedArray/prototype/reduceRight/BigInt/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/reduceRight/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/reduceRight/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/reduceRight/length.js | 2 +- test/built-ins/TypedArray/prototype/reduceRight/name.js | 2 +- test/built-ins/TypedArray/prototype/reduceRight/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-func.js | 2 +- .../built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/reverse/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/reverse/BigInt/name.js | 2 +- test/built-ins/TypedArray/prototype/reverse/BigInt/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/reverse/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/reverse/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/reverse/length.js | 2 +- test/built-ins/TypedArray/prototype/reverse/name.js | 2 +- test/built-ins/TypedArray/prototype/reverse/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js | 3 +-- test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/set/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/set/BigInt/name.js | 2 +- test/built-ins/TypedArray/prototype/set/BigInt/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/set/bit-precision.js | 3 +-- test/built-ins/TypedArray/prototype/set/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/set/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/set/length.js | 2 +- test/built-ins/TypedArray/prototype/set/name.js | 2 +- test/built-ins/TypedArray/prototype/set/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/slice/BigInt/bit-precision.js | 1 - test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/slice/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/slice/BigInt/name.js | 2 +- test/built-ins/TypedArray/prototype/slice/BigInt/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/slice/bit-precision.js | 1 - test/built-ins/TypedArray/prototype/slice/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/slice/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/slice/length.js | 2 +- test/built-ins/TypedArray/prototype/slice/name.js | 2 +- test/built-ins/TypedArray/prototype/slice/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/some/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/some/BigInt/name.js | 2 +- test/built-ins/TypedArray/prototype/some/BigInt/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/some/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/some/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/some/length.js | 2 +- test/built-ins/TypedArray/prototype/some/name.js | 2 +- test/built-ins/TypedArray/prototype/some/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/sort/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/sort/BigInt/name.js | 2 +- test/built-ins/TypedArray/prototype/sort/BigInt/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/sort/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/sort/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/sort/length.js | 2 +- test/built-ins/TypedArray/prototype/sort/name.js | 2 +- test/built-ins/TypedArray/prototype/sort/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-func.js | 2 +- .../TypedArray/prototype/subarray/BigInt/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/subarray/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/subarray/BigInt/name.js | 2 +- test/built-ins/TypedArray/prototype/subarray/BigInt/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/subarray/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/subarray/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/subarray/length.js | 2 +- test/built-ins/TypedArray/prototype/subarray/name.js | 2 +- test/built-ins/TypedArray/prototype/subarray/prop-desc.js | 2 +- .../TypedArray/prototype/toLocaleString/BigInt/invoked-as-func.js | 2 +- .../TypedArray/prototype/toLocaleString/BigInt/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/toLocaleString/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/toLocaleString/BigInt/name.js | 2 +- test/built-ins/TypedArray/prototype/toLocaleString/BigInt/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-func.js | 2 +- .../built-ins/TypedArray/prototype/toLocaleString/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/toLocaleString/length.js | 2 +- test/built-ins/TypedArray/prototype/toLocaleString/name.js | 2 +- test/built-ins/TypedArray/prototype/toLocaleString/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/toString.js | 2 +- test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/values/BigInt/length.js | 2 +- test/built-ins/TypedArray/prototype/values/BigInt/name.js | 2 +- test/built-ins/TypedArray/prototype/values/BigInt/prop-desc.js | 2 +- test/built-ins/TypedArray/prototype/values/invoked-as-func.js | 2 +- test/built-ins/TypedArray/prototype/values/invoked-as-method.js | 2 +- test/built-ins/TypedArray/prototype/values/length.js | 2 +- test/built-ins/TypedArray/prototype/values/name.js | 2 +- test/built-ins/TypedArray/prototype/values/prop-desc.js | 2 +- 406 files changed, 274 insertions(+), 408 deletions(-) diff --git a/test/built-ins/TypedArray/prototype/Symbol.iterator.js b/test/built-ins/TypedArray/prototype/Symbol.iterator.js index e488e08df..67179b62a 100644 --- a/test/built-ins/TypedArray/prototype/Symbol.iterator.js +++ b/test/built-ins/TypedArray/prototype/Symbol.iterator.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.30 +esid: sec-%typedarray%.prototype-@@iterator description: > Initial state of the Symbol.iterator property info: | diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-accessor.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-accessor.js index a7f843337..e2852b8f3 100644 --- a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-accessor.js +++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-accessor.js @@ -1,7 +1,7 @@ // 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.3.31 +esid: sec-get-%typedarray%.prototype-@@tostringtag description: > Return undefined if this value does not have a [[TypedArrayName]] internal slot info: | diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-func.js index fee58c92f..33aa05dac 100644 --- a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.31 +esid: sec-get-%typedarray%.prototype-@@tostringtag description: If this value is not Object, return undefined. info: | 22.2.3.31 get %TypedArray%.prototype [ @@toStringTag ] diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/length.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/length.js index 6b8e035cd..13e4e9e17 100644 --- a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.31 +esid: sec-get-%typedarray%.prototype-@@tostringtag description: > get %TypedArray%.prototype [ @@toStringTag ].length is 0. info: | diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/name.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/name.js index 9b9342a72..1004ce463 100644 --- a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.31 +esid: sec-get-%typedarray%.prototype-@@tostringtag description: > get %TypedArray%.prototype [ @@toStringTag ].name is "get [Symbol.toStringTag]". info: | diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/prop-desc.js index bae8ca763..23f76220b 100644 --- a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.31 +esid: sec-get-%typedarray%.prototype-@@tostringtag description: > "@@toStringTag" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-accessor.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-accessor.js index 252c9cfcb..a6fcea836 100644 --- a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-accessor.js +++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-accessor.js @@ -1,7 +1,7 @@ // 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.3.31 +esid: sec-get-%typedarray%.prototype-@@tostringtag description: > Return undefined if this value does not have a [[TypedArrayName]] internal slot info: | diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-func.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-func.js index 60e2f84f9..3c89cc5cd 100644 --- a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.31 +esid: sec-get-%typedarray%.prototype-@@tostringtag description: If this value is not Object, return undefined. info: | 22.2.3.31 get %TypedArray%.prototype [ @@toStringTag ] diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/length.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/length.js index faa887b93..37b6d2aaf 100644 --- a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/length.js +++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.31 +esid: sec-get-%typedarray%.prototype-@@tostringtag description: > get %TypedArray%.prototype [ @@toStringTag ].length is 0. info: | diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/name.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/name.js index f39dc9eaa..fef03e767 100644 --- a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/name.js +++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.31 +esid: sec-get-%typedarray%.prototype-@@tostringtag description: > get %TypedArray%.prototype [ @@toStringTag ].name is "get [Symbol.toStringTag]". info: | diff --git a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/prop-desc.js b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/prop-desc.js index 75c827fae..62c84434b 100644 --- a/test/built-ins/TypedArray/prototype/Symbol.toStringTag/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/Symbol.toStringTag/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.31 +esid: sec-get-%typedarray%.prototype-@@tostringtag description: > "@@toStringTag" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/buffer/BigInt/return-buffer.js b/test/built-ins/TypedArray/prototype/buffer/BigInt/return-buffer.js index c49a8df0a..7630425eb 100644 --- a/test/built-ins/TypedArray/prototype/buffer/BigInt/return-buffer.js +++ b/test/built-ins/TypedArray/prototype/buffer/BigInt/return-buffer.js @@ -1,7 +1,7 @@ // 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.3.1 +esid: sec-get-%typedarray%.prototype.buffer description: > Return buffer from [[ViewedArrayBuffer]] internal slot info: | diff --git a/test/built-ins/TypedArray/prototype/buffer/invoked-as-accessor.js b/test/built-ins/TypedArray/prototype/buffer/invoked-as-accessor.js index 46e9206a8..6c8241122 100644 --- a/test/built-ins/TypedArray/prototype/buffer/invoked-as-accessor.js +++ b/test/built-ins/TypedArray/prototype/buffer/invoked-as-accessor.js @@ -1,7 +1,7 @@ // 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.3.1 +esid: sec-get-%typedarray%.prototype.buffer description: > Requires this value to have a [[ViewedArrayBuffer]] internal slot info: | diff --git a/test/built-ins/TypedArray/prototype/buffer/invoked-as-func.js b/test/built-ins/TypedArray/prototype/buffer/invoked-as-func.js index 249511110..d962e2d58 100644 --- a/test/built-ins/TypedArray/prototype/buffer/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/buffer/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.1 +esid: sec-get-%typedarray%.prototype.buffer description: Throws a TypeError exception when invoked as a function info: | 22.2.3.1 get %TypedArray%.prototype.buffer diff --git a/test/built-ins/TypedArray/prototype/buffer/length.js b/test/built-ins/TypedArray/prototype/buffer/length.js index 72e488c11..cb0b835ca 100644 --- a/test/built-ins/TypedArray/prototype/buffer/length.js +++ b/test/built-ins/TypedArray/prototype/buffer/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.1 +esid: sec-get-%typedarray%.prototype.buffer description: > get %TypedArray%.prototype.buffer.length is 0. info: | diff --git a/test/built-ins/TypedArray/prototype/buffer/name.js b/test/built-ins/TypedArray/prototype/buffer/name.js index bbd1b6f37..d01a0555b 100644 --- a/test/built-ins/TypedArray/prototype/buffer/name.js +++ b/test/built-ins/TypedArray/prototype/buffer/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.1 +esid: sec-get-%typedarray%.prototype.buffer description: > get %TypedArray%.prototype.buffer.name is "get buffer". info: | diff --git a/test/built-ins/TypedArray/prototype/buffer/prop-desc.js b/test/built-ins/TypedArray/prototype/buffer/prop-desc.js index f666062a7..0927ee3fa 100644 --- a/test/built-ins/TypedArray/prototype/buffer/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/buffer/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.1 +esid: sec-get-%typedarray%.prototype.buffer description: > "buffer" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/buffer/return-buffer.js b/test/built-ins/TypedArray/prototype/buffer/return-buffer.js index 82420a6df..fe01f785b 100644 --- a/test/built-ins/TypedArray/prototype/buffer/return-buffer.js +++ b/test/built-ins/TypedArray/prototype/buffer/return-buffer.js @@ -1,7 +1,7 @@ // 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.3.1 +esid: sec-get-%typedarray%.prototype.buffer description: > Return buffer from [[ViewedArrayBuffer]] internal slot info: | diff --git a/test/built-ins/TypedArray/prototype/buffer/this-has-no-typedarrayname-internal.js b/test/built-ins/TypedArray/prototype/buffer/this-has-no-typedarrayname-internal.js index 9b6b28db8..65dace14a 100644 --- a/test/built-ins/TypedArray/prototype/buffer/this-has-no-typedarrayname-internal.js +++ b/test/built-ins/TypedArray/prototype/buffer/this-has-no-typedarrayname-internal.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-get-%typedarray%.prototype.buffer -es6id: 22.2.3.1 description: > Throws a TypeError exception when `this` does not have a [[TypedArrayName]] internal slot diff --git a/test/built-ins/TypedArray/prototype/buffer/this-is-not-object.js b/test/built-ins/TypedArray/prototype/buffer/this-is-not-object.js index 0292bd502..29a455566 100644 --- a/test/built-ins/TypedArray/prototype/buffer/this-is-not-object.js +++ b/test/built-ins/TypedArray/prototype/buffer/this-is-not-object.js @@ -1,7 +1,7 @@ // 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.3.1 +esid: sec-get-%typedarray%.prototype.buffer description: Throws a TypeError exception when `this` is not Object info: | 22.2.3.1 get %TypedArray%.prototype.buffer diff --git a/test/built-ins/TypedArray/prototype/byteLength/BigInt/return-bytelength.js b/test/built-ins/TypedArray/prototype/byteLength/BigInt/return-bytelength.js index c60a40801..381bc7c2d 100644 --- a/test/built-ins/TypedArray/prototype/byteLength/BigInt/return-bytelength.js +++ b/test/built-ins/TypedArray/prototype/byteLength/BigInt/return-bytelength.js @@ -1,7 +1,7 @@ // 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.3.2 +esid: sec-get-%typedarray%.prototype.bytelength description: > Return value from [[ByteLength]] internal slot info: | diff --git a/test/built-ins/TypedArray/prototype/byteLength/invoked-as-accessor.js b/test/built-ins/TypedArray/prototype/byteLength/invoked-as-accessor.js index e46b08e37..9838344e4 100644 --- a/test/built-ins/TypedArray/prototype/byteLength/invoked-as-accessor.js +++ b/test/built-ins/TypedArray/prototype/byteLength/invoked-as-accessor.js @@ -1,7 +1,7 @@ // 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.3.2 +esid: sec-get-%typedarray%.prototype.bytelength description: > Requires this value to have a [[ViewedArrayBuffer]] internal slot info: | diff --git a/test/built-ins/TypedArray/prototype/byteLength/invoked-as-func.js b/test/built-ins/TypedArray/prototype/byteLength/invoked-as-func.js index 71ee4d577..f9189895e 100644 --- a/test/built-ins/TypedArray/prototype/byteLength/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/byteLength/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.2 +esid: sec-get-%typedarray%.prototype.bytelength description: Throws a TypeError exception when invoked as a function info: | 22.2.3.2 get %TypedArray%.prototype.byteLength diff --git a/test/built-ins/TypedArray/prototype/byteLength/length.js b/test/built-ins/TypedArray/prototype/byteLength/length.js index ab0d0cf87..9ce1fc54b 100644 --- a/test/built-ins/TypedArray/prototype/byteLength/length.js +++ b/test/built-ins/TypedArray/prototype/byteLength/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.2 +esid: sec-get-%typedarray%.prototype.bytelength description: > get %TypedArray%.prototype.byteLength.length is 0. info: | diff --git a/test/built-ins/TypedArray/prototype/byteLength/name.js b/test/built-ins/TypedArray/prototype/byteLength/name.js index 4dfc681d1..e2d8f7850 100644 --- a/test/built-ins/TypedArray/prototype/byteLength/name.js +++ b/test/built-ins/TypedArray/prototype/byteLength/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.2 +esid: sec-get-%typedarray%.prototype.bytelength description: > get %TypedArray%.prototype.byteLength.name is "get byteLength". info: | diff --git a/test/built-ins/TypedArray/prototype/byteLength/prop-desc.js b/test/built-ins/TypedArray/prototype/byteLength/prop-desc.js index da1aedd28..c3e699419 100644 --- a/test/built-ins/TypedArray/prototype/byteLength/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/byteLength/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.2 +esid: sec-get-%typedarray%.prototype.bytelength description: > "byteLength" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/byteLength/return-bytelength.js b/test/built-ins/TypedArray/prototype/byteLength/return-bytelength.js index f801c9ac3..51e0556a7 100644 --- a/test/built-ins/TypedArray/prototype/byteLength/return-bytelength.js +++ b/test/built-ins/TypedArray/prototype/byteLength/return-bytelength.js @@ -1,7 +1,7 @@ // 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.3.2 +esid: sec-get-%typedarray%.prototype.bytelength description: > Return value from [[ByteLength]] internal slot info: | diff --git a/test/built-ins/TypedArray/prototype/byteLength/this-has-no-typedarrayname-internal.js b/test/built-ins/TypedArray/prototype/byteLength/this-has-no-typedarrayname-internal.js index f8c050544..0cac912ca 100644 --- a/test/built-ins/TypedArray/prototype/byteLength/this-has-no-typedarrayname-internal.js +++ b/test/built-ins/TypedArray/prototype/byteLength/this-has-no-typedarrayname-internal.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-get-%typedarray%.prototype.bytelength -es6id: 22.2.3.2 description: > Throws a TypeError exception when `this` does not have a [[TypedArrayName]] internal slot diff --git a/test/built-ins/TypedArray/prototype/byteLength/this-is-not-object.js b/test/built-ins/TypedArray/prototype/byteLength/this-is-not-object.js index a59d22646..7144a74c3 100644 --- a/test/built-ins/TypedArray/prototype/byteLength/this-is-not-object.js +++ b/test/built-ins/TypedArray/prototype/byteLength/this-is-not-object.js @@ -1,7 +1,7 @@ // 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.3.2 +esid: sec-get-%typedarray%.prototype.bytelength description: Throws a TypeError exception when `this` is not Object info: | 22.2.3.2 get %TypedArray%.prototype.byteLength diff --git a/test/built-ins/TypedArray/prototype/byteOffset/BigInt/return-byteoffset.js b/test/built-ins/TypedArray/prototype/byteOffset/BigInt/return-byteoffset.js index 692d5ee56..5799aea59 100644 --- a/test/built-ins/TypedArray/prototype/byteOffset/BigInt/return-byteoffset.js +++ b/test/built-ins/TypedArray/prototype/byteOffset/BigInt/return-byteoffset.js @@ -1,7 +1,7 @@ // 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.3.3 +esid: sec-get-%typedarray%.prototype.byteoffset description: > Return value from [[ByteOffset]] internal slot info: | diff --git a/test/built-ins/TypedArray/prototype/byteOffset/invoked-as-accessor.js b/test/built-ins/TypedArray/prototype/byteOffset/invoked-as-accessor.js index ba155d2b5..4daaebdcb 100644 --- a/test/built-ins/TypedArray/prototype/byteOffset/invoked-as-accessor.js +++ b/test/built-ins/TypedArray/prototype/byteOffset/invoked-as-accessor.js @@ -1,7 +1,7 @@ // 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.3.3 +esid: sec-get-%typedarray%.prototype.byteoffset description: > Requires this value to have a [[ViewedArrayBuffer]] internal slot info: | diff --git a/test/built-ins/TypedArray/prototype/byteOffset/invoked-as-func.js b/test/built-ins/TypedArray/prototype/byteOffset/invoked-as-func.js index 426b3143e..78c3607a6 100644 --- a/test/built-ins/TypedArray/prototype/byteOffset/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/byteOffset/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.3 +esid: sec-get-%typedarray%.prototype.byteoffset description: Throws a TypeError exception when invoked as a function info: | 22.2.3.3 get %TypedArray%.prototype.byteOffset diff --git a/test/built-ins/TypedArray/prototype/byteOffset/length.js b/test/built-ins/TypedArray/prototype/byteOffset/length.js index 9710c0018..6362cabe5 100644 --- a/test/built-ins/TypedArray/prototype/byteOffset/length.js +++ b/test/built-ins/TypedArray/prototype/byteOffset/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.3 +esid: sec-get-%typedarray%.prototype.byteoffset description: > get %TypedArray%.prototype.byteOffset.length is 0. info: | diff --git a/test/built-ins/TypedArray/prototype/byteOffset/name.js b/test/built-ins/TypedArray/prototype/byteOffset/name.js index af0f98c17..5fc746efb 100644 --- a/test/built-ins/TypedArray/prototype/byteOffset/name.js +++ b/test/built-ins/TypedArray/prototype/byteOffset/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.3 +esid: sec-get-%typedarray%.prototype.byteoffset description: > get %TypedArray%.prototype.byteOffset.name is "get byteOffset". info: | diff --git a/test/built-ins/TypedArray/prototype/byteOffset/prop-desc.js b/test/built-ins/TypedArray/prototype/byteOffset/prop-desc.js index 2c2bd81cb..7d0bfb98e 100644 --- a/test/built-ins/TypedArray/prototype/byteOffset/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/byteOffset/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.3 +esid: sec-get-%typedarray%.prototype.byteoffset description: > "byteOffset" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/byteOffset/return-byteoffset.js b/test/built-ins/TypedArray/prototype/byteOffset/return-byteoffset.js index 1663d4797..44502e06e 100644 --- a/test/built-ins/TypedArray/prototype/byteOffset/return-byteoffset.js +++ b/test/built-ins/TypedArray/prototype/byteOffset/return-byteoffset.js @@ -1,7 +1,7 @@ // 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.3.3 +esid: sec-get-%typedarray%.prototype.byteoffset description: > Return value from [[ByteOffset]] internal slot info: | diff --git a/test/built-ins/TypedArray/prototype/byteOffset/this-has-no-typedarrayname-internal.js b/test/built-ins/TypedArray/prototype/byteOffset/this-has-no-typedarrayname-internal.js index dbd36a027..2e03fc820 100644 --- a/test/built-ins/TypedArray/prototype/byteOffset/this-has-no-typedarrayname-internal.js +++ b/test/built-ins/TypedArray/prototype/byteOffset/this-has-no-typedarrayname-internal.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-get-%typedarray%.prototype.byteoffset -es6id: 22.2.3.3 description: > Throws a TypeError exception when `this` does not have a [[TypedArrayName]] internal slot diff --git a/test/built-ins/TypedArray/prototype/byteOffset/this-is-not-object.js b/test/built-ins/TypedArray/prototype/byteOffset/this-is-not-object.js index 4ea526ac9..e8aba85f7 100644 --- a/test/built-ins/TypedArray/prototype/byteOffset/this-is-not-object.js +++ b/test/built-ins/TypedArray/prototype/byteOffset/this-is-not-object.js @@ -1,7 +1,7 @@ // 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.3.3 +esid: sec-get-%typedarray%.prototype.byteoffset description: Throws a TypeError exception when `this` is not Object info: | 22.2.3.3 get %TypedArray%.prototype.byteOffset diff --git a/test/built-ins/TypedArray/prototype/constructor.js b/test/built-ins/TypedArray/prototype/constructor.js index 453eaf3f4..d3862d5fb 100644 --- a/test/built-ins/TypedArray/prototype/constructor.js +++ b/test/built-ins/TypedArray/prototype/constructor.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.4 +esid: sec-%typedarray%.prototype.constructor description: > Initial state of the constructor property info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js index 709166c7e..07748b765 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > end argument is coerced to an integer values. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js index c91d0c883..986973deb 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > start argument is coerced to an integer value. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js index 7b7baf7d3..da3cb4e80 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > target argument is coerced to an integer value. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/get-length-ignores-length-prop.js index 0b02e6462..0de142b60 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/get-length-ignores-length-prop.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/get-length-ignores-length-prop.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Unreachable abrupt from Get(O, "length") as [[ArrayLength]] is returned. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-func.js index 9b2836c2d..7559361e1 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.5 +esid: sec-%typedarray%.prototype.copywithin description: Throws a TypeError exception when invoked as a function info: | 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [, end ] ) diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-method.js index fdc3f22eb..5a40d48c9 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.5 +esid: sec-%typedarray%.prototype.copywithin description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [, end ] ) diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js index 56ed9e312..5346aedde 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.5 +esid: sec-%typedarray%.prototype.copywithin description: > %TypedArray%.prototype.copyWithin.length is 2. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js index f1eaecc38..2123668fe 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.5 +esid: sec-%typedarray%.prototype.copywithin description: > %TypedArray%.prototype.copyWithin.name is "copyWithin". info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js index 45fd8f36d..a4b84379f 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Set values with negative end argument. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js index 17c08eea3..f9f81685b 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Set values with negative out of bounds end argument. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js index 84ee0dcca..916c443fa 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Set values with out of bounds negative start argument. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js index 613f4f50c..d9ad966bf 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Set values with out of bounds negative target argument. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js index 928d349d3..21146e980 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Set values with negative start argument. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js index e7e08504b..020d13768 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Set values with negative target argument. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js index a921443c4..bc2f07eb7 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Max value of end position is the this.length. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js index 8782ea76a..93b0f9899 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Max values of target and start positions are this.length. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js index f958bc6e0..33b29e242 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Copy values with non-negative target and start positions. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js index cda7b0e03..44d0945f1 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Copy values with non-negative target, start and end positions. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js index c3e90369a..b113d2f67 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.5 +esid: sec-%typedarray%.prototype.copywithin description: > "copyWithin" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end-is-symbol.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end-is-symbol.js index adcbf5318..cb06fdfda 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end-is-symbol.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end-is-symbol.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Return abrupt if end is a Symbol. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end.js index bd4fd5bc1..6e7a39fb4 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Return abrupt from ToInteger(end). info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start-is-symbol.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start-is-symbol.js index 196600a8a..d0b8b75f1 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start-is-symbol.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start-is-symbol.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Return abrupt if start is a Symbol. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start.js index 788473453..a8bb5d5b5 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Return abrupt from ToInteger(start). info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target-is-symbol.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target-is-symbol.js index 20e8bf58a..305e9234e 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target-is-symbol.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target-is-symbol.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Return abrupt if target is a Symbol. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target.js index 9c8b00b4c..76d035b0a 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Return abrupt from ToInteger(target). info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js index 62a3f69a1..d61c44ad8 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Returns `this`. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js index 3a0d5df7d..daeaca317 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > If `end` is undefined, set final position to `this.length`. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/bit-precision.js b/test/built-ins/TypedArray/prototype/copyWithin/bit-precision.js index f2725a242..2aff81d30 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/bit-precision.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/bit-precision.js @@ -3,7 +3,6 @@ /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: Preservation of bit-level encoding info: | Array.prototype.copyWithin (target, start [ , end ] ) diff --git a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js index 50f6de2c3..ef209fb79 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > end argument is coerced to an integer values. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js index 1fecbd46d..b381f23fd 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > start argument is coerced to an integer value. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js index f49d147b2..ff1f310fe 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > target argument is coerced to an integer value. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/copyWithin/get-length-ignores-length-prop.js index f5d89ea2a..852ccfbd9 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/get-length-ignores-length-prop.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/get-length-ignores-length-prop.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Unreachable abrupt from Get(O, "length") as [[ArrayLength]] is returned. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/invoked-as-func.js b/test/built-ins/TypedArray/prototype/copyWithin/invoked-as-func.js index f191a5a7c..92611443e 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.5 +esid: sec-%typedarray%.prototype.copywithin description: Throws a TypeError exception when invoked as a function info: | 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [, end ] ) diff --git a/test/built-ins/TypedArray/prototype/copyWithin/invoked-as-method.js b/test/built-ins/TypedArray/prototype/copyWithin/invoked-as-method.js index cfbb192c5..07271dbbe 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.5 +esid: sec-%typedarray%.prototype.copywithin description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [, end ] ) diff --git a/test/built-ins/TypedArray/prototype/copyWithin/length.js b/test/built-ins/TypedArray/prototype/copyWithin/length.js index c6fb4ac91..e2a0b3004 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/length.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.5 +esid: sec-%typedarray%.prototype.copywithin description: > %TypedArray%.prototype.copyWithin.length is 2. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/name.js b/test/built-ins/TypedArray/prototype/copyWithin/name.js index 313a71035..90e05d1ae 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/name.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.5 +esid: sec-%typedarray%.prototype.copywithin description: > %TypedArray%.prototype.copyWithin.name is "copyWithin". info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js index 4d1bb72cf..90020a0ec 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Set values with negative end argument. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js index 25ddbcf72..1cfbca0e0 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Set values with negative out of bounds end argument. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js index b439a5d2b..42bebe243 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Set values with out of bounds negative start argument. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js index da99b0918..7fa145404 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Set values with out of bounds negative target argument. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js index a5c12e04d..140b4b7fe 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Set values with negative start argument. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js index 18760a102..4afa54e6a 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Set values with negative target argument. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js index ace11ebb5..292f039e0 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Max value of end position is the this.length. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js index 878009f36..69793a06c 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Max values of target and start positions are this.length. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js index 261223948..2a7eeea4a 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Copy values with non-negative target and start positions. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js index bbb794cc0..7ff5d7a0a 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Copy values with non-negative target, start and end positions. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/prop-desc.js b/test/built-ins/TypedArray/prototype/copyWithin/prop-desc.js index ef94eaab6..e35ba438e 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.5 +esid: sec-%typedarray%.prototype.copywithin description: > "copyWithin" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-end-is-symbol.js b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-end-is-symbol.js index 1aba14215..2f935bf93 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-end-is-symbol.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-end-is-symbol.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Return abrupt if end is a Symbol. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-end.js b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-end.js index 301ed81ce..eeb3d8256 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-end.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Return abrupt from ToInteger(end). info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-start-is-symbol.js b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-start-is-symbol.js index 47e8687cc..c508e66be 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-start-is-symbol.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-start-is-symbol.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Return abrupt if start is a Symbol. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-start.js b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-start.js index 89e71980e..08e24b260 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-start.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Return abrupt from ToInteger(start). info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-target-is-symbol.js b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-target-is-symbol.js index 063825661..9c8acb987 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-target-is-symbol.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-target-is-symbol.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Return abrupt if target is a Symbol. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-target.js b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-target.js index 3386bbfd2..ba9a4b2f2 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-target.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Return abrupt from ToInteger(target). info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/return-this.js b/test/built-ins/TypedArray/prototype/copyWithin/return-this.js index cf34d6583..5b3718e85 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/return-this.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/return-this.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > Returns `this`. info: | diff --git a/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js b/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js index 4f00f0f33..0d0cb0b1c 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.copywithin -es6id: 22.2.3.5 description: > If `end` is undefined, set final position to `this.length`. info: | diff --git a/test/built-ins/TypedArray/prototype/entries/BigInt/iter-prototype.js b/test/built-ins/TypedArray/prototype/entries/BigInt/iter-prototype.js index ae795bb04..dbce25ad3 100644 --- a/test/built-ins/TypedArray/prototype/entries/BigInt/iter-prototype.js +++ b/test/built-ins/TypedArray/prototype/entries/BigInt/iter-prototype.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.6 esid: sec-%typedarray%.prototype.entries description: > The prototype of the returned iterator is ArrayIteratorPrototype diff --git a/test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js b/test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js index 2c2b47cd4..015595422 100644 --- a/test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js +++ b/test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js @@ -1,7 +1,6 @@ // 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.3.6 esid: sec-%typedarray%.prototype.entries description: Return an iterator for the entries. info: | diff --git a/test/built-ins/TypedArray/prototype/entries/invoked-as-func.js b/test/built-ins/TypedArray/prototype/entries/invoked-as-func.js index b539f44c7..0408b7cbb 100644 --- a/test/built-ins/TypedArray/prototype/entries/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/entries/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.6 +esid: sec-%typedarray%.prototype.entries description: Throws a TypeError exception when invoked as a function info: | 22.2.3.6 %TypedArray%.prototype.entries ( ) diff --git a/test/built-ins/TypedArray/prototype/entries/invoked-as-method.js b/test/built-ins/TypedArray/prototype/entries/invoked-as-method.js index 39388b184..de2a001c7 100644 --- a/test/built-ins/TypedArray/prototype/entries/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/entries/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.6 +esid: sec-%typedarray%.prototype.entries description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.6 %TypedArray%.prototype.entries ( ) diff --git a/test/built-ins/TypedArray/prototype/entries/iter-prototype.js b/test/built-ins/TypedArray/prototype/entries/iter-prototype.js index bc16cf1f3..0afa22dce 100644 --- a/test/built-ins/TypedArray/prototype/entries/iter-prototype.js +++ b/test/built-ins/TypedArray/prototype/entries/iter-prototype.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.6 esid: sec-%typedarray%.prototype.entries description: > The prototype of the returned iterator is ArrayIteratorPrototype diff --git a/test/built-ins/TypedArray/prototype/entries/length.js b/test/built-ins/TypedArray/prototype/entries/length.js index 7c7f800af..2646da747 100644 --- a/test/built-ins/TypedArray/prototype/entries/length.js +++ b/test/built-ins/TypedArray/prototype/entries/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.6 +esid: sec-%typedarray%.prototype.entries description: > %TypedArray%.prototype.entries.length is 0. info: | diff --git a/test/built-ins/TypedArray/prototype/entries/name.js b/test/built-ins/TypedArray/prototype/entries/name.js index 9f7ab0dd2..b2b085c5c 100644 --- a/test/built-ins/TypedArray/prototype/entries/name.js +++ b/test/built-ins/TypedArray/prototype/entries/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.6 +esid: sec-%typedarray%.prototype.entries description: > %TypedArray%.prototype.entries.name is "entries". info: | diff --git a/test/built-ins/TypedArray/prototype/entries/prop-desc.js b/test/built-ins/TypedArray/prototype/entries/prop-desc.js index 8ab8609e1..79f83eab6 100644 --- a/test/built-ins/TypedArray/prototype/entries/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/entries/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.6 +esid: sec-%typedarray%.prototype.entries description: > "entries" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/entries/return-itor.js b/test/built-ins/TypedArray/prototype/entries/return-itor.js index d7db93696..e52c6c4e1 100644 --- a/test/built-ins/TypedArray/prototype/entries/return-itor.js +++ b/test/built-ins/TypedArray/prototype/entries/return-itor.js @@ -1,7 +1,6 @@ // 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.3.6 esid: sec-%typedarray%.prototype.entries description: Return an iterator for the entries. info: | diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-func.js index 1ae892380..83d64511c 100644 --- a/test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.7 +esid: sec-%typedarray%.prototype.every description: Throws a TypeError exception when invoked as a function info: | 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-method.js index 24d9fd6fd..2b99d4c68 100644 --- a/test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/every/BigInt/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.7 +esid: sec-%typedarray%.prototype.every description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/length.js b/test/built-ins/TypedArray/prototype/every/BigInt/length.js index ee523a260..f446c7b44 100644 --- a/test/built-ins/TypedArray/prototype/every/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/every/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.7 +esid: sec-%typedarray%.prototype.every description: > %TypedArray%.prototype.every.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/name.js b/test/built-ins/TypedArray/prototype/every/BigInt/name.js index 0bd6cc255..f3112a183 100644 --- a/test/built-ins/TypedArray/prototype/every/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/every/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.7 +esid: sec-%typedarray%.prototype.every description: > %TypedArray%.prototype.every.name is "every". info: | diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/every/BigInt/prop-desc.js index cd6a80a3a..f2846eb09 100644 --- a/test/built-ins/TypedArray/prototype/every/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/every/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.7 +esid: sec-%typedarray%.prototype.every description: > "every" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/every/invoked-as-func.js b/test/built-ins/TypedArray/prototype/every/invoked-as-func.js index ed64993c8..b861fa914 100644 --- a/test/built-ins/TypedArray/prototype/every/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/every/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.7 +esid: sec-%typedarray%.prototype.every description: Throws a TypeError exception when invoked as a function info: | 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/every/invoked-as-method.js b/test/built-ins/TypedArray/prototype/every/invoked-as-method.js index 491821d69..d70fa2346 100644 --- a/test/built-ins/TypedArray/prototype/every/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/every/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.7 +esid: sec-%typedarray%.prototype.every description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/every/length.js b/test/built-ins/TypedArray/prototype/every/length.js index 64b41dbb1..cd07fc891 100644 --- a/test/built-ins/TypedArray/prototype/every/length.js +++ b/test/built-ins/TypedArray/prototype/every/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.7 +esid: sec-%typedarray%.prototype.every description: > %TypedArray%.prototype.every.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/every/name.js b/test/built-ins/TypedArray/prototype/every/name.js index f43fbf927..8fe375426 100644 --- a/test/built-ins/TypedArray/prototype/every/name.js +++ b/test/built-ins/TypedArray/prototype/every/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.7 +esid: sec-%typedarray%.prototype.every description: > %TypedArray%.prototype.every.name is "every". info: | diff --git a/test/built-ins/TypedArray/prototype/every/prop-desc.js b/test/built-ins/TypedArray/prototype/every/prop-desc.js index 6e581c16e..b16458886 100644 --- a/test/built-ins/TypedArray/prototype/every/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/every/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.7 +esid: sec-%typedarray%.prototype.every description: > "every" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js b/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js index 9a53f55a4..ced8b9da8 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Fills elements from coerced to Integer `start` and `end` values info: | diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations-consistent-nan.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations-consistent-nan.js index 827dc9344..d8ca3818b 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations-consistent-nan.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations-consistent-nan.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: Consistent canonicalization of NaN values info: | 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations.js index 40e9e3fe9..848da1415 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Fills all the elements with non numeric values values. info: | diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js index 48602ea11..3809de222 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Fills all the elements from a with a custom start and end indexes. info: | diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js index c4a97bfc9..fdfa47987 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Fills all the elements with non numeric values values. info: | diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js index b5bbe59da..0d09f8b37 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Fills all the elements from a with a custom end index. info: | diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js index 674cf1490..76883779e 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Fills all the elements from a with a custom start index. info: | diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-symbol-throws.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-symbol-throws.js index 687db856d..dddad60fa 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-symbol-throws.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-symbol-throws.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Throws a TypeError if value is a Symbol info: | diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js index 83a2bbd7a..93d496983 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Fills all the elements with `value` from a default start and index. info: | diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/fill/BigInt/get-length-ignores-length-prop.js index 36ca60566..5aa9a3a82 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/get-length-ignores-length-prop.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/get-length-ignores-length-prop.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Unreachable abrupt from Get(O, "length") as [[ArrayLength]] is returned. info: | diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-func.js index 363ba5180..f7f0936d1 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.8 +esid: sec-%typedarray%.prototype.fill description: Throws a TypeError exception when invoked as a function info: | 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-method.js index 20dc89a17..897c2164b 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.8 +esid: sec-%typedarray%.prototype.fill description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/length.js b/test/built-ins/TypedArray/prototype/fill/BigInt/length.js index 17bf26159..77f2db6a8 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.8 +esid: sec-%typedarray%.prototype.fill description: > %TypedArray%.prototype.fill.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/name.js b/test/built-ins/TypedArray/prototype/fill/BigInt/name.js index 99c9ec2b4..82a964616 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.8 +esid: sec-%typedarray%.prototype.fill description: > %TypedArray%.prototype.fill.name is "fill". info: | diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/fill/BigInt/prop-desc.js index b3f039205..f6673d34b 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.8 +esid: sec-%typedarray%.prototype.fill description: > "fill" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end-as-symbol.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end-as-symbol.js index 1ad1b898c..084c9ac1e 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end-as-symbol.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end-as-symbol.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Return abrupt if end is a Symbol. info: | diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end.js index 3a2aa9285..a97eebf74 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Return abrupt from ToInteger(end). info: | diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js index 5133dac24..a1c8b8bbf 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Returns abrupt from value set info: | diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start-as-symbol.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start-as-symbol.js index 69749d03c..d95c9a30d 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start-as-symbol.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start-as-symbol.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Return abrupt from ToInteger(start) as a Symbol. info: | diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start.js index 37bed7f7a..8003e7e91 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Return abrupt from ToInteger(start). info: | diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-this.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-this.js index b9b93eed4..20697ddc3 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/return-this.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-this.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Returns `this`. includes: [testBigIntTypedArray.js] diff --git a/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js b/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js index 1fb4c00de..1b750929b 100644 --- a/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js +++ b/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Fills elements from coerced to Integer `start` and `end` values info: | diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan.js b/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan.js index e16bd5c26..dc4818ca0 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: Consistent canonicalization of NaN values info: | 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations.js b/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations.js index 91def14f2..702c5e45e 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Fills all the elements with non numeric values values. info: | diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js b/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js index 836a0986f..192ddd341 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Fills all the elements from a with a custom start and end indexes. info: | diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js b/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js index 52b4e53c4..323afbb8c 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Fills all the elements with non numeric values values. info: | diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js index 786169b34..bd355a80d 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Fills all the elements from a with a custom end index. info: | diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js index 4a9f38799..7142124d8 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Fills all the elements from a with a custom start index. info: | diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-symbol-throws.js b/test/built-ins/TypedArray/prototype/fill/fill-values-symbol-throws.js index 79707d644..be5ca9b5e 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-symbol-throws.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-symbol-throws.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Throws a TypeError if value is a Symbol info: | diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values.js b/test/built-ins/TypedArray/prototype/fill/fill-values.js index 0f3ceddf5..ea0654790 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Fills all the elements with `value` from a default start and index. info: | diff --git a/test/built-ins/TypedArray/prototype/fill/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/fill/get-length-ignores-length-prop.js index b0432cb2a..5ba5c9437 100644 --- a/test/built-ins/TypedArray/prototype/fill/get-length-ignores-length-prop.js +++ b/test/built-ins/TypedArray/prototype/fill/get-length-ignores-length-prop.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Unreachable abrupt from Get(O, "length") as [[ArrayLength]] is returned. info: | diff --git a/test/built-ins/TypedArray/prototype/fill/invoked-as-func.js b/test/built-ins/TypedArray/prototype/fill/invoked-as-func.js index 200caa130..0215e90fe 100644 --- a/test/built-ins/TypedArray/prototype/fill/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/fill/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.8 +esid: sec-%typedarray%.prototype.fill description: Throws a TypeError exception when invoked as a function info: | 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) diff --git a/test/built-ins/TypedArray/prototype/fill/invoked-as-method.js b/test/built-ins/TypedArray/prototype/fill/invoked-as-method.js index b3eb9760a..32d15fce4 100644 --- a/test/built-ins/TypedArray/prototype/fill/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/fill/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.8 +esid: sec-%typedarray%.prototype.fill description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) diff --git a/test/built-ins/TypedArray/prototype/fill/length.js b/test/built-ins/TypedArray/prototype/fill/length.js index 38b5b348c..463c36e8a 100644 --- a/test/built-ins/TypedArray/prototype/fill/length.js +++ b/test/built-ins/TypedArray/prototype/fill/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.8 +esid: sec-%typedarray%.prototype.fill description: > %TypedArray%.prototype.fill.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/fill/name.js b/test/built-ins/TypedArray/prototype/fill/name.js index 510c54526..1350c0bdc 100644 --- a/test/built-ins/TypedArray/prototype/fill/name.js +++ b/test/built-ins/TypedArray/prototype/fill/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.8 +esid: sec-%typedarray%.prototype.fill description: > %TypedArray%.prototype.fill.name is "fill". info: | diff --git a/test/built-ins/TypedArray/prototype/fill/prop-desc.js b/test/built-ins/TypedArray/prototype/fill/prop-desc.js index d0175e2e5..efdad3679 100644 --- a/test/built-ins/TypedArray/prototype/fill/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/fill/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.8 +esid: sec-%typedarray%.prototype.fill description: > "fill" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end-as-symbol.js b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end-as-symbol.js index 0df2df135..f1a27370b 100644 --- a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end-as-symbol.js +++ b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end-as-symbol.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Return abrupt if end is a Symbol. info: | diff --git a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end.js b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end.js index f50c840d7..044d9b333 100644 --- a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end.js +++ b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Return abrupt from ToInteger(end). info: | diff --git a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js index 207b67a7e..04fbc57b5 100644 --- a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js +++ b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Returns abrupt from value set info: | diff --git a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start-as-symbol.js b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start-as-symbol.js index 1eda6669b..e50be1fea 100644 --- a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start-as-symbol.js +++ b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start-as-symbol.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Return abrupt from ToInteger(start) as a Symbol. info: | diff --git a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start.js b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start.js index 6f3dc4070..34d732fe3 100644 --- a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start.js +++ b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Return abrupt from ToInteger(start). info: | diff --git a/test/built-ins/TypedArray/prototype/fill/return-this.js b/test/built-ins/TypedArray/prototype/fill/return-this.js index b920053a5..2ec863eca 100644 --- a/test/built-ins/TypedArray/prototype/fill/return-this.js +++ b/test/built-ins/TypedArray/prototype/fill/return-this.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.fill -es6id: 22.2.3.8 description: > Returns `this`. includes: [testTypedArray.js] diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-func.js index 86c878c88..92e9758b5 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.9 +esid: sec-%typedarray%.prototype.filter description: Throws a TypeError exception when invoked as a function info: | 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-method.js index 0c70719e1..18c818b65 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.9 +esid: sec-%typedarray%.prototype.filter description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/length.js b/test/built-ins/TypedArray/prototype/filter/BigInt/length.js index 2b5d020a3..443642674 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.9 +esid: sec-%typedarray%.prototype.filter description: > %TypedArray%.prototype.filter.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/name.js b/test/built-ins/TypedArray/prototype/filter/BigInt/name.js index f582e69dd..729c841a4 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.9 +esid: sec-%typedarray%.prototype.filter description: > %TypedArray%.prototype.filter.name is "filter". info: | diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/filter/BigInt/prop-desc.js index 898755704..abb20a831 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.9 +esid: sec-%typedarray%.prototype.filter description: > "filter" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/filter/invoked-as-func.js b/test/built-ins/TypedArray/prototype/filter/invoked-as-func.js index 0328929f7..fe9a12384 100644 --- a/test/built-ins/TypedArray/prototype/filter/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/filter/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.9 +esid: sec-%typedarray%.prototype.filter description: Throws a TypeError exception when invoked as a function info: | 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/filter/invoked-as-method.js b/test/built-ins/TypedArray/prototype/filter/invoked-as-method.js index 74c7f5c0e..9509bf1ea 100644 --- a/test/built-ins/TypedArray/prototype/filter/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/filter/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.9 +esid: sec-%typedarray%.prototype.filter description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/filter/length.js b/test/built-ins/TypedArray/prototype/filter/length.js index 8734db0ff..4c04b2192 100644 --- a/test/built-ins/TypedArray/prototype/filter/length.js +++ b/test/built-ins/TypedArray/prototype/filter/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.9 +esid: sec-%typedarray%.prototype.filter description: > %TypedArray%.prototype.filter.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/filter/name.js b/test/built-ins/TypedArray/prototype/filter/name.js index d9b31ac0f..ac7e5cbd2 100644 --- a/test/built-ins/TypedArray/prototype/filter/name.js +++ b/test/built-ins/TypedArray/prototype/filter/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.9 +esid: sec-%typedarray%.prototype.filter description: > %TypedArray%.prototype.filter.name is "filter". info: | diff --git a/test/built-ins/TypedArray/prototype/filter/prop-desc.js b/test/built-ins/TypedArray/prototype/filter/prop-desc.js index 4d0715e68..096fb51a4 100644 --- a/test/built-ins/TypedArray/prototype/filter/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/filter/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.9 +esid: sec-%typedarray%.prototype.filter description: > "filter" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/find/BigInt/get-length-ignores-length-prop.js index 790de25db..aa522e378 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/get-length-ignores-length-prop.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/get-length-ignores-length-prop.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.find -es6id: 22.2.3.10 description: > [[Get]] of "length" uses [[ArrayLength]] info: | diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-func.js index eea7537b2..088c3398a 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.10 +esid: sec-%typedarray%.prototype.find description: Throws a TypeError exception when invoked as a function info: | 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-method.js index ed0d1a9a2..7bb3bb741 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.10 +esid: sec-%typedarray%.prototype.find description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/length.js b/test/built-ins/TypedArray/prototype/find/BigInt/length.js index e61e1c21e..3947f6bf8 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.10 +esid: sec-%typedarray%.prototype.find description: > %TypedArray%.prototype.find.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/name.js b/test/built-ins/TypedArray/prototype/find/BigInt/name.js index ab18751c2..d5dcef13c 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.10 +esid: sec-%typedarray%.prototype.find description: > %TypedArray%.prototype.find.name is "find". info: | diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js index 6ed966f70..92a2a9349 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.find -es6id: 22.2.3.10 description: > Change values during predicate call info: | diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-parameters.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-parameters.js index fd69894e6..fb1741af5 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-parameters.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-parameters.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.find -es6id: 22.2.3.10 description: > Predicate called as F.call( thisArg, kValue, k, O ) for each array entry. info: | diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-non-strict.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-non-strict.js index 538bd26ac..882bd21af 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-non-strict.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-non-strict.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.find -es6id: 22.2.3.10 description: > Verify predicate this on non-strict mode info: | diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-strict.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-strict.js index 414440969..b7ce4535d 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-strict.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-this-strict.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.find -es6id: 22.2.3.10 description: > Verify predicate this on strict mode info: | diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-is-not-callable-throws.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-is-not-callable-throws.js index c9b0f5ace..b579dfa11 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-is-not-callable-throws.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-is-not-callable-throws.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.find -es6id: 22.2.3.10 description: > Throws a TypeError exception if predicate is not callable. info: | diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-may-detach-buffer.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-may-detach-buffer.js index fafed535e..49e58ac61 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-may-detach-buffer.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-may-detach-buffer.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.find -es6id: 22.2.3.10 description: > Predicate may detach the buffer info: | diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-not-called-on-empty-array.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-not-called-on-empty-array.js index 029c16522..230aff544 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-not-called-on-empty-array.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-not-called-on-empty-array.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.find -es6id: 22.2.3.10 description: > Predicate is not called on empty instances info: | diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/find/BigInt/prop-desc.js index 13af89a56..990975cd7 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.10 +esid: sec-%typedarray%.prototype.find description: > "find" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/return-abrupt-from-predicate-call.js b/test/built-ins/TypedArray/prototype/find/BigInt/return-abrupt-from-predicate-call.js index 0942d004d..0f693f4a2 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/return-abrupt-from-predicate-call.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/return-abrupt-from-predicate-call.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.find -es6id: 22.2.3.10 description: > Return abrupt from predicate call. info: | diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/return-found-value-predicate-result-is-true.js b/test/built-ins/TypedArray/prototype/find/BigInt/return-found-value-predicate-result-is-true.js index 63fda9413..c4469ae2e 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/return-found-value-predicate-result-is-true.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/return-found-value-predicate-result-is-true.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.find -es6id: 22.2.3.10 description: > Return found value if predicate return a boolean true value. info: | diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/return-undefined-if-predicate-returns-false-value.js b/test/built-ins/TypedArray/prototype/find/BigInt/return-undefined-if-predicate-returns-false-value.js index 86f3f6cd3..2c8e2d1c3 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/return-undefined-if-predicate-returns-false-value.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/return-undefined-if-predicate-returns-false-value.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.find -es6id: 22.2.3.10 description: > Return undefined if predicate always returns a boolean false value. info: | diff --git a/test/built-ins/TypedArray/prototype/find/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/find/get-length-ignores-length-prop.js index 754c2d307..f236772a3 100644 --- a/test/built-ins/TypedArray/prototype/find/get-length-ignores-length-prop.js +++ b/test/built-ins/TypedArray/prototype/find/get-length-ignores-length-prop.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.find -es6id: 22.2.3.10 description: > [[Get]] of "length" uses [[ArrayLength]] info: | diff --git a/test/built-ins/TypedArray/prototype/find/invoked-as-func.js b/test/built-ins/TypedArray/prototype/find/invoked-as-func.js index 07152e439..540aa34d7 100644 --- a/test/built-ins/TypedArray/prototype/find/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/find/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.10 +esid: sec-%typedarray%.prototype.find description: Throws a TypeError exception when invoked as a function info: | 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/find/invoked-as-method.js b/test/built-ins/TypedArray/prototype/find/invoked-as-method.js index 5661c00fb..98e6faa33 100644 --- a/test/built-ins/TypedArray/prototype/find/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/find/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.10 +esid: sec-%typedarray%.prototype.find description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/find/length.js b/test/built-ins/TypedArray/prototype/find/length.js index 6bc32f8f0..b5f9a6e5a 100644 --- a/test/built-ins/TypedArray/prototype/find/length.js +++ b/test/built-ins/TypedArray/prototype/find/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.10 +esid: sec-%typedarray%.prototype.find description: > %TypedArray%.prototype.find.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/find/name.js b/test/built-ins/TypedArray/prototype/find/name.js index f8f7c11ff..a4975ab8a 100644 --- a/test/built-ins/TypedArray/prototype/find/name.js +++ b/test/built-ins/TypedArray/prototype/find/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.10 +esid: sec-%typedarray%.prototype.find description: > %TypedArray%.prototype.find.name is "find". info: | diff --git a/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js index b036a7c92..f6fbe7290 100644 --- a/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js +++ b/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.find -es6id: 22.2.3.10 description: > Change values during predicate call info: | diff --git a/test/built-ins/TypedArray/prototype/find/predicate-call-parameters.js b/test/built-ins/TypedArray/prototype/find/predicate-call-parameters.js index e31cb9522..42598466e 100644 --- a/test/built-ins/TypedArray/prototype/find/predicate-call-parameters.js +++ b/test/built-ins/TypedArray/prototype/find/predicate-call-parameters.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.find -es6id: 22.2.3.10 description: > Predicate called as F.call( thisArg, kValue, k, O ) for each array entry. info: | diff --git a/test/built-ins/TypedArray/prototype/find/predicate-call-this-non-strict.js b/test/built-ins/TypedArray/prototype/find/predicate-call-this-non-strict.js index d4a1ee560..3246908b6 100644 --- a/test/built-ins/TypedArray/prototype/find/predicate-call-this-non-strict.js +++ b/test/built-ins/TypedArray/prototype/find/predicate-call-this-non-strict.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.find -es6id: 22.2.3.10 description: > Verify predicate this on non-strict mode info: | diff --git a/test/built-ins/TypedArray/prototype/find/predicate-call-this-strict.js b/test/built-ins/TypedArray/prototype/find/predicate-call-this-strict.js index f62576392..22ed01f77 100644 --- a/test/built-ins/TypedArray/prototype/find/predicate-call-this-strict.js +++ b/test/built-ins/TypedArray/prototype/find/predicate-call-this-strict.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.find -es6id: 22.2.3.10 description: > Verify predicate this on strict mode info: | diff --git a/test/built-ins/TypedArray/prototype/find/predicate-is-not-callable-throws.js b/test/built-ins/TypedArray/prototype/find/predicate-is-not-callable-throws.js index a8adc918e..f470ad927 100644 --- a/test/built-ins/TypedArray/prototype/find/predicate-is-not-callable-throws.js +++ b/test/built-ins/TypedArray/prototype/find/predicate-is-not-callable-throws.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.find -es6id: 22.2.3.10 description: > Throws a TypeError exception if predicate is not callable. info: | diff --git a/test/built-ins/TypedArray/prototype/find/predicate-may-detach-buffer.js b/test/built-ins/TypedArray/prototype/find/predicate-may-detach-buffer.js index 5dea87238..fbac50d14 100644 --- a/test/built-ins/TypedArray/prototype/find/predicate-may-detach-buffer.js +++ b/test/built-ins/TypedArray/prototype/find/predicate-may-detach-buffer.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.find -es6id: 22.2.3.10 description: > Predicate may detach the buffer info: | diff --git a/test/built-ins/TypedArray/prototype/find/predicate-not-called-on-empty-array.js b/test/built-ins/TypedArray/prototype/find/predicate-not-called-on-empty-array.js index cda391591..304c5da96 100644 --- a/test/built-ins/TypedArray/prototype/find/predicate-not-called-on-empty-array.js +++ b/test/built-ins/TypedArray/prototype/find/predicate-not-called-on-empty-array.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.find -es6id: 22.2.3.10 description: > Predicate is not called on empty instances info: | diff --git a/test/built-ins/TypedArray/prototype/find/prop-desc.js b/test/built-ins/TypedArray/prototype/find/prop-desc.js index 0a2411280..b38c2b656 100644 --- a/test/built-ins/TypedArray/prototype/find/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/find/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.10 +esid: sec-%typedarray%.prototype.find description: > "find" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/find/return-abrupt-from-predicate-call.js b/test/built-ins/TypedArray/prototype/find/return-abrupt-from-predicate-call.js index ceb765ef1..1c99c9ef7 100644 --- a/test/built-ins/TypedArray/prototype/find/return-abrupt-from-predicate-call.js +++ b/test/built-ins/TypedArray/prototype/find/return-abrupt-from-predicate-call.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.find -es6id: 22.2.3.10 description: > Return abrupt from predicate call. info: | diff --git a/test/built-ins/TypedArray/prototype/find/return-found-value-predicate-result-is-true.js b/test/built-ins/TypedArray/prototype/find/return-found-value-predicate-result-is-true.js index 716b1638b..fa6aa2286 100644 --- a/test/built-ins/TypedArray/prototype/find/return-found-value-predicate-result-is-true.js +++ b/test/built-ins/TypedArray/prototype/find/return-found-value-predicate-result-is-true.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.find -es6id: 22.2.3.10 description: > Return found value if predicate return a boolean true value. info: | diff --git a/test/built-ins/TypedArray/prototype/find/return-undefined-if-predicate-returns-false-value.js b/test/built-ins/TypedArray/prototype/find/return-undefined-if-predicate-returns-false-value.js index 0133a6948..2a59dc0a4 100644 --- a/test/built-ins/TypedArray/prototype/find/return-undefined-if-predicate-returns-false-value.js +++ b/test/built-ins/TypedArray/prototype/find/return-undefined-if-predicate-returns-false-value.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.find -es6id: 22.2.3.10 description: > Return undefined if predicate always returns a boolean false value. info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/get-length-ignores-length-prop.js index 64ba1216f..47ea12773 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/get-length-ignores-length-prop.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/get-length-ignores-length-prop.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.findindex -es6id: 22.2.3.11 description: > [[Get]] of "length" uses [[ArrayLength]] info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-func.js index eec6d6341..f305556a1 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.11 +esid: sec-%typedarray%.prototype.findindex description: Throws a TypeError exception when invoked as a function info: | 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-method.js index 73197eb1d..1871afdab 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.11 +esid: sec-%typedarray%.prototype.findindex description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/length.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/length.js index aeab6fc8e..55083eeb6 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.11 +esid: sec-%typedarray%.prototype.findindex description: > %TypedArray%.prototype.findIndex.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/name.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/name.js index a0cc1c772..5065cb746 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.11 +esid: sec-%typedarray%.prototype.findindex description: > %TypedArray%.prototype.findIndex.name is "findIndex". info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js index 0dc15c76e..b3614e1e9 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.findindex -es6id: 22.2.3.11 description: > Change values during predicate call info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-parameters.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-parameters.js index e63adf53f..eb73cd7e1 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-parameters.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-parameters.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.findindex -es6id: 22.2.3.11 description: > Predicate called as F.call( thisArg, kValue, k, O ) for each array entry. info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-non-strict.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-non-strict.js index a4a8ab7eb..3c1d4b9f2 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-non-strict.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-non-strict.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.findindex -es6id: 22.2.3.11 description: > Verify predicate this on non-strict mode info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-strict.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-strict.js index 554a55aa0..af6ce6a73 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-strict.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-this-strict.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.findindex -es6id: 22.2.3.11 description: > Predicate thisArg as F.call( thisArg, kValue, k, O ) for each array entry. info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-is-not-callable-throws.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-is-not-callable-throws.js index 3a2143101..c8a101d05 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-is-not-callable-throws.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-is-not-callable-throws.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.findindex -es6id: 22.2.3.11 description: > Throws a TypeError exception if predicate is not callable. info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-may-detach-buffer.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-may-detach-buffer.js index 3bf9014ff..80078b3fe 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-may-detach-buffer.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-may-detach-buffer.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.findindex -es6id: 22.2.3.11 description: > Predicate may detach the buffer info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-not-called-on-empty-array.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-not-called-on-empty-array.js index a58100f03..a08e80ef5 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-not-called-on-empty-array.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-not-called-on-empty-array.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.findindex -es6id: 22.2.3.11 description: > Predicate is not called on an empty instance info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/prop-desc.js index a4bf542d7..7022cdd4e 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.11 +esid: sec-%typedarray%.prototype.findindex description: > "findIndex" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-abrupt-from-predicate-call.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-abrupt-from-predicate-call.js index 6994a7954..49405f3c5 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-abrupt-from-predicate-call.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-abrupt-from-predicate-call.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.findindex -es6id: 22.2.3.11 description: > Return abrupt from predicate call. info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-index-predicate-result-is-true.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-index-predicate-result-is-true.js index 0c979bd4f..f19c09910 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-index-predicate-result-is-true.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-index-predicate-result-is-true.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.findindex -es6id: 22.2.3.11 description: > Return index if predicate return a boolean true value. info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-negative-one-if-predicate-returns-false-value.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-negative-one-if-predicate-returns-false-value.js index 28001d77c..933985462 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-negative-one-if-predicate-returns-false-value.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-negative-one-if-predicate-returns-false-value.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.findindex -es6id: 22.2.3.11 description: > Return -1 if predicate always returns a boolean false value. info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/findIndex/get-length-ignores-length-prop.js index 697f3ef43..7aa5368e4 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/get-length-ignores-length-prop.js +++ b/test/built-ins/TypedArray/prototype/findIndex/get-length-ignores-length-prop.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.findindex -es6id: 22.2.3.11 description: > [[Get]] of "length" uses [[ArrayLength]] info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/invoked-as-func.js b/test/built-ins/TypedArray/prototype/findIndex/invoked-as-func.js index 16a85a91d..54ca2a83c 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/findIndex/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.11 +esid: sec-%typedarray%.prototype.findindex description: Throws a TypeError exception when invoked as a function info: | 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/findIndex/invoked-as-method.js b/test/built-ins/TypedArray/prototype/findIndex/invoked-as-method.js index dfd2e8f25..d5ec6304f 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/findIndex/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.11 +esid: sec-%typedarray%.prototype.findindex description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/findIndex/length.js b/test/built-ins/TypedArray/prototype/findIndex/length.js index f2d44b12b..49b360c54 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/length.js +++ b/test/built-ins/TypedArray/prototype/findIndex/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.11 +esid: sec-%typedarray%.prototype.findindex description: > %TypedArray%.prototype.findIndex.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/name.js b/test/built-ins/TypedArray/prototype/findIndex/name.js index c2113b623..6b77fdb45 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/name.js +++ b/test/built-ins/TypedArray/prototype/findIndex/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.11 +esid: sec-%typedarray%.prototype.findindex description: > %TypedArray%.prototype.findIndex.name is "findIndex". info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js index e2a0fab02..13c032fbb 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js +++ b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.findindex -es6id: 22.2.3.11 description: > Change values during predicate call info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-parameters.js b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-parameters.js index c19ccd1d9..ecb52b705 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-parameters.js +++ b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-parameters.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.findindex -es6id: 22.2.3.11 description: > Predicate called as F.call( thisArg, kValue, k, O ) for each array entry. info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-this-non-strict.js b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-this-non-strict.js index 68175c781..5f6086b8f 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-this-non-strict.js +++ b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-this-non-strict.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.findindex -es6id: 22.2.3.11 description: > Verify predicate this on non-strict mode info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-this-strict.js b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-this-strict.js index a4dd13ac2..96ef46098 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-this-strict.js +++ b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-this-strict.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.findindex -es6id: 22.2.3.11 description: > Predicate thisArg as F.call( thisArg, kValue, k, O ) for each array entry. info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/predicate-is-not-callable-throws.js b/test/built-ins/TypedArray/prototype/findIndex/predicate-is-not-callable-throws.js index 5b97bf74a..872c4ffe8 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/predicate-is-not-callable-throws.js +++ b/test/built-ins/TypedArray/prototype/findIndex/predicate-is-not-callable-throws.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.findindex -es6id: 22.2.3.11 description: > Throws a TypeError exception if predicate is not callable. info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/predicate-may-detach-buffer.js b/test/built-ins/TypedArray/prototype/findIndex/predicate-may-detach-buffer.js index 831d296ce..6124bc3fb 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/predicate-may-detach-buffer.js +++ b/test/built-ins/TypedArray/prototype/findIndex/predicate-may-detach-buffer.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.findindex -es6id: 22.2.3.11 description: > Predicate may detach the buffer info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/predicate-not-called-on-empty-array.js b/test/built-ins/TypedArray/prototype/findIndex/predicate-not-called-on-empty-array.js index e4fa770da..e6a4abb4a 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/predicate-not-called-on-empty-array.js +++ b/test/built-ins/TypedArray/prototype/findIndex/predicate-not-called-on-empty-array.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.findindex -es6id: 22.2.3.11 description: > Predicate is not called on an empty instance info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/prop-desc.js b/test/built-ins/TypedArray/prototype/findIndex/prop-desc.js index 014d8284a..7824b34b8 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/findIndex/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.11 +esid: sec-%typedarray%.prototype.findindex description: > "findIndex" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/return-abrupt-from-predicate-call.js b/test/built-ins/TypedArray/prototype/findIndex/return-abrupt-from-predicate-call.js index df09745c1..1b01c8221 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/return-abrupt-from-predicate-call.js +++ b/test/built-ins/TypedArray/prototype/findIndex/return-abrupt-from-predicate-call.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.findindex -es6id: 22.2.3.11 description: > Return abrupt from predicate call. info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/return-index-predicate-result-is-true.js b/test/built-ins/TypedArray/prototype/findIndex/return-index-predicate-result-is-true.js index 1e56448ca..572c284b9 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/return-index-predicate-result-is-true.js +++ b/test/built-ins/TypedArray/prototype/findIndex/return-index-predicate-result-is-true.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.findindex -es6id: 22.2.3.11 description: > Return index if predicate return a boolean true value. info: | diff --git a/test/built-ins/TypedArray/prototype/findIndex/return-negative-one-if-predicate-returns-false-value.js b/test/built-ins/TypedArray/prototype/findIndex/return-negative-one-if-predicate-returns-false-value.js index 7a8b9d9e5..3ebf60868 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/return-negative-one-if-predicate-returns-false-value.js +++ b/test/built-ins/TypedArray/prototype/findIndex/return-negative-one-if-predicate-returns-false-value.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.findindex -es6id: 22.2.3.11 description: > Return -1 if predicate always returns a boolean false value. info: | diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-func.js index 6ea0a324c..d4eb50b88 100644 --- a/test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.12 +esid: sec-%typedarray%.prototype.foreach description: Throws a TypeError exception when invoked as a function info: | 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-method.js index 7062e8b1d..f45505275 100644 --- a/test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.12 +esid: sec-%typedarray%.prototype.foreach description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/length.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/length.js index bb291f677..6499dfab0 100644 --- a/test/built-ins/TypedArray/prototype/forEach/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.12 +esid: sec-%typedarray%.prototype.foreach description: > %TypedArray%.prototype.forEach.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/name.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/name.js index 6adfd3c6b..9b192a05c 100644 --- a/test/built-ins/TypedArray/prototype/forEach/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.12 +esid: sec-%typedarray%.prototype.foreach description: > %TypedArray%.prototype.forEach.name is "forEach". info: | diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/prop-desc.js index 56bafc356..c17d2d901 100644 --- a/test/built-ins/TypedArray/prototype/forEach/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.12 +esid: sec-%typedarray%.prototype.foreach description: > "forEach" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/forEach/invoked-as-func.js b/test/built-ins/TypedArray/prototype/forEach/invoked-as-func.js index 5312bbde0..a99a5bef7 100644 --- a/test/built-ins/TypedArray/prototype/forEach/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/forEach/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.12 +esid: sec-%typedarray%.prototype.foreach description: Throws a TypeError exception when invoked as a function info: | 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/forEach/invoked-as-method.js b/test/built-ins/TypedArray/prototype/forEach/invoked-as-method.js index 630c7b8a5..a4a25e298 100644 --- a/test/built-ins/TypedArray/prototype/forEach/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/forEach/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.12 +esid: sec-%typedarray%.prototype.foreach description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/forEach/length.js b/test/built-ins/TypedArray/prototype/forEach/length.js index bc00a6ccf..75d08ac5a 100644 --- a/test/built-ins/TypedArray/prototype/forEach/length.js +++ b/test/built-ins/TypedArray/prototype/forEach/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.12 +esid: sec-%typedarray%.prototype.foreach description: > %TypedArray%.prototype.forEach.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/forEach/name.js b/test/built-ins/TypedArray/prototype/forEach/name.js index 7a3cf395f..e74f2bf23 100644 --- a/test/built-ins/TypedArray/prototype/forEach/name.js +++ b/test/built-ins/TypedArray/prototype/forEach/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.12 +esid: sec-%typedarray%.prototype.foreach description: > %TypedArray%.prototype.forEach.name is "forEach". info: | diff --git a/test/built-ins/TypedArray/prototype/forEach/prop-desc.js b/test/built-ins/TypedArray/prototype/forEach/prop-desc.js index 86fc95ef0..2f7163a78 100644 --- a/test/built-ins/TypedArray/prototype/forEach/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/forEach/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.12 +esid: sec-%typedarray%.prototype.foreach description: > "forEach" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/includes/BigInt/this-is-not-object.js index 2bee1f2f3..88a42bcdf 100644 --- a/test/built-ins/TypedArray/prototype/includes/BigInt/this-is-not-object.js +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/this-is-not-object.js @@ -1,7 +1,6 @@ // 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.3.14 esid: sec-%typedarray%.prototype.includes description: Throws a TypeError exception when `this` is not Object info: | diff --git a/test/built-ins/TypedArray/prototype/includes/this-is-not-object.js b/test/built-ins/TypedArray/prototype/includes/this-is-not-object.js index bf43ae7c8..2e7fdcc07 100644 --- a/test/built-ins/TypedArray/prototype/includes/this-is-not-object.js +++ b/test/built-ins/TypedArray/prototype/includes/this-is-not-object.js @@ -1,7 +1,6 @@ // 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.3.14 esid: sec-%typedarray%.prototype.includes description: Throws a TypeError exception when `this` is not Object info: | diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-func.js index 8134bac14..f2d8ff705 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.13 +esid: sec-%typedarray%.prototype.indexof description: Throws a TypeError exception when invoked as a function info: | 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] ) diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-method.js index 6a87487b7..80560a9ad 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.13 +esid: sec-%typedarray%.prototype.indexof description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] ) diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/length.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/length.js index fc4a0303d..1998ca260 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.13 +esid: sec-%typedarray%.prototype.indexof description: > %TypedArray%.prototype.indexOf.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/name.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/name.js index 594595344..e27bd001b 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.13 +esid: sec-%typedarray%.prototype.indexof description: > %TypedArray%.prototype.indexOf.name is "indexOf". info: | diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/prop-desc.js index a9454f493..003f3e34c 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.13 +esid: sec-%typedarray%.prototype.indexof description: > "indexOf" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/indexOf/invoked-as-func.js b/test/built-ins/TypedArray/prototype/indexOf/invoked-as-func.js index d304d4426..99207d03d 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/indexOf/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.13 +esid: sec-%typedarray%.prototype.indexof description: Throws a TypeError exception when invoked as a function info: | 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] ) diff --git a/test/built-ins/TypedArray/prototype/indexOf/invoked-as-method.js b/test/built-ins/TypedArray/prototype/indexOf/invoked-as-method.js index ef348b237..75f1957a7 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/indexOf/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.13 +esid: sec-%typedarray%.prototype.indexof description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] ) diff --git a/test/built-ins/TypedArray/prototype/indexOf/length.js b/test/built-ins/TypedArray/prototype/indexOf/length.js index 09f1a36fa..2ceca46c1 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/length.js +++ b/test/built-ins/TypedArray/prototype/indexOf/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.13 +esid: sec-%typedarray%.prototype.indexof description: > %TypedArray%.prototype.indexOf.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/indexOf/name.js b/test/built-ins/TypedArray/prototype/indexOf/name.js index 1f1ba6bfc..18313b112 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/name.js +++ b/test/built-ins/TypedArray/prototype/indexOf/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.13 +esid: sec-%typedarray%.prototype.indexof description: > %TypedArray%.prototype.indexOf.name is "indexOf". info: | diff --git a/test/built-ins/TypedArray/prototype/indexOf/prop-desc.js b/test/built-ins/TypedArray/prototype/indexOf/prop-desc.js index 6e58a0755..528cbb23b 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/indexOf/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.13 +esid: sec-%typedarray%.prototype.indexof description: > "indexOf" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-func.js index f2bab1f7f..1340f3931 100644 --- a/test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.14 +esid: sec-%typedarray%.prototype.join description: Throws a TypeError exception when invoked as a function info: | 22.2.3.14 %TypedArray%.prototype.join ( separator ) diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-method.js index 11bf0beda..1121e42aa 100644 --- a/test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/join/BigInt/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.14 +esid: sec-%typedarray%.prototype.join description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.14 %TypedArray%.prototype.join ( separator ) diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/length.js b/test/built-ins/TypedArray/prototype/join/BigInt/length.js index 540d1aba3..c1f772d36 100644 --- a/test/built-ins/TypedArray/prototype/join/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/join/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.14 +esid: sec-%typedarray%.prototype.join description: > %TypedArray%.prototype.join.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/name.js b/test/built-ins/TypedArray/prototype/join/BigInt/name.js index dea31a3c7..a35bba48e 100644 --- a/test/built-ins/TypedArray/prototype/join/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/join/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.14 +esid: sec-%typedarray%.prototype.join description: > %TypedArray%.prototype.join.name is "join". info: | diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/join/BigInt/prop-desc.js index 2102a0b24..da037abc5 100644 --- a/test/built-ins/TypedArray/prototype/join/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/join/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.14 +esid: sec-%typedarray%.prototype.join description: > "join" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/join/invoked-as-func.js b/test/built-ins/TypedArray/prototype/join/invoked-as-func.js index 0c85a33c5..a2c1cb169 100644 --- a/test/built-ins/TypedArray/prototype/join/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/join/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.14 +esid: sec-%typedarray%.prototype.join description: Throws a TypeError exception when invoked as a function info: | 22.2.3.14 %TypedArray%.prototype.join ( separator ) diff --git a/test/built-ins/TypedArray/prototype/join/invoked-as-method.js b/test/built-ins/TypedArray/prototype/join/invoked-as-method.js index 910a03ff1..6f83240f5 100644 --- a/test/built-ins/TypedArray/prototype/join/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/join/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.14 +esid: sec-%typedarray%.prototype.join description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.14 %TypedArray%.prototype.join ( separator ) diff --git a/test/built-ins/TypedArray/prototype/join/length.js b/test/built-ins/TypedArray/prototype/join/length.js index 4223addcb..907703286 100644 --- a/test/built-ins/TypedArray/prototype/join/length.js +++ b/test/built-ins/TypedArray/prototype/join/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.14 +esid: sec-%typedarray%.prototype.join description: > %TypedArray%.prototype.join.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/join/name.js b/test/built-ins/TypedArray/prototype/join/name.js index 6e99daf0a..29315666f 100644 --- a/test/built-ins/TypedArray/prototype/join/name.js +++ b/test/built-ins/TypedArray/prototype/join/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.14 +esid: sec-%typedarray%.prototype.join description: > %TypedArray%.prototype.join.name is "join". info: | diff --git a/test/built-ins/TypedArray/prototype/join/prop-desc.js b/test/built-ins/TypedArray/prototype/join/prop-desc.js index fca83e7e1..f55543e76 100644 --- a/test/built-ins/TypedArray/prototype/join/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/join/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.14 +esid: sec-%typedarray%.prototype.join description: > "join" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-func.js index f96271997..2b04ed7f2 100644 --- a/test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.15 +esid: sec-%typedarray%.prototype.keys description: Throws a TypeError exception when invoked as a function info: | 22.2.3.15 %TypedArray%.prototype.keys ( ) diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-method.js index ca9b0d663..9e67e8b90 100644 --- a/test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/keys/BigInt/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.15 +esid: sec-%typedarray%.prototype.keys description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.15 %TypedArray%.prototype.keys ( ) diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/length.js b/test/built-ins/TypedArray/prototype/keys/BigInt/length.js index 39d20e5e2..ef18be936 100644 --- a/test/built-ins/TypedArray/prototype/keys/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/keys/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.15 +esid: sec-%typedarray%.prototype.keys description: > %TypedArray%.prototype.keys.length is 0. info: | diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/name.js b/test/built-ins/TypedArray/prototype/keys/BigInt/name.js index 2cd9e67d4..3312f488b 100644 --- a/test/built-ins/TypedArray/prototype/keys/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/keys/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.15 +esid: sec-%typedarray%.prototype.keys description: > %TypedArray%.prototype.keys.name is "keys". info: | diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/keys/BigInt/prop-desc.js index 669d27257..7a3664476 100644 --- a/test/built-ins/TypedArray/prototype/keys/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/keys/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.15 +esid: sec-%typedarray%.prototype.keys description: > "keys" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/keys/invoked-as-func.js b/test/built-ins/TypedArray/prototype/keys/invoked-as-func.js index 2788b24d6..6c65712c4 100644 --- a/test/built-ins/TypedArray/prototype/keys/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/keys/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.15 +esid: sec-%typedarray%.prototype.keys description: Throws a TypeError exception when invoked as a function info: | 22.2.3.15 %TypedArray%.prototype.keys ( ) diff --git a/test/built-ins/TypedArray/prototype/keys/invoked-as-method.js b/test/built-ins/TypedArray/prototype/keys/invoked-as-method.js index e98b6081c..8b3cc12f1 100644 --- a/test/built-ins/TypedArray/prototype/keys/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/keys/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.15 +esid: sec-%typedarray%.prototype.keys description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.15 %TypedArray%.prototype.keys ( ) diff --git a/test/built-ins/TypedArray/prototype/keys/length.js b/test/built-ins/TypedArray/prototype/keys/length.js index 1f5be5e1c..ed354d593 100644 --- a/test/built-ins/TypedArray/prototype/keys/length.js +++ b/test/built-ins/TypedArray/prototype/keys/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.15 +esid: sec-%typedarray%.prototype.keys description: > %TypedArray%.prototype.keys.length is 0. info: | diff --git a/test/built-ins/TypedArray/prototype/keys/name.js b/test/built-ins/TypedArray/prototype/keys/name.js index ed2c2d9e8..ab0235b87 100644 --- a/test/built-ins/TypedArray/prototype/keys/name.js +++ b/test/built-ins/TypedArray/prototype/keys/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.15 +esid: sec-%typedarray%.prototype.keys description: > %TypedArray%.prototype.keys.name is "keys". info: | diff --git a/test/built-ins/TypedArray/prototype/keys/prop-desc.js b/test/built-ins/TypedArray/prototype/keys/prop-desc.js index 71e4a2c4b..9243d93ea 100644 --- a/test/built-ins/TypedArray/prototype/keys/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/keys/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.15 +esid: sec-%typedarray%.prototype.keys description: > "keys" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-func.js index d36811f90..3f9822050 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.16 +esid: sec-%typedarray%.prototype.lastindexof description: Throws a TypeError exception when invoked as a function info: | 22.2.3.16 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-method.js index ec03407bb..3f034e421 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.16 +esid: sec-%typedarray%.prototype.lastindexof description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.16 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length.js index 809454a16..5519e8f2e 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.16 +esid: sec-%typedarray%.prototype.lastindexof description: > %TypedArray%.prototype.lastIndexOf.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/name.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/name.js index 4e500aaf4..e53c677be 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.16 +esid: sec-%typedarray%.prototype.lastindexof description: > %TypedArray%.prototype.lastIndexOf.name is "lastIndexOf". info: | diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/prop-desc.js index 0b5ab2e59..007203b94 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.16 +esid: sec-%typedarray%.prototype.lastindexof description: > "lastIndexOf" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-func.js b/test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-func.js index 2462fec66..0448d059c 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.16 +esid: sec-%typedarray%.prototype.lastindexof description: Throws a TypeError exception when invoked as a function info: | 22.2.3.16 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-method.js b/test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-method.js index ecf6183d4..347d0c7c1 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.16 +esid: sec-%typedarray%.prototype.lastindexof description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.16 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/length.js b/test/built-ins/TypedArray/prototype/lastIndexOf/length.js index 6e0a829bc..46207ba85 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/length.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.16 +esid: sec-%typedarray%.prototype.lastindexof description: > %TypedArray%.prototype.lastIndexOf.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/name.js b/test/built-ins/TypedArray/prototype/lastIndexOf/name.js index 859ad4cde..be38057f2 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/name.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.16 +esid: sec-%typedarray%.prototype.lastindexof description: > %TypedArray%.prototype.lastIndexOf.name is "lastIndexOf". info: | diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/prop-desc.js b/test/built-ins/TypedArray/prototype/lastIndexOf/prop-desc.js index c1b1a3c61..082125cce 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.16 +esid: sec-%typedarray%.prototype.lastindexof description: > "lastIndexOf" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-accessor.js b/test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-accessor.js index e8f07cb68..d67d24370 100644 --- a/test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-accessor.js +++ b/test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-accessor.js @@ -1,7 +1,7 @@ // 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.3.17 +esid: sec-get-%typedarray%.prototype.length description: > Requires this value to have a [[ViewedArrayBuffer]] internal slot info: | diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-func.js index 0e3283914..100bf4c55 100644 --- a/test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/length/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.17 +esid: sec-get-%typedarray%.prototype.length description: Throws a TypeError exception when invoked as a function info: | 22.2.3.17 get %TypedArray%.prototype.length diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/length.js b/test/built-ins/TypedArray/prototype/length/BigInt/length.js index 873bf7d57..446f89c3b 100644 --- a/test/built-ins/TypedArray/prototype/length/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/length/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.17 +esid: sec-get-%typedarray%.prototype.length description: > get %TypedArray%.prototype.length.length is 0. info: | diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/name.js b/test/built-ins/TypedArray/prototype/length/BigInt/name.js index 168a579c7..c37e872a9 100644 --- a/test/built-ins/TypedArray/prototype/length/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/length/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.17 +esid: sec-get-%typedarray%.prototype.length description: > get %TypedArray%.prototype.length.name is "get length". info: | diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/length/BigInt/prop-desc.js index be321d354..e047b41ef 100644 --- a/test/built-ins/TypedArray/prototype/length/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/length/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.17 +esid: sec-get-%typedarray%.prototype.length description: > "length" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/length/invoked-as-accessor.js b/test/built-ins/TypedArray/prototype/length/invoked-as-accessor.js index 731737656..cc13ea81c 100644 --- a/test/built-ins/TypedArray/prototype/length/invoked-as-accessor.js +++ b/test/built-ins/TypedArray/prototype/length/invoked-as-accessor.js @@ -1,7 +1,7 @@ // 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.3.17 +esid: sec-get-%typedarray%.prototype.length description: > Requires this value to have a [[ViewedArrayBuffer]] internal slot info: | diff --git a/test/built-ins/TypedArray/prototype/length/invoked-as-func.js b/test/built-ins/TypedArray/prototype/length/invoked-as-func.js index 7f94fd1bb..4606e730e 100644 --- a/test/built-ins/TypedArray/prototype/length/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/length/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.17 +esid: sec-get-%typedarray%.prototype.length description: Throws a TypeError exception when invoked as a function info: | 22.2.3.17 get %TypedArray%.prototype.length diff --git a/test/built-ins/TypedArray/prototype/length/length.js b/test/built-ins/TypedArray/prototype/length/length.js index 43ac09dc6..46643927b 100644 --- a/test/built-ins/TypedArray/prototype/length/length.js +++ b/test/built-ins/TypedArray/prototype/length/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.17 +esid: sec-get-%typedarray%.prototype.length description: > get %TypedArray%.prototype.length.length is 0. info: | diff --git a/test/built-ins/TypedArray/prototype/length/name.js b/test/built-ins/TypedArray/prototype/length/name.js index d9d6605da..fe55423df 100644 --- a/test/built-ins/TypedArray/prototype/length/name.js +++ b/test/built-ins/TypedArray/prototype/length/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.17 +esid: sec-get-%typedarray%.prototype.length description: > get %TypedArray%.prototype.length.name is "get length". info: | diff --git a/test/built-ins/TypedArray/prototype/length/prop-desc.js b/test/built-ins/TypedArray/prototype/length/prop-desc.js index 290311346..2557b1720 100644 --- a/test/built-ins/TypedArray/prototype/length/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/length/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.17 +esid: sec-get-%typedarray%.prototype.length description: > "length" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-func.js index 1c07da18e..20e5bb534 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.18 +esid: sec-%typedarray%.prototype.map description: Throws a TypeError exception when invoked as a function info: | 22.2.3.18 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-method.js index 3d5bb1f8f..7f03579fd 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.18 +esid: sec-%typedarray%.prototype.map description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.18 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/length.js b/test/built-ins/TypedArray/prototype/map/BigInt/length.js index 75c9a5ace..53f9ce83a 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.18 +esid: sec-%typedarray%.prototype.map description: > %TypedArray%.prototype.map.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/name.js b/test/built-ins/TypedArray/prototype/map/BigInt/name.js index bd5237b2d..fcdebfb01 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.18 +esid: sec-%typedarray%.prototype.map description: > %TypedArray%.prototype.map.name is "map". info: | diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/map/BigInt/prop-desc.js index c68afe481..96c34e545 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.18 +esid: sec-%typedarray%.prototype.map description: > "map" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/map/invoked-as-func.js b/test/built-ins/TypedArray/prototype/map/invoked-as-func.js index 8431e13ca..d330f2889 100644 --- a/test/built-ins/TypedArray/prototype/map/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/map/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.18 +esid: sec-%typedarray%.prototype.map description: Throws a TypeError exception when invoked as a function info: | 22.2.3.18 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/map/invoked-as-method.js b/test/built-ins/TypedArray/prototype/map/invoked-as-method.js index b1a722c48..ebccfdff9 100644 --- a/test/built-ins/TypedArray/prototype/map/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/map/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.18 +esid: sec-%typedarray%.prototype.map description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.18 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/map/length.js b/test/built-ins/TypedArray/prototype/map/length.js index 1a88244a0..a83dcf805 100644 --- a/test/built-ins/TypedArray/prototype/map/length.js +++ b/test/built-ins/TypedArray/prototype/map/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.18 +esid: sec-%typedarray%.prototype.map description: > %TypedArray%.prototype.map.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/map/name.js b/test/built-ins/TypedArray/prototype/map/name.js index 0158e044f..085bae78d 100644 --- a/test/built-ins/TypedArray/prototype/map/name.js +++ b/test/built-ins/TypedArray/prototype/map/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.18 +esid: sec-%typedarray%.prototype.map description: > %TypedArray%.prototype.map.name is "map". info: | diff --git a/test/built-ins/TypedArray/prototype/map/prop-desc.js b/test/built-ins/TypedArray/prototype/map/prop-desc.js index b00e16469..02536ea43 100644 --- a/test/built-ins/TypedArray/prototype/map/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/map/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.18 +esid: sec-%typedarray%.prototype.map description: > "map" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-func.js index 32441ea61..6b0406b58 100644 --- a/test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.19 +esid: sec-%typedarray%.prototype.reduce description: Throws a TypeError exception when invoked as a function info: | 22.2.3.19 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-method.js index fcc586259..609adb498 100644 --- a/test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.19 +esid: sec-%typedarray%.prototype.reduce description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.19 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/length.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/length.js index 03b80a145..bb10543bf 100644 --- a/test/built-ins/TypedArray/prototype/reduce/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.19 +esid: sec-%typedarray%.prototype.reduce description: > %TypedArray%.prototype.reduce.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/name.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/name.js index 86ad9f3d4..4f1226970 100644 --- a/test/built-ins/TypedArray/prototype/reduce/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.19 +esid: sec-%typedarray%.prototype.reduce description: > %TypedArray%.prototype.reduce.name is "reduce". info: | diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/prop-desc.js index 6b53a2630..938262600 100644 --- a/test/built-ins/TypedArray/prototype/reduce/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.19 +esid: sec-%typedarray%.prototype.reduce description: > "reduce" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/reduce/invoked-as-func.js b/test/built-ins/TypedArray/prototype/reduce/invoked-as-func.js index ab7b67039..bf5bf5e10 100644 --- a/test/built-ins/TypedArray/prototype/reduce/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/reduce/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.19 +esid: sec-%typedarray%.prototype.reduce description: Throws a TypeError exception when invoked as a function info: | 22.2.3.19 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) diff --git a/test/built-ins/TypedArray/prototype/reduce/invoked-as-method.js b/test/built-ins/TypedArray/prototype/reduce/invoked-as-method.js index e50473401..b35bef486 100644 --- a/test/built-ins/TypedArray/prototype/reduce/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/reduce/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.19 +esid: sec-%typedarray%.prototype.reduce description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.19 %TypedArray%.prototype.reduce ( callbackfn [ , initialValue ] ) diff --git a/test/built-ins/TypedArray/prototype/reduce/length.js b/test/built-ins/TypedArray/prototype/reduce/length.js index 7bf2e6f01..0034666cb 100644 --- a/test/built-ins/TypedArray/prototype/reduce/length.js +++ b/test/built-ins/TypedArray/prototype/reduce/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.19 +esid: sec-%typedarray%.prototype.reduce description: > %TypedArray%.prototype.reduce.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/reduce/name.js b/test/built-ins/TypedArray/prototype/reduce/name.js index 33cf84edb..32b025fad 100644 --- a/test/built-ins/TypedArray/prototype/reduce/name.js +++ b/test/built-ins/TypedArray/prototype/reduce/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.19 +esid: sec-%typedarray%.prototype.reduce description: > %TypedArray%.prototype.reduce.name is "reduce". info: | diff --git a/test/built-ins/TypedArray/prototype/reduce/prop-desc.js b/test/built-ins/TypedArray/prototype/reduce/prop-desc.js index d291e79bc..aff04ee89 100644 --- a/test/built-ins/TypedArray/prototype/reduce/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/reduce/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.19 +esid: sec-%typedarray%.prototype.reduce description: > "reduce" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-func.js index 7bc30e60c..9a0fec093 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.20 +esid: sec-%typedarray%.prototype.reduceright description: Throws a TypeError exception when invoked as a function info: | 22.2.3.20 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-method.js index 468ad5e36..d36832aa2 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.20 +esid: sec-%typedarray%.prototype.reduceright description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.20 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/length.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/length.js index cb857c2f5..7c8ab8e07 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.20 +esid: sec-%typedarray%.prototype.reduceright description: > %TypedArray%.prototype.reduceRight.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/name.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/name.js index fa94ac119..6a6ee5e8c 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.20 +esid: sec-%typedarray%.prototype.reduceright description: > %TypedArray%.prototype.reduceRight.name is "reduceRight". info: | diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/prop-desc.js index 71eeecbbf..76455ab4c 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.20 +esid: sec-%typedarray%.prototype.reduceright description: > "reduceRight" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/reduceRight/invoked-as-func.js b/test/built-ins/TypedArray/prototype/reduceRight/invoked-as-func.js index e7f3104ad..49937beb2 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.20 +esid: sec-%typedarray%.prototype.reduceright description: Throws a TypeError exception when invoked as a function info: | 22.2.3.20 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) diff --git a/test/built-ins/TypedArray/prototype/reduceRight/invoked-as-method.js b/test/built-ins/TypedArray/prototype/reduceRight/invoked-as-method.js index 397eb2b1d..f3cd49e0b 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.20 +esid: sec-%typedarray%.prototype.reduceright description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.20 %TypedArray%.prototype.reduceRight ( callbackfn [ , initialValue ] ) diff --git a/test/built-ins/TypedArray/prototype/reduceRight/length.js b/test/built-ins/TypedArray/prototype/reduceRight/length.js index 4bb6265de..b0a06637e 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/length.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.20 +esid: sec-%typedarray%.prototype.reduceright description: > %TypedArray%.prototype.reduceRight.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/reduceRight/name.js b/test/built-ins/TypedArray/prototype/reduceRight/name.js index e9cec95aa..8fd47b81b 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/name.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.20 +esid: sec-%typedarray%.prototype.reduceright description: > %TypedArray%.prototype.reduceRight.name is "reduceRight". info: | diff --git a/test/built-ins/TypedArray/prototype/reduceRight/prop-desc.js b/test/built-ins/TypedArray/prototype/reduceRight/prop-desc.js index 5b22846e0..37a688721 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.20 +esid: sec-%typedarray%.prototype.reduceright description: > "reduceRight" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-func.js index f8b4b6fde..48e16d6be 100644 --- a/test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.21 +esid: sec-%typedarray%.prototype.reverse description: Throws a TypeError exception when invoked as a function info: | 22.2.3.21 %TypedArray%.prototype.reverse ( ) diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-method.js index ec8dd5945..601ce65ff 100644 --- a/test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.21 +esid: sec-%typedarray%.prototype.reverse description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.21 %TypedArray%.prototype.reverse ( ) diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/length.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/length.js index afb56f9e1..3b7195d73 100644 --- a/test/built-ins/TypedArray/prototype/reverse/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.21 +esid: sec-%typedarray%.prototype.reverse description: > %TypedArray%.prototype.reverse.length is 0. info: | diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/name.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/name.js index 9652d5a60..b7e2130cb 100644 --- a/test/built-ins/TypedArray/prototype/reverse/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.21 +esid: sec-%typedarray%.prototype.reverse description: > %TypedArray%.prototype.reverse.name is "reverse". info: | diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/prop-desc.js index 56c828f36..d60950d69 100644 --- a/test/built-ins/TypedArray/prototype/reverse/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.21 +esid: sec-%typedarray%.prototype.reverse description: > "reverse" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/reverse/invoked-as-func.js b/test/built-ins/TypedArray/prototype/reverse/invoked-as-func.js index a35fbf147..3082a2ff7 100644 --- a/test/built-ins/TypedArray/prototype/reverse/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/reverse/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.21 +esid: sec-%typedarray%.prototype.reverse description: Throws a TypeError exception when invoked as a function info: | 22.2.3.21 %TypedArray%.prototype.reverse ( ) diff --git a/test/built-ins/TypedArray/prototype/reverse/invoked-as-method.js b/test/built-ins/TypedArray/prototype/reverse/invoked-as-method.js index 510fa2083..991cd44af 100644 --- a/test/built-ins/TypedArray/prototype/reverse/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/reverse/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.21 +esid: sec-%typedarray%.prototype.reverse description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.21 %TypedArray%.prototype.reverse ( ) diff --git a/test/built-ins/TypedArray/prototype/reverse/length.js b/test/built-ins/TypedArray/prototype/reverse/length.js index 644539de0..f92f125fc 100644 --- a/test/built-ins/TypedArray/prototype/reverse/length.js +++ b/test/built-ins/TypedArray/prototype/reverse/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.21 +esid: sec-%typedarray%.prototype.reverse description: > %TypedArray%.prototype.reverse.length is 0. info: | diff --git a/test/built-ins/TypedArray/prototype/reverse/name.js b/test/built-ins/TypedArray/prototype/reverse/name.js index 7c52b9b5d..7fc42d4c5 100644 --- a/test/built-ins/TypedArray/prototype/reverse/name.js +++ b/test/built-ins/TypedArray/prototype/reverse/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.21 +esid: sec-%typedarray%.prototype.reverse description: > %TypedArray%.prototype.reverse.name is "reverse". info: | diff --git a/test/built-ins/TypedArray/prototype/reverse/prop-desc.js b/test/built-ins/TypedArray/prototype/reverse/prop-desc.js index a3bc215b6..7d2c9fc89 100644 --- a/test/built-ins/TypedArray/prototype/reverse/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/reverse/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.21 +esid: sec-%typedarray%.prototype.reverse description: > "reverse" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js b/test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js index 07ec82242..41d326bed 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js @@ -1,8 +1,7 @@ // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-%typedarray%.prototype.set -es6id: 22.2.3.22.2 +esid: sec-%typedarray%.prototype.set.2 description: Preservation of bit-level encoding info: | [...] diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-func.js index 1826706ff..ee55b5aa4 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.22 +esid: sec-%typedarray%.prototype.set description: Throws a TypeError exception when invoked as a function info: | 22.2.3.22 %TypedArray%.prototype.set ( overloaded [ , offset ]) diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-method.js index 4f52624e7..1b0a08698 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.22 +esid: sec-%typedarray%.prototype.set description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.22 %TypedArray%.prototype.set ( overloaded [ , offset ]) diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/length.js b/test/built-ins/TypedArray/prototype/set/BigInt/length.js index a206e85a9..bf7b68956 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.22 +esid: sec-%typedarray%.prototype.set description: > %TypedArray%.prototype.set.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/name.js b/test/built-ins/TypedArray/prototype/set/BigInt/name.js index 2bb904d8f..87c194862 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.22 +esid: sec-%typedarray%.prototype.set description: > %TypedArray%.prototype.set.name is "set". info: | diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/set/BigInt/prop-desc.js index 6dabe5c1b..e8237d1fd 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.22 +esid: sec-%typedarray%.prototype.set description: > "set" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/set/bit-precision.js b/test/built-ins/TypedArray/prototype/set/bit-precision.js index 29dc14629..9010a9de2 100644 --- a/test/built-ins/TypedArray/prototype/set/bit-precision.js +++ b/test/built-ins/TypedArray/prototype/set/bit-precision.js @@ -1,8 +1,7 @@ // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-%typedarray%.prototype.set -es6id: 22.2.3.22.2 +esid: sec-%typedarray%.prototype.set.2 description: Preservation of bit-level encoding info: | [...] diff --git a/test/built-ins/TypedArray/prototype/set/invoked-as-func.js b/test/built-ins/TypedArray/prototype/set/invoked-as-func.js index deae7a637..7a5b9e7bf 100644 --- a/test/built-ins/TypedArray/prototype/set/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/set/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.22 +esid: sec-%typedarray%.prototype.set description: Throws a TypeError exception when invoked as a function info: | 22.2.3.22 %TypedArray%.prototype.set ( overloaded [ , offset ]) diff --git a/test/built-ins/TypedArray/prototype/set/invoked-as-method.js b/test/built-ins/TypedArray/prototype/set/invoked-as-method.js index 37b489687..586772a2c 100644 --- a/test/built-ins/TypedArray/prototype/set/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/set/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.22 +esid: sec-%typedarray%.prototype.set description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.22 %TypedArray%.prototype.set ( overloaded [ , offset ]) diff --git a/test/built-ins/TypedArray/prototype/set/length.js b/test/built-ins/TypedArray/prototype/set/length.js index 344b151f7..081f2bdc4 100644 --- a/test/built-ins/TypedArray/prototype/set/length.js +++ b/test/built-ins/TypedArray/prototype/set/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.22 +esid: sec-%typedarray%.prototype.set description: > %TypedArray%.prototype.set.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/set/name.js b/test/built-ins/TypedArray/prototype/set/name.js index 22e4c79cd..5d43516fc 100644 --- a/test/built-ins/TypedArray/prototype/set/name.js +++ b/test/built-ins/TypedArray/prototype/set/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.22 +esid: sec-%typedarray%.prototype.set description: > %TypedArray%.prototype.set.name is "set". info: | diff --git a/test/built-ins/TypedArray/prototype/set/prop-desc.js b/test/built-ins/TypedArray/prototype/set/prop-desc.js index afce91c7d..4773c6900 100644 --- a/test/built-ins/TypedArray/prototype/set/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/set/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.22 +esid: sec-%typedarray%.prototype.set description: > "set" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/bit-precision.js b/test/built-ins/TypedArray/prototype/slice/BigInt/bit-precision.js index 4c581eb60..a97fbaf10 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/bit-precision.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/bit-precision.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.slice -es6id: 22.2.3.23 description: Preservation of bit-level encoding info: | [...] diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-func.js index d12fa6245..31645fbb4 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.23 +esid: sec-%typedarray%.prototype.slice description: Throws a TypeError exception when invoked as a function info: | 22.2.3.23 %TypedArray%.prototype.slice ( start, end ) diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-method.js index c352bbaf6..4b9c7c4ff 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.23 +esid: sec-%typedarray%.prototype.slice description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.23 %TypedArray%.prototype.slice ( start, end ) diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/length.js b/test/built-ins/TypedArray/prototype/slice/BigInt/length.js index 615fac7a2..eb6d370c9 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.23 +esid: sec-%typedarray%.prototype.slice description: > %TypedArray%.prototype.slice.length is 2. info: | diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/name.js b/test/built-ins/TypedArray/prototype/slice/BigInt/name.js index e26ef197a..d551fc812 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.23 +esid: sec-%typedarray%.prototype.slice description: > %TypedArray%.prototype.slice.name is "slice". info: | diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/slice/BigInt/prop-desc.js index a750f3750..a4d85f01e 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.23 +esid: sec-%typedarray%.prototype.slice description: > "slice" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/slice/bit-precision.js b/test/built-ins/TypedArray/prototype/slice/bit-precision.js index 07c7e1fbb..6e23045ce 100644 --- a/test/built-ins/TypedArray/prototype/slice/bit-precision.js +++ b/test/built-ins/TypedArray/prototype/slice/bit-precision.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.slice -es6id: 22.2.3.23 description: Preservation of bit-level encoding info: | [...] diff --git a/test/built-ins/TypedArray/prototype/slice/invoked-as-func.js b/test/built-ins/TypedArray/prototype/slice/invoked-as-func.js index dca485714..564bad96e 100644 --- a/test/built-ins/TypedArray/prototype/slice/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/slice/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.23 +esid: sec-%typedarray%.prototype.slice description: Throws a TypeError exception when invoked as a function info: | 22.2.3.23 %TypedArray%.prototype.slice ( start, end ) diff --git a/test/built-ins/TypedArray/prototype/slice/invoked-as-method.js b/test/built-ins/TypedArray/prototype/slice/invoked-as-method.js index 90e03f2f2..ab5941dcc 100644 --- a/test/built-ins/TypedArray/prototype/slice/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/slice/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.23 +esid: sec-%typedarray%.prototype.slice description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.23 %TypedArray%.prototype.slice ( start, end ) diff --git a/test/built-ins/TypedArray/prototype/slice/length.js b/test/built-ins/TypedArray/prototype/slice/length.js index 50b4cf8a9..da4a58b1b 100644 --- a/test/built-ins/TypedArray/prototype/slice/length.js +++ b/test/built-ins/TypedArray/prototype/slice/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.23 +esid: sec-%typedarray%.prototype.slice description: > %TypedArray%.prototype.slice.length is 2. info: | diff --git a/test/built-ins/TypedArray/prototype/slice/name.js b/test/built-ins/TypedArray/prototype/slice/name.js index a2849cf78..f834475cb 100644 --- a/test/built-ins/TypedArray/prototype/slice/name.js +++ b/test/built-ins/TypedArray/prototype/slice/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.23 +esid: sec-%typedarray%.prototype.slice description: > %TypedArray%.prototype.slice.name is "slice". info: | diff --git a/test/built-ins/TypedArray/prototype/slice/prop-desc.js b/test/built-ins/TypedArray/prototype/slice/prop-desc.js index afd6a374c..b97ec0478 100644 --- a/test/built-ins/TypedArray/prototype/slice/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/slice/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.23 +esid: sec-%typedarray%.prototype.slice description: > "slice" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-func.js index f093afd9b..4be0d0c6c 100644 --- a/test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.24 +esid: sec-%typedarray%.prototype.some description: Throws a TypeError exception when invoked as a function info: | 22.2.3.24 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-method.js index 7fc537318..71b8fd36d 100644 --- a/test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/some/BigInt/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.24 +esid: sec-%typedarray%.prototype.some description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.24 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/length.js b/test/built-ins/TypedArray/prototype/some/BigInt/length.js index c1574968f..34a6c3906 100644 --- a/test/built-ins/TypedArray/prototype/some/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/some/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.24 +esid: sec-%typedarray%.prototype.some description: > %TypedArray%.prototype.some.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/name.js b/test/built-ins/TypedArray/prototype/some/BigInt/name.js index e216ae780..b26a59533 100644 --- a/test/built-ins/TypedArray/prototype/some/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/some/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.24 +esid: sec-%typedarray%.prototype.some description: > %TypedArray%.prototype.some.name is "some". info: | diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/some/BigInt/prop-desc.js index 00de662ca..45d71bd20 100644 --- a/test/built-ins/TypedArray/prototype/some/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/some/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.24 +esid: sec-%typedarray%.prototype.some description: > "some" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/some/invoked-as-func.js b/test/built-ins/TypedArray/prototype/some/invoked-as-func.js index 72baa34bb..ff1164de3 100644 --- a/test/built-ins/TypedArray/prototype/some/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/some/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.24 +esid: sec-%typedarray%.prototype.some description: Throws a TypeError exception when invoked as a function info: | 22.2.3.24 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/some/invoked-as-method.js b/test/built-ins/TypedArray/prototype/some/invoked-as-method.js index f93c41842..58d20fa96 100644 --- a/test/built-ins/TypedArray/prototype/some/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/some/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.24 +esid: sec-%typedarray%.prototype.some description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.24 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] ) diff --git a/test/built-ins/TypedArray/prototype/some/length.js b/test/built-ins/TypedArray/prototype/some/length.js index 344b61c2b..d6ec17146 100644 --- a/test/built-ins/TypedArray/prototype/some/length.js +++ b/test/built-ins/TypedArray/prototype/some/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.24 +esid: sec-%typedarray%.prototype.some description: > %TypedArray%.prototype.some.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/some/name.js b/test/built-ins/TypedArray/prototype/some/name.js index e9fa5f406..08fcd0ad0 100644 --- a/test/built-ins/TypedArray/prototype/some/name.js +++ b/test/built-ins/TypedArray/prototype/some/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.24 +esid: sec-%typedarray%.prototype.some description: > %TypedArray%.prototype.some.name is "some". info: | diff --git a/test/built-ins/TypedArray/prototype/some/prop-desc.js b/test/built-ins/TypedArray/prototype/some/prop-desc.js index 21f449599..b42b0f254 100644 --- a/test/built-ins/TypedArray/prototype/some/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/some/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.24 +esid: sec-%typedarray%.prototype.some description: > "some" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-func.js index 89e84fc27..760443c6f 100644 --- a/test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.25 +esid: sec-%typedarray%.prototype.sort description: Throws a TypeError exception when invoked as a function info: | 22.2.3.25 %TypedArray%.prototype.sort ( comparefn ) diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-method.js index fea2db35b..e288c99e5 100644 --- a/test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.25 +esid: sec-%typedarray%.prototype.sort description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.25 %TypedArray%.prototype.sort ( comparefn ) diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/length.js b/test/built-ins/TypedArray/prototype/sort/BigInt/length.js index 028e2639b..91cb4c2d2 100644 --- a/test/built-ins/TypedArray/prototype/sort/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.25 +esid: sec-%typedarray%.prototype.sort description: > %TypedArray%.prototype.sort.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/name.js b/test/built-ins/TypedArray/prototype/sort/BigInt/name.js index 2214531a3..7441ad53e 100644 --- a/test/built-ins/TypedArray/prototype/sort/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.25 +esid: sec-%typedarray%.prototype.sort description: > %TypedArray%.prototype.sort.name is "sort". info: | diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/sort/BigInt/prop-desc.js index 21f05def7..69e74787e 100644 --- a/test/built-ins/TypedArray/prototype/sort/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.25 +esid: sec-%typedarray%.prototype.sort description: > "sort" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/sort/invoked-as-func.js b/test/built-ins/TypedArray/prototype/sort/invoked-as-func.js index b3e77e4cb..705ef3a3d 100644 --- a/test/built-ins/TypedArray/prototype/sort/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/sort/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.25 +esid: sec-%typedarray%.prototype.sort description: Throws a TypeError exception when invoked as a function info: | 22.2.3.25 %TypedArray%.prototype.sort ( comparefn ) diff --git a/test/built-ins/TypedArray/prototype/sort/invoked-as-method.js b/test/built-ins/TypedArray/prototype/sort/invoked-as-method.js index 33edcc428..4f18b417e 100644 --- a/test/built-ins/TypedArray/prototype/sort/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/sort/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.25 +esid: sec-%typedarray%.prototype.sort description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.25 %TypedArray%.prototype.sort ( comparefn ) diff --git a/test/built-ins/TypedArray/prototype/sort/length.js b/test/built-ins/TypedArray/prototype/sort/length.js index d8237d233..757ffbb80 100644 --- a/test/built-ins/TypedArray/prototype/sort/length.js +++ b/test/built-ins/TypedArray/prototype/sort/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.25 +esid: sec-%typedarray%.prototype.sort description: > %TypedArray%.prototype.sort.length is 1. info: | diff --git a/test/built-ins/TypedArray/prototype/sort/name.js b/test/built-ins/TypedArray/prototype/sort/name.js index e1785cd7e..55fbd9f29 100644 --- a/test/built-ins/TypedArray/prototype/sort/name.js +++ b/test/built-ins/TypedArray/prototype/sort/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.25 +esid: sec-%typedarray%.prototype.sort description: > %TypedArray%.prototype.sort.name is "sort". info: | diff --git a/test/built-ins/TypedArray/prototype/sort/prop-desc.js b/test/built-ins/TypedArray/prototype/sort/prop-desc.js index 681de6475..c59cdf175 100644 --- a/test/built-ins/TypedArray/prototype/sort/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/sort/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.25 +esid: sec-%typedarray%.prototype.sort description: > "sort" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-func.js index ca9598644..dc28bbf0e 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.26 +esid: sec-%typedarray%.prototype.subarray description: Throws a TypeError exception when invoked as a function info: | 22.2.3.26 %TypedArray%.prototype.subarray( [ begin [ , end ] ] ) diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-method.js index abfefd8fc..887e139bc 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.26 +esid: sec-%typedarray%.prototype.subarray description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.26 %TypedArray%.prototype.subarray( [ begin [ , end ] ] ) diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/length.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/length.js index 7d6bb6297..cec810c3f 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.26 +esid: sec-%typedarray%.prototype.subarray description: > %TypedArray%.prototype.subarray.length is 2. info: | diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/name.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/name.js index d5d11e1b5..e5a201b4f 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.26 +esid: sec-%typedarray%.prototype.subarray description: > %TypedArray%.prototype.subarray.name is "subarray". info: | diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/prop-desc.js index 23353fadb..baaf982c3 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.26 +esid: sec-%typedarray%.prototype.subarray description: > "subarray" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/subarray/invoked-as-func.js b/test/built-ins/TypedArray/prototype/subarray/invoked-as-func.js index 702976ece..4a13c6f31 100644 --- a/test/built-ins/TypedArray/prototype/subarray/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/subarray/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.26 +esid: sec-%typedarray%.prototype.subarray description: Throws a TypeError exception when invoked as a function info: | 22.2.3.26 %TypedArray%.prototype.subarray( [ begin [ , end ] ] ) diff --git a/test/built-ins/TypedArray/prototype/subarray/invoked-as-method.js b/test/built-ins/TypedArray/prototype/subarray/invoked-as-method.js index 2195190d7..cf195a76c 100644 --- a/test/built-ins/TypedArray/prototype/subarray/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/subarray/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.26 +esid: sec-%typedarray%.prototype.subarray description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.26 %TypedArray%.prototype.subarray( [ begin [ , end ] ] ) diff --git a/test/built-ins/TypedArray/prototype/subarray/length.js b/test/built-ins/TypedArray/prototype/subarray/length.js index 8ce548c5a..71032debc 100644 --- a/test/built-ins/TypedArray/prototype/subarray/length.js +++ b/test/built-ins/TypedArray/prototype/subarray/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.26 +esid: sec-%typedarray%.prototype.subarray description: > %TypedArray%.prototype.subarray.length is 2. info: | diff --git a/test/built-ins/TypedArray/prototype/subarray/name.js b/test/built-ins/TypedArray/prototype/subarray/name.js index 9bb40df38..a83264cda 100644 --- a/test/built-ins/TypedArray/prototype/subarray/name.js +++ b/test/built-ins/TypedArray/prototype/subarray/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.26 +esid: sec-%typedarray%.prototype.subarray description: > %TypedArray%.prototype.subarray.name is "subarray". info: | diff --git a/test/built-ins/TypedArray/prototype/subarray/prop-desc.js b/test/built-ins/TypedArray/prototype/subarray/prop-desc.js index 7891c7d77..0a7cb8bac 100644 --- a/test/built-ins/TypedArray/prototype/subarray/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/subarray/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.26 +esid: sec-%typedarray%.prototype.subarray description: > "subarray" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-func.js index b124aaf26..f8e43830d 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.27 +esid: sec-%typedarray%.prototype.tolocalestring description: Throws a TypeError exception when invoked as a function info: | 22.2.3.27 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-method.js index 27ad4e2bc..977734f74 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.27 +esid: sec-%typedarray%.prototype.tolocalestring description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.27 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/length.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/length.js index 20f6962ef..b6778df88 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.27 +esid: sec-%typedarray%.prototype.tolocalestring description: > %TypedArray%.prototype.toLocaleString.length is 0. info: | diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/name.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/name.js index 2899e7f6c..26c007174 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.27 +esid: sec-%typedarray%.prototype.tolocalestring description: > %TypedArray%.prototype.toLocaleString.name is "toLocaleString". info: | diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/prop-desc.js index 784268170..7be324dc6 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.27 +esid: sec-%typedarray%.prototype.tolocalestring description: > "toLocaleString" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-func.js b/test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-func.js index 062547bc4..935d87c42 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.27 +esid: sec-%typedarray%.prototype.tolocalestring description: Throws a TypeError exception when invoked as a function info: | 22.2.3.27 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-method.js b/test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-method.js index be172381a..34e97df8f 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.27 +esid: sec-%typedarray%.prototype.tolocalestring description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.27 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ]) diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/length.js b/test/built-ins/TypedArray/prototype/toLocaleString/length.js index 8780643ee..1e9335e34 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/length.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.27 +esid: sec-%typedarray%.prototype.tolocalestring description: > %TypedArray%.prototype.toLocaleString.length is 0. info: | diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/name.js b/test/built-ins/TypedArray/prototype/toLocaleString/name.js index 6a126f0ff..df0f6cdfa 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/name.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.27 +esid: sec-%typedarray%.prototype.tolocalestring description: > %TypedArray%.prototype.toLocaleString.name is "toLocaleString". info: | diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/prop-desc.js b/test/built-ins/TypedArray/prototype/toLocaleString/prop-desc.js index 3d5ecac07..c23f0c198 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.27 +esid: sec-%typedarray%.prototype.tolocalestring description: > "toLocaleString" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/toString.js b/test/built-ins/TypedArray/prototype/toString.js index 2b880503d..f20715743 100644 --- a/test/built-ins/TypedArray/prototype/toString.js +++ b/test/built-ins/TypedArray/prototype/toString.js @@ -1,7 +1,7 @@ // 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.3.28 +esid: sec-%typedarray%.prototype.tostring description: > "toString" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-func.js index f9e994aa3..26607d78a 100644 --- a/test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.29 +esid: sec-%typedarray%.prototype.values description: Throws a TypeError exception when invoked as a function info: | 22.2.3.29 %TypedArray%.prototype.values ( ) diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-method.js index 5ec17b0f4..cec67a6de 100644 --- a/test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/values/BigInt/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.29 +esid: sec-%typedarray%.prototype.values description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.29 %TypedArray%.prototype.values ( ) diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/length.js b/test/built-ins/TypedArray/prototype/values/BigInt/length.js index 0e3da84d8..ee205aebd 100644 --- a/test/built-ins/TypedArray/prototype/values/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/values/BigInt/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.29 +esid: sec-%typedarray%.prototype.values description: > %TypedArray%.prototype.values.length is 0. info: | diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/name.js b/test/built-ins/TypedArray/prototype/values/BigInt/name.js index 3f2139028..8f10a2dcc 100644 --- a/test/built-ins/TypedArray/prototype/values/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/values/BigInt/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.29 +esid: sec-%typedarray%.prototype.values description: > %TypedArray%.prototype.values.name is "values". info: | diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/values/BigInt/prop-desc.js index 0a1c9796f..8087bd6d6 100644 --- a/test/built-ins/TypedArray/prototype/values/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/values/BigInt/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.29 +esid: sec-%typedarray%.prototype.values description: > "values" property of TypedArrayPrototype info: | diff --git a/test/built-ins/TypedArray/prototype/values/invoked-as-func.js b/test/built-ins/TypedArray/prototype/values/invoked-as-func.js index 8d8697662..bb01f5daa 100644 --- a/test/built-ins/TypedArray/prototype/values/invoked-as-func.js +++ b/test/built-ins/TypedArray/prototype/values/invoked-as-func.js @@ -1,7 +1,7 @@ // 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.3.29 +esid: sec-%typedarray%.prototype.values description: Throws a TypeError exception when invoked as a function info: | 22.2.3.29 %TypedArray%.prototype.values ( ) diff --git a/test/built-ins/TypedArray/prototype/values/invoked-as-method.js b/test/built-ins/TypedArray/prototype/values/invoked-as-method.js index 5402d2267..177ca3016 100644 --- a/test/built-ins/TypedArray/prototype/values/invoked-as-method.js +++ b/test/built-ins/TypedArray/prototype/values/invoked-as-method.js @@ -1,7 +1,7 @@ // 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.3.29 +esid: sec-%typedarray%.prototype.values description: Requires a [[TypedArrayName]] internal slot. info: | 22.2.3.29 %TypedArray%.prototype.values ( ) diff --git a/test/built-ins/TypedArray/prototype/values/length.js b/test/built-ins/TypedArray/prototype/values/length.js index cc260277f..31da8ea5d 100644 --- a/test/built-ins/TypedArray/prototype/values/length.js +++ b/test/built-ins/TypedArray/prototype/values/length.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.29 +esid: sec-%typedarray%.prototype.values description: > %TypedArray%.prototype.values.length is 0. info: | diff --git a/test/built-ins/TypedArray/prototype/values/name.js b/test/built-ins/TypedArray/prototype/values/name.js index ccafda816..67caa3615 100644 --- a/test/built-ins/TypedArray/prototype/values/name.js +++ b/test/built-ins/TypedArray/prototype/values/name.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 22.2.3.29 +esid: sec-%typedarray%.prototype.values description: > %TypedArray%.prototype.values.name is "values". info: | diff --git a/test/built-ins/TypedArray/prototype/values/prop-desc.js b/test/built-ins/TypedArray/prototype/values/prop-desc.js index 9eecfde59..cb06c7315 100644 --- a/test/built-ins/TypedArray/prototype/values/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/values/prop-desc.js @@ -1,7 +1,7 @@ // 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.3.29 +esid: sec-%typedarray%.prototype.values description: > "values" property of TypedArrayPrototype info: | -- cgit v1.2.1 From d30bf82d4780742b34a76369ca0f52d71e282a48 Mon Sep 17 00:00:00 2001 From: Leo Balter Date: Thu, 15 Feb 2018 12:40:46 -0500 Subject: Add missing feature flags --- .../TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js | 1 + .../TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js | 1 + .../TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js | 1 + test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js | 1 + test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js | 1 + .../TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js | 1 + .../prototype/copyWithin/BigInt/negative-out-of-bounds-start.js | 1 + .../prototype/copyWithin/BigInt/negative-out-of-bounds-target.js | 1 + test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js | 1 + test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js | 1 + .../prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js | 1 + .../copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js | 1 + .../prototype/copyWithin/BigInt/non-negative-target-and-start.js | 1 + .../prototype/copyWithin/BigInt/non-negative-target-start-and-end.js | 1 + test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js | 1 + .../TypedArray/prototype/every/BigInt/callbackfn-detachbuffer.js | 1 + test/built-ins/TypedArray/prototype/every/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/every/BigInt/name.js | 1 + test/built-ins/TypedArray/prototype/every/BigInt/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js | 1 + .../fill/BigInt/fill-values-conversion-operations-consistent-nan.js | 1 + .../prototype/fill/BigInt/fill-values-conversion-operations.js | 1 + .../TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js | 1 + .../TypedArray/prototype/fill/BigInt/fill-values-relative-end.js | 1 + .../TypedArray/prototype/fill/BigInt/fill-values-relative-start.js | 1 + test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js | 1 + test/built-ins/TypedArray/prototype/fill/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/fill/BigInt/name.js | 1 + test/built-ins/TypedArray/prototype/fill/BigInt/prop-desc.js | 1 + .../TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js | 1 + test/built-ins/TypedArray/prototype/filter/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/filter/BigInt/name.js | 1 + test/built-ins/TypedArray/prototype/filter/BigInt/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/find/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/find/BigInt/name.js | 1 + .../TypedArray/prototype/find/BigInt/predicate-call-changes-value.js | 1 + test/built-ins/TypedArray/prototype/find/BigInt/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/findIndex/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/findIndex/BigInt/name.js | 1 + .../prototype/findIndex/BigInt/predicate-call-changes-value.js | 1 + test/built-ins/TypedArray/prototype/findIndex/BigInt/prop-desc.js | 1 + .../TypedArray/prototype/forEach/BigInt/callbackfn-detachbuffer.js | 1 + test/built-ins/TypedArray/prototype/forEach/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/forEach/BigInt/name.js | 1 + test/built-ins/TypedArray/prototype/forEach/BigInt/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/includes/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/includes/BigInt/name.js | 1 + test/built-ins/TypedArray/prototype/includes/BigInt/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/indexOf/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/indexOf/BigInt/name.js | 1 + test/built-ins/TypedArray/prototype/indexOf/BigInt/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/join/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/join/BigInt/name.js | 1 + test/built-ins/TypedArray/prototype/join/BigInt/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/keys/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/keys/BigInt/name.js | 1 + test/built-ins/TypedArray/prototype/keys/BigInt/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/name.js | 1 + test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/length/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/length/BigInt/name.js | 1 + test/built-ins/TypedArray/prototype/length/BigInt/prop-desc.js | 1 + .../built-ins/TypedArray/prototype/map/BigInt/callbackfn-detachbuffer.js | 1 + test/built-ins/TypedArray/prototype/map/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/map/BigInt/name.js | 1 + test/built-ins/TypedArray/prototype/map/BigInt/prop-desc.js | 1 + .../BigInt/return-new-typedarray-conversion-operation-consistent-nan.js | 1 + .../prototype/map/BigInt/return-new-typedarray-conversion-operation.js | 1 + .../TypedArray/prototype/reduce/BigInt/callbackfn-detachbuffer.js | 1 + test/built-ins/TypedArray/prototype/reduce/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/reduce/BigInt/name.js | 1 + test/built-ins/TypedArray/prototype/reduce/BigInt/prop-desc.js | 1 + .../TypedArray/prototype/reduceRight/BigInt/callbackfn-detachbuffer.js | 1 + test/built-ins/TypedArray/prototype/reduceRight/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/reduceRight/BigInt/name.js | 1 + test/built-ins/TypedArray/prototype/reduceRight/BigInt/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/reverse/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/reverse/BigInt/name.js | 1 + test/built-ins/TypedArray/prototype/reverse/BigInt/prop-desc.js | 1 + .../prototype/set/BigInt/array-arg-src-tonumber-value-conversions.js | 1 + test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js | 1 + test/built-ins/TypedArray/prototype/set/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/set/BigInt/name.js | 1 + test/built-ins/TypedArray/prototype/set/BigInt/prop-desc.js | 1 + .../typedarray-arg-set-values-diff-buffer-other-type-conversions.js | 1 + test/built-ins/TypedArray/prototype/slice/BigInt/bit-precision.js | 1 + test/built-ins/TypedArray/prototype/slice/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/slice/BigInt/name.js | 1 + test/built-ins/TypedArray/prototype/slice/BigInt/prop-desc.js | 1 + .../TypedArray/prototype/some/BigInt/callbackfn-detachbuffer.js | 1 + test/built-ins/TypedArray/prototype/some/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/some/BigInt/name.js | 1 + test/built-ins/TypedArray/prototype/some/BigInt/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/sort/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/sort/BigInt/name.js | 1 + test/built-ins/TypedArray/prototype/sort/BigInt/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/subarray/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/subarray/BigInt/name.js | 1 + test/built-ins/TypedArray/prototype/subarray/BigInt/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/toLocaleString/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/toLocaleString/BigInt/name.js | 1 + test/built-ins/TypedArray/prototype/toLocaleString/BigInt/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/values/BigInt/length.js | 1 + test/built-ins/TypedArray/prototype/values/BigInt/name.js | 1 + test/built-ins/TypedArray/prototype/values/BigInt/prop-desc.js | 1 + .../object-arg/object-arg-conversion-operation-consistent-nan.js | 1 + .../ctors-bigint/object-arg/object-arg-conversion-operation.js | 1 + .../internals/DefineOwnProperty/BigInt/conversion-operation.js | 1 + test/built-ins/TypedArrays/internals/Set/BigInt/conversion-operation.js | 1 + 112 files changed, 112 insertions(+) diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js index 07748b765..c713fdf95 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js @@ -23,6 +23,7 @@ info: | ToInteger(end). ... includes: [compareArray.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js index 986973deb..6ad29124a 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js @@ -22,6 +22,7 @@ info: | 5. Let relativeStart be ? ToInteger(start). ... includes: [compareArray.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js index da3cb4e80..caaa2214e 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js @@ -22,6 +22,7 @@ info: | 3. Let relativeTarget be ? ToInteger(target). ... includes: [compareArray.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js index 5346aedde..7c635e69c 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.copyWithin.length, 2); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js index 2123668fe..902c628c4 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.copyWithin.name, "copyWithin"); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js index a4b84379f..5a01aec33 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js @@ -25,6 +25,7 @@ info: | final be min(relativeEnd, len). ... includes: [compareArray.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js index f9f81685b..245f6f482 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js @@ -25,6 +25,7 @@ info: | final be min(relativeEnd, len). ... includes: [compareArray.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js index 916c443fa..11f5b47ee 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js @@ -23,6 +23,7 @@ info: | from be min(relativeStart, len). ... includes: [compareArray.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js index d9ad966bf..34c2759fe 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js @@ -23,6 +23,7 @@ info: | to be min(relativeTarget, len). ... includes: [compareArray.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js index 21146e980..3ec8bf03e 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js @@ -23,6 +23,7 @@ info: | from be min(relativeStart, len). ... includes: [compareArray.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js index 020d13768..9227f3e6d 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js @@ -23,6 +23,7 @@ info: | to be min(relativeTarget, len). ... includes: [compareArray.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js index bc2f07eb7..dcbe8f800 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js @@ -16,6 +16,7 @@ info: | ... includes: [compareArray.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js index 93b0f9899..63fd382cf 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js @@ -16,6 +16,7 @@ info: | ... includes: [compareArray.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js index 33b29e242..30190b3f4 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js @@ -16,6 +16,7 @@ info: | ... includes: [compareArray.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js index 44d0945f1..25df02789 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js @@ -16,6 +16,7 @@ info: | ... includes: [compareArray.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js index b113d2f67..d75e27ac0 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js index daeaca317..513e762c3 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js @@ -23,6 +23,7 @@ info: | ToInteger(end). ... includes: [compareArray.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-detachbuffer.js index 13660264f..144798687 100644 --- a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-detachbuffer.js +++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-detachbuffer.js @@ -22,6 +22,7 @@ info: | ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). ... includes: [detachArrayBuffer.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/length.js b/test/built-ins/TypedArray/prototype/every/BigInt/length.js index f446c7b44..cbe40ceaa 100644 --- a/test/built-ins/TypedArray/prototype/every/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/every/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.every.length, 1); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/name.js b/test/built-ins/TypedArray/prototype/every/BigInt/name.js index f3112a183..c7fb7d764 100644 --- a/test/built-ins/TypedArray/prototype/every/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/every/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.every.name, "every"); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/every/BigInt/prop-desc.js index f2846eb09..d1c570ca1 100644 --- a/test/built-ins/TypedArray/prototype/every/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/every/BigInt/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js b/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js index ced8b9da8..75bd12543 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js @@ -28,6 +28,7 @@ info: | ToInteger(end). ... includes: [compareArray.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations-consistent-nan.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations-consistent-nan.js index d8ca3818b..5db1cfcae 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations-consistent-nan.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations-consistent-nan.js @@ -48,6 +48,7 @@ info: | each implementation distinguishable NaN value. ... includes: [nans.js, testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] ---*/ function body(FloatArray) { diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations.js index 848da1415..676d18f86 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-operations.js @@ -44,6 +44,7 @@ info: | e. Else, ... includes: [byteConversionValues.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js index 3809de222..d429dc11e 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js @@ -30,6 +30,7 @@ info: | final be min(relativeEnd, len). ... includes: [compareArray.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js index 0d09f8b37..0f92f444b 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js @@ -27,6 +27,7 @@ info: | final be min(relativeEnd, len). ... includes: [compareArray.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js index 76883779e..0d6b6f397 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js @@ -25,6 +25,7 @@ info: | min(relativeStart, len). ... includes: [compareArray.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js index 93d496983..a9c337df9 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js @@ -25,6 +25,7 @@ info: | a. Let Pk be ! ToString(k). b. Perform ? Set(O, Pk, value, true). includes: [compareArray.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/length.js b/test/built-ins/TypedArray/prototype/fill/BigInt/length.js index 77f2db6a8..6bf1feff5 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.fill.length, 1); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/name.js b/test/built-ins/TypedArray/prototype/fill/BigInt/name.js index 82a964616..82e72227a 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.fill.name, "fill"); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/fill/BigInt/prop-desc.js index f6673d34b..752b7a282 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js index ff563cd3a..c5bba7c92 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js @@ -14,6 +14,7 @@ info: | c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). ... includes: [detachArrayBuffer.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/length.js b/test/built-ins/TypedArray/prototype/filter/BigInt/length.js index 443642674..3c0af26ac 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.filter.length, 1); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/name.js b/test/built-ins/TypedArray/prototype/filter/BigInt/name.js index 729c841a4..4eb3d76b2 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.filter.name, "filter"); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/filter/BigInt/prop-desc.js index abb20a831..37c277bcf 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/length.js b/test/built-ins/TypedArray/prototype/find/BigInt/length.js index 3947f6bf8..9c8cdcacc 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.find.length, 1); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/name.js b/test/built-ins/TypedArray/prototype/find/BigInt/name.js index d5dcef13c..c84053e8e 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.find.name, "find"); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js index 92a2a9349..4fd9ec6f1 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js @@ -26,6 +26,7 @@ info: | c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). ... includes: [compareArray.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/find/BigInt/prop-desc.js index 990975cd7..e2c5e7e9d 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/length.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/length.js index 55083eeb6..64d37958e 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.findIndex.length, 1); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/name.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/name.js index 5065cb746..84a9724a2 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.findIndex.name, "findIndex"); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js index b3614e1e9..d20b670eb 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js @@ -22,6 +22,7 @@ info: | c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). ... includes: [compareArray.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/prop-desc.js index 7022cdd4e..9913a867e 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-detachbuffer.js index 0f7725e4f..bf04fe979 100644 --- a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-detachbuffer.js +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-detachbuffer.js @@ -22,6 +22,7 @@ info: | ii. Perform ? Call(callbackfn, T, « kValue, k, O »). ... includes: [detachArrayBuffer.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/length.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/length.js index 6499dfab0..f8f9624a9 100644 --- a/test/built-ins/TypedArray/prototype/forEach/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.forEach.length, 1); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/name.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/name.js index 9b192a05c..36c9ffde4 100644 --- a/test/built-ins/TypedArray/prototype/forEach/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.forEach.name, "forEach"); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/prop-desc.js index c17d2d901..b095a89f2 100644 --- a/test/built-ins/TypedArray/prototype/forEach/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/length.js b/test/built-ins/TypedArray/prototype/includes/BigInt/length.js index 9f7938791..f438ccd6f 100644 --- a/test/built-ins/TypedArray/prototype/includes/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.includes.length, 1); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/name.js b/test/built-ins/TypedArray/prototype/includes/BigInt/name.js index fdc316989..4d90c44c8 100644 --- a/test/built-ins/TypedArray/prototype/includes/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.includes.name, "includes"); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/includes/BigInt/prop-desc.js index fcdef18da..fa4630d51 100644 --- a/test/built-ins/TypedArray/prototype/includes/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/length.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/length.js index 1998ca260..d39f7dab9 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.indexOf.length, 1); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/name.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/name.js index e27bd001b..93ad66115 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.indexOf.name, "indexOf"); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/prop-desc.js index 003f3e34c..aab149737 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/length.js b/test/built-ins/TypedArray/prototype/join/BigInt/length.js index c1f772d36..6e1332323 100644 --- a/test/built-ins/TypedArray/prototype/join/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/join/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.join.length, 1); diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/name.js b/test/built-ins/TypedArray/prototype/join/BigInt/name.js index a35bba48e..c7a1bfdfc 100644 --- a/test/built-ins/TypedArray/prototype/join/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/join/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.join.name, "join"); diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/join/BigInt/prop-desc.js index da037abc5..f1ab91a06 100644 --- a/test/built-ins/TypedArray/prototype/join/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/join/BigInt/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/length.js b/test/built-ins/TypedArray/prototype/keys/BigInt/length.js index ef18be936..0f4b206a5 100644 --- a/test/built-ins/TypedArray/prototype/keys/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/keys/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.keys.length, 0); diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/name.js b/test/built-ins/TypedArray/prototype/keys/BigInt/name.js index 3312f488b..da53744ca 100644 --- a/test/built-ins/TypedArray/prototype/keys/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/keys/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.keys.name, "keys"); diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/keys/BigInt/prop-desc.js index 7a3664476..74b5908dc 100644 --- a/test/built-ins/TypedArray/prototype/keys/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/keys/BigInt/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length.js index 5519e8f2e..dbc89d473 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.lastIndexOf.length, 1); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/name.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/name.js index e53c677be..b4216d190 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.lastIndexOf.name, "lastIndexOf"); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/prop-desc.js index 007203b94..52a04ab83 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/length.js b/test/built-ins/TypedArray/prototype/length/BigInt/length.js index 446f89c3b..832fba4a9 100644 --- a/test/built-ins/TypedArray/prototype/length/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/length/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "length"); diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/name.js b/test/built-ins/TypedArray/prototype/length/BigInt/name.js index c37e872a9..f7f29be88 100644 --- a/test/built-ins/TypedArray/prototype/length/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/length/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "length"); diff --git a/test/built-ins/TypedArray/prototype/length/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/length/BigInt/prop-desc.js index e047b41ef..2afd62048 100644 --- a/test/built-ins/TypedArray/prototype/length/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/length/BigInt/prop-desc.js @@ -11,6 +11,7 @@ info: | Section 17: Every accessor property described in clauses 18 through 26 and in Annex B.2 has the attributes {[[Enumerable]]: false, [[Configurable]]: true } includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-detachbuffer.js index 59971da1e..94bf74867 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-detachbuffer.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-detachbuffer.js @@ -14,6 +14,7 @@ info: | c. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »). ... includes: [detachArrayBuffer.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/length.js b/test/built-ins/TypedArray/prototype/map/BigInt/length.js index 53f9ce83a..95a983b03 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.map.length, 1); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/name.js b/test/built-ins/TypedArray/prototype/map/BigInt/name.js index fcdebfb01..0f54d40cb 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.map.name, "map"); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/map/BigInt/prop-desc.js index 96c34e545..ea1d8805f 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation-consistent-nan.js b/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation-consistent-nan.js index a8c3cb62e..1b9534f1a 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation-consistent-nan.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation-consistent-nan.js @@ -41,6 +41,7 @@ info: | each implementation distinguishable NaN value. ... includes: [nans.js, testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] ---*/ function body(FloatArray) { diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation.js b/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation.js index fdc16e2ab..6f2b83a63 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/return-new-typedarray-conversion-operation.js @@ -38,6 +38,7 @@ info: | e. Else, ... includes: [byteConversionValues.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-detachbuffer.js index 60ce57fe7..f904d53a1 100644 --- a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-detachbuffer.js +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-detachbuffer.js @@ -23,6 +23,7 @@ info: | k, O »). ... includes: [detachArrayBuffer.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/length.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/length.js index bb10543bf..bb04ee94f 100644 --- a/test/built-ins/TypedArray/prototype/reduce/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.reduce.length, 1); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/name.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/name.js index 4f1226970..e07d1dfa5 100644 --- a/test/built-ins/TypedArray/prototype/reduce/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.reduce.name, "reduce"); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/prop-desc.js index 938262600..ed8d8a42c 100644 --- a/test/built-ins/TypedArray/prototype/reduce/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-detachbuffer.js index c484769f4..fe816660c 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-detachbuffer.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-detachbuffer.js @@ -23,6 +23,7 @@ info: | k, O »). ... includes: [detachArrayBuffer.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/length.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/length.js index 7c8ab8e07..8cf3d8d6a 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.reduceRight.length, 1); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/name.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/name.js index 6a6ee5e8c..fb63b3a35 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.reduceRight.name, "reduceRight"); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/prop-desc.js index 76455ab4c..0d6f4d2fd 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/length.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/length.js index 3b7195d73..22545aeb0 100644 --- a/test/built-ins/TypedArray/prototype/reverse/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.reverse.length, 0); diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/name.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/name.js index b7e2130cb..2fda014b2 100644 --- a/test/built-ins/TypedArray/prototype/reverse/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.reverse.name, "reverse"); diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/prop-desc.js index d60950d69..3bd6e881d 100644 --- a/test/built-ins/TypedArray/prototype/reverse/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-conversions.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-conversions.js index 04d518689..78fd9dcbb 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-conversions.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-conversions.js @@ -19,6 +19,7 @@ info: | kNumber). ... includes: [byteConversionValues.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js b/test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js index 41d326bed..979b0b384 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/bit-precision.js @@ -16,6 +16,7 @@ info: | iii. Set srcByteIndex to srcByteIndex + 1. iv. Set targetByteIndex to targetByteIndex + 1. includes: [nans.js, compareArray.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ function body(FloatArray) { diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/length.js b/test/built-ins/TypedArray/prototype/set/BigInt/length.js index bf7b68956..2f1001cd0 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.set.length, 1); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/name.js b/test/built-ins/TypedArray/prototype/set/BigInt/name.js index 87c194862..85d386c7c 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.set.name, "set"); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/set/BigInt/prop-desc.js index e8237d1fd..ca3c8bc15 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions.js index 5e819db9c..fbb323f97 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-conversions.js @@ -22,6 +22,7 @@ info: | ii. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType, value). includes: [byteConversionValues.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/bit-precision.js b/test/built-ins/TypedArray/prototype/slice/BigInt/bit-precision.js index a97fbaf10..e27565331 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/bit-precision.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/bit-precision.js @@ -21,6 +21,7 @@ info: | iii. Increase srcByteIndex by 1. iv. Increase targetByteIndex by 1. includes: [nans.js, compareArray.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ function body(FloatArray) { diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/length.js b/test/built-ins/TypedArray/prototype/slice/BigInt/length.js index eb6d370c9..57d76ac14 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.slice.length, 2); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/name.js b/test/built-ins/TypedArray/prototype/slice/BigInt/name.js index d551fc812..4021a1c50 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.slice.name, "slice"); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/slice/BigInt/prop-desc.js index a4d85f01e..d97889d47 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-detachbuffer.js index 9c92aed23..9d504d2e3 100644 --- a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-detachbuffer.js +++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-detachbuffer.js @@ -22,6 +22,7 @@ info: | ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). ... includes: [detachArrayBuffer.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/length.js b/test/built-ins/TypedArray/prototype/some/BigInt/length.js index 34a6c3906..ee214df0f 100644 --- a/test/built-ins/TypedArray/prototype/some/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/some/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.some.length, 1); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/name.js b/test/built-ins/TypedArray/prototype/some/BigInt/name.js index b26a59533..8bf75d8ea 100644 --- a/test/built-ins/TypedArray/prototype/some/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/some/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.some.name, "some"); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/some/BigInt/prop-desc.js index 45d71bd20..59a567362 100644 --- a/test/built-ins/TypedArray/prototype/some/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/some/BigInt/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/length.js b/test/built-ins/TypedArray/prototype/sort/BigInt/length.js index 91cb4c2d2..c6bbb9f28 100644 --- a/test/built-ins/TypedArray/prototype/sort/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.sort.length, 1); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/name.js b/test/built-ins/TypedArray/prototype/sort/BigInt/name.js index 7441ad53e..5f516c540 100644 --- a/test/built-ins/TypedArray/prototype/sort/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.sort.name, "sort"); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/sort/BigInt/prop-desc.js index 69e74787e..86fc9e32b 100644 --- a/test/built-ins/TypedArray/prototype/sort/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/length.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/length.js index cec810c3f..818891a63 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.subarray.length, 2); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/name.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/name.js index e5a201b4f..30c47e577 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.subarray.name, "subarray"); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/prop-desc.js index baaf982c3..218949025 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/length.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/length.js index b6778df88..1bf9e889b 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.toLocaleString.length, 0); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/name.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/name.js index 26c007174..87a238ad1 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.toLocaleString.name, "toLocaleString"); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/prop-desc.js index 7be324dc6..81d0cd374 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/length.js b/test/built-ins/TypedArray/prototype/values/BigInt/length.js index ee205aebd..ce420f0ae 100644 --- a/test/built-ins/TypedArray/prototype/values/BigInt/length.js +++ b/test/built-ins/TypedArray/prototype/values/BigInt/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.values.length, 0); diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/name.js b/test/built-ins/TypedArray/prototype/values/BigInt/name.js index 8f10a2dcc..cc8ad3aed 100644 --- a/test/built-ins/TypedArray/prototype/values/BigInt/name.js +++ b/test/built-ins/TypedArray/prototype/values/BigInt/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ assert.sameValue(TypedArray.prototype.values.name, "values"); diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/values/BigInt/prop-desc.js index 8087bd6d6..b805b7e8c 100644 --- a/test/built-ins/TypedArray/prototype/values/BigInt/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/values/BigInt/prop-desc.js @@ -9,6 +9,7 @@ info: | 26 and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation-consistent-nan.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation-consistent-nan.js index c3adc0642..8d94c090a 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation-consistent-nan.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation-consistent-nan.js @@ -46,6 +46,7 @@ info: | each implementation distinguishable NaN value. ... includes: [nans.js, testBigIntTypedArray.js, compareArray.js] +features: [BigInt, TypedArray] ---*/ function body(FloatArray) { diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation.js index 472cdccc0..f6cef9bc8 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-conversion-operation.js @@ -43,6 +43,7 @@ info: | e. Else, ... includes: [byteConversionValues.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testTypedArrayConversions(byteConversionValues, function(TA, value, expected) { diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/conversion-operation.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/conversion-operation.js index 9286ba6f5..9fe931cfa 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/conversion-operation.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/conversion-operation.js @@ -42,6 +42,7 @@ info: | e. Else, ... includes: [byteConversionValues.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/conversion-operation.js b/test/built-ins/TypedArrays/internals/Set/BigInt/conversion-operation.js index 4c8bff504..8f30a59a4 100644 --- a/test/built-ins/TypedArrays/internals/Set/BigInt/conversion-operation.js +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/conversion-operation.js @@ -39,6 +39,7 @@ info: | e. Else, ... includes: [byteConversionValues.js, testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { -- cgit v1.2.1 From b6664ca24ab12627e8b52814ad2991db7d82aa1c Mon Sep 17 00:00:00 2001 From: Leo Balter Date: Thu, 15 Feb 2018 12:50:48 -0500 Subject: Add missing feature flag for TypedArrays --- test/built-ins/TypedArray/from/length.js | 1 + test/built-ins/TypedArray/from/name.js | 1 + test/built-ins/TypedArray/from/prop-desc.js | 1 + test/built-ins/TypedArray/length.js | 1 + test/built-ins/TypedArray/name.js | 1 + test/built-ins/TypedArray/of/length.js | 1 + test/built-ins/TypedArray/of/name.js | 1 + test/built-ins/TypedArray/of/prop-desc.js | 1 + test/built-ins/TypedArray/prototype.js | 1 + test/built-ins/TypedArray/prototype/buffer/length.js | 1 + test/built-ins/TypedArray/prototype/buffer/name.js | 1 + test/built-ins/TypedArray/prototype/buffer/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/byteLength/length.js | 1 + test/built-ins/TypedArray/prototype/byteLength/name.js | 1 + test/built-ins/TypedArray/prototype/byteLength/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/byteOffset/length.js | 1 + test/built-ins/TypedArray/prototype/byteOffset/name.js | 1 + test/built-ins/TypedArray/prototype/byteOffset/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/constructor.js | 1 + test/built-ins/TypedArray/prototype/copyWithin/bit-precision.js | 1 + test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js | 1 + test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js | 1 + test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js | 1 + test/built-ins/TypedArray/prototype/copyWithin/length.js | 1 + test/built-ins/TypedArray/prototype/copyWithin/name.js | 1 + test/built-ins/TypedArray/prototype/copyWithin/negative-end.js | 1 + .../TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js | 1 + .../TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js | 1 + .../TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js | 1 + test/built-ins/TypedArray/prototype/copyWithin/negative-start.js | 1 + test/built-ins/TypedArray/prototype/copyWithin/negative-target.js | 1 + .../TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js | 1 + .../prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js | 1 + .../TypedArray/prototype/copyWithin/non-negative-target-and-start.js | 1 + .../TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js | 1 + test/built-ins/TypedArray/prototype/copyWithin/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js | 1 + test/built-ins/TypedArray/prototype/entries/length.js | 1 + test/built-ins/TypedArray/prototype/entries/name.js | 1 + test/built-ins/TypedArray/prototype/entries/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/every/callbackfn-detachbuffer.js | 1 + test/built-ins/TypedArray/prototype/every/length.js | 1 + test/built-ins/TypedArray/prototype/every/name.js | 1 + test/built-ins/TypedArray/prototype/every/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/fill/coerced-indexes.js | 1 + .../prototype/fill/fill-values-conversion-operations-consistent-nan.js | 1 + .../TypedArray/prototype/fill/fill-values-conversion-operations.js | 1 + .../TypedArray/prototype/fill/fill-values-custom-start-and-end.js | 1 + test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js | 1 + test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js | 1 + test/built-ins/TypedArray/prototype/fill/fill-values.js | 1 + test/built-ins/TypedArray/prototype/fill/length.js | 1 + test/built-ins/TypedArray/prototype/fill/name.js | 1 + test/built-ins/TypedArray/prototype/fill/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js | 1 + test/built-ins/TypedArray/prototype/filter/length.js | 1 + test/built-ins/TypedArray/prototype/filter/name.js | 1 + test/built-ins/TypedArray/prototype/filter/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/find/length.js | 1 + test/built-ins/TypedArray/prototype/find/name.js | 1 + test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js | 1 + test/built-ins/TypedArray/prototype/find/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/findIndex/length.js | 1 + test/built-ins/TypedArray/prototype/findIndex/name.js | 1 + .../TypedArray/prototype/findIndex/predicate-call-changes-value.js | 1 + test/built-ins/TypedArray/prototype/findIndex/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/forEach/callbackfn-detachbuffer.js | 1 + test/built-ins/TypedArray/prototype/forEach/length.js | 1 + test/built-ins/TypedArray/prototype/forEach/name.js | 1 + test/built-ins/TypedArray/prototype/forEach/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/includes/length.js | 1 + test/built-ins/TypedArray/prototype/includes/name.js | 1 + test/built-ins/TypedArray/prototype/includes/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/indexOf/length.js | 1 + test/built-ins/TypedArray/prototype/indexOf/name.js | 1 + test/built-ins/TypedArray/prototype/indexOf/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/join/length.js | 1 + test/built-ins/TypedArray/prototype/join/name.js | 1 + test/built-ins/TypedArray/prototype/join/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/keys/length.js | 1 + test/built-ins/TypedArray/prototype/keys/name.js | 1 + test/built-ins/TypedArray/prototype/keys/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/lastIndexOf/length.js | 1 + test/built-ins/TypedArray/prototype/lastIndexOf/name.js | 1 + test/built-ins/TypedArray/prototype/lastIndexOf/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/length/length.js | 1 + test/built-ins/TypedArray/prototype/length/name.js | 1 + test/built-ins/TypedArray/prototype/length/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/map/callbackfn-detachbuffer.js | 1 + test/built-ins/TypedArray/prototype/map/length.js | 1 + test/built-ins/TypedArray/prototype/map/name.js | 1 + test/built-ins/TypedArray/prototype/map/prop-desc.js | 1 + .../map/return-new-typedarray-conversion-operation-consistent-nan.js | 1 + .../prototype/map/return-new-typedarray-conversion-operation.js | 1 + test/built-ins/TypedArray/prototype/reduce/callbackfn-detachbuffer.js | 1 + test/built-ins/TypedArray/prototype/reduce/length.js | 1 + test/built-ins/TypedArray/prototype/reduce/name.js | 1 + test/built-ins/TypedArray/prototype/reduce/prop-desc.js | 1 + .../TypedArray/prototype/reduceRight/callbackfn-detachbuffer.js | 1 + test/built-ins/TypedArray/prototype/reduceRight/length.js | 1 + test/built-ins/TypedArray/prototype/reduceRight/name.js | 1 + test/built-ins/TypedArray/prototype/reduceRight/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/reverse/length.js | 1 + test/built-ins/TypedArray/prototype/reverse/name.js | 1 + test/built-ins/TypedArray/prototype/reverse/prop-desc.js | 1 + .../TypedArray/prototype/set/array-arg-src-tonumber-value-conversions.js | 1 + test/built-ins/TypedArray/prototype/set/bit-precision.js | 1 + test/built-ins/TypedArray/prototype/set/length.js | 1 + test/built-ins/TypedArray/prototype/set/name.js | 1 + test/built-ins/TypedArray/prototype/set/prop-desc.js | 1 + .../set/typedarray-arg-set-values-diff-buffer-other-type-conversions.js | 1 + test/built-ins/TypedArray/prototype/slice/bit-precision.js | 1 + test/built-ins/TypedArray/prototype/slice/length.js | 1 + test/built-ins/TypedArray/prototype/slice/name.js | 1 + test/built-ins/TypedArray/prototype/slice/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/some/callbackfn-detachbuffer.js | 1 + test/built-ins/TypedArray/prototype/some/length.js | 1 + test/built-ins/TypedArray/prototype/some/name.js | 1 + test/built-ins/TypedArray/prototype/some/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/sort/length.js | 1 + test/built-ins/TypedArray/prototype/sort/name.js | 1 + test/built-ins/TypedArray/prototype/sort/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/subarray/length.js | 1 + test/built-ins/TypedArray/prototype/subarray/name.js | 1 + test/built-ins/TypedArray/prototype/subarray/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/toLocaleString/length.js | 1 + test/built-ins/TypedArray/prototype/toLocaleString/name.js | 1 + test/built-ins/TypedArray/prototype/toLocaleString/prop-desc.js | 1 + test/built-ins/TypedArray/prototype/toString.js | 1 + test/built-ins/TypedArray/prototype/values/length.js | 1 + test/built-ins/TypedArray/prototype/values/name.js | 1 + test/built-ins/TypedArray/prototype/values/prop-desc.js | 1 + test/built-ins/TypedArrays/Float32Array/BYTES_PER_ELEMENT.js | 1 + test/built-ins/TypedArrays/Float32Array/constructor.js | 1 + test/built-ins/TypedArrays/Float32Array/length.js | 1 + test/built-ins/TypedArrays/Float32Array/name.js | 1 + test/built-ins/TypedArrays/Float32Array/prototype.js | 1 + test/built-ins/TypedArrays/Float32Array/prototype/BYTES_PER_ELEMENT.js | 1 + test/built-ins/TypedArrays/Float32Array/prototype/constructor.js | 1 + .../TypedArrays/Float32Array/prototype/not-typedarray-object.js | 1 + test/built-ins/TypedArrays/Float64Array/BYTES_PER_ELEMENT.js | 1 + test/built-ins/TypedArrays/Float64Array/constructor.js | 1 + test/built-ins/TypedArrays/Float64Array/length.js | 1 + test/built-ins/TypedArrays/Float64Array/name.js | 1 + test/built-ins/TypedArrays/Float64Array/prototype.js | 1 + test/built-ins/TypedArrays/Float64Array/prototype/BYTES_PER_ELEMENT.js | 1 + test/built-ins/TypedArrays/Float64Array/prototype/constructor.js | 1 + .../TypedArrays/Float64Array/prototype/not-typedarray-object.js | 1 + test/built-ins/TypedArrays/Int16Array/BYTES_PER_ELEMENT.js | 1 + test/built-ins/TypedArrays/Int16Array/constructor.js | 1 + test/built-ins/TypedArrays/Int16Array/length.js | 1 + test/built-ins/TypedArrays/Int16Array/name.js | 1 + test/built-ins/TypedArrays/Int16Array/prototype.js | 1 + test/built-ins/TypedArrays/Int16Array/prototype/BYTES_PER_ELEMENT.js | 1 + test/built-ins/TypedArrays/Int16Array/prototype/constructor.js | 1 + test/built-ins/TypedArrays/Int16Array/prototype/not-typedarray-object.js | 1 + test/built-ins/TypedArrays/Int32Array/BYTES_PER_ELEMENT.js | 1 + test/built-ins/TypedArrays/Int32Array/constructor.js | 1 + test/built-ins/TypedArrays/Int32Array/length.js | 1 + test/built-ins/TypedArrays/Int32Array/name.js | 1 + test/built-ins/TypedArrays/Int32Array/prototype.js | 1 + test/built-ins/TypedArrays/Int32Array/prototype/BYTES_PER_ELEMENT.js | 1 + test/built-ins/TypedArrays/Int32Array/prototype/constructor.js | 1 + test/built-ins/TypedArrays/Int32Array/prototype/not-typedarray-object.js | 1 + test/built-ins/TypedArrays/Int8Array/BYTES_PER_ELEMENT.js | 1 + test/built-ins/TypedArrays/Int8Array/constructor.js | 1 + test/built-ins/TypedArrays/Int8Array/length.js | 1 + test/built-ins/TypedArrays/Int8Array/name.js | 1 + test/built-ins/TypedArrays/Int8Array/prototype.js | 1 + test/built-ins/TypedArrays/Int8Array/prototype/BYTES_PER_ELEMENT.js | 1 + test/built-ins/TypedArrays/Int8Array/prototype/constructor.js | 1 + test/built-ins/TypedArrays/Int8Array/prototype/not-typedarray-object.js | 1 + test/built-ins/TypedArrays/Uint16Array/BYTES_PER_ELEMENT.js | 1 + test/built-ins/TypedArrays/Uint16Array/constructor.js | 1 + test/built-ins/TypedArrays/Uint16Array/length.js | 1 + test/built-ins/TypedArrays/Uint16Array/name.js | 1 + test/built-ins/TypedArrays/Uint16Array/prototype.js | 1 + test/built-ins/TypedArrays/Uint16Array/prototype/BYTES_PER_ELEMENT.js | 1 + test/built-ins/TypedArrays/Uint16Array/prototype/constructor.js | 1 + .../built-ins/TypedArrays/Uint16Array/prototype/not-typedarray-object.js | 1 + test/built-ins/TypedArrays/Uint32Array/BYTES_PER_ELEMENT.js | 1 + test/built-ins/TypedArrays/Uint32Array/constructor.js | 1 + test/built-ins/TypedArrays/Uint32Array/length.js | 1 + test/built-ins/TypedArrays/Uint32Array/name.js | 1 + test/built-ins/TypedArrays/Uint32Array/prototype.js | 1 + test/built-ins/TypedArrays/Uint32Array/prototype/BYTES_PER_ELEMENT.js | 1 + test/built-ins/TypedArrays/Uint32Array/prototype/constructor.js | 1 + .../built-ins/TypedArrays/Uint32Array/prototype/not-typedarray-object.js | 1 + test/built-ins/TypedArrays/Uint8Array/BYTES_PER_ELEMENT.js | 1 + test/built-ins/TypedArrays/Uint8Array/constructor.js | 1 + test/built-ins/TypedArrays/Uint8Array/length.js | 1 + test/built-ins/TypedArrays/Uint8Array/name.js | 1 + test/built-ins/TypedArrays/Uint8Array/prototype.js | 1 + test/built-ins/TypedArrays/Uint8Array/prototype/BYTES_PER_ELEMENT.js | 1 + test/built-ins/TypedArrays/Uint8Array/prototype/constructor.js | 1 + test/built-ins/TypedArrays/Uint8Array/prototype/not-typedarray-object.js | 1 + test/built-ins/TypedArrays/Uint8ClampedArray/BYTES_PER_ELEMENT.js | 1 + test/built-ins/TypedArrays/Uint8ClampedArray/constructor.js | 1 + test/built-ins/TypedArrays/Uint8ClampedArray/length.js | 1 + test/built-ins/TypedArrays/Uint8ClampedArray/name.js | 1 + test/built-ins/TypedArrays/Uint8ClampedArray/prototype.js | 1 + .../TypedArrays/Uint8ClampedArray/prototype/BYTES_PER_ELEMENT.js | 1 + test/built-ins/TypedArrays/Uint8ClampedArray/prototype/constructor.js | 1 + .../TypedArrays/Uint8ClampedArray/prototype/not-typedarray-object.js | 1 + .../ctors/object-arg/object-arg-conversion-operation-consistent-nan.js | 1 + .../TypedArrays/ctors/object-arg/object-arg-conversion-operation.js | 1 + .../internals/DefineOwnProperty/conversion-operation-consistent-nan.js | 1 + .../TypedArrays/internals/DefineOwnProperty/conversion-operation.js | 1 + .../TypedArrays/internals/Set/conversion-operation-consistent-nan.js | 1 + test/built-ins/TypedArrays/internals/Set/conversion-operation.js | 1 + 210 files changed, 210 insertions(+) diff --git a/test/built-ins/TypedArray/from/length.js b/test/built-ins/TypedArray/from/length.js index 8a5282b56..45306875f 100644 --- a/test/built-ins/TypedArray/from/length.js +++ b/test/built-ins/TypedArray/from/length.js @@ -21,6 +21,7 @@ info: | has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.from.length, 1); diff --git a/test/built-ins/TypedArray/from/name.js b/test/built-ins/TypedArray/from/name.js index 0e7b0251c..dbcba77c3 100644 --- a/test/built-ins/TypedArray/from/name.js +++ b/test/built-ins/TypedArray/from/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.from.name, "from"); diff --git a/test/built-ins/TypedArray/from/prop-desc.js b/test/built-ins/TypedArray/from/prop-desc.js index abd3dc18c..82232460b 100644 --- a/test/built-ins/TypedArray/from/prop-desc.js +++ b/test/built-ins/TypedArray/from/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ verifyNotEnumerable(TypedArray, 'from'); diff --git a/test/built-ins/TypedArray/length.js b/test/built-ins/TypedArray/length.js index 8360f0848..98c47a33e 100644 --- a/test/built-ins/TypedArray/length.js +++ b/test/built-ins/TypedArray/length.js @@ -14,6 +14,7 @@ info: | Function object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.length, 0); diff --git a/test/built-ins/TypedArray/name.js b/test/built-ins/TypedArray/name.js index 0047b5886..5a28debf0 100644 --- a/test/built-ins/TypedArray/name.js +++ b/test/built-ins/TypedArray/name.js @@ -15,6 +15,7 @@ info: | Function object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.name, 'TypedArray'); diff --git a/test/built-ins/TypedArray/of/length.js b/test/built-ins/TypedArray/of/length.js index 03b7eb4c9..a26827e18 100644 --- a/test/built-ins/TypedArray/of/length.js +++ b/test/built-ins/TypedArray/of/length.js @@ -21,6 +21,7 @@ info: | has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.of.length, 0); diff --git a/test/built-ins/TypedArray/of/name.js b/test/built-ins/TypedArray/of/name.js index eceb8d002..eed607fe2 100644 --- a/test/built-ins/TypedArray/of/name.js +++ b/test/built-ins/TypedArray/of/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.of.name, "of"); diff --git a/test/built-ins/TypedArray/of/prop-desc.js b/test/built-ins/TypedArray/of/prop-desc.js index 613759e9d..a8df8bf88 100644 --- a/test/built-ins/TypedArray/of/prop-desc.js +++ b/test/built-ins/TypedArray/of/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ verifyNotEnumerable(TypedArray, 'of'); diff --git a/test/built-ins/TypedArray/prototype.js b/test/built-ins/TypedArray/prototype.js index d6611bfac..f788d8723 100644 --- a/test/built-ins/TypedArray/prototype.js +++ b/test/built-ins/TypedArray/prototype.js @@ -10,6 +10,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ verifyNotEnumerable(TypedArray, 'prototype'); diff --git a/test/built-ins/TypedArray/prototype/buffer/length.js b/test/built-ins/TypedArray/prototype/buffer/length.js index cb0b835ca..1ddb20c4e 100644 --- a/test/built-ins/TypedArray/prototype/buffer/length.js +++ b/test/built-ins/TypedArray/prototype/buffer/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "buffer"); diff --git a/test/built-ins/TypedArray/prototype/buffer/name.js b/test/built-ins/TypedArray/prototype/buffer/name.js index d01a0555b..d52454a7f 100644 --- a/test/built-ins/TypedArray/prototype/buffer/name.js +++ b/test/built-ins/TypedArray/prototype/buffer/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "buffer"); diff --git a/test/built-ins/TypedArray/prototype/buffer/prop-desc.js b/test/built-ins/TypedArray/prototype/buffer/prop-desc.js index 0927ee3fa..dee44b2fe 100644 --- a/test/built-ins/TypedArray/prototype/buffer/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/buffer/prop-desc.js @@ -11,6 +11,7 @@ info: | Section 17: Every accessor property described in clauses 18 through 26 and in Annex B.2 has the attributes {[[Enumerable]]: false, [[Configurable]]: true } includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/byteLength/length.js b/test/built-ins/TypedArray/prototype/byteLength/length.js index 9ce1fc54b..4252cd5d9 100644 --- a/test/built-ins/TypedArray/prototype/byteLength/length.js +++ b/test/built-ins/TypedArray/prototype/byteLength/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "byteLength"); diff --git a/test/built-ins/TypedArray/prototype/byteLength/name.js b/test/built-ins/TypedArray/prototype/byteLength/name.js index e2d8f7850..a70cc87bb 100644 --- a/test/built-ins/TypedArray/prototype/byteLength/name.js +++ b/test/built-ins/TypedArray/prototype/byteLength/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "byteLength"); diff --git a/test/built-ins/TypedArray/prototype/byteLength/prop-desc.js b/test/built-ins/TypedArray/prototype/byteLength/prop-desc.js index c3e699419..64a1388b4 100644 --- a/test/built-ins/TypedArray/prototype/byteLength/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/byteLength/prop-desc.js @@ -11,6 +11,7 @@ info: | Section 17: Every accessor property described in clauses 18 through 26 and in Annex B.2 has the attributes {[[Enumerable]]: false, [[Configurable]]: true } includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/byteOffset/length.js b/test/built-ins/TypedArray/prototype/byteOffset/length.js index 6362cabe5..71c9b31c8 100644 --- a/test/built-ins/TypedArray/prototype/byteOffset/length.js +++ b/test/built-ins/TypedArray/prototype/byteOffset/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "byteOffset"); diff --git a/test/built-ins/TypedArray/prototype/byteOffset/name.js b/test/built-ins/TypedArray/prototype/byteOffset/name.js index 5fc746efb..5b5a2ecab 100644 --- a/test/built-ins/TypedArray/prototype/byteOffset/name.js +++ b/test/built-ins/TypedArray/prototype/byteOffset/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "byteOffset"); diff --git a/test/built-ins/TypedArray/prototype/byteOffset/prop-desc.js b/test/built-ins/TypedArray/prototype/byteOffset/prop-desc.js index 7d0bfb98e..9960cf289 100644 --- a/test/built-ins/TypedArray/prototype/byteOffset/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/byteOffset/prop-desc.js @@ -11,6 +11,7 @@ info: | Section 17: Every accessor property described in clauses 18 through 26 and in Annex B.2 has the attributes {[[Enumerable]]: false, [[Configurable]]: true } includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/constructor.js b/test/built-ins/TypedArray/prototype/constructor.js index d3862d5fb..bcd7f6c67 100644 --- a/test/built-ins/TypedArray/prototype/constructor.js +++ b/test/built-ins/TypedArray/prototype/constructor.js @@ -11,6 +11,7 @@ info: | Per ES6 section 17, the method should exist on the %TypedArray% prototype, and it should be writable and configurable, but not enumerable. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.constructor, TypedArray); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/bit-precision.js b/test/built-ins/TypedArray/prototype/copyWithin/bit-precision.js index 2aff81d30..215f01f4a 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/bit-precision.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/bit-precision.js @@ -13,6 +13,7 @@ info: | i. Let fromVal be ? Get(O, fromKey). ii. Perform ? Set(O, toKey, fromVal, true). includes: [nans.js, compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ function body(FloatArray) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js index ef209fb79..19f06fbd3 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js @@ -23,6 +23,7 @@ info: | ToInteger(end). ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js index b381f23fd..b1e1fc5a3 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js @@ -22,6 +22,7 @@ info: | 5. Let relativeStart be ? ToInteger(start). ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js index ff1f310fe..fc8b1de9d 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js @@ -22,6 +22,7 @@ info: | 3. Let relativeTarget be ? ToInteger(target). ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/length.js b/test/built-ins/TypedArray/prototype/copyWithin/length.js index e2a0b3004..63c37c4ff 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/length.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.copyWithin.length, 2); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/name.js b/test/built-ins/TypedArray/prototype/copyWithin/name.js index 90e05d1ae..068057df3 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/name.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.copyWithin.name, "copyWithin"); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js index 90020a0ec..f1b881b6f 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js @@ -25,6 +25,7 @@ info: | final be min(relativeEnd, len). ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js index 1cfbca0e0..d3a12fe31 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js @@ -25,6 +25,7 @@ info: | final be min(relativeEnd, len). ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js index 42bebe243..4a5b207e2 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js @@ -23,6 +23,7 @@ info: | from be min(relativeStart, len). ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js index 7fa145404..e6d4964ca 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js @@ -23,6 +23,7 @@ info: | to be min(relativeTarget, len). ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js index 140b4b7fe..8c16e7a29 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js @@ -23,6 +23,7 @@ info: | from be min(relativeStart, len). ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js index 4afa54e6a..bd99a2ca1 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js @@ -23,6 +23,7 @@ info: | to be min(relativeTarget, len). ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js index 292f039e0..676cdced8 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js @@ -16,6 +16,7 @@ info: | ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js index 69793a06c..af8dd60e4 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js @@ -16,6 +16,7 @@ info: | ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js index 2a7eeea4a..a8270bb4e 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js @@ -16,6 +16,7 @@ info: | ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js index 7ff5d7a0a..cf35552e1 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js @@ -16,6 +16,7 @@ info: | ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/copyWithin/prop-desc.js b/test/built-ins/TypedArray/prototype/copyWithin/prop-desc.js index e35ba438e..1d4c0f7b7 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js b/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js index 0d0cb0b1c..7535edbaf 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js @@ -23,6 +23,7 @@ info: | ToInteger(end). ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/entries/length.js b/test/built-ins/TypedArray/prototype/entries/length.js index 2646da747..a72e7706c 100644 --- a/test/built-ins/TypedArray/prototype/entries/length.js +++ b/test/built-ins/TypedArray/prototype/entries/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.entries.length, 0); diff --git a/test/built-ins/TypedArray/prototype/entries/name.js b/test/built-ins/TypedArray/prototype/entries/name.js index b2b085c5c..9647c66c5 100644 --- a/test/built-ins/TypedArray/prototype/entries/name.js +++ b/test/built-ins/TypedArray/prototype/entries/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.entries.name, "entries"); diff --git a/test/built-ins/TypedArray/prototype/entries/prop-desc.js b/test/built-ins/TypedArray/prototype/entries/prop-desc.js index 79f83eab6..b6be2f048 100644 --- a/test/built-ins/TypedArray/prototype/entries/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/entries/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/every/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/every/callbackfn-detachbuffer.js index 3deb25f8d..8032d06bf 100644 --- a/test/built-ins/TypedArray/prototype/every/callbackfn-detachbuffer.js +++ b/test/built-ins/TypedArray/prototype/every/callbackfn-detachbuffer.js @@ -22,6 +22,7 @@ info: | ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). ... includes: [detachArrayBuffer.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/every/length.js b/test/built-ins/TypedArray/prototype/every/length.js index cd07fc891..2f5bf8961 100644 --- a/test/built-ins/TypedArray/prototype/every/length.js +++ b/test/built-ins/TypedArray/prototype/every/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.every.length, 1); diff --git a/test/built-ins/TypedArray/prototype/every/name.js b/test/built-ins/TypedArray/prototype/every/name.js index 8fe375426..4d216dd9d 100644 --- a/test/built-ins/TypedArray/prototype/every/name.js +++ b/test/built-ins/TypedArray/prototype/every/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.every.name, "every"); diff --git a/test/built-ins/TypedArray/prototype/every/prop-desc.js b/test/built-ins/TypedArray/prototype/every/prop-desc.js index b16458886..0f252fb72 100644 --- a/test/built-ins/TypedArray/prototype/every/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/every/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js b/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js index 1b750929b..b33ecc654 100644 --- a/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js +++ b/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js @@ -28,6 +28,7 @@ info: | ToInteger(end). ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan.js b/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan.js index dc4818ca0..80e435b2e 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan.js @@ -48,6 +48,7 @@ info: | each implementation distinguishable NaN value. ... includes: [nans.js, testTypedArray.js, compareArray.js] +features: [TypedArray] ---*/ function body(FloatArray) { diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations.js b/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations.js index 702c5e45e..057b33afc 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations.js @@ -44,6 +44,7 @@ info: | e. Else, ... includes: [byteConversionValues.js, testTypedArray.js] +features: [TypedArray] ---*/ testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js b/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js index 192ddd341..6ad18b85d 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js @@ -30,6 +30,7 @@ info: | final be min(relativeEnd, len). ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js index bd355a80d..8341205ed 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js @@ -27,6 +27,7 @@ info: | final be min(relativeEnd, len). ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js index 7142124d8..93c0b214b 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js @@ -25,6 +25,7 @@ info: | min(relativeStart, len). ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values.js b/test/built-ins/TypedArray/prototype/fill/fill-values.js index ea0654790..665796e37 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values.js @@ -25,6 +25,7 @@ info: | a. Let Pk be ! ToString(k). b. Perform ? Set(O, Pk, value, true). includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/fill/length.js b/test/built-ins/TypedArray/prototype/fill/length.js index 463c36e8a..b6c737535 100644 --- a/test/built-ins/TypedArray/prototype/fill/length.js +++ b/test/built-ins/TypedArray/prototype/fill/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.fill.length, 1); diff --git a/test/built-ins/TypedArray/prototype/fill/name.js b/test/built-ins/TypedArray/prototype/fill/name.js index 1350c0bdc..69820f96a 100644 --- a/test/built-ins/TypedArray/prototype/fill/name.js +++ b/test/built-ins/TypedArray/prototype/fill/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.fill.name, "fill"); diff --git a/test/built-ins/TypedArray/prototype/fill/prop-desc.js b/test/built-ins/TypedArray/prototype/fill/prop-desc.js index efdad3679..8cc26d79b 100644 --- a/test/built-ins/TypedArray/prototype/fill/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/fill/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js index ad57fcc22..1e2251472 100644 --- a/test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js +++ b/test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js @@ -14,6 +14,7 @@ info: | c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). ... includes: [detachArrayBuffer.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/filter/length.js b/test/built-ins/TypedArray/prototype/filter/length.js index 4c04b2192..62a72cfa9 100644 --- a/test/built-ins/TypedArray/prototype/filter/length.js +++ b/test/built-ins/TypedArray/prototype/filter/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.filter.length, 1); diff --git a/test/built-ins/TypedArray/prototype/filter/name.js b/test/built-ins/TypedArray/prototype/filter/name.js index ac7e5cbd2..069c0adc6 100644 --- a/test/built-ins/TypedArray/prototype/filter/name.js +++ b/test/built-ins/TypedArray/prototype/filter/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.filter.name, "filter"); diff --git a/test/built-ins/TypedArray/prototype/filter/prop-desc.js b/test/built-ins/TypedArray/prototype/filter/prop-desc.js index 096fb51a4..b9dc5886d 100644 --- a/test/built-ins/TypedArray/prototype/filter/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/filter/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/find/length.js b/test/built-ins/TypedArray/prototype/find/length.js index b5f9a6e5a..15607315f 100644 --- a/test/built-ins/TypedArray/prototype/find/length.js +++ b/test/built-ins/TypedArray/prototype/find/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.find.length, 1); diff --git a/test/built-ins/TypedArray/prototype/find/name.js b/test/built-ins/TypedArray/prototype/find/name.js index a4975ab8a..c1636fc13 100644 --- a/test/built-ins/TypedArray/prototype/find/name.js +++ b/test/built-ins/TypedArray/prototype/find/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.find.name, "find"); diff --git a/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js index f6fbe7290..fc22821dd 100644 --- a/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js +++ b/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js @@ -26,6 +26,7 @@ info: | c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/find/prop-desc.js b/test/built-ins/TypedArray/prototype/find/prop-desc.js index b38c2b656..f4d44f373 100644 --- a/test/built-ins/TypedArray/prototype/find/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/find/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/findIndex/length.js b/test/built-ins/TypedArray/prototype/findIndex/length.js index 49b360c54..0ec6d4a5f 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/length.js +++ b/test/built-ins/TypedArray/prototype/findIndex/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.findIndex.length, 1); diff --git a/test/built-ins/TypedArray/prototype/findIndex/name.js b/test/built-ins/TypedArray/prototype/findIndex/name.js index 6b77fdb45..deb8c73a9 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/name.js +++ b/test/built-ins/TypedArray/prototype/findIndex/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.findIndex.name, "findIndex"); diff --git a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js index 13c032fbb..cc7ba9fad 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js +++ b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js @@ -22,6 +22,7 @@ info: | c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/findIndex/prop-desc.js b/test/built-ins/TypedArray/prototype/findIndex/prop-desc.js index 7824b34b8..74abd2659 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/findIndex/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/forEach/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/forEach/callbackfn-detachbuffer.js index 44971dbae..6540255f7 100644 --- a/test/built-ins/TypedArray/prototype/forEach/callbackfn-detachbuffer.js +++ b/test/built-ins/TypedArray/prototype/forEach/callbackfn-detachbuffer.js @@ -22,6 +22,7 @@ info: | ii. Perform ? Call(callbackfn, T, « kValue, k, O »). ... includes: [detachArrayBuffer.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/forEach/length.js b/test/built-ins/TypedArray/prototype/forEach/length.js index 75d08ac5a..48bdb6a25 100644 --- a/test/built-ins/TypedArray/prototype/forEach/length.js +++ b/test/built-ins/TypedArray/prototype/forEach/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.forEach.length, 1); diff --git a/test/built-ins/TypedArray/prototype/forEach/name.js b/test/built-ins/TypedArray/prototype/forEach/name.js index e74f2bf23..23ae3f631 100644 --- a/test/built-ins/TypedArray/prototype/forEach/name.js +++ b/test/built-ins/TypedArray/prototype/forEach/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.forEach.name, "forEach"); diff --git a/test/built-ins/TypedArray/prototype/forEach/prop-desc.js b/test/built-ins/TypedArray/prototype/forEach/prop-desc.js index 2f7163a78..58e7e95b1 100644 --- a/test/built-ins/TypedArray/prototype/forEach/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/forEach/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/includes/length.js b/test/built-ins/TypedArray/prototype/includes/length.js index 95a4c9922..b59e5c995 100644 --- a/test/built-ins/TypedArray/prototype/includes/length.js +++ b/test/built-ins/TypedArray/prototype/includes/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.includes.length, 1); diff --git a/test/built-ins/TypedArray/prototype/includes/name.js b/test/built-ins/TypedArray/prototype/includes/name.js index 7996b2a3a..7f515b125 100644 --- a/test/built-ins/TypedArray/prototype/includes/name.js +++ b/test/built-ins/TypedArray/prototype/includes/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.includes.name, "includes"); diff --git a/test/built-ins/TypedArray/prototype/includes/prop-desc.js b/test/built-ins/TypedArray/prototype/includes/prop-desc.js index 8214efc1e..16cca2097 100644 --- a/test/built-ins/TypedArray/prototype/includes/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/includes/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/indexOf/length.js b/test/built-ins/TypedArray/prototype/indexOf/length.js index 2ceca46c1..5729797c6 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/length.js +++ b/test/built-ins/TypedArray/prototype/indexOf/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.indexOf.length, 1); diff --git a/test/built-ins/TypedArray/prototype/indexOf/name.js b/test/built-ins/TypedArray/prototype/indexOf/name.js index 18313b112..ee50628ff 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/name.js +++ b/test/built-ins/TypedArray/prototype/indexOf/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.indexOf.name, "indexOf"); diff --git a/test/built-ins/TypedArray/prototype/indexOf/prop-desc.js b/test/built-ins/TypedArray/prototype/indexOf/prop-desc.js index 528cbb23b..e950a34a7 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/indexOf/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/join/length.js b/test/built-ins/TypedArray/prototype/join/length.js index 907703286..1353a225a 100644 --- a/test/built-ins/TypedArray/prototype/join/length.js +++ b/test/built-ins/TypedArray/prototype/join/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.join.length, 1); diff --git a/test/built-ins/TypedArray/prototype/join/name.js b/test/built-ins/TypedArray/prototype/join/name.js index 29315666f..e859b75c5 100644 --- a/test/built-ins/TypedArray/prototype/join/name.js +++ b/test/built-ins/TypedArray/prototype/join/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.join.name, "join"); diff --git a/test/built-ins/TypedArray/prototype/join/prop-desc.js b/test/built-ins/TypedArray/prototype/join/prop-desc.js index f55543e76..bc12cb00c 100644 --- a/test/built-ins/TypedArray/prototype/join/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/join/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/keys/length.js b/test/built-ins/TypedArray/prototype/keys/length.js index ed354d593..8ca31ed83 100644 --- a/test/built-ins/TypedArray/prototype/keys/length.js +++ b/test/built-ins/TypedArray/prototype/keys/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.keys.length, 0); diff --git a/test/built-ins/TypedArray/prototype/keys/name.js b/test/built-ins/TypedArray/prototype/keys/name.js index ab0235b87..787e112f9 100644 --- a/test/built-ins/TypedArray/prototype/keys/name.js +++ b/test/built-ins/TypedArray/prototype/keys/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.keys.name, "keys"); diff --git a/test/built-ins/TypedArray/prototype/keys/prop-desc.js b/test/built-ins/TypedArray/prototype/keys/prop-desc.js index 9243d93ea..eb9eb8114 100644 --- a/test/built-ins/TypedArray/prototype/keys/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/keys/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/length.js b/test/built-ins/TypedArray/prototype/lastIndexOf/length.js index 46207ba85..ffac1f404 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/length.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.lastIndexOf.length, 1); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/name.js b/test/built-ins/TypedArray/prototype/lastIndexOf/name.js index be38057f2..7af241b5a 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/name.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.lastIndexOf.name, "lastIndexOf"); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/prop-desc.js b/test/built-ins/TypedArray/prototype/lastIndexOf/prop-desc.js index 082125cce..31fa33034 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/length/length.js b/test/built-ins/TypedArray/prototype/length/length.js index 46643927b..83477ed19 100644 --- a/test/built-ins/TypedArray/prototype/length/length.js +++ b/test/built-ins/TypedArray/prototype/length/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "length"); diff --git a/test/built-ins/TypedArray/prototype/length/name.js b/test/built-ins/TypedArray/prototype/length/name.js index fe55423df..733f7c4ea 100644 --- a/test/built-ins/TypedArray/prototype/length/name.js +++ b/test/built-ins/TypedArray/prototype/length/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "length"); diff --git a/test/built-ins/TypedArray/prototype/length/prop-desc.js b/test/built-ins/TypedArray/prototype/length/prop-desc.js index 2557b1720..eb3284e68 100644 --- a/test/built-ins/TypedArray/prototype/length/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/length/prop-desc.js @@ -11,6 +11,7 @@ info: | Section 17: Every accessor property described in clauses 18 through 26 and in Annex B.2 has the attributes {[[Enumerable]]: false, [[Configurable]]: true } includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/map/callbackfn-detachbuffer.js index ef5b7fee7..72d775dfe 100644 --- a/test/built-ins/TypedArray/prototype/map/callbackfn-detachbuffer.js +++ b/test/built-ins/TypedArray/prototype/map/callbackfn-detachbuffer.js @@ -14,6 +14,7 @@ info: | c. Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »). ... includes: [detachArrayBuffer.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/map/length.js b/test/built-ins/TypedArray/prototype/map/length.js index a83dcf805..b6b51f554 100644 --- a/test/built-ins/TypedArray/prototype/map/length.js +++ b/test/built-ins/TypedArray/prototype/map/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.map.length, 1); diff --git a/test/built-ins/TypedArray/prototype/map/name.js b/test/built-ins/TypedArray/prototype/map/name.js index 085bae78d..92aad9621 100644 --- a/test/built-ins/TypedArray/prototype/map/name.js +++ b/test/built-ins/TypedArray/prototype/map/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.map.name, "map"); diff --git a/test/built-ins/TypedArray/prototype/map/prop-desc.js b/test/built-ins/TypedArray/prototype/map/prop-desc.js index 02536ea43..473ecddaa 100644 --- a/test/built-ins/TypedArray/prototype/map/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/map/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation-consistent-nan.js b/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation-consistent-nan.js index 836a51239..15b63f791 100644 --- a/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation-consistent-nan.js +++ b/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation-consistent-nan.js @@ -41,6 +41,7 @@ info: | each implementation distinguishable NaN value. ... includes: [nans.js, testTypedArray.js, compareArray.js] +features: [TypedArray] ---*/ function body(FloatArray) { diff --git a/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation.js b/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation.js index 13f1de02c..29ee3f8ab 100644 --- a/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation.js +++ b/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation.js @@ -38,6 +38,7 @@ info: | e. Else, ... includes: [byteConversionValues.js, testTypedArray.js] +features: [TypedArray] ---*/ testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { diff --git a/test/built-ins/TypedArray/prototype/reduce/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/reduce/callbackfn-detachbuffer.js index ac8ddff2e..773b4b4c2 100644 --- a/test/built-ins/TypedArray/prototype/reduce/callbackfn-detachbuffer.js +++ b/test/built-ins/TypedArray/prototype/reduce/callbackfn-detachbuffer.js @@ -23,6 +23,7 @@ info: | k, O »). ... includes: [detachArrayBuffer.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/reduce/length.js b/test/built-ins/TypedArray/prototype/reduce/length.js index 0034666cb..9d4afc624 100644 --- a/test/built-ins/TypedArray/prototype/reduce/length.js +++ b/test/built-ins/TypedArray/prototype/reduce/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.reduce.length, 1); diff --git a/test/built-ins/TypedArray/prototype/reduce/name.js b/test/built-ins/TypedArray/prototype/reduce/name.js index 32b025fad..9074a96d4 100644 --- a/test/built-ins/TypedArray/prototype/reduce/name.js +++ b/test/built-ins/TypedArray/prototype/reduce/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.reduce.name, "reduce"); diff --git a/test/built-ins/TypedArray/prototype/reduce/prop-desc.js b/test/built-ins/TypedArray/prototype/reduce/prop-desc.js index aff04ee89..338776d73 100644 --- a/test/built-ins/TypedArray/prototype/reduce/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/reduce/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-detachbuffer.js index cd5ab46f6..7731c1e96 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-detachbuffer.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-detachbuffer.js @@ -23,6 +23,7 @@ info: | k, O »). ... includes: [detachArrayBuffer.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/reduceRight/length.js b/test/built-ins/TypedArray/prototype/reduceRight/length.js index b0a06637e..7d0227b6b 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/length.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.reduceRight.length, 1); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/name.js b/test/built-ins/TypedArray/prototype/reduceRight/name.js index 8fd47b81b..e483a273b 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/name.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.reduceRight.name, "reduceRight"); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/prop-desc.js b/test/built-ins/TypedArray/prototype/reduceRight/prop-desc.js index 37a688721..0dd9b7acd 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/reverse/length.js b/test/built-ins/TypedArray/prototype/reverse/length.js index f92f125fc..4a0364829 100644 --- a/test/built-ins/TypedArray/prototype/reverse/length.js +++ b/test/built-ins/TypedArray/prototype/reverse/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.reverse.length, 0); diff --git a/test/built-ins/TypedArray/prototype/reverse/name.js b/test/built-ins/TypedArray/prototype/reverse/name.js index 7fc42d4c5..eff372aa3 100644 --- a/test/built-ins/TypedArray/prototype/reverse/name.js +++ b/test/built-ins/TypedArray/prototype/reverse/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.reverse.name, "reverse"); diff --git a/test/built-ins/TypedArray/prototype/reverse/prop-desc.js b/test/built-ins/TypedArray/prototype/reverse/prop-desc.js index 7d2c9fc89..dbe292d44 100644 --- a/test/built-ins/TypedArray/prototype/reverse/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/reverse/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-conversions.js b/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-conversions.js index d5e346f11..f7b158c95 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-conversions.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-conversions.js @@ -19,6 +19,7 @@ info: | kNumber). ... includes: [byteConversionValues.js, testTypedArray.js] +features: [TypedArray] ---*/ testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { diff --git a/test/built-ins/TypedArray/prototype/set/bit-precision.js b/test/built-ins/TypedArray/prototype/set/bit-precision.js index 9010a9de2..0e9aac1c8 100644 --- a/test/built-ins/TypedArray/prototype/set/bit-precision.js +++ b/test/built-ins/TypedArray/prototype/set/bit-precision.js @@ -16,6 +16,7 @@ info: | iii. Set srcByteIndex to srcByteIndex + 1. iv. Set targetByteIndex to targetByteIndex + 1. includes: [nans.js, compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ function body(FloatArray) { diff --git a/test/built-ins/TypedArray/prototype/set/length.js b/test/built-ins/TypedArray/prototype/set/length.js index 081f2bdc4..7e94fdc4f 100644 --- a/test/built-ins/TypedArray/prototype/set/length.js +++ b/test/built-ins/TypedArray/prototype/set/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.set.length, 1); diff --git a/test/built-ins/TypedArray/prototype/set/name.js b/test/built-ins/TypedArray/prototype/set/name.js index 5d43516fc..f7cbaf394 100644 --- a/test/built-ins/TypedArray/prototype/set/name.js +++ b/test/built-ins/TypedArray/prototype/set/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.set.name, "set"); diff --git a/test/built-ins/TypedArray/prototype/set/prop-desc.js b/test/built-ins/TypedArray/prototype/set/prop-desc.js index 4773c6900..5adf2b15f 100644 --- a/test/built-ins/TypedArray/prototype/set/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/set/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-conversions.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-conversions.js index 26b00197b..5174b5528 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-conversions.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-conversions.js @@ -22,6 +22,7 @@ info: | ii. Perform SetValueInBuffer(targetBuffer, targetByteIndex, targetType, value). includes: [byteConversionValues.js, testTypedArray.js] +features: [TypedArray] ---*/ testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { diff --git a/test/built-ins/TypedArray/prototype/slice/bit-precision.js b/test/built-ins/TypedArray/prototype/slice/bit-precision.js index 6e23045ce..6f86ad033 100644 --- a/test/built-ins/TypedArray/prototype/slice/bit-precision.js +++ b/test/built-ins/TypedArray/prototype/slice/bit-precision.js @@ -21,6 +21,7 @@ info: | iii. Increase srcByteIndex by 1. iv. Increase targetByteIndex by 1. includes: [nans.js, compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ function body(FloatArray) { diff --git a/test/built-ins/TypedArray/prototype/slice/length.js b/test/built-ins/TypedArray/prototype/slice/length.js index da4a58b1b..a33abd745 100644 --- a/test/built-ins/TypedArray/prototype/slice/length.js +++ b/test/built-ins/TypedArray/prototype/slice/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.slice.length, 2); diff --git a/test/built-ins/TypedArray/prototype/slice/name.js b/test/built-ins/TypedArray/prototype/slice/name.js index f834475cb..69d319918 100644 --- a/test/built-ins/TypedArray/prototype/slice/name.js +++ b/test/built-ins/TypedArray/prototype/slice/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.slice.name, "slice"); diff --git a/test/built-ins/TypedArray/prototype/slice/prop-desc.js b/test/built-ins/TypedArray/prototype/slice/prop-desc.js index b97ec0478..ad27545fc 100644 --- a/test/built-ins/TypedArray/prototype/slice/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/slice/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/some/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/some/callbackfn-detachbuffer.js index 053f96a32..495e2bc91 100644 --- a/test/built-ins/TypedArray/prototype/some/callbackfn-detachbuffer.js +++ b/test/built-ins/TypedArray/prototype/some/callbackfn-detachbuffer.js @@ -22,6 +22,7 @@ info: | ii. Let testResult be ToBoolean(? Call(callbackfn, T, « kValue, k, O »)). ... includes: [detachArrayBuffer.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/some/length.js b/test/built-ins/TypedArray/prototype/some/length.js index d6ec17146..47560ff66 100644 --- a/test/built-ins/TypedArray/prototype/some/length.js +++ b/test/built-ins/TypedArray/prototype/some/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.some.length, 1); diff --git a/test/built-ins/TypedArray/prototype/some/name.js b/test/built-ins/TypedArray/prototype/some/name.js index 08fcd0ad0..1d0ad6735 100644 --- a/test/built-ins/TypedArray/prototype/some/name.js +++ b/test/built-ins/TypedArray/prototype/some/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.some.name, "some"); diff --git a/test/built-ins/TypedArray/prototype/some/prop-desc.js b/test/built-ins/TypedArray/prototype/some/prop-desc.js index b42b0f254..c4d9e30b0 100644 --- a/test/built-ins/TypedArray/prototype/some/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/some/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/sort/length.js b/test/built-ins/TypedArray/prototype/sort/length.js index 757ffbb80..8bd6a93ad 100644 --- a/test/built-ins/TypedArray/prototype/sort/length.js +++ b/test/built-ins/TypedArray/prototype/sort/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.sort.length, 1); diff --git a/test/built-ins/TypedArray/prototype/sort/name.js b/test/built-ins/TypedArray/prototype/sort/name.js index 55fbd9f29..d920126ec 100644 --- a/test/built-ins/TypedArray/prototype/sort/name.js +++ b/test/built-ins/TypedArray/prototype/sort/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.sort.name, "sort"); diff --git a/test/built-ins/TypedArray/prototype/sort/prop-desc.js b/test/built-ins/TypedArray/prototype/sort/prop-desc.js index c59cdf175..b8fecb045 100644 --- a/test/built-ins/TypedArray/prototype/sort/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/sort/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/subarray/length.js b/test/built-ins/TypedArray/prototype/subarray/length.js index 71032debc..8328dc699 100644 --- a/test/built-ins/TypedArray/prototype/subarray/length.js +++ b/test/built-ins/TypedArray/prototype/subarray/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.subarray.length, 2); diff --git a/test/built-ins/TypedArray/prototype/subarray/name.js b/test/built-ins/TypedArray/prototype/subarray/name.js index a83264cda..fb51a5f53 100644 --- a/test/built-ins/TypedArray/prototype/subarray/name.js +++ b/test/built-ins/TypedArray/prototype/subarray/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.subarray.name, "subarray"); diff --git a/test/built-ins/TypedArray/prototype/subarray/prop-desc.js b/test/built-ins/TypedArray/prototype/subarray/prop-desc.js index 0a7cb8bac..776e57ad7 100644 --- a/test/built-ins/TypedArray/prototype/subarray/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/subarray/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/length.js b/test/built-ins/TypedArray/prototype/toLocaleString/length.js index 1e9335e34..deadce49f 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/length.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.toLocaleString.length, 0); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/name.js b/test/built-ins/TypedArray/prototype/toLocaleString/name.js index df0f6cdfa..20a8dfe16 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/name.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.toLocaleString.name, "toLocaleString"); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/prop-desc.js b/test/built-ins/TypedArray/prototype/toLocaleString/prop-desc.js index c23f0c198..d5e4a414d 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/prop-desc.js @@ -9,6 +9,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/toString.js b/test/built-ins/TypedArray/prototype/toString.js index f20715743..48ef729bd 100644 --- a/test/built-ins/TypedArray/prototype/toString.js +++ b/test/built-ins/TypedArray/prototype/toString.js @@ -15,6 +15,7 @@ info: | and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArray/prototype/values/length.js b/test/built-ins/TypedArray/prototype/values/length.js index 31da8ea5d..deae67fbd 100644 --- a/test/built-ins/TypedArray/prototype/values/length.js +++ b/test/built-ins/TypedArray/prototype/values/length.js @@ -20,6 +20,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.values.length, 0); diff --git a/test/built-ins/TypedArray/prototype/values/name.js b/test/built-ins/TypedArray/prototype/values/name.js index 67caa3615..43b3d9dbb 100644 --- a/test/built-ins/TypedArray/prototype/values/name.js +++ b/test/built-ins/TypedArray/prototype/values/name.js @@ -17,6 +17,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ assert.sameValue(TypedArray.prototype.values.name, "values"); diff --git a/test/built-ins/TypedArray/prototype/values/prop-desc.js b/test/built-ins/TypedArray/prototype/values/prop-desc.js index cb06c7315..7080c970d 100644 --- a/test/built-ins/TypedArray/prototype/values/prop-desc.js +++ b/test/built-ins/TypedArray/prototype/values/prop-desc.js @@ -9,6 +9,7 @@ info: | 26 and in Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js, testTypedArray.js] +features: [TypedArray] ---*/ var TypedArrayPrototype = TypedArray.prototype; diff --git a/test/built-ins/TypedArrays/Float32Array/BYTES_PER_ELEMENT.js b/test/built-ins/TypedArrays/Float32Array/BYTES_PER_ELEMENT.js index 754e6eb6b..1c4d2a6d3 100644 --- a/test/built-ins/TypedArrays/Float32Array/BYTES_PER_ELEMENT.js +++ b/test/built-ins/TypedArrays/Float32Array/BYTES_PER_ELEMENT.js @@ -12,6 +12,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Float32Array.BYTES_PER_ELEMENT, 4); diff --git a/test/built-ins/TypedArrays/Float32Array/constructor.js b/test/built-ins/TypedArrays/Float32Array/constructor.js index 5bdc1f397..e42589108 100644 --- a/test/built-ins/TypedArrays/Float32Array/constructor.js +++ b/test/built-ins/TypedArrays/Float32Array/constructor.js @@ -6,6 +6,7 @@ es6id: 22.2.4 esid: sec-typedarray-constructors description: > Float32Array is a constructor function. +features: [TypedArray] ---*/ assert.sameValue(typeof Float32Array, 'function', 'typeof Float32Array is "function"'); diff --git a/test/built-ins/TypedArrays/Float32Array/length.js b/test/built-ins/TypedArrays/Float32Array/length.js index 3b5874b3b..41d18dd60 100644 --- a/test/built-ins/TypedArrays/Float32Array/length.js +++ b/test/built-ins/TypedArrays/Float32Array/length.js @@ -21,6 +21,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Float32Array.length, 3); diff --git a/test/built-ins/TypedArrays/Float32Array/name.js b/test/built-ins/TypedArrays/Float32Array/name.js index 3ae1299cc..06b6b6930 100644 --- a/test/built-ins/TypedArrays/Float32Array/name.js +++ b/test/built-ins/TypedArrays/Float32Array/name.js @@ -19,6 +19,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Float32Array.name, "Float32Array"); diff --git a/test/built-ins/TypedArrays/Float32Array/prototype.js b/test/built-ins/TypedArrays/Float32Array/prototype.js index 4af0838e2..0a19304e1 100644 --- a/test/built-ins/TypedArrays/Float32Array/prototype.js +++ b/test/built-ins/TypedArrays/Float32Array/prototype.js @@ -11,6 +11,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Float32Array.prototype, Object.getPrototypeOf(new Float32Array(0))); diff --git a/test/built-ins/TypedArrays/Float32Array/prototype/BYTES_PER_ELEMENT.js b/test/built-ins/TypedArrays/Float32Array/prototype/BYTES_PER_ELEMENT.js index 941b1f73c..ad23cfab2 100644 --- a/test/built-ins/TypedArrays/Float32Array/prototype/BYTES_PER_ELEMENT.js +++ b/test/built-ins/TypedArrays/Float32Array/prototype/BYTES_PER_ELEMENT.js @@ -12,6 +12,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Float32Array.prototype.BYTES_PER_ELEMENT, 4); diff --git a/test/built-ins/TypedArrays/Float32Array/prototype/constructor.js b/test/built-ins/TypedArrays/Float32Array/prototype/constructor.js index cd4d87382..109c2056d 100644 --- a/test/built-ins/TypedArrays/Float32Array/prototype/constructor.js +++ b/test/built-ins/TypedArrays/Float32Array/prototype/constructor.js @@ -15,6 +15,7 @@ info: | the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Float32Array.prototype.constructor, Float32Array); diff --git a/test/built-ins/TypedArrays/Float32Array/prototype/not-typedarray-object.js b/test/built-ins/TypedArrays/Float32Array/prototype/not-typedarray-object.js index 0f18bbdc4..11411192d 100644 --- a/test/built-ins/TypedArrays/Float32Array/prototype/not-typedarray-object.js +++ b/test/built-ins/TypedArrays/Float32Array/prototype/not-typedarray-object.js @@ -10,6 +10,7 @@ info: | A TypedArray prototype object is an ordinary object. It does not have a [[ViewedArrayBuffer]] or any other of the internal slots that are specific to TypedArray instance objects. +features: [TypedArray] ---*/ assert.throws(TypeError, function() { diff --git a/test/built-ins/TypedArrays/Float64Array/BYTES_PER_ELEMENT.js b/test/built-ins/TypedArrays/Float64Array/BYTES_PER_ELEMENT.js index 261a71cf9..d293ee0e7 100644 --- a/test/built-ins/TypedArrays/Float64Array/BYTES_PER_ELEMENT.js +++ b/test/built-ins/TypedArrays/Float64Array/BYTES_PER_ELEMENT.js @@ -12,6 +12,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Float64Array.BYTES_PER_ELEMENT, 8); diff --git a/test/built-ins/TypedArrays/Float64Array/constructor.js b/test/built-ins/TypedArrays/Float64Array/constructor.js index 433beee4a..6e5c95926 100644 --- a/test/built-ins/TypedArrays/Float64Array/constructor.js +++ b/test/built-ins/TypedArrays/Float64Array/constructor.js @@ -6,6 +6,7 @@ es6id: 22.2.4 esid: sec-typedarray-constructors description: > Float64Array is a constructor function. +features: [TypedArray] ---*/ assert.sameValue(typeof Float64Array, 'function', 'typeof Float64Array is "function"'); diff --git a/test/built-ins/TypedArrays/Float64Array/length.js b/test/built-ins/TypedArrays/Float64Array/length.js index 26134d59a..98bfb5fec 100644 --- a/test/built-ins/TypedArrays/Float64Array/length.js +++ b/test/built-ins/TypedArrays/Float64Array/length.js @@ -21,6 +21,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Float64Array.length, 3); diff --git a/test/built-ins/TypedArrays/Float64Array/name.js b/test/built-ins/TypedArrays/Float64Array/name.js index 84743080a..c1633a7c2 100644 --- a/test/built-ins/TypedArrays/Float64Array/name.js +++ b/test/built-ins/TypedArrays/Float64Array/name.js @@ -19,6 +19,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Float64Array.name, "Float64Array"); diff --git a/test/built-ins/TypedArrays/Float64Array/prototype.js b/test/built-ins/TypedArrays/Float64Array/prototype.js index c2ec7fd18..f12d6dc57 100644 --- a/test/built-ins/TypedArrays/Float64Array/prototype.js +++ b/test/built-ins/TypedArrays/Float64Array/prototype.js @@ -11,6 +11,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Float64Array.prototype, Object.getPrototypeOf(new Float64Array(0))); diff --git a/test/built-ins/TypedArrays/Float64Array/prototype/BYTES_PER_ELEMENT.js b/test/built-ins/TypedArrays/Float64Array/prototype/BYTES_PER_ELEMENT.js index 1221f2c8b..559bd9b4f 100644 --- a/test/built-ins/TypedArrays/Float64Array/prototype/BYTES_PER_ELEMENT.js +++ b/test/built-ins/TypedArrays/Float64Array/prototype/BYTES_PER_ELEMENT.js @@ -12,6 +12,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Float64Array.prototype.BYTES_PER_ELEMENT, 8); diff --git a/test/built-ins/TypedArrays/Float64Array/prototype/constructor.js b/test/built-ins/TypedArrays/Float64Array/prototype/constructor.js index 53d979316..a991e6b1c 100644 --- a/test/built-ins/TypedArrays/Float64Array/prototype/constructor.js +++ b/test/built-ins/TypedArrays/Float64Array/prototype/constructor.js @@ -15,6 +15,7 @@ info: | the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Float64Array.prototype.constructor, Float64Array); diff --git a/test/built-ins/TypedArrays/Float64Array/prototype/not-typedarray-object.js b/test/built-ins/TypedArrays/Float64Array/prototype/not-typedarray-object.js index 0f18bbdc4..11411192d 100644 --- a/test/built-ins/TypedArrays/Float64Array/prototype/not-typedarray-object.js +++ b/test/built-ins/TypedArrays/Float64Array/prototype/not-typedarray-object.js @@ -10,6 +10,7 @@ info: | A TypedArray prototype object is an ordinary object. It does not have a [[ViewedArrayBuffer]] or any other of the internal slots that are specific to TypedArray instance objects. +features: [TypedArray] ---*/ assert.throws(TypeError, function() { diff --git a/test/built-ins/TypedArrays/Int16Array/BYTES_PER_ELEMENT.js b/test/built-ins/TypedArrays/Int16Array/BYTES_PER_ELEMENT.js index 1e3f122d8..9e053e0d4 100644 --- a/test/built-ins/TypedArrays/Int16Array/BYTES_PER_ELEMENT.js +++ b/test/built-ins/TypedArrays/Int16Array/BYTES_PER_ELEMENT.js @@ -12,6 +12,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Int16Array.BYTES_PER_ELEMENT, 2); diff --git a/test/built-ins/TypedArrays/Int16Array/constructor.js b/test/built-ins/TypedArrays/Int16Array/constructor.js index 8138d47fc..4498302d8 100644 --- a/test/built-ins/TypedArrays/Int16Array/constructor.js +++ b/test/built-ins/TypedArrays/Int16Array/constructor.js @@ -6,6 +6,7 @@ es6id: 22.2.4 esid: sec-typedarray-constructors description: > Int16Array is a constructor function. +features: [TypedArray] ---*/ assert.sameValue(typeof Int16Array, 'function', 'typeof Int16Array is "function"'); diff --git a/test/built-ins/TypedArrays/Int16Array/length.js b/test/built-ins/TypedArrays/Int16Array/length.js index 2d064eacb..95447e9f2 100644 --- a/test/built-ins/TypedArrays/Int16Array/length.js +++ b/test/built-ins/TypedArrays/Int16Array/length.js @@ -21,6 +21,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Int16Array.length, 3); diff --git a/test/built-ins/TypedArrays/Int16Array/name.js b/test/built-ins/TypedArrays/Int16Array/name.js index 13cc1da9d..1e1c6e017 100644 --- a/test/built-ins/TypedArrays/Int16Array/name.js +++ b/test/built-ins/TypedArrays/Int16Array/name.js @@ -19,6 +19,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Int16Array.name, "Int16Array"); diff --git a/test/built-ins/TypedArrays/Int16Array/prototype.js b/test/built-ins/TypedArrays/Int16Array/prototype.js index e4caec425..3549313f4 100644 --- a/test/built-ins/TypedArrays/Int16Array/prototype.js +++ b/test/built-ins/TypedArrays/Int16Array/prototype.js @@ -11,6 +11,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Int16Array.prototype, Object.getPrototypeOf(new Int16Array(0))); diff --git a/test/built-ins/TypedArrays/Int16Array/prototype/BYTES_PER_ELEMENT.js b/test/built-ins/TypedArrays/Int16Array/prototype/BYTES_PER_ELEMENT.js index 1e1da133d..b3d650663 100644 --- a/test/built-ins/TypedArrays/Int16Array/prototype/BYTES_PER_ELEMENT.js +++ b/test/built-ins/TypedArrays/Int16Array/prototype/BYTES_PER_ELEMENT.js @@ -12,6 +12,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Int16Array.prototype.BYTES_PER_ELEMENT, 2); diff --git a/test/built-ins/TypedArrays/Int16Array/prototype/constructor.js b/test/built-ins/TypedArrays/Int16Array/prototype/constructor.js index 4e2880af7..a58903157 100644 --- a/test/built-ins/TypedArrays/Int16Array/prototype/constructor.js +++ b/test/built-ins/TypedArrays/Int16Array/prototype/constructor.js @@ -15,6 +15,7 @@ info: | the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Int16Array.prototype.constructor, Int16Array); diff --git a/test/built-ins/TypedArrays/Int16Array/prototype/not-typedarray-object.js b/test/built-ins/TypedArrays/Int16Array/prototype/not-typedarray-object.js index db946df96..0fcecc39b 100644 --- a/test/built-ins/TypedArrays/Int16Array/prototype/not-typedarray-object.js +++ b/test/built-ins/TypedArrays/Int16Array/prototype/not-typedarray-object.js @@ -10,6 +10,7 @@ info: | A TypedArray prototype object is an ordinary object. It does not have a [[ViewedArrayBuffer]] or any other of the internal slots that are specific to TypedArray instance objects. +features: [TypedArray] ---*/ assert.throws(TypeError, function() { diff --git a/test/built-ins/TypedArrays/Int32Array/BYTES_PER_ELEMENT.js b/test/built-ins/TypedArrays/Int32Array/BYTES_PER_ELEMENT.js index 58befea34..8109567f6 100644 --- a/test/built-ins/TypedArrays/Int32Array/BYTES_PER_ELEMENT.js +++ b/test/built-ins/TypedArrays/Int32Array/BYTES_PER_ELEMENT.js @@ -12,6 +12,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Int32Array.BYTES_PER_ELEMENT, 4); diff --git a/test/built-ins/TypedArrays/Int32Array/constructor.js b/test/built-ins/TypedArrays/Int32Array/constructor.js index fb5841496..c21794d06 100644 --- a/test/built-ins/TypedArrays/Int32Array/constructor.js +++ b/test/built-ins/TypedArrays/Int32Array/constructor.js @@ -6,6 +6,7 @@ es6id: 22.2.4 esid: sec-typedarray-constructors description: > Int32Array is a constructor function. +features: [TypedArray] ---*/ assert.sameValue(typeof Int32Array, 'function', 'typeof Int32Array is "function"'); diff --git a/test/built-ins/TypedArrays/Int32Array/length.js b/test/built-ins/TypedArrays/Int32Array/length.js index ce6eae5a1..6821ea673 100644 --- a/test/built-ins/TypedArrays/Int32Array/length.js +++ b/test/built-ins/TypedArrays/Int32Array/length.js @@ -21,6 +21,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Int32Array.length, 3); diff --git a/test/built-ins/TypedArrays/Int32Array/name.js b/test/built-ins/TypedArrays/Int32Array/name.js index 6d3acc24a..5e7ce33d1 100644 --- a/test/built-ins/TypedArrays/Int32Array/name.js +++ b/test/built-ins/TypedArrays/Int32Array/name.js @@ -19,6 +19,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Int32Array.name, "Int32Array"); diff --git a/test/built-ins/TypedArrays/Int32Array/prototype.js b/test/built-ins/TypedArrays/Int32Array/prototype.js index 91b7e8d15..b40519b82 100644 --- a/test/built-ins/TypedArrays/Int32Array/prototype.js +++ b/test/built-ins/TypedArrays/Int32Array/prototype.js @@ -11,6 +11,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Int32Array.prototype, Object.getPrototypeOf(new Int32Array(0))); diff --git a/test/built-ins/TypedArrays/Int32Array/prototype/BYTES_PER_ELEMENT.js b/test/built-ins/TypedArrays/Int32Array/prototype/BYTES_PER_ELEMENT.js index 1e8703ff2..62fe3505d 100644 --- a/test/built-ins/TypedArrays/Int32Array/prototype/BYTES_PER_ELEMENT.js +++ b/test/built-ins/TypedArrays/Int32Array/prototype/BYTES_PER_ELEMENT.js @@ -12,6 +12,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Int32Array.prototype.BYTES_PER_ELEMENT, 4); diff --git a/test/built-ins/TypedArrays/Int32Array/prototype/constructor.js b/test/built-ins/TypedArrays/Int32Array/prototype/constructor.js index 4f11783ad..cc335e1c1 100644 --- a/test/built-ins/TypedArrays/Int32Array/prototype/constructor.js +++ b/test/built-ins/TypedArrays/Int32Array/prototype/constructor.js @@ -15,6 +15,7 @@ info: | the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Int32Array.prototype.constructor, Int32Array); diff --git a/test/built-ins/TypedArrays/Int32Array/prototype/not-typedarray-object.js b/test/built-ins/TypedArrays/Int32Array/prototype/not-typedarray-object.js index d00cd295e..7076ef853 100644 --- a/test/built-ins/TypedArrays/Int32Array/prototype/not-typedarray-object.js +++ b/test/built-ins/TypedArrays/Int32Array/prototype/not-typedarray-object.js @@ -10,6 +10,7 @@ info: | A TypedArray prototype object is an ordinary object. It does not have a [[ViewedArrayBuffer]] or any other of the internal slots that are specific to TypedArray instance objects. +features: [TypedArray] ---*/ assert.throws(TypeError, function() { diff --git a/test/built-ins/TypedArrays/Int8Array/BYTES_PER_ELEMENT.js b/test/built-ins/TypedArrays/Int8Array/BYTES_PER_ELEMENT.js index 918fc5844..9e7c0a196 100644 --- a/test/built-ins/TypedArrays/Int8Array/BYTES_PER_ELEMENT.js +++ b/test/built-ins/TypedArrays/Int8Array/BYTES_PER_ELEMENT.js @@ -12,6 +12,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Int8Array.BYTES_PER_ELEMENT, 1); diff --git a/test/built-ins/TypedArrays/Int8Array/constructor.js b/test/built-ins/TypedArrays/Int8Array/constructor.js index 97074507b..a166cfa4f 100644 --- a/test/built-ins/TypedArrays/Int8Array/constructor.js +++ b/test/built-ins/TypedArrays/Int8Array/constructor.js @@ -6,6 +6,7 @@ es6id: 22.2.4 esid: sec-typedarray-constructors description: > Int8Array is a constructor function. +features: [TypedArray] ---*/ assert.sameValue(typeof Int8Array, 'function', 'typeof Int8Array is "function"'); diff --git a/test/built-ins/TypedArrays/Int8Array/length.js b/test/built-ins/TypedArrays/Int8Array/length.js index ec25b3d4d..0cd4836c6 100644 --- a/test/built-ins/TypedArrays/Int8Array/length.js +++ b/test/built-ins/TypedArrays/Int8Array/length.js @@ -21,6 +21,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Int8Array.length, 3); diff --git a/test/built-ins/TypedArrays/Int8Array/name.js b/test/built-ins/TypedArrays/Int8Array/name.js index 7f84f6446..41cbab8aa 100644 --- a/test/built-ins/TypedArrays/Int8Array/name.js +++ b/test/built-ins/TypedArrays/Int8Array/name.js @@ -19,6 +19,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Int8Array.name, "Int8Array"); diff --git a/test/built-ins/TypedArrays/Int8Array/prototype.js b/test/built-ins/TypedArrays/Int8Array/prototype.js index f489da58a..214082ec4 100644 --- a/test/built-ins/TypedArrays/Int8Array/prototype.js +++ b/test/built-ins/TypedArrays/Int8Array/prototype.js @@ -11,6 +11,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Int8Array.prototype, Object.getPrototypeOf(new Int8Array(0))); diff --git a/test/built-ins/TypedArrays/Int8Array/prototype/BYTES_PER_ELEMENT.js b/test/built-ins/TypedArrays/Int8Array/prototype/BYTES_PER_ELEMENT.js index a8ef7f30e..7a2085614 100644 --- a/test/built-ins/TypedArrays/Int8Array/prototype/BYTES_PER_ELEMENT.js +++ b/test/built-ins/TypedArrays/Int8Array/prototype/BYTES_PER_ELEMENT.js @@ -12,6 +12,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Int8Array.prototype.BYTES_PER_ELEMENT, 1); diff --git a/test/built-ins/TypedArrays/Int8Array/prototype/constructor.js b/test/built-ins/TypedArrays/Int8Array/prototype/constructor.js index 3861cca5e..914474fb7 100644 --- a/test/built-ins/TypedArrays/Int8Array/prototype/constructor.js +++ b/test/built-ins/TypedArrays/Int8Array/prototype/constructor.js @@ -15,6 +15,7 @@ info: | the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Int8Array.prototype.constructor, Int8Array); diff --git a/test/built-ins/TypedArrays/Int8Array/prototype/not-typedarray-object.js b/test/built-ins/TypedArrays/Int8Array/prototype/not-typedarray-object.js index 7876c1023..14472ad8d 100644 --- a/test/built-ins/TypedArrays/Int8Array/prototype/not-typedarray-object.js +++ b/test/built-ins/TypedArrays/Int8Array/prototype/not-typedarray-object.js @@ -10,6 +10,7 @@ info: | A TypedArray prototype object is an ordinary object. It does not have a [[ViewedArrayBuffer]] or any other of the internal slots that are specific to TypedArray instance objects. +features: [TypedArray] ---*/ assert.throws(TypeError, function() { diff --git a/test/built-ins/TypedArrays/Uint16Array/BYTES_PER_ELEMENT.js b/test/built-ins/TypedArrays/Uint16Array/BYTES_PER_ELEMENT.js index 09265ad55..c0b79f341 100644 --- a/test/built-ins/TypedArrays/Uint16Array/BYTES_PER_ELEMENT.js +++ b/test/built-ins/TypedArrays/Uint16Array/BYTES_PER_ELEMENT.js @@ -12,6 +12,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint16Array.BYTES_PER_ELEMENT, 2); diff --git a/test/built-ins/TypedArrays/Uint16Array/constructor.js b/test/built-ins/TypedArrays/Uint16Array/constructor.js index 71fe8e8b0..7b02e272a 100644 --- a/test/built-ins/TypedArrays/Uint16Array/constructor.js +++ b/test/built-ins/TypedArrays/Uint16Array/constructor.js @@ -6,6 +6,7 @@ es6id: 22.2.4 esid: sec-typedarray-constructors description: > Uint16Array is a constructor function. +features: [TypedArray] ---*/ assert.sameValue(typeof Uint16Array, 'function', 'typeof Uint16Array is "function"'); diff --git a/test/built-ins/TypedArrays/Uint16Array/length.js b/test/built-ins/TypedArrays/Uint16Array/length.js index f63352714..30061f817 100644 --- a/test/built-ins/TypedArrays/Uint16Array/length.js +++ b/test/built-ins/TypedArrays/Uint16Array/length.js @@ -21,6 +21,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint16Array.length, 3); diff --git a/test/built-ins/TypedArrays/Uint16Array/name.js b/test/built-ins/TypedArrays/Uint16Array/name.js index ff0b45f4a..9d39f94d1 100644 --- a/test/built-ins/TypedArrays/Uint16Array/name.js +++ b/test/built-ins/TypedArrays/Uint16Array/name.js @@ -19,6 +19,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint16Array.name, "Uint16Array"); diff --git a/test/built-ins/TypedArrays/Uint16Array/prototype.js b/test/built-ins/TypedArrays/Uint16Array/prototype.js index c82df2e5b..33e77c2c1 100644 --- a/test/built-ins/TypedArrays/Uint16Array/prototype.js +++ b/test/built-ins/TypedArrays/Uint16Array/prototype.js @@ -11,6 +11,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint16Array.prototype, Object.getPrototypeOf(new Uint16Array(0))); diff --git a/test/built-ins/TypedArrays/Uint16Array/prototype/BYTES_PER_ELEMENT.js b/test/built-ins/TypedArrays/Uint16Array/prototype/BYTES_PER_ELEMENT.js index 95c810a94..7feb311ec 100644 --- a/test/built-ins/TypedArrays/Uint16Array/prototype/BYTES_PER_ELEMENT.js +++ b/test/built-ins/TypedArrays/Uint16Array/prototype/BYTES_PER_ELEMENT.js @@ -12,6 +12,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint16Array.prototype.BYTES_PER_ELEMENT, 2); diff --git a/test/built-ins/TypedArrays/Uint16Array/prototype/constructor.js b/test/built-ins/TypedArrays/Uint16Array/prototype/constructor.js index e77659619..5d7e33fb6 100644 --- a/test/built-ins/TypedArrays/Uint16Array/prototype/constructor.js +++ b/test/built-ins/TypedArrays/Uint16Array/prototype/constructor.js @@ -15,6 +15,7 @@ info: | the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint16Array.prototype.constructor, Uint16Array); diff --git a/test/built-ins/TypedArrays/Uint16Array/prototype/not-typedarray-object.js b/test/built-ins/TypedArrays/Uint16Array/prototype/not-typedarray-object.js index bb98cd2e2..595591043 100644 --- a/test/built-ins/TypedArrays/Uint16Array/prototype/not-typedarray-object.js +++ b/test/built-ins/TypedArrays/Uint16Array/prototype/not-typedarray-object.js @@ -10,6 +10,7 @@ info: | A TypedArray prototype object is an ordinary object. It does not have a [[ViewedArrayBuffer]] or any other of the internal slots that are specific to TypedArray instance objects. +features: [TypedArray] ---*/ assert.throws(TypeError, function() { diff --git a/test/built-ins/TypedArrays/Uint32Array/BYTES_PER_ELEMENT.js b/test/built-ins/TypedArrays/Uint32Array/BYTES_PER_ELEMENT.js index 9aea50c06..986f9ba09 100644 --- a/test/built-ins/TypedArrays/Uint32Array/BYTES_PER_ELEMENT.js +++ b/test/built-ins/TypedArrays/Uint32Array/BYTES_PER_ELEMENT.js @@ -12,6 +12,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint32Array.BYTES_PER_ELEMENT, 4); diff --git a/test/built-ins/TypedArrays/Uint32Array/constructor.js b/test/built-ins/TypedArrays/Uint32Array/constructor.js index 35872a626..5d4385a14 100644 --- a/test/built-ins/TypedArrays/Uint32Array/constructor.js +++ b/test/built-ins/TypedArrays/Uint32Array/constructor.js @@ -6,6 +6,7 @@ es6id: 22.2.4 esid: sec-typedarray-constructors description: > Uint32Array is a constructor function. +features: [TypedArray] ---*/ assert.sameValue(typeof Uint32Array, 'function', 'typeof Uint32Array is "function"'); diff --git a/test/built-ins/TypedArrays/Uint32Array/length.js b/test/built-ins/TypedArrays/Uint32Array/length.js index a9953d862..99bb6344f 100644 --- a/test/built-ins/TypedArrays/Uint32Array/length.js +++ b/test/built-ins/TypedArrays/Uint32Array/length.js @@ -21,6 +21,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint32Array.length, 3); diff --git a/test/built-ins/TypedArrays/Uint32Array/name.js b/test/built-ins/TypedArrays/Uint32Array/name.js index b49cb56d1..8bef4ebb4 100644 --- a/test/built-ins/TypedArrays/Uint32Array/name.js +++ b/test/built-ins/TypedArrays/Uint32Array/name.js @@ -19,6 +19,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint32Array.name, "Uint32Array"); diff --git a/test/built-ins/TypedArrays/Uint32Array/prototype.js b/test/built-ins/TypedArrays/Uint32Array/prototype.js index 56ca7d599..8f42cfa42 100644 --- a/test/built-ins/TypedArrays/Uint32Array/prototype.js +++ b/test/built-ins/TypedArrays/Uint32Array/prototype.js @@ -11,6 +11,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint32Array.prototype, Object.getPrototypeOf(new Uint32Array(0))); diff --git a/test/built-ins/TypedArrays/Uint32Array/prototype/BYTES_PER_ELEMENT.js b/test/built-ins/TypedArrays/Uint32Array/prototype/BYTES_PER_ELEMENT.js index b8ae52879..ec2c6958d 100644 --- a/test/built-ins/TypedArrays/Uint32Array/prototype/BYTES_PER_ELEMENT.js +++ b/test/built-ins/TypedArrays/Uint32Array/prototype/BYTES_PER_ELEMENT.js @@ -12,6 +12,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint32Array.prototype.BYTES_PER_ELEMENT, 4); diff --git a/test/built-ins/TypedArrays/Uint32Array/prototype/constructor.js b/test/built-ins/TypedArrays/Uint32Array/prototype/constructor.js index fb0149e6e..7017fdbc9 100644 --- a/test/built-ins/TypedArrays/Uint32Array/prototype/constructor.js +++ b/test/built-ins/TypedArrays/Uint32Array/prototype/constructor.js @@ -15,6 +15,7 @@ info: | the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint32Array.prototype.constructor, Uint32Array); diff --git a/test/built-ins/TypedArrays/Uint32Array/prototype/not-typedarray-object.js b/test/built-ins/TypedArrays/Uint32Array/prototype/not-typedarray-object.js index 554fb7d5e..b3bc4b3a9 100644 --- a/test/built-ins/TypedArrays/Uint32Array/prototype/not-typedarray-object.js +++ b/test/built-ins/TypedArrays/Uint32Array/prototype/not-typedarray-object.js @@ -10,6 +10,7 @@ info: | A TypedArray prototype object is an ordinary object. It does not have a [[ViewedArrayBuffer]] or any other of the internal slots that are specific to TypedArray instance objects. +features: [TypedArray] ---*/ assert.throws(TypeError, function() { diff --git a/test/built-ins/TypedArrays/Uint8Array/BYTES_PER_ELEMENT.js b/test/built-ins/TypedArrays/Uint8Array/BYTES_PER_ELEMENT.js index c27e5c948..d1a45b344 100644 --- a/test/built-ins/TypedArrays/Uint8Array/BYTES_PER_ELEMENT.js +++ b/test/built-ins/TypedArrays/Uint8Array/BYTES_PER_ELEMENT.js @@ -12,6 +12,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint8Array.BYTES_PER_ELEMENT, 1); diff --git a/test/built-ins/TypedArrays/Uint8Array/constructor.js b/test/built-ins/TypedArrays/Uint8Array/constructor.js index 60cfeb495..d15b76332 100644 --- a/test/built-ins/TypedArrays/Uint8Array/constructor.js +++ b/test/built-ins/TypedArrays/Uint8Array/constructor.js @@ -6,6 +6,7 @@ es6id: 22.2.4 esid: sec-typedarray-constructors description: > Uint8Array is a constructor function. +features: [TypedArray] ---*/ assert.sameValue(typeof Uint8Array, 'function', 'typeof Uint8Array is "function"'); diff --git a/test/built-ins/TypedArrays/Uint8Array/length.js b/test/built-ins/TypedArrays/Uint8Array/length.js index 1c1cf63db..dcf71bf7b 100644 --- a/test/built-ins/TypedArrays/Uint8Array/length.js +++ b/test/built-ins/TypedArrays/Uint8Array/length.js @@ -21,6 +21,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint8Array.length, 3); diff --git a/test/built-ins/TypedArrays/Uint8Array/name.js b/test/built-ins/TypedArrays/Uint8Array/name.js index dbfc43ecc..fd54dabf8 100644 --- a/test/built-ins/TypedArrays/Uint8Array/name.js +++ b/test/built-ins/TypedArrays/Uint8Array/name.js @@ -19,6 +19,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint8Array.name, "Uint8Array"); diff --git a/test/built-ins/TypedArrays/Uint8Array/prototype.js b/test/built-ins/TypedArrays/Uint8Array/prototype.js index 1f6720744..69a1175ab 100644 --- a/test/built-ins/TypedArrays/Uint8Array/prototype.js +++ b/test/built-ins/TypedArrays/Uint8Array/prototype.js @@ -11,6 +11,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint8Array.prototype, Object.getPrototypeOf(new Uint8Array(0))); diff --git a/test/built-ins/TypedArrays/Uint8Array/prototype/BYTES_PER_ELEMENT.js b/test/built-ins/TypedArrays/Uint8Array/prototype/BYTES_PER_ELEMENT.js index f9752701f..109033c26 100644 --- a/test/built-ins/TypedArrays/Uint8Array/prototype/BYTES_PER_ELEMENT.js +++ b/test/built-ins/TypedArrays/Uint8Array/prototype/BYTES_PER_ELEMENT.js @@ -12,6 +12,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint8Array.prototype.BYTES_PER_ELEMENT, 1); diff --git a/test/built-ins/TypedArrays/Uint8Array/prototype/constructor.js b/test/built-ins/TypedArrays/Uint8Array/prototype/constructor.js index 59c17d132..50fd39c71 100644 --- a/test/built-ins/TypedArrays/Uint8Array/prototype/constructor.js +++ b/test/built-ins/TypedArrays/Uint8Array/prototype/constructor.js @@ -15,6 +15,7 @@ info: | the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint8Array.prototype.constructor, Uint8Array); diff --git a/test/built-ins/TypedArrays/Uint8Array/prototype/not-typedarray-object.js b/test/built-ins/TypedArrays/Uint8Array/prototype/not-typedarray-object.js index 9715bb3ed..c59b0f656 100644 --- a/test/built-ins/TypedArrays/Uint8Array/prototype/not-typedarray-object.js +++ b/test/built-ins/TypedArrays/Uint8Array/prototype/not-typedarray-object.js @@ -10,6 +10,7 @@ info: | A TypedArray prototype object is an ordinary object. It does not have a [[ViewedArrayBuffer]] or any other of the internal slots that are specific to TypedArray instance objects. +features: [TypedArray] ---*/ assert.throws(TypeError, function() { diff --git a/test/built-ins/TypedArrays/Uint8ClampedArray/BYTES_PER_ELEMENT.js b/test/built-ins/TypedArrays/Uint8ClampedArray/BYTES_PER_ELEMENT.js index 32974b0c7..4585d0470 100644 --- a/test/built-ins/TypedArrays/Uint8ClampedArray/BYTES_PER_ELEMENT.js +++ b/test/built-ins/TypedArrays/Uint8ClampedArray/BYTES_PER_ELEMENT.js @@ -12,6 +12,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint8ClampedArray.BYTES_PER_ELEMENT, 1); diff --git a/test/built-ins/TypedArrays/Uint8ClampedArray/constructor.js b/test/built-ins/TypedArrays/Uint8ClampedArray/constructor.js index cb34f7353..1f41a4e12 100644 --- a/test/built-ins/TypedArrays/Uint8ClampedArray/constructor.js +++ b/test/built-ins/TypedArrays/Uint8ClampedArray/constructor.js @@ -6,6 +6,7 @@ es6id: 22.2.4 esid: sec-typedarray-constructors description: > Uint8ClampedArray is a constructor function. +features: [TypedArray] ---*/ assert.sameValue(typeof Uint8ClampedArray, 'function', 'typeof Uint8ClampedArray is "function"'); diff --git a/test/built-ins/TypedArrays/Uint8ClampedArray/length.js b/test/built-ins/TypedArrays/Uint8ClampedArray/length.js index e3ccfd54b..3a0314d64 100644 --- a/test/built-ins/TypedArrays/Uint8ClampedArray/length.js +++ b/test/built-ins/TypedArrays/Uint8ClampedArray/length.js @@ -21,6 +21,7 @@ info: | object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint8ClampedArray.length, 3); diff --git a/test/built-ins/TypedArrays/Uint8ClampedArray/name.js b/test/built-ins/TypedArrays/Uint8ClampedArray/name.js index fac664679..d5dbb8021 100644 --- a/test/built-ins/TypedArrays/Uint8ClampedArray/name.js +++ b/test/built-ins/TypedArrays/Uint8ClampedArray/name.js @@ -19,6 +19,7 @@ info: | object, if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint8ClampedArray.name, "Uint8ClampedArray"); diff --git a/test/built-ins/TypedArrays/Uint8ClampedArray/prototype.js b/test/built-ins/TypedArrays/Uint8ClampedArray/prototype.js index 962b09534..a3217b0a9 100644 --- a/test/built-ins/TypedArrays/Uint8ClampedArray/prototype.js +++ b/test/built-ins/TypedArrays/Uint8ClampedArray/prototype.js @@ -11,6 +11,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint8ClampedArray.prototype, Object.getPrototypeOf(new Uint8ClampedArray(0))); diff --git a/test/built-ins/TypedArrays/Uint8ClampedArray/prototype/BYTES_PER_ELEMENT.js b/test/built-ins/TypedArrays/Uint8ClampedArray/prototype/BYTES_PER_ELEMENT.js index 0f744d9f2..d7c3a9995 100644 --- a/test/built-ins/TypedArrays/Uint8ClampedArray/prototype/BYTES_PER_ELEMENT.js +++ b/test/built-ins/TypedArrays/Uint8ClampedArray/prototype/BYTES_PER_ELEMENT.js @@ -12,6 +12,7 @@ info: | This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint8ClampedArray.prototype.BYTES_PER_ELEMENT, 1); diff --git a/test/built-ins/TypedArrays/Uint8ClampedArray/prototype/constructor.js b/test/built-ins/TypedArrays/Uint8ClampedArray/prototype/constructor.js index 0223f2e42..dd8c53542 100644 --- a/test/built-ins/TypedArrays/Uint8ClampedArray/prototype/constructor.js +++ b/test/built-ins/TypedArrays/Uint8ClampedArray/prototype/constructor.js @@ -15,6 +15,7 @@ info: | the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified. includes: [propertyHelper.js] +features: [TypedArray] ---*/ assert.sameValue(Uint8ClampedArray.prototype.constructor, Uint8ClampedArray); diff --git a/test/built-ins/TypedArrays/Uint8ClampedArray/prototype/not-typedarray-object.js b/test/built-ins/TypedArrays/Uint8ClampedArray/prototype/not-typedarray-object.js index c8a8b3c83..b67a0a062 100644 --- a/test/built-ins/TypedArrays/Uint8ClampedArray/prototype/not-typedarray-object.js +++ b/test/built-ins/TypedArrays/Uint8ClampedArray/prototype/not-typedarray-object.js @@ -10,6 +10,7 @@ info: | A TypedArray prototype object is an ordinary object. It does not have a [[ViewedArrayBuffer]] or any other of the internal slots that are specific to TypedArray instance objects. +features: [TypedArray] ---*/ assert.throws(TypeError, function() { diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-conversion-operation-consistent-nan.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-conversion-operation-consistent-nan.js index a81d4c504..d01684942 100644 --- a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-conversion-operation-consistent-nan.js +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-conversion-operation-consistent-nan.js @@ -46,6 +46,7 @@ info: | each implementation distinguishable NaN value. ... includes: [nans.js, testTypedArray.js, compareArray.js] +features: [TypedArray] ---*/ function body(FloatArray) { diff --git a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-conversion-operation.js b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-conversion-operation.js index d14a14023..959054911 100644 --- a/test/built-ins/TypedArrays/ctors/object-arg/object-arg-conversion-operation.js +++ b/test/built-ins/TypedArrays/ctors/object-arg/object-arg-conversion-operation.js @@ -43,6 +43,7 @@ info: | e. Else, ... includes: [byteConversionValues.js, testTypedArray.js] +features: [TypedArray] ---*/ testTypedArrayConversions(byteConversionValues, function(TA, value, expected) { diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/conversion-operation-consistent-nan.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/conversion-operation-consistent-nan.js index 19323c66d..c990ecd97 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/conversion-operation-consistent-nan.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/conversion-operation-consistent-nan.js @@ -45,6 +45,7 @@ info: | each implementation distinguishable NaN value. ... includes: [nans.js, testTypedArray.js, compareArray.js] +features: [TypedArray] ---*/ function body(FloatArray) { diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/conversion-operation.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/conversion-operation.js index f78228c5b..a496517ea 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/conversion-operation.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/conversion-operation.js @@ -42,6 +42,7 @@ info: | e. Else, ... includes: [byteConversionValues.js, testTypedArray.js] +features: [TypedArray] ---*/ testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { diff --git a/test/built-ins/TypedArrays/internals/Set/conversion-operation-consistent-nan.js b/test/built-ins/TypedArrays/internals/Set/conversion-operation-consistent-nan.js index 71703cd5f..39a672a64 100644 --- a/test/built-ins/TypedArrays/internals/Set/conversion-operation-consistent-nan.js +++ b/test/built-ins/TypedArrays/internals/Set/conversion-operation-consistent-nan.js @@ -42,6 +42,7 @@ info: | each implementation distinguishable NaN value. ... includes: [nans.js, testTypedArray.js, compareArray.js] +features: [TypedArray] ---*/ function body(FloatArray) { diff --git a/test/built-ins/TypedArrays/internals/Set/conversion-operation.js b/test/built-ins/TypedArrays/internals/Set/conversion-operation.js index 7ef883bcd..e7eedd407 100644 --- a/test/built-ins/TypedArrays/internals/Set/conversion-operation.js +++ b/test/built-ins/TypedArrays/internals/Set/conversion-operation.js @@ -39,6 +39,7 @@ info: | e. Else, ... includes: [byteConversionValues.js, testTypedArray.js] +features: [TypedArray] ---*/ testTypedArrayConversions(byteConversionValues, function(TA, value, expected, initial) { -- cgit v1.2.1 From 3f3f2faa8e71eaa3f316635dc8fb3c3a0661b654 Mon Sep 17 00:00:00 2001 From: Leo Balter Date: Thu, 15 Feb 2018 12:52:26 -0500 Subject: whitespace --- harness/testBigIntTypedArray.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/harness/testBigIntTypedArray.js b/harness/testBigIntTypedArray.js index 90bb3aee4..4b0e332d8 100644 --- a/harness/testBigIntTypedArray.js +++ b/harness/testBigIntTypedArray.js @@ -17,7 +17,7 @@ var BigIntTypedArrayConstructors = [ * The %TypedArray% intrinsic constructor function. */ var TypedArray = Object.getPrototypeOf(Int8Array); - + function convertToBigInt(x) { return (Array.isArray(x)) ? x.map(convertToBigInt) : BigInt(x); } @@ -74,4 +74,3 @@ function testBigIntTypedArrayConversions(byteConversionValues, fn) { }); }); } - \ No newline at end of file -- cgit v1.2.1 From 098c69540ee57f94daf795b20e8a3e70ab986860 Mon Sep 17 00:00:00 2001 From: Leo Balter Date: Thu, 15 Feb 2018 13:00:09 -0500 Subject: Remove N() --- harness/testTypedArray.js | 6 +- .../prototype/copyWithin/coerced-values-end.js | 26 ++--- .../prototype/copyWithin/coerced-values-start.js | 34 +++---- .../prototype/copyWithin/coerced-values-target.js | 34 +++---- .../prototype/copyWithin/negative-end.js | 34 +++---- .../copyWithin/negative-out-of-bounds-end.js | 42 ++++---- .../copyWithin/negative-out-of-bounds-start.js | 34 +++---- .../copyWithin/negative-out-of-bounds-target.js | 18 ++-- .../prototype/copyWithin/negative-start.js | 26 ++--- .../prototype/copyWithin/negative-target.js | 14 +-- .../copyWithin/non-negative-out-of-bounds-end.js | 18 ++-- .../non-negative-out-of-bounds-target-and-start.js | 30 +++--- .../copyWithin/non-negative-target-and-start.js | 18 ++-- .../non-negative-target-start-and-end.js | 22 ++--- .../TypedArray/prototype/copyWithin/return-this.js | 4 +- .../prototype/copyWithin/undefined-end.js | 10 +- .../TypedArray/prototype/entries/iter-prototype.js | 4 +- .../TypedArray/prototype/entries/return-itor.js | 10 +- .../every/callbackfn-arguments-with-thisarg.js | 10 +- .../every/callbackfn-arguments-without-thisarg.js | 10 +- .../callbackfn-no-interaction-over-non-integer.js | 8 +- .../callbackfn-return-does-not-change-instance.js | 10 +- .../callbackfn-set-value-during-interaction.js | 16 +-- .../every/get-length-uses-internal-arraylength.js | 4 +- .../prototype/every/values-are-not-cached.js | 8 +- .../TypedArray/prototype/fill/coerced-indexes.js | 30 +++--- .../prototype/fill/fill-values-conversion-once.js | 8 +- .../fill/fill-values-custom-start-and-end.js | 12 +-- .../prototype/fill/fill-values-non-numeric.js | 26 ++--- .../prototype/fill/fill-values-relative-end.js | 10 +- .../prototype/fill/fill-values-relative-start.js | 10 +- .../TypedArray/prototype/fill/fill-values.js | 6 +- .../fill/get-length-ignores-length-prop.js | 4 +- .../prototype/fill/return-abrupt-from-end.js | 4 +- .../prototype/fill/return-abrupt-from-set-value.js | 4 +- .../prototype/fill/return-abrupt-from-start.js | 4 +- .../TypedArray/prototype/fill/return-this.js | 6 +- .../filter/callbackfn-arguments-with-thisarg.js | 10 +- .../filter/callbackfn-arguments-without-thisarg.js | 10 +- .../callbackfn-no-iteration-over-non-integer.js | 8 +- .../callbackfn-return-does-not-change-instance.js | 10 +- .../callbackfn-set-value-during-iteration.js | 16 +-- .../filter/result-does-not-share-buffer.js | 4 +- .../filter/result-full-callbackfn-returns-true.js | 4 +- .../filter/speciesctor-get-ctor-abrupt.js | 4 +- .../filter/speciesctor-get-ctor-inherited.js | 4 +- .../filter/speciesctor-get-ctor-returns-throws.js | 4 +- .../prototype/filter/speciesctor-get-ctor.js | 4 +- ...eciesctor-get-species-custom-ctor-invocation.js | 6 +- ...species-custom-ctor-returns-another-instance.js | 4 +- .../filter/speciesctor-get-species-custom-ctor.js | 6 +- .../prototype/filter/values-are-not-cached.js | 8 +- .../TypedArray/prototype/filter/values-are-set.js | 10 +- .../find/get-length-ignores-length-prop.js | 6 +- .../prototype/find/predicate-call-changes-value.js | 24 ++--- .../prototype/find/predicate-call-parameters.js | 10 +- .../return-found-value-predicate-result-is-true.js | 20 ++-- .../findIndex/get-length-ignores-length-prop.js | 4 +- .../findIndex/predicate-call-changes-value.js | 18 ++-- .../findIndex/predicate-call-parameters.js | 10 +- .../return-index-predicate-result-is-true.js | 6 +- ...egative-one-if-predicate-returns-false-value.js | 4 +- .../forEach/callbackfn-arguments-with-thisarg.js | 10 +- .../callbackfn-arguments-without-thisarg.js | 10 +- .../callbackfn-no-interaction-over-non-integer.js | 8 +- .../callbackfn-return-does-not-change-instance.js | 10 +- .../callbackfn-set-value-during-interaction.js | 16 +-- .../prototype/forEach/values-are-not-cached.js | 8 +- .../prototype/includes/fromIndex-infinity.js | 8 +- .../prototype/includes/fromIndex-minus-zero.js | 10 +- .../get-length-uses-internal-arraylength.js | 6 +- .../return-abrupt-tointeger-fromindex-symbol.js | 6 +- .../includes/return-abrupt-tointeger-fromindex.js | 6 +- .../includes/search-found-returns-true.js | 22 ++--- .../includes/search-not-found-returns-false.js | 16 +-- .../prototype/includes/tointeger-fromindex.js | 36 +++---- .../prototype/indexOf/fromIndex-infinity.js | 8 +- .../prototype/indexOf/fromIndex-minus-zero.js | 8 +- .../get-length-uses-internal-arraylength.js | 6 +- .../indexOf/search-found-returns-index.js | 22 ++--- .../indexOf/search-not-found-returns-minus-one.js | 16 +-- .../prototype/indexOf/tointeger-fromindex.js | 36 +++---- ...or-result-from-tostring-on-each-simple-value.js | 4 +- .../join/get-length-uses-internal-arraylength.js | 4 +- .../result-from-tostring-on-each-simple-value.js | 4 +- .../TypedArray/prototype/keys/iter-prototype.js | 4 +- .../TypedArray/prototype/keys/return-itor.js | 4 +- .../prototype/lastIndexOf/fromIndex-infinity.js | 8 +- .../prototype/lastIndexOf/fromIndex-minus-zero.js | 8 +- .../get-length-uses-internal-arraylength.js | 6 +- .../lastIndexOf/search-found-returns-index.js | 48 ++++----- .../search-not-found-returns-minus-one.js | 24 ++--- .../prototype/lastIndexOf/tointeger-fromindex.js | 36 +++---- .../prototype/map/arraylength-internal.js | 6 +- .../map/callbackfn-arguments-with-thisarg.js | 12 +-- .../map/callbackfn-arguments-without-thisarg.js | 12 +-- .../prototype/map/callbackfn-detachbuffer.js | 2 +- ...n-no-interaction-over-non-integer-properties.js | 10 +- .../callbackfn-return-affects-returned-object.js | 12 +-- .../callbackfn-return-does-not-change-instance.js | 12 +-- ...-return-does-not-copy-non-integer-properties.js | 6 +- .../map/callbackfn-set-value-during-interaction.js | 18 ++-- .../TypedArray/prototype/map/callbackfn-this.js | 6 +- .../prototype/map/values-are-not-cached.js | 10 +- .../callbackfn-arguments-custom-accumulator.js | 10 +- .../callbackfn-arguments-default-accumulator.js | 14 +-- ...kfn-no-iteration-over-non-integer-properties.js | 8 +- .../callbackfn-return-does-not-change-instance.js | 10 +- .../callbackfn-set-value-during-iteration.js | 16 +-- .../reduce/get-length-uses-internal-arraylength.js | 4 +- .../reduce/result-is-last-callbackfn-return.js | 6 +- .../prototype/reduce/result-of-any-type.js | 4 +- .../return-first-value-without-callbackfn.js | 6 +- .../prototype/reduce/values-are-not-cached.js | 8 +- .../callbackfn-arguments-custom-accumulator.js | 10 +- .../callbackfn-arguments-default-accumulator.js | 14 +-- ...kfn-no-iteration-over-non-integer-properties.js | 8 +- .../callbackfn-return-does-not-change-instance.js | 10 +- .../callbackfn-set-value-during-iteration.js | 16 +-- .../get-length-uses-internal-arraylength.js | 4 +- .../result-is-last-callbackfn-return.js | 6 +- .../prototype/reduceRight/result-of-any-type.js | 4 +- .../return-first-value-without-callbackfn.js | 6 +- .../prototype/reduceRight/values-are-not-cached.js | 8 +- .../get-length-uses-internal-arraylength.js | 4 +- .../TypedArray/prototype/reverse/reverts.js | 30 +++--- .../prototype/set/array-arg-offset-tointeger.js | 110 ++++++++++----------- .../array-arg-return-abrupt-from-src-get-length.js | 4 +- .../array-arg-return-abrupt-from-src-get-value.js | 12 +-- ...ray-arg-return-abrupt-from-src-length-symbol.js | 4 +- .../set/array-arg-return-abrupt-from-src-length.js | 4 +- ...return-abrupt-from-src-tonumber-value-symbol.js | 12 +-- ...ay-arg-return-abrupt-from-src-tonumber-value.js | 12 +-- ...array-arg-return-abrupt-from-toobject-offset.js | 4 +- .../prototype/set/array-arg-set-values-in-order.js | 10 +- .../prototype/set/array-arg-set-values.js | 32 +++--- ...rray-arg-src-tonumber-value-type-conversions.js | 8 +- .../set/array-arg-src-values-are-not-cached.js | 22 ++--- .../set/array-arg-target-arraylength-internal.js | 4 +- ...argetbuffer-detached-on-get-src-value-throws.js | 6 +- .../set/typedarray-arg-offset-tointeger.js | 76 +++++++------- ...darray-arg-set-values-diff-buffer-other-type.js | 16 +-- ...edarray-arg-set-values-diff-buffer-same-type.js | 16 +-- ...edarray-arg-set-values-same-buffer-same-type.js | 14 +-- .../set/typedarray-arg-src-arraylength-internal.js | 4 +- .../set/typedarray-arg-src-byteoffset-internal.js | 6 +- .../typedarray-arg-target-arraylength-internal.js | 4 +- .../typedarray-arg-target-byteoffset-internal.js | 6 +- .../prototype/slice/arraylength-internal.js | 8 +- .../TypedArray/prototype/slice/infinity.js | 8 +- .../TypedArray/prototype/slice/minus-zero.js | 8 +- .../result-does-not-copy-ordinary-properties.js | 4 +- .../slice/results-with-different-length.js | 60 +++++------ .../prototype/slice/results-with-empty-length.js | 4 +- .../prototype/slice/results-with-same-length.js | 12 +-- .../slice/set-values-from-different-ctor-type.js | 6 +- .../prototype/slice/speciesctor-get-ctor-abrupt.js | 4 +- .../slice/speciesctor-get-ctor-inherited.js | 4 +- .../slice/speciesctor-get-ctor-returns-throws.js | 4 +- .../prototype/slice/speciesctor-get-ctor.js | 4 +- ...eciesctor-get-species-custom-ctor-invocation.js | 4 +- ...species-custom-ctor-returns-another-instance.js | 4 +- .../slice/speciesctor-get-species-custom-ctor.js | 6 +- .../TypedArray/prototype/slice/tointeger-end.js | 20 ++-- .../TypedArray/prototype/slice/tointeger-start.js | 30 +++--- .../some/callbackfn-arguments-with-thisarg.js | 10 +- .../some/callbackfn-arguments-without-thisarg.js | 10 +- .../callbackfn-no-interaction-over-non-integer.js | 8 +- .../callbackfn-return-does-not-change-instance.js | 10 +- .../callbackfn-set-value-during-interaction.js | 16 +-- .../some/get-length-uses-internal-arraylength.js | 4 +- .../prototype/some/values-are-not-cached.js | 8 +- .../prototype/sort/arraylength-internal.js | 4 +- .../prototype/sort/comparefn-call-throws.js | 4 +- .../TypedArray/prototype/sort/comparefn-calls.js | 8 +- .../sort/comparefn-nonfunction-call-throws.js | 4 +- .../prototype/sort/return-same-instance.js | 4 +- .../prototype/sort/sortcompare-with-no-tostring.js | 6 +- .../TypedArray/prototype/sort/sorted-values.js | 18 ++-- .../TypedArray/prototype/subarray/infinity.js | 8 +- .../TypedArray/prototype/subarray/minus-zero.js | 8 +- .../result-does-not-copy-ordinary-properties.js | 4 +- .../result-is-new-instance-from-same-ctor.js | 6 +- .../result-is-new-instance-with-shared-buffer.js | 12 +-- .../subarray/results-with-different-length.js | 60 +++++------ .../subarray/results-with-empty-length.js | 4 +- .../prototype/subarray/results-with-same-length.js | 12 +-- .../subarray/speciesctor-get-ctor-abrupt.js | 4 +- .../subarray/speciesctor-get-ctor-inherited.js | 4 +- .../speciesctor-get-ctor-returns-throws.js | 4 +- .../prototype/subarray/speciesctor-get-ctor.js | 4 +- ...eciesctor-get-species-custom-ctor-invocation.js | 4 +- ...species-custom-ctor-returns-another-instance.js | 4 +- .../speciesctor-get-species-custom-ctor.js | 6 +- .../prototype/subarray/tointeger-begin.js | 30 +++--- .../TypedArray/prototype/subarray/tointeger-end.js | 20 ++-- .../calls-tolocalestring-from-each-value.js | 6 +- .../calls-tostring-from-each-value.js | 2 +- .../calls-valueof-from-each-value.js | 2 +- .../get-length-uses-internal-arraylength.js | 2 +- ...turn-abrupt-from-firstelement-tolocalestring.js | 2 +- .../return-abrupt-from-firstelement-tostring.js | 2 +- .../return-abrupt-from-firstelement-valueof.js | 2 +- ...eturn-abrupt-from-nextelement-tolocalestring.js | 2 +- .../return-abrupt-from-nextelement-tostring.js | 2 +- .../return-abrupt-from-nextelement-valueof.js | 2 +- .../prototype/toLocaleString/return-result.js | 2 +- .../TypedArray/prototype/values/iter-prototype.js | 2 +- .../TypedArray/prototype/values/return-itor.js | 10 +- 209 files changed, 1219 insertions(+), 1221 deletions(-) diff --git a/harness/testTypedArray.js b/harness/testTypedArray.js index bf6c4875e..2699214ca 100644 --- a/harness/testTypedArray.js +++ b/harness/testTypedArray.js @@ -41,11 +41,9 @@ var TypedArray = Object.getPrototypeOf(Int8Array); function testWithTypedArrayConstructors(f, selected) { var constructors = selected || typedArrayConstructors; for (var i = 0; i < constructors.length; ++i) { - // TODO: Remove this - var N = function(x) { return x; }; var constructor = constructors[i]; try { - f(constructor, N); + f(constructor); } catch (e) { e.message += " (Testing with " + constructor.name + ".)"; throw e; @@ -77,5 +75,5 @@ function testTypedArrayConversions(byteConversionValues, fn) { } fn(TA, value, exp, initial); }); - }, numericTypedArrayConstructors); + }); } diff --git a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js index 19f06fbd3..225f52cea 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js @@ -26,51 +26,51 @@ includes: [compareArray.js, testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(1, 0, null), - N([0, 1, 2, 3]) + new TA([0, 1, 2, 3]).copyWithin(1, 0, null), + [0, 1, 2, 3] ), 'null value coerced to 0' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(1, 0, NaN), - N([0, 1, 2, 3]) + new TA([0, 1, 2, 3]).copyWithin(1, 0, NaN), + [0, 1, 2, 3] ), 'NaN value coerced to 0' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(1, 0, false), - N([0, 1, 2, 3]) + new TA([0, 1, 2, 3]).copyWithin(1, 0, false), + [0, 1, 2, 3] ), 'false value coerced to 0' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(1, 0, true), - N([0, 0, 2, 3]) + new TA([0, 1, 2, 3]).copyWithin(1, 0, true), + [0, 0, 2, 3] ), 'true value coerced to 1' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(1, 0, '-2'), - N([0, 0, 1, 3]) + new TA([0, 1, 2, 3]).copyWithin(1, 0, '-2'), + [0, 0, 1, 3] ), 'string "-2" value coerced to integer -2' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(1, 0, -2.5), - N([0, 0, 1, 3]) + new TA([0, 1, 2, 3]).copyWithin(1, 0, -2.5), + [0, 0, 1, 3] ), 'float -2.5 value coerced to integer -2' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js index b1e1fc5a3..45aa223aa 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js @@ -25,67 +25,67 @@ includes: [compareArray.js, testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(1, undefined), - N([0, 0, 1, 2]) + new TA([0, 1, 2, 3]).copyWithin(1, undefined), + [0, 0, 1, 2] ), 'undefined value coerced to 0' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(1, false), - N([0, 0, 1, 2]) + new TA([0, 1, 2, 3]).copyWithin(1, false), + [0, 0, 1, 2] ), 'false value coerced to 0' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(1, NaN), - N([0, 0, 1, 2]) + new TA([0, 1, 2, 3]).copyWithin(1, NaN), + [0, 0, 1, 2] ), 'NaN value coerced to 0' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(1, null), - N([0, 0, 1, 2]) + new TA([0, 1, 2, 3]).copyWithin(1, null), + [0, 0, 1, 2] ), 'null value coerced to 0' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(0, true), - N([1, 2, 3, 3]) + new TA([0, 1, 2, 3]).copyWithin(0, true), + [1, 2, 3, 3] ), 'true value coerced to 1' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(0, '1'), - N([1, 2, 3, 3]) + new TA([0, 1, 2, 3]).copyWithin(0, '1'), + [1, 2, 3, 3] ), 'string "1" value coerced to 1' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(1, 0.5), - N([0, 0, 1, 2]) + new TA([0, 1, 2, 3]).copyWithin(1, 0.5), + [0, 0, 1, 2] ), '0.5 float value coerced to integer 0' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(0, 1.5), - N([1, 2, 3, 3]) + new TA([0, 1, 2, 3]).copyWithin(0, 1.5), + [1, 2, 3, 3] ), '1.5 float value coerced to integer 1' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js index fc8b1de9d..1f20f4ecf 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js @@ -25,67 +25,67 @@ includes: [compareArray.js, testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(undefined, 1), - N([1, 2, 3, 3]) + new TA([0, 1, 2, 3]).copyWithin(undefined, 1), + [1, 2, 3, 3] ), 'undefined value coerced to 0' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(false, 1), - N([1, 2, 3, 3]) + new TA([0, 1, 2, 3]).copyWithin(false, 1), + [1, 2, 3, 3] ), 'false value coerced to 0' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(NaN, 1), - N([1, 2, 3, 3]) + new TA([0, 1, 2, 3]).copyWithin(NaN, 1), + [1, 2, 3, 3] ), 'NaN value coerced to 0' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(null, 1), - N([1, 2, 3, 3]) + new TA([0, 1, 2, 3]).copyWithin(null, 1), + [1, 2, 3, 3] ), 'null value coerced to 0' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(true, 0), - N([0, 0, 1, 2]) + new TA([0, 1, 2, 3]).copyWithin(true, 0), + [0, 0, 1, 2] ), 'true value coerced to 1' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin('1', 0), - N([0, 0, 1, 2]) + new TA([0, 1, 2, 3]).copyWithin('1', 0), + [0, 0, 1, 2] ), 'string "1" value coerced to 1' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(0.5, 1), - N([1, 2, 3, 3]) + new TA([0, 1, 2, 3]).copyWithin(0.5, 1), + [1, 2, 3, 3] ), '0.5 float value coerced to integer 0' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(1.5, 0), - N([0, 0, 1, 2]) + new TA([0, 1, 2, 3]).copyWithin(1.5, 0), + [0, 0, 1, 2] ), '1.5 float value coerced to integer 1' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js index f1b881b6f..cc97dacf1 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js @@ -28,67 +28,67 @@ includes: [compareArray.js, testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(0, 1, -1), - N([1, 2, 2, 3]) + new TA([0, 1, 2, 3]).copyWithin(0, 1, -1), + [1, 2, 2, 3] ), '[0, 1, 2, 3].copyWithin(0, 1, -1) -> [1, 2, 2, 3]' ); assert( compareArray( - new TA(N([0, 1, 2, 3, 4])).copyWithin(2, 0, -1), - N([0, 1, 0, 1, 2]) + new TA([0, 1, 2, 3, 4]).copyWithin(2, 0, -1), + [0, 1, 0, 1, 2] ), '[0, 1, 2, 3, 4].copyWithin(2, 0, -1) -> [0, 1, 0, 1, 2]' ); assert( compareArray( - new TA(N([0, 1, 2, 3, 4])).copyWithin(1, 2, -2), - N([0, 2, 2, 3, 4]) + new TA([0, 1, 2, 3, 4]).copyWithin(1, 2, -2), + [0, 2, 2, 3, 4] ), '[0, 1, 2, 3, 4].copyWithin(1, 2, -2) -> [0, 2, 2, 3, 4]' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(0, -2, -1), - N([2, 1, 2, 3]) + new TA([0, 1, 2, 3]).copyWithin(0, -2, -1), + [2, 1, 2, 3] ), '[0, 1, 2, 3].copyWithin(0, -2, -1) -> [2, 1, 2, 3]' ); assert( compareArray( - new TA(N([0, 1, 2, 3, 4])).copyWithin(2, -2, -1), - N([0, 1, 3, 3, 4]) + new TA([0, 1, 2, 3, 4]).copyWithin(2, -2, -1), + [0, 1, 3, 3, 4] ), '[0, 1, 2, 3, 4].copyWithin(2, -2, 1) -> [0, 1, 3, 3, 4]' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(-3, -2, -1), - N([0, 2, 2, 3]) + new TA([0, 1, 2, 3]).copyWithin(-3, -2, -1), + [0, 2, 2, 3] ), '[0, 1, 2, 3].copyWithin(-3, -2, -1) -> [0, 2, 2, 3]' ); assert( compareArray( - new TA(N([0, 1, 2, 3, 4])).copyWithin(-2, -3, -1), - N([0, 1, 2, 2, 3]) + new TA([0, 1, 2, 3, 4]).copyWithin(-2, -3, -1), + [0, 1, 2, 2, 3] ), '[0, 1, 2, 3, 4].copyWithin(-2, -3, -1) -> [0, 1, 2, 2, 3]' ); assert( compareArray( - new TA(N([0, 1, 2, 3, 4])).copyWithin(-5, -2, -1), - N([3, 1, 2, 3, 4]) + new TA([0, 1, 2, 3, 4]).copyWithin(-5, -2, -1), + [3, 1, 2, 3, 4] ), '[0, 1, 2, 3, 4].copyWithin(-5, -2, -1) -> [3, 1, 2, 3, 4]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js index d3a12fe31..6f77a75cd 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-end.js @@ -28,83 +28,83 @@ includes: [compareArray.js, testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(0, 1, -10), - N([0, 1, 2, 3]) + new TA([0, 1, 2, 3]).copyWithin(0, 1, -10), + [0, 1, 2, 3] ), '[0, 1, 2, 3].copyWithin(0, 1, -10) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA(N([1, 2, 3, 4, 5])).copyWithin(0, 1, -Infinity), - N([1, 2, 3, 4, 5]) + new TA([1, 2, 3, 4, 5]).copyWithin(0, 1, -Infinity), + [1, 2, 3, 4, 5] ), '[1, 2, 3, 4, 5].copyWithin(0, 1, -Infinity) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(0, -2, -10), - N([0, 1, 2, 3]) + new TA([0, 1, 2, 3]).copyWithin(0, -2, -10), + [0, 1, 2, 3] ), '[0, 1, 2, 3].copyWithin(0, -2, -10) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA(N([1, 2, 3, 4, 5])).copyWithin(0, -2, -Infinity), - N([1, 2, 3, 4, 5]) + new TA([1, 2, 3, 4, 5]).copyWithin(0, -2, -Infinity), + [1, 2, 3, 4, 5] ), '[1, 2, 3, 4, 5].copyWithin(0, -2, -Infinity) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(0, -9, -10), - N([0, 1, 2, 3]) + new TA([0, 1, 2, 3]).copyWithin(0, -9, -10), + [0, 1, 2, 3] ), '[0, 1, 2, 3].copyWithin(0, -9, -10) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA(N([1, 2, 3, 4, 5])).copyWithin(0, -9, -Infinity), - N([1, 2, 3, 4, 5]) + new TA([1, 2, 3, 4, 5]).copyWithin(0, -9, -Infinity), + [1, 2, 3, 4, 5] ), '[1, 2, 3, 4, 5].copyWithin(0, -9, -Infinity) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(-3, -2, -10), - N([0, 1, 2, 3]) + new TA([0, 1, 2, 3]).copyWithin(-3, -2, -10), + [0, 1, 2, 3] ), '[0, 1, 2, 3].copyWithin(-3, -2, -10) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA(N([1, 2, 3, 4, 5])).copyWithin(-3, -2, -Infinity), - N([1, 2, 3, 4, 5]) + new TA([1, 2, 3, 4, 5]).copyWithin(-3, -2, -Infinity), + [1, 2, 3, 4, 5] ), '[1, 2, 3, 4, 5].copyWithin(-3, -2, -Infinity) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(-7, -8, -9), - N([0, 1, 2, 3]) + new TA([0, 1, 2, 3]).copyWithin(-7, -8, -9), + [0, 1, 2, 3] ), '[0, 1, 2, 3].copyWithin(-7, -8, -9) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA(N([1, 2, 3, 4, 5])).copyWithin(-7, -8, -Infinity), - N([1, 2, 3, 4, 5]) + new TA([1, 2, 3, 4, 5]).copyWithin(-7, -8, -Infinity), + [1, 2, 3, 4, 5] ), '[1, 2, 3, 4, 5].copyWithin(-7, -8, -Infinity) -> [1, 2, 3, 4, 5]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js index 4a5b207e2..456f3ed44 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-start.js @@ -26,67 +26,67 @@ includes: [compareArray.js, testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(0, -10), - N([0, 1, 2, 3]) + new TA([0, 1, 2, 3]).copyWithin(0, -10), + [0, 1, 2, 3] ), '[0, 1, 2, 3]).copyWithin(0, -10) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA(N([1, 2, 3, 4, 5])).copyWithin(0, -Infinity), - N([1, 2, 3, 4, 5]) + new TA([1, 2, 3, 4, 5]).copyWithin(0, -Infinity), + [1, 2, 3, 4, 5] ), '[1, 2, 3, 4, 5]).copyWithin(0, -Infinity) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA(N([0, 1, 2, 3, 4])).copyWithin(2, -10), - N([0, 1, 0, 1, 2]) + new TA([0, 1, 2, 3, 4]).copyWithin(2, -10), + [0, 1, 0, 1, 2] ), '[0, 1, 2, 3, 4]).copyWithin(2, -2) -> [0, 1, 0, 1, 2]' ); assert( compareArray( - new TA(N([1, 2, 3, 4, 5])).copyWithin(2, -Infinity), - N([1, 2, 1, 2, 3]) + new TA([1, 2, 3, 4, 5]).copyWithin(2, -Infinity), + [1, 2, 1, 2, 3] ), '[1, 2, 3, 4, 5]).copyWithin(2, -Infinity) -> [1, 2, 1, 2, 3]' ); assert( compareArray( - new TA(N([0, 1, 2, 3, 4])).copyWithin(10, -10), - N([0, 1, 2, 3, 4]) + new TA([0, 1, 2, 3, 4]).copyWithin(10, -10), + [0, 1, 2, 3, 4] ), '[0, 1, 2, 3, 4]).copyWithin(10, -10) -> [0, 1, 2, 3, 4]' ); assert( compareArray( - new TA(N([1, 2, 3, 4, 5])).copyWithin(10, -Infinity), - N([1, 2, 3, 4, 5]) + new TA([1, 2, 3, 4, 5]).copyWithin(10, -Infinity), + [1, 2, 3, 4, 5] ), '[1, 2, 3, 4, 5]).copyWithin(10, -Infinity) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(-9, -10), - N([0, 1, 2, 3]) + new TA([0, 1, 2, 3]).copyWithin(-9, -10), + [0, 1, 2, 3] ), '[0, 1, 2, 3].copyWithin(-9, -10) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA(N([1, 2, 3, 4, 5])).copyWithin(-9, -Infinity), - N([1, 2, 3, 4, 5]) + new TA([1, 2, 3, 4, 5]).copyWithin(-9, -Infinity), + [1, 2, 3, 4, 5] ), '[1, 2, 3, 4, 5].copyWithin(-9, -Infinity) -> [1, 2, 3, 4, 5]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js index e6d4964ca..2ec06c368 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-out-of-bounds-target.js @@ -26,35 +26,35 @@ includes: [compareArray.js, testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(-10, 0), - N([0, 1, 2, 3]) + new TA([0, 1, 2, 3]).copyWithin(-10, 0), + [0, 1, 2, 3] ), '[0, 1, 2, 3].copyWithin(-10, 0) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA(N([1, 2, 3, 4, 5])).copyWithin(-Infinity, 0), - N([1, 2, 3, 4, 5]) + new TA([1, 2, 3, 4, 5]).copyWithin(-Infinity, 0), + [1, 2, 3, 4, 5] ), '[1, 2, 3, 4, 5].copyWithin(-Infinity, 0) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA(N([0, 1, 2, 3, 4])).copyWithin(-10, 2), - N([2, 3, 4, 3, 4]) + new TA([0, 1, 2, 3, 4]).copyWithin(-10, 2), + [2, 3, 4, 3, 4] ), '[0, 1, 2, 3, 4].copyWithin(-10, 2) -> [2, 3, 4, 3, 4]' ); assert( compareArray( - new TA(N([1, 2, 3, 4, 5])).copyWithin(-Infinity, 2), - N([3, 4, 5, 4, 5]) + new TA([1, 2, 3, 4, 5]).copyWithin(-Infinity, 2), + [3, 4, 5, 4, 5] ), '[1, 2, 3, 4, 5].copyWithin(-Infinity, 2) -> [3, 4, 5, 4, 5]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js index 8c16e7a29..4035db6c2 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js @@ -26,51 +26,51 @@ includes: [compareArray.js, testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(0, -1), - N([3, 1, 2, 3]) + new TA([0, 1, 2, 3]).copyWithin(0, -1), + [3, 1, 2, 3] ), '[0, 1, 2, 3].copyWithin(0, -1) -> [3, 1, 2, 3]' ); assert( compareArray( - new TA(N([0, 1, 2, 3, 4])).copyWithin(2, -2), - N([0, 1, 3, 4, 4]) + new TA([0, 1, 2, 3, 4]).copyWithin(2, -2), + [0, 1, 3, 4, 4] ), '[0, 1, 2, 3, 4].copyWithin(2, -2) -> [0, 1, 3, 4, 4]' ); assert( compareArray( - new TA(N([0, 1, 2, 3, 4])).copyWithin(1, -2), - N([0, 3, 4, 3, 4]) + new TA([0, 1, 2, 3, 4]).copyWithin(1, -2), + [0, 3, 4, 3, 4] ), '[0, 1, 2, 3, 4].copyWithin(1, -2) -> [0, 3, 4, 3, 4]' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(-1, -2), - N([0, 1, 2, 2]) + new TA([0, 1, 2, 3]).copyWithin(-1, -2), + [0, 1, 2, 2] ), '[0, 1, 2, 3].copyWithin(-1, -2) -> [ 0, 1, 2, 2 ]' ); assert( compareArray( - new TA(N([0, 1, 2, 3, 4])).copyWithin(-2, -3), - N([0, 1, 2, 2, 3]) + new TA([0, 1, 2, 3, 4]).copyWithin(-2, -3), + [0, 1, 2, 2, 3] ), '[0, 1, 2, 3, 4].copyWithin(-2, -3) -> [0, 1, 2, 2, 3]' ); assert( compareArray( - new TA(N([0, 1, 2, 3, 4])).copyWithin(-5, -2), - N([3, 4, 2, 3, 4]) + new TA([0, 1, 2, 3, 4]).copyWithin(-5, -2), + [3, 4, 2, 3, 4] ), '[0, 1, 2, 3, 4].copyWithin(-5, -2) -> [3, 4, 2, 3, 4]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js index bd99a2ca1..f6cde1f61 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js @@ -26,27 +26,27 @@ includes: [compareArray.js, testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(-1, 0), - N([0, 1, 2, 0]) + new TA([0, 1, 2, 3]).copyWithin(-1, 0), + [0, 1, 2, 0] ), '[0, 1, 2, 3].copyWithin(-1, 0) -> [0, 1, 2, 0]' ); assert( compareArray( - new TA(N([0, 1, 2, 3, 4])).copyWithin(-2, 2), - N([0, 1, 2, 2, 3]) + new TA([0, 1, 2, 3, 4]).copyWithin(-2, 2), + [0, 1, 2, 2, 3] ), '[0, 1, 2, 3, 4].copyWithin(-2, 2) -> [0, 1, 2, 2, 3]' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(-1, 2), - N([0, 1, 2, 2]) + new TA([0, 1, 2, 3]).copyWithin(-1, 2), + [0, 1, 2, 2] ), '[0, 1, 2, 3].copyWithin(-1, 2) -> [0, 1, 2, 2]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js index 676cdced8..f37b8a02b 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-end.js @@ -19,35 +19,35 @@ includes: [compareArray.js, testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(0, 1, 6), - N([1, 2, 3, 3]) + new TA([0, 1, 2, 3]).copyWithin(0, 1, 6), + [1, 2, 3, 3] ), '[0, 1, 2, 3].copyWithin(0, 1, 6) -> [1, 2, 3, 3]' ); assert( compareArray( - new TA(N([1, 2, 3, 4, 5])).copyWithin(0, 1, Infinity), - N([2, 3, 4, 5, 5]) + new TA([1, 2, 3, 4, 5]).copyWithin(0, 1, Infinity), + [2, 3, 4, 5, 5] ), '[1, 2, 3, 4, 5].copyWithin(0, 1, Infinity) -> [2, 3, 4, 5, 5]' ); assert( compareArray( - new TA(N([0, 1, 2, 3, 4, 5])).copyWithin(1, 3, 6), - N([0, 3, 4, 5, 4, 5]) + new TA([0, 1, 2, 3, 4, 5]).copyWithin(1, 3, 6), + [0, 3, 4, 5, 4, 5] ), '[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 6) -> [0, 3, 4, 5, 4, 5]' ); assert( compareArray( - new TA(N([1, 2, 3, 4, 5])).copyWithin(1, 3, Infinity), - N([1, 4, 5, 4, 5]) + new TA([1, 2, 3, 4, 5]).copyWithin(1, 3, Infinity), + [1, 4, 5, 4, 5] ), '[1, 2, 3, 4, 5].copyWithin(1, 3, Infinity) -> [1, 4, 5, 4, 5]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js index af8dd60e4..3862d7b7d 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-out-of-bounds-target-and-start.js @@ -19,55 +19,55 @@ includes: [compareArray.js, testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(N([0, 1, 2, 3, 4, 5])).copyWithin(6, 0), - N([0, 1, 2, 3, 4, 5]) + new TA([0, 1, 2, 3, 4, 5]).copyWithin(6, 0), + [0, 1, 2, 3, 4, 5] ) ); assert( compareArray( - new TA(N([1, 2, 3, 4, 5])).copyWithin(Infinity, 0), - N([1, 2, 3, 4, 5]) + new TA([1, 2, 3, 4, 5]).copyWithin(Infinity, 0), + [1, 2, 3, 4, 5] ), '[1, 2, 3, 4, 5].copyWithin(Infinity, 0) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA(N([0, 1, 2, 3, 4, 5])).copyWithin(0, 6), - N([0, 1, 2, 3, 4, 5]) + new TA([0, 1, 2, 3, 4, 5]).copyWithin(0, 6), + [0, 1, 2, 3, 4, 5] ) ); assert( compareArray( - new TA(N([1, 2, 3, 4, 5])).copyWithin(0, Infinity), - N([1, 2, 3, 4, 5]) + new TA([1, 2, 3, 4, 5]).copyWithin(0, Infinity), + [1, 2, 3, 4, 5] ), '[1, 2, 3, 4, 5].copyWithin(0, Infinity) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA(N([0, 1, 2, 3, 4, 5])).copyWithin(6, 6), - N([0, 1, 2, 3, 4, 5]) + new TA([0, 1, 2, 3, 4, 5]).copyWithin(6, 6), + [0, 1, 2, 3, 4, 5] ) ); assert( compareArray( - new TA(N([0, 1, 2, 3, 4, 5])).copyWithin(10, 10), - N([0, 1, 2, 3, 4, 5]) + new TA([0, 1, 2, 3, 4, 5]).copyWithin(10, 10), + [0, 1, 2, 3, 4, 5] ) ); assert( compareArray( - new TA(N([1, 2, 3, 4, 5])).copyWithin(Infinity, Infinity), - N([1, 2, 3, 4, 5]) + new TA([1, 2, 3, 4, 5]).copyWithin(Infinity, Infinity), + [1, 2, 3, 4, 5] ), '[1, 2, 3, 4, 5].copyWithin(Infinity, Infinity) -> [1, 2, 3, 4, 5]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js index a8270bb4e..0cfd34c5e 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-and-start.js @@ -19,32 +19,32 @@ includes: [compareArray.js, testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(N([1, 2, 3, 4, 5, 6])).copyWithin(0, 0), - N([1, 2, 3, 4, 5, 6]) + new TA([1, 2, 3, 4, 5, 6]).copyWithin(0, 0), + [1, 2, 3, 4, 5, 6] ) ); assert( compareArray( - new TA(N([1, 2, 3, 4, 5, 6])).copyWithin(0, 2), - N([3, 4, 5, 6, 5, 6]) + new TA([1, 2, 3, 4, 5, 6]).copyWithin(0, 2), + [3, 4, 5, 6, 5, 6] ) ); assert( compareArray( - new TA(N([1, 2, 3, 4, 5, 6])).copyWithin(3, 0), - N([1, 2, 3, 1, 2, 3]) + new TA([1, 2, 3, 4, 5, 6]).copyWithin(3, 0), + [1, 2, 3, 1, 2, 3] ) ); assert( compareArray( - new TA(N([0, 1, 2, 3, 4, 5])).copyWithin(1, 4), - N([0, 4, 5, 3, 4, 5]) + new TA([0, 1, 2, 3, 4, 5]).copyWithin(1, 4), + [0, 4, 5, 3, 4, 5] ) ); }); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js index cf35552e1..5ce98d35e 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/non-negative-target-start-and-end.js @@ -19,27 +19,27 @@ includes: [compareArray.js, testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(0, 0, 0), - N([0, 1, 2, 3]) + new TA([0, 1, 2, 3]).copyWithin(0, 0, 0), + [0, 1, 2, 3] ), '[0, 1, 2, 3].copyWithin(0, 0, 0) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(0, 0, 2), - N([0, 1, 2, 3]) + new TA([0, 1, 2, 3]).copyWithin(0, 0, 2), + [0, 1, 2, 3] ), '[0, 1, 2, 3].copyWithin(0, 0, 2) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(0, 1, 2), - N([1, 1, 2, 3]) + new TA([0, 1, 2, 3]).copyWithin(0, 1, 2), + [1, 1, 2, 3] ), '[0, 1, 2, 3].copyWithin(0, 1, 2) -> [1, 1, 2, 3]' ); @@ -57,16 +57,16 @@ testWithTypedArrayConstructors(function(TA, N) { */ assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(1, 0, 2), - N([0, 0, 1, 3]) + new TA([0, 1, 2, 3]).copyWithin(1, 0, 2), + [0, 0, 1, 3] ), '[0, 1, 2, 3].copyWithin(1, 0, 2) -> [0, 0, 1, 3]' ); assert( compareArray( - new TA(N([0, 1, 2, 3, 4, 5])).copyWithin(1, 3, 5), - N([0, 3, 4, 3, 4, 5]) + new TA([0, 1, 2, 3, 4, 5]).copyWithin(1, 3, 5), + [0, 3, 4, 3, 4, 5] ), '[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 5) -> [0, 3, 4, 3, 4, 5]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/return-this.js b/test/built-ins/TypedArray/prototype/copyWithin/return-this.js index 5b3718e85..2ecaa1974 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/return-this.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/return-this.js @@ -23,13 +23,13 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample1 = new TA(); var result1 = sample1.copyWithin(0, 0); assert.sameValue(result1, sample1); - var sample2 = new TA(N([1, 2, 3])); + var sample2 = new TA([1, 2, 3]); var result2 = sample2.copyWithin(1, 0); assert.sameValue(result2, sample2); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js b/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js index 7535edbaf..672878806 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js @@ -26,19 +26,19 @@ includes: [compareArray.js, testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(0, 1, undefined), - N([1, 2, 3, 3]) + new TA([0, 1, 2, 3]).copyWithin(0, 1, undefined), + [1, 2, 3, 3] ), '[0, 1, 2, 3].copyWithin(0, 1, undefined) -> [1, 2, 3]' ); assert( compareArray( - new TA(N([0, 1, 2, 3])).copyWithin(0, 1), - N([1, 2, 3, 3]) + new TA([0, 1, 2, 3]).copyWithin(0, 1), + [1, 2, 3, 3] ), '[0, 1, 2, 3].copyWithin(0, 1) -> [1, 2, 3, 3]' ); diff --git a/test/built-ins/TypedArray/prototype/entries/iter-prototype.js b/test/built-ins/TypedArray/prototype/entries/iter-prototype.js index 0afa22dce..0fae10faf 100644 --- a/test/built-ins/TypedArray/prototype/entries/iter-prototype.js +++ b/test/built-ins/TypedArray/prototype/entries/iter-prototype.js @@ -16,8 +16,8 @@ features: [Symbol.iterator, TypedArray] var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]()); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([0, 42, 64])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([0, 42, 64]); var iter = sample.entries(); assert.sameValue(Object.getPrototypeOf(iter), ArrayIteratorProto); diff --git a/test/built-ins/TypedArray/prototype/entries/return-itor.js b/test/built-ins/TypedArray/prototype/entries/return-itor.js index e52c6c4e1..a3da9e9f9 100644 --- a/test/built-ins/TypedArray/prototype/entries/return-itor.js +++ b/test/built-ins/TypedArray/prototype/entries/return-itor.js @@ -14,20 +14,20 @@ features: [TypedArray] var sample = [0, 42, 64]; -testWithTypedArrayConstructors(function(TA, N) { - var typedArray = new TA(N(sample)); +testWithTypedArrayConstructors(function(TA) { + var typedArray = new TA(sample); var itor = typedArray.entries(); var next = itor.next(); - assert(compareArray(next.value, [0, N(0)])); + assert(compareArray(next.value, [0, 0])); assert.sameValue(next.done, false); next = itor.next(); - assert(compareArray(next.value, [1, N(42)])); + assert(compareArray(next.value, [1, 42])); assert.sameValue(next.done, false); next = itor.next(); - assert(compareArray(next.value, [2, N(64)])); + assert(compareArray(next.value, [2, 64])); assert.sameValue(next.done, false); next = itor.next(); diff --git a/test/built-ins/TypedArray/prototype/every/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/every/callbackfn-arguments-with-thisarg.js index 703db4713..548fa2602 100644 --- a/test/built-ins/TypedArray/prototype/every/callbackfn-arguments-with-thisarg.js +++ b/test/built-ins/TypedArray/prototype/every/callbackfn-arguments-with-thisarg.js @@ -25,8 +25,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); var results = []; var thisArg = ["test262", 0, "ecma262", 0]; @@ -40,17 +40,17 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue(thisArg.length, 4, "thisArg.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); + assert.sameValue(results[0][0], 42, "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); + assert.sameValue(results[1][0], 43, "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); + assert.sameValue(results[2][0], 44, "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/every/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/every/callbackfn-arguments-without-thisarg.js index 033e54eac..5c3a74689 100644 --- a/test/built-ins/TypedArray/prototype/every/callbackfn-arguments-without-thisarg.js +++ b/test/built-ins/TypedArray/prototype/every/callbackfn-arguments-without-thisarg.js @@ -25,8 +25,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); var results = []; @@ -38,17 +38,17 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue(results.length, 3, "results.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); + assert.sameValue(results[0][0], 42, "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); + assert.sameValue(results[1][0], 43, "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); + assert.sameValue(results[2][0], 44, "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/every/callbackfn-no-interaction-over-non-integer.js b/test/built-ins/TypedArray/prototype/every/callbackfn-no-interaction-over-non-integer.js index 3631c549e..cfd6aa77e 100644 --- a/test/built-ins/TypedArray/prototype/every/callbackfn-no-interaction-over-non-integer.js +++ b/test/built-ins/TypedArray/prototype/every/callbackfn-no-interaction-over-non-integer.js @@ -18,8 +18,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([7, 8])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([7, 8]); var results = []; @@ -36,6 +36,6 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue(results[0][1], 0, "results[0][1] - key"); assert.sameValue(results[1][1], 1, "results[1][1] - key"); - assert.sameValue(results[0][0], N(7), "results[0][0] - value"); - assert.sameValue(results[1][0], N(8), "results[1][0] - value"); + assert.sameValue(results[0][0], 7, "results[0][0] - value"); + assert.sameValue(results[1][0], 8, "results[1][0] - value"); }); diff --git a/test/built-ins/TypedArray/prototype/every/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/every/callbackfn-return-does-not-change-instance.js index c882314fe..5eeb597c9 100644 --- a/test/built-ins/TypedArray/prototype/every/callbackfn-return-does-not-change-instance.js +++ b/test/built-ins/TypedArray/prototype/every/callbackfn-return-does-not-change-instance.js @@ -25,14 +25,14 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42]); sample.every(function() { return 43; }); - assert.sameValue(sample[0], N(40), "[0] == 40"); - assert.sameValue(sample[1], N(41), "[1] == 41"); - assert.sameValue(sample[2], N(42), "[2] == 42"); + assert.sameValue(sample[0], 40, "[0] == 40"); + assert.sameValue(sample[1], 41, "[1] == 41"); + assert.sameValue(sample[2], 42, "[2] == 42"); }); diff --git a/test/built-ins/TypedArray/prototype/every/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/every/callbackfn-set-value-during-interaction.js index 290a3fd69..3b8f537e1 100644 --- a/test/built-ins/TypedArray/prototype/every/callbackfn-set-value-during-interaction.js +++ b/test/built-ins/TypedArray/prototype/every/callbackfn-set-value-during-interaction.js @@ -25,24 +25,24 @@ includes: [testTypedArray.js] features: [Reflect.set, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); var newVal = 0; sample.every(function(val, i) { if (i > 0) { assert.sameValue( - sample[i - 1], N(newVal - 1), + sample[i - 1], newVal - 1, "get the changed value during the loop" ); assert.sameValue( - Reflect.set(sample, 0, N(7)), + Reflect.set(sample, 0, 7), true, "re-set a value for sample[0]" ); } assert.sameValue( - Reflect.set(sample, i, N(newVal)), + Reflect.set(sample, i, newVal), true, "set value during iteration" ); @@ -52,7 +52,7 @@ testWithTypedArrayConstructors(function(TA, N) { return true; }); - assert.sameValue(sample[0], N(7), "changed values after iteration [0] == 7"); - assert.sameValue(sample[1], N(1), "changed values after iteration [1] == 1"); - assert.sameValue(sample[2], N(2), "changed values after iteration [2] == 2"); + assert.sameValue(sample[0], 7, "changed values after iteration [0] == 7"); + assert.sameValue(sample[1], 1, "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], 2, "changed values after iteration [2] == 2"); }); diff --git a/test/built-ins/TypedArray/prototype/every/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/every/get-length-uses-internal-arraylength.js index 7101f75c6..e7bbae8fc 100644 --- a/test/built-ins/TypedArray/prototype/every/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/every/get-length-uses-internal-arraylength.js @@ -30,8 +30,8 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); var calls = 0; Object.defineProperty(TA.prototype, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/every/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/every/values-are-not-cached.js index e9cec7b7f..d9afa33bb 100644 --- a/test/built-ins/TypedArray/prototype/every/values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/every/values-are-not-cached.js @@ -26,16 +26,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); sample.every(function(v, i) { if (i < sample.length - 1) { - sample[i+1] = N(42); + sample[i+1] = 42; } assert.sameValue( - v, N(42), "method does not cache values before callbackfn calls" + v, 42, "method does not cache values before callbackfn calls" ); return true; }); diff --git a/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js b/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js index b33ecc654..0f0dab7d8 100644 --- a/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js +++ b/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js @@ -31,74 +31,74 @@ includes: [compareArray.js, testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { assert( - compareArray(new TA(N([0, 0])).fill(N(1), undefined), N([1, 1])), + compareArray(new TA([0, 0])).fill(1, undefined), [1, 1], '`undefined` start coerced to 0' ); assert( - compareArray(new TA(N([0, 0])).fill(N(1), 0, undefined), N([1, 1])), + compareArray(new TA([0, 0])).fill(1, 0, undefined), [1, 1], 'If end is undefined, let relativeEnd be len' ); assert( - compareArray(new TA(N([0, 0])).fill(N(1), null), N([1, 1])), + compareArray(new TA([0, 0])).fill(1, null), [1, 1], '`null` start coerced to 0' ); assert( - compareArray(new TA(N([0, 0])).fill(N(1), 0, null), N([0, 0])), + compareArray(new TA([0, 0])).fill(1, 0, null), [0, 0], '`null` end coerced to 0' ); assert( - compareArray(new TA(N([0, 0])).fill(N(1), true), N([0, 1])), + compareArray(new TA([0, 0])).fill(1, true), [0, 1], '`true` start coerced to 1' ); assert( - compareArray(new TA(N([0, 0])).fill(N(1), 0, true), N([1, 0])), + compareArray(new TA([0, 0])).fill(1, 0, true), [1, 0], '`true` end coerced to 1' ); assert( - compareArray(new TA(N([0, 0])).fill(N(1), false), N([1, 1])), + compareArray(new TA([0, 0])).fill(1, false), [1, 1], '`false` start coerced to 0' ); assert( - compareArray(new TA(N([0, 0])).fill(N(1), 0, false), N([0, 0])), + compareArray(new TA([0, 0])).fill(1, 0, false), [0, 0], '`false` end coerced to 0' ); assert( - compareArray(new TA(N([0, 0])).fill(N(1), NaN), N([1, 1])), + compareArray(new TA([0, 0])).fill(1, NaN), [1, 1], '`NaN` start coerced to 0' ); assert( - compareArray(new TA(N([0, 0])).fill(N(1), 0, NaN), N([0, 0])), + compareArray(new TA([0, 0])).fill(1, 0, NaN), [0, 0], '`NaN` end coerced to 0' ); assert( - compareArray(new TA(N([0, 0])).fill(N(1), '1'), N([0, 1])), + compareArray(new TA([0, 0])).fill(1, '1'), [0, 1], 'string start coerced' ); assert( - compareArray(new TA(N([0, 0])).fill(N(1), 0, '1'), N([1, 0])), + compareArray(new TA([0, 0])).fill(1, 0, '1'), [1, 0], 'string end coerced' ); assert( - compareArray(new TA(N([0, 0])).fill(N(1), 1.5), N([0, 1])), + compareArray(new TA([0, 0])).fill(1, 1.5), [0, 1], 'start as a float number coerced' ); assert( - compareArray(new TA(N([0, 0])).fill(N(1), 0, 1.5), N([1, 0])), + compareArray(new TA([0, 0])).fill(1, 0, 1.5), [1, 0], 'end as a float number coerced' ); }); diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-once.js b/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-once.js index 4237c8061..f5e1bd6b7 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-once.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-conversion-once.js @@ -14,14 +14,14 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample = new TA(2); var n = 1; - sample.fill({ valueOf() { return N(n++); } }); + sample.fill({ valueOf() { return n++; } }); assert.sameValue(n, 2, "additional unexpected ToNumber() calls"); - assert.sameValue(sample[0], N(1), "incorrect ToNumber result in index 0"); - assert.sameValue(sample[1], N(1), "incorrect ToNumber result in index 1"); + assert.sameValue(sample[0], 1, "incorrect ToNumber result in index 0"); + assert.sameValue(sample[1], 1, "incorrect ToNumber result in index 1"); }); diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js b/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js index 6ad18b85d..ca66ad48c 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js @@ -33,10 +33,10 @@ includes: [compareArray.js, testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - assert(compareArray(new TA(N([0, 0, 0])).fill(N(8), 1, 2), N([0, 8, 0]))); - assert(compareArray(new TA(N([0, 0, 0, 0, 0])).fill(N(8), -3, 4), N([0, 0, 8, 8, 0]))); - assert(compareArray(new TA(N([0, 0, 0, 0, 0])).fill(N(8), -2, -1), N([0, 0, 0, 8, 0]))); - assert(compareArray(new TA(N([0, 0, 0, 0, 0])).fill(N(8), -1, -3), N([0, 0, 0, 0, 0]))); - assert(compareArray(new TA(N([0, 0, 0, 0, 0])).fill(N(8), 1, 3), N([0, 8, 8, 0, 0]))); +testWithTypedArrayConstructors(function(TA) { + assert(compareArray(new TA([0, 0, 0])).fill(8, 1, 2), [0, 8, 0]); + assert(compareArray(new TA([0, 0, 0, 0, 0])).fill(8, -3, 4), [0, 0, 8, 8, 0]); + assert(compareArray(new TA([0, 0, 0, 0, 0])).fill(8, -2, -1), [0, 0, 0, 8, 0]); + assert(compareArray(new TA([0, 0, 0, 0, 0])).fill(8, -1, -3), [0, 0, 0, 0, 0]); + assert(compareArray(new TA([0, 0, 0, 0, 0])).fill(8, 1, 3), [0, 8, 8, 0, 0]); }); diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js b/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js index 323afbb8c..b2735c770 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js @@ -36,41 +36,41 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample; - sample = new TA(N([42])); + sample = new TA([42]); sample.fill(null); assert.sameValue(sample[0], 0, "null => 0"); - sample = new TA(N([42])); + sample = new TA([42]); sample.fill(false); - assert.sameValue(sample[0], N(0), "false => 0"); + assert.sameValue(sample[0], 0, "false => 0"); - sample = new TA(N([42])); + sample = new TA([42]); sample.fill(true); - assert.sameValue(sample[0], N(1), "true => 1"); + assert.sameValue(sample[0], 1, "true => 1"); - sample = new TA(N([42])); + sample = new TA([42]); sample.fill("7"); - assert.sameValue(sample[0], N(7), "string conversion"); + assert.sameValue(sample[0], 7, "string conversion"); - sample = new TA(N([42])); + sample = new TA([42]); sample.fill({ toString: function() { return "1"; }, valueOf: function() { - return N(7); + return 7; } }); - assert.sameValue(sample[0], N(7), "object valueOf conversion before toString"); + assert.sameValue(sample[0], 7, "object valueOf conversion before toString"); - sample = new TA(N([42])); + sample = new TA([42]); sample.fill({ toString: function() { return "7"; } }); - assert.sameValue(sample[0], N(7), "object toString when valueOf is absent"); + assert.sameValue(sample[0], 7, "object toString when valueOf is absent"); }); diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js index 8341205ed..13f76f482 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js @@ -30,24 +30,24 @@ includes: [compareArray.js, testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { assert( - compareArray(new TA(N([0, 0, 0])).fill(N(8), 0, 1), N([8, 0, 0])), + compareArray(new TA([0, 0, 0])).fill(8, 0, 1), [8, 0, 0], "Fill elements from custom end position" ); assert( - compareArray(new TA(N([0, 0, 0])).fill(N(8), 0, -1), N([8, 8, 0])), + compareArray(new TA([0, 0, 0])).fill(8, 0, -1), [8, 8, 0], "negative end sets final position to max((length + relativeEnd), 0)" ); assert( - compareArray(new TA(N([0, 0, 0])).fill(N(8), 0, 5), N([8, 8, 8])), + compareArray(new TA([0, 0, 0])).fill(8, 0, 5), [8, 8, 8], "end position is never higher than of length" ); assert( - compareArray(new TA(N([0, 0, 0])).fill(N(8), 0, -4), N([0, 0, 0])), + compareArray(new TA([0, 0, 0])).fill(8, 0, -4), [0, 0, 0], "end position is 0 when (len + relativeEnd) < 0" ); }); diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js index 93c0b214b..245c5d856 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js @@ -28,24 +28,24 @@ includes: [compareArray.js, testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { assert( - compareArray(new TA(N([0, 0, 0])).fill(N(8), 1), N([0, 8, 8])), + compareArray(new TA([0, 0, 0])).fill(8, 1), [0, 8, 8], "Fill elements from custom start position" ); assert( - compareArray(new TA(N([0, 0, 0])).fill(N(8), 4), N([0, 0, 0])), + compareArray(new TA([0, 0, 0])).fill(8, 4), [0, 0, 0], "start position is never higher than length" ); assert( - compareArray(new TA(N([0, 0, 0])).fill(N(8), -1), N([0, 0, 8])), + compareArray(new TA([0, 0, 0])).fill(8, -1), [0, 0, 8], "start < 0 sets initial position to max((len + relativeStart), 0)" ); assert( - compareArray(new TA(N([0, 0, 0])).fill(N(8), -5), N([8, 8, 8])), + compareArray(new TA([0, 0, 0])).fill(8, -5), [8, 8, 8], "start position is 0 when (len + relativeStart) < 0" ); }); diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values.js b/test/built-ins/TypedArray/prototype/fill/fill-values.js index 665796e37..cf632e77b 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values.js @@ -28,17 +28,17 @@ includes: [compareArray.js, testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { assert( compareArray( - new TA().fill(N(8)), + new TA().fill(8), [] ), "does not fill an empty instance" ); assert( - compareArray(new TA(N([0, 0, 0])).fill(N(8)), N([8, 8, 8])), + compareArray(new TA([0, 0, 0])).fill(8), [8, 8, 8], "Default start and end indexes are 0 and this.length" ); }); diff --git a/test/built-ins/TypedArray/prototype/fill/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/fill/get-length-ignores-length-prop.js index 5ba5c9437..3d5a2340a 100644 --- a/test/built-ins/TypedArray/prototype/fill/get-length-ignores-length-prop.js +++ b/test/built-ins/TypedArray/prototype/fill/get-length-ignores-length-prop.js @@ -33,7 +33,7 @@ Object.defineProperty(TypedArray.prototype, "length", { } }); -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { Object.defineProperty(TA.prototype, "length", { get: function() { throw new Test262Error(); @@ -47,5 +47,5 @@ testWithTypedArrayConstructors(function(TA, N) { } }); - assert.sameValue(sample.fill(N(1), 0), sample); + assert.sameValue(sample.fill(1, 0), sample); }); diff --git a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end.js b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end.js index 044d9b333..14646ab64 100644 --- a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end.js +++ b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-end.js @@ -34,9 +34,9 @@ var end = { } }; -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample = new TA(); assert.throws(Test262Error, function() { - sample.fill(N(1), 0, end); + sample.fill(1, 0, end); }); }); diff --git a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js index 04fbc57b5..5702d4e6b 100644 --- a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js +++ b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js @@ -36,8 +36,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42]); var obj = { valueOf: function() { throw new Test262Error(); diff --git a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start.js b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start.js index 34d732fe3..d55177f72 100644 --- a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start.js +++ b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-start.js @@ -33,9 +33,9 @@ var start = { } }; -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample = new TA(); assert.throws(Test262Error, function() { - sample.fill(N(1), start); + sample.fill(1, start); }); }); diff --git a/test/built-ins/TypedArray/prototype/fill/return-this.js b/test/built-ins/TypedArray/prototype/fill/return-this.js index 2ec863eca..95ce81f93 100644 --- a/test/built-ins/TypedArray/prototype/fill/return-this.js +++ b/test/built-ins/TypedArray/prototype/fill/return-this.js @@ -8,13 +8,13 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample1 = new TA(); - var result1 = sample1.fill(N(1)); + var result1 = sample1.fill(1); assert.sameValue(result1, sample1); var sample2 = new TA(42); - var result2 = sample2.fill(N(7)); + var result2 = sample2.fill(7); assert.sameValue(result2, sample2); }); diff --git a/test/built-ins/TypedArray/prototype/filter/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/filter/callbackfn-arguments-with-thisarg.js index d16a5e361..ea90d12a0 100644 --- a/test/built-ins/TypedArray/prototype/filter/callbackfn-arguments-with-thisarg.js +++ b/test/built-ins/TypedArray/prototype/filter/callbackfn-arguments-with-thisarg.js @@ -16,8 +16,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); var results = []; var thisArg = ["test262", 0, "ecma262", 0]; @@ -30,17 +30,17 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue(thisArg.length, 4, "thisArg.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); + assert.sameValue(results[0][0], 42, "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); + assert.sameValue(results[1][0], 43, "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); + assert.sameValue(results[2][0], 44, "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/filter/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/filter/callbackfn-arguments-without-thisarg.js index 95a30a38e..557107c93 100644 --- a/test/built-ins/TypedArray/prototype/filter/callbackfn-arguments-without-thisarg.js +++ b/test/built-ins/TypedArray/prototype/filter/callbackfn-arguments-without-thisarg.js @@ -16,8 +16,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); var results = []; @@ -28,17 +28,17 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue(results.length, 3, "results.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); + assert.sameValue(results[0][0], 42, "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); + assert.sameValue(results[1][0], 43, "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); + assert.sameValue(results[2][0], 44, "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/filter/callbackfn-no-iteration-over-non-integer.js b/test/built-ins/TypedArray/prototype/filter/callbackfn-no-iteration-over-non-integer.js index 16691aac8..6a9c5d282 100644 --- a/test/built-ins/TypedArray/prototype/filter/callbackfn-no-iteration-over-non-integer.js +++ b/test/built-ins/TypedArray/prototype/filter/callbackfn-no-iteration-over-non-integer.js @@ -16,8 +16,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([7, 8])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([7, 8]); var results = []; @@ -33,6 +33,6 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); - assert.sameValue(results[0][0], N(7), "results[0][0] - kValue"); - assert.sameValue(results[1][0], N(8), "results[1][0] - kValue"); + assert.sameValue(results[0][0], 7, "results[0][0] - kValue"); + assert.sameValue(results[1][0], 8, "results[1][0] - kValue"); }); diff --git a/test/built-ins/TypedArray/prototype/filter/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/filter/callbackfn-return-does-not-change-instance.js index 6bf3f93af..7d3776296 100644 --- a/test/built-ins/TypedArray/prototype/filter/callbackfn-return-does-not-change-instance.js +++ b/test/built-ins/TypedArray/prototype/filter/callbackfn-return-does-not-change-instance.js @@ -8,16 +8,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample1 = new TA(3); - sample1[1] = N(1); + sample1[1] = 1; sample1.filter(function() { return 42; }); - assert.sameValue(sample1[0], N(0), "[0] == 0"); - assert.sameValue(sample1[1], N(1), "[1] == 1"); - assert.sameValue(sample1[2], N(0), "[2] == 0"); + assert.sameValue(sample1[0], 0, "[0] == 0"); + assert.sameValue(sample1[1], 1, "[1] == 1"); + assert.sameValue(sample1[2], 0, "[2] == 0"); }); diff --git a/test/built-ins/TypedArray/prototype/filter/callbackfn-set-value-during-iteration.js b/test/built-ins/TypedArray/prototype/filter/callbackfn-set-value-during-iteration.js index 5ef780ce1..97c4ae7d3 100644 --- a/test/built-ins/TypedArray/prototype/filter/callbackfn-set-value-during-iteration.js +++ b/test/built-ins/TypedArray/prototype/filter/callbackfn-set-value-during-iteration.js @@ -16,24 +16,24 @@ includes: [testTypedArray.js] features: [Reflect.set, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); var newVal = 0; sample.filter(function(val, i) { if (i > 0) { assert.sameValue( - sample[i - 1], N(newVal - 1), + sample[i - 1], newVal - 1, "get the changed value during the loop" ); assert.sameValue( - Reflect.set(sample, 0, N(7)), + Reflect.set(sample, 0, 7), true, "re-set a value for sample[0]" ); } assert.sameValue( - Reflect.set(sample, i, N(newVal)), + Reflect.set(sample, i, newVal), true, "set value during interaction" ); @@ -41,7 +41,7 @@ testWithTypedArrayConstructors(function(TA, N) { newVal++; }); - assert.sameValue(sample[0], N(7), "changed values after interaction [0] == 7"); - assert.sameValue(sample[1], N(1), "changed values after interaction [1] == 1"); - assert.sameValue(sample[2], N(2), "changed values after interaction [2] == 2"); + assert.sameValue(sample[0], 7, "changed values after interaction [0] == 7"); + assert.sameValue(sample[1], 1, "changed values after interaction [1] == 1"); + assert.sameValue(sample[2], 2, "changed values after interaction [2] == 2"); }); diff --git a/test/built-ins/TypedArray/prototype/filter/result-does-not-share-buffer.js b/test/built-ins/TypedArray/prototype/filter/result-does-not-share-buffer.js index 1d68757d6..bbd292d14 100644 --- a/test/built-ins/TypedArray/prototype/filter/result-does-not-share-buffer.js +++ b/test/built-ins/TypedArray/prototype/filter/result-does-not-share-buffer.js @@ -15,8 +15,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42]); var result; result = sample.filter(function() { return true; }); diff --git a/test/built-ins/TypedArray/prototype/filter/result-full-callbackfn-returns-true.js b/test/built-ins/TypedArray/prototype/filter/result-full-callbackfn-returns-true.js index 299979989..f46bf483d 100644 --- a/test/built-ins/TypedArray/prototype/filter/result-full-callbackfn-returns-true.js +++ b/test/built-ins/TypedArray/prototype/filter/result-full-callbackfn-returns-true.js @@ -16,8 +16,8 @@ includes: [testTypedArray.js, compareArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42]); [ true, diff --git a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-abrupt.js b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-abrupt.js index e4d589050..6f9099eae 100644 --- a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-abrupt.js +++ b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-abrupt.js @@ -26,8 +26,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); Object.defineProperty(sample, "constructor", { get: function() { diff --git a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-inherited.js b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-inherited.js index f58f47211..9db63a8eb 100644 --- a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-inherited.js +++ b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-inherited.js @@ -26,8 +26,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); var calls = 0; var result; diff --git a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-returns-throws.js b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-returns-throws.js index 9b574031c..a63bd2e53 100644 --- a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-returns-throws.js +++ b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor-returns-throws.js @@ -30,8 +30,8 @@ features: [Symbol, TypedArray] var callbackfn = function() { return true; }; -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); sample.constructor = 42; assert.throws(TypeError, function() { diff --git a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor.js b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor.js index 23b11e3fd..6308fe92f 100644 --- a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor.js +++ b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-ctor.js @@ -26,8 +26,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); var calls = 0; var result; diff --git a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor-invocation.js b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor-invocation.js index 3339c513a..ad8313a26 100644 --- a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor-invocation.js +++ b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor-invocation.js @@ -36,8 +36,8 @@ includes: [testTypedArray.js] features: [Symbol.species, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 42, 42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 42, 42]); var result, ctorThis; sample.constructor = {}; @@ -47,7 +47,7 @@ testWithTypedArrayConstructors(function(TA, N) { return new TA(count); }; - sample.filter(function(v) { return v === N(42); }); + sample.filter(function(v) { return v === 42; }); assert.sameValue(result.length, 1, "called with 1 argument"); assert.sameValue(result[0], 2, "[0] is the new captured length"); diff --git a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor-returns-another-instance.js b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor-returns-another-instance.js index 5181cf3c7..79547878b 100644 --- a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor-returns-another-instance.js +++ b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor-returns-another-instance.js @@ -36,8 +36,8 @@ includes: [testTypedArray.js, compareArray.js] features: [Symbol.species, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40]); var otherTA = TA === Int8Array ? Int16Array : Int8Array; var other = new otherTA([1, 0, 1]); var result; diff --git a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor.js b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor.js index 309f646a3..28e12b135 100644 --- a/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor.js +++ b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor.js @@ -36,8 +36,8 @@ includes: [testTypedArray.js, compareArray.js] features: [Symbol.species, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42]); var calls = 0; var other, result; @@ -52,5 +52,5 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue(calls, 1, "ctor called once"); assert.sameValue(result, other, "return is instance of custom constructor"); - assert(compareArray(result, N([40, 41, 42])), "values are set on the new obj"); + assert(compareArray(result, [40, 41, 42]), "values are set on the new obj"); }); diff --git a/test/built-ins/TypedArray/prototype/filter/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/filter/values-are-not-cached.js index 47c0d465f..1b24d310e 100644 --- a/test/built-ins/TypedArray/prototype/filter/values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/filter/values-are-not-cached.js @@ -16,16 +16,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); sample.filter(function(v, i) { if (i < sample.length - 1) { - sample[i+1] = N(42); + sample[i+1] = 42; } assert.sameValue( - v, N(42), "method does not cache values before callbackfn calls" + v, 42, "method does not cache values before callbackfn calls" ); }); }); diff --git a/test/built-ins/TypedArray/prototype/filter/values-are-set.js b/test/built-ins/TypedArray/prototype/filter/values-are-set.js index 2a033c701..c9f16b8df 100644 --- a/test/built-ins/TypedArray/prototype/filter/values-are-set.js +++ b/test/built-ins/TypedArray/prototype/filter/values-are-set.js @@ -16,15 +16,15 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([41, 1, 42, 7])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([41, 1, 42, 7]); var result; result = sample.filter(function() { return true; }); - assert(compareArray(result, N([41, 1, 42, 7])), "values are set #1"); + assert(compareArray(result, [41, 1, 42, 7]), "values are set #1"); result = sample.filter(function(v) { - return v > N(40); + return v > 40; }); - assert(compareArray(result, N([41, 42])), "values are set #2"); + assert(compareArray(result, [41, 42]), "values are set #2"); }); diff --git a/test/built-ins/TypedArray/prototype/find/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/find/get-length-ignores-length-prop.js index f236772a3..4c5905ee1 100644 --- a/test/built-ins/TypedArray/prototype/find/get-length-ignores-length-prop.js +++ b/test/built-ins/TypedArray/prototype/find/get-length-ignores-length-prop.js @@ -31,14 +31,14 @@ Object.defineProperty(TypedArray.prototype, "length", { } }); -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { Object.defineProperty(TA.prototype, "length", { get: function() { throw new Test262Error(); } }); - var sample = new TA(N([42])); + var sample = new TA([42]); Object.defineProperty(sample, "length", { get: function() { @@ -49,6 +49,6 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue( sample.find(function() { return true; }), - N(42) + 42 ); }); diff --git a/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js index fc22821dd..0b8baa4ba 100644 --- a/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js +++ b/test/built-ins/TypedArray/prototype/find/predicate-call-changes-value.js @@ -29,8 +29,8 @@ includes: [compareArray.js, testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var arr = N([1, 2, 3]); +testWithTypedArrayConstructors(function(TA) { + var arr = [1, 2, 3]; var sample; var result; @@ -38,41 +38,41 @@ testWithTypedArrayConstructors(function(TA, N) { sample.find(function(val, i) { sample[i] = arr[i]; - assert.sameValue(val, N(0), "value is not mapped to instance"); + assert.sameValue(val, 0, "value is not mapped to instance"); }); assert(compareArray(sample, arr), "values set during each predicate call"); sample = new TA(arr); result = sample.find(function(val, i) { if ( i === 0 ) { - sample[2] = N(7); + sample[2] = 7; } - return val === N(7); + return val === 7; }); - assert.sameValue(result, N(7), "value found"); + assert.sameValue(result, 7, "value found"); sample = new TA(arr); result = sample.find(function(val, i) { if ( i === 0 ) { - sample[2] = N(7); + sample[2] = 7; } - return val === N(3); + return val === 3; }); assert.sameValue(result, undefined, "value not found"); sample = new TA(arr); result = sample.find(function(val, i) { if ( i > 0 ) { - sample[0] = N(7); + sample[0] = 7; } - return val === N(7); + return val === 7; }); assert.sameValue(result, undefined, "value not found - changed after call"); sample = new TA(arr); result = sample.find(function() { - sample[0] = N(7); + sample[0] = 7; return true; }); - assert.sameValue(result, N(1), "find() returns previous found value"); + assert.sameValue(result, 1, "find() returns previous found value"); }); diff --git a/test/built-ins/TypedArray/prototype/find/predicate-call-parameters.js b/test/built-ins/TypedArray/prototype/find/predicate-call-parameters.js index 42598466e..7d364c091 100644 --- a/test/built-ins/TypedArray/prototype/find/predicate-call-parameters.js +++ b/test/built-ins/TypedArray/prototype/find/predicate-call-parameters.js @@ -29,8 +29,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([39, 2, 62])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([39, 2, 62]); var results = []; var result; @@ -43,19 +43,19 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue(results.length, 3, "predicate is called for each index"); result = results[0]; - assert.sameValue(result[0], N(39), "results[0][0] === 39, value"); + assert.sameValue(result[0], 39, "results[0][0] === 39, value"); assert.sameValue(result[1], 0, "results[0][1] === 0, index"); assert.sameValue(result[2], sample, "results[0][2] === sample, instance"); assert.sameValue(result.length, 3, "results[0].length === 3 arguments"); result = results[1]; - assert.sameValue(result[0], N(2), "results[1][0] === 2, value"); + assert.sameValue(result[0], 2, "results[1][0] === 2, value"); assert.sameValue(result[1], 1, "results[1][1] === 1, index"); assert.sameValue(result[2], sample, "results[1][2] === sample, instance"); assert.sameValue(result.length, 3, "results[1].length === 3 arguments"); result = results[2]; - assert.sameValue(result[0], N(62), "results[2][0] === 62, value"); + assert.sameValue(result[0], 62, "results[2][0] === 62, value"); assert.sameValue(result[1], 2, "results[2][1] === 2, index"); assert.sameValue(result[2], sample, "results[2][2] === sample, instance"); assert.sameValue(result.length, 3, "results[2].length === 3 arguments"); diff --git a/test/built-ins/TypedArray/prototype/find/return-found-value-predicate-result-is-true.js b/test/built-ins/TypedArray/prototype/find/return-found-value-predicate-result-is-true.js index fa6aa2286..304b48355 100644 --- a/test/built-ins/TypedArray/prototype/find/return-found-value-predicate-result-is-true.js +++ b/test/built-ins/TypedArray/prototype/find/return-found-value-predicate-result-is-true.js @@ -28,8 +28,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([39, 2, 62])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([39, 2, 62]); var called, result; called = 0; @@ -37,29 +37,29 @@ testWithTypedArrayConstructors(function(TA, N) { called++; return true; }); - assert.sameValue(result, N(39), "returned true on sample[0]"); + assert.sameValue(result, 39, "returned true on sample[0]"); assert.sameValue(called, 1, "predicate was called once"); called = 0; result = sample.find(function(val) { called++; - return val === N(62); + return val === 62; }); assert.sameValue(called, 3, "predicate was called three times"); - assert.sameValue(result, N(62), "returned true on sample[3]"); + assert.sameValue(result, 62, "returned true on sample[3]"); result = sample.find(function() { return "string"; }); - assert.sameValue(result, N(39), "ToBoolean(string)"); + assert.sameValue(result, 39, "ToBoolean(string)"); result = sample.find(function() { return {}; }); - assert.sameValue(result, N(39), "ToBoolean(object)"); + assert.sameValue(result, 39, "ToBoolean(object)"); result = sample.find(function() { return Symbol(""); }); - assert.sameValue(result, N(39), "ToBoolean(symbol)"); + assert.sameValue(result, 39, "ToBoolean(symbol)"); result = sample.find(function() { return 1; }); - assert.sameValue(result, N(39), "ToBoolean(number)"); + assert.sameValue(result, 39, "ToBoolean(number)"); result = sample.find(function() { return -1; }); - assert.sameValue(result, N(39), "ToBoolean(negative number)"); + assert.sameValue(result, 39, "ToBoolean(negative number)"); }); diff --git a/test/built-ins/TypedArray/prototype/findIndex/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/findIndex/get-length-ignores-length-prop.js index 7aa5368e4..89b8815c5 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/get-length-ignores-length-prop.js +++ b/test/built-ins/TypedArray/prototype/findIndex/get-length-ignores-length-prop.js @@ -29,14 +29,14 @@ Object.defineProperty(TypedArray.prototype, "length", { } }); -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { Object.defineProperty(TA.prototype, "length", { get: function() { throw new Test262Error(); } }); - var sample = new TA(N([42])); + var sample = new TA([42]); Object.defineProperty(sample, "length", { get: function() { diff --git a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js index cc7ba9fad..2843859a0 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js +++ b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-changes-value.js @@ -25,8 +25,8 @@ includes: [compareArray.js, testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var arr = N([10, 20, 30]); +testWithTypedArrayConstructors(function(TA) { + var arr = [10, 20, 30]; var sample; var result; @@ -34,34 +34,34 @@ testWithTypedArrayConstructors(function(TA, N) { sample.findIndex(function(val, i) { sample[i] = arr[i]; - assert.sameValue(val, N(0), "value is not mapped to instance"); + assert.sameValue(val, 0, "value is not mapped to instance"); }); assert(compareArray(sample, arr), "values set during each predicate call"); sample = new TA(arr); result = sample.findIndex(function(val, i) { if ( i === 0 ) { - sample[2] = N(7); + sample[2] = 7; } - return val === N(7); + return val === 7; }); assert.sameValue(result, 2, "value found"); sample = new TA(arr); result = sample.findIndex(function(val, i) { if ( i === 0 ) { - sample[2] = N(7); + sample[2] = 7; } - return val === N(30); + return val === 30; }); assert.sameValue(result, -1, "value not found"); sample = new TA(arr); result = sample.findIndex(function(val, i) { if ( i > 0 ) { - sample[0] = N(7); + sample[0] = 7; } - return val === N(7); + return val === 7; }); assert.sameValue(result, -1, "value not found - changed after call"); }); diff --git a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-parameters.js b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-parameters.js index ecb52b705..5483cc49a 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/predicate-call-parameters.js +++ b/test/built-ins/TypedArray/prototype/findIndex/predicate-call-parameters.js @@ -27,8 +27,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([39, 2, 62])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([39, 2, 62]); var results = []; var result; @@ -41,19 +41,19 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue(results.length, 3, "predicate is called for each index"); result = results[0]; - assert.sameValue(result[0], N(39), "results[0][0] === 39, value"); + assert.sameValue(result[0], 39, "results[0][0] === 39, value"); assert.sameValue(result[1], 0, "results[0][1] === 0, index"); assert.sameValue(result[2], sample, "results[0][2] === sample, instance"); assert.sameValue(result.length, 3, "results[0].length === 3, arguments"); result = results[1]; - assert.sameValue(result[0], N(2), "results[1][0] === 2, value"); + assert.sameValue(result[0], 2, "results[1][0] === 2, value"); assert.sameValue(result[1], 1, "results[1][1] === 1, index"); assert.sameValue(result[2], sample, "results[1][2] === sample, instance"); assert.sameValue(result.length, 3, "results[1].length === 3, arguments"); result = results[2]; - assert.sameValue(result[0], N(62), "results[2][0] === 62, value"); + assert.sameValue(result[0], 62, "results[2][0] === 62, value"); assert.sameValue(result[1], 2, "results[2][1] === 2, index"); assert.sameValue(result[2], sample, "results[2][2] === sample, instance"); assert.sameValue(result.length, 3, "results[2].length === 3, arguments"); diff --git a/test/built-ins/TypedArray/prototype/findIndex/return-index-predicate-result-is-true.js b/test/built-ins/TypedArray/prototype/findIndex/return-index-predicate-result-is-true.js index 572c284b9..498e9ac3e 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/return-index-predicate-result-is-true.js +++ b/test/built-ins/TypedArray/prototype/findIndex/return-index-predicate-result-is-true.js @@ -27,8 +27,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([39, 3, 9])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([39, 3, 9]); var called = 0; var result = sample.findIndex(function() { @@ -42,7 +42,7 @@ testWithTypedArrayConstructors(function(TA, N) { called = 0; result = sample.findIndex(function(val) { called++; - return val === N(9); + return val === 9; }); assert.sameValue(called, 3, "predicate was called three times"); diff --git a/test/built-ins/TypedArray/prototype/findIndex/return-negative-one-if-predicate-returns-false-value.js b/test/built-ins/TypedArray/prototype/findIndex/return-negative-one-if-predicate-returns-false-value.js index 3ebf60868..76bda3ca0 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/return-negative-one-if-predicate-returns-false-value.js +++ b/test/built-ins/TypedArray/prototype/findIndex/return-negative-one-if-predicate-returns-false-value.js @@ -26,8 +26,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([1, 2, 3])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([1, 2, 3]); var called = 0; var result = sample.findIndex(function() { diff --git a/test/built-ins/TypedArray/prototype/forEach/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/forEach/callbackfn-arguments-with-thisarg.js index 15a960ab9..13ae208be 100644 --- a/test/built-ins/TypedArray/prototype/forEach/callbackfn-arguments-with-thisarg.js +++ b/test/built-ins/TypedArray/prototype/forEach/callbackfn-arguments-with-thisarg.js @@ -25,8 +25,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); var results = []; var thisArg = ["test262", 0, "ecma262", 0]; @@ -39,17 +39,17 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue(thisArg.length, 4, "thisArg.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); + assert.sameValue(results[0][0], 42, "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); + assert.sameValue(results[1][0], 43, "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); + assert.sameValue(results[2][0], 44, "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/forEach/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/forEach/callbackfn-arguments-without-thisarg.js index 454df6941..1255dbf2b 100644 --- a/test/built-ins/TypedArray/prototype/forEach/callbackfn-arguments-without-thisarg.js +++ b/test/built-ins/TypedArray/prototype/forEach/callbackfn-arguments-without-thisarg.js @@ -25,8 +25,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); var results = []; @@ -37,17 +37,17 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue(results.length, 3, "results.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); + assert.sameValue(results[0][0], 42, "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); + assert.sameValue(results[1][0], 43, "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); + assert.sameValue(results[2][0], 44, "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/forEach/callbackfn-no-interaction-over-non-integer.js b/test/built-ins/TypedArray/prototype/forEach/callbackfn-no-interaction-over-non-integer.js index a36a8824b..4056d65f4 100644 --- a/test/built-ins/TypedArray/prototype/forEach/callbackfn-no-interaction-over-non-integer.js +++ b/test/built-ins/TypedArray/prototype/forEach/callbackfn-no-interaction-over-non-integer.js @@ -19,8 +19,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([7, 8])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([7, 8]); var results = []; @@ -36,6 +36,6 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); - assert.sameValue(results[0][0], N(7), "results[0][0] - kValue"); - assert.sameValue(results[1][0], N(8), "results[1][0] - kValue"); + assert.sameValue(results[0][0], 7, "results[0][0] - kValue"); + assert.sameValue(results[1][0], 8, "results[1][0] - kValue"); }); diff --git a/test/built-ins/TypedArray/prototype/forEach/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/forEach/callbackfn-return-does-not-change-instance.js index b2c7f3ff5..19584f112 100644 --- a/test/built-ins/TypedArray/prototype/forEach/callbackfn-return-does-not-change-instance.js +++ b/test/built-ins/TypedArray/prototype/forEach/callbackfn-return-does-not-change-instance.js @@ -15,16 +15,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample1 = new TA(3); - sample1[1] = N(1); + sample1[1] = 1; sample1.forEach(function() { return 42; }); - assert.sameValue(sample1[0], N(0), "[0] == 0"); - assert.sameValue(sample1[1], N(1), "[1] == 1"); - assert.sameValue(sample1[2], N(0), "[2] == 0"); + assert.sameValue(sample1[0], 0, "[0] == 0"); + assert.sameValue(sample1[1], 1, "[1] == 1"); + assert.sameValue(sample1[2], 0, "[2] == 0"); }); diff --git a/test/built-ins/TypedArray/prototype/forEach/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/forEach/callbackfn-set-value-during-interaction.js index 4c5a73bbf..8cae0a4c5 100644 --- a/test/built-ins/TypedArray/prototype/forEach/callbackfn-set-value-during-interaction.js +++ b/test/built-ins/TypedArray/prototype/forEach/callbackfn-set-value-during-interaction.js @@ -16,24 +16,24 @@ includes: [testTypedArray.js] features: [Reflect.set, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); var newVal = 0; sample.forEach(function(val, i) { if (i > 0) { assert.sameValue( - sample[i - 1], N(newVal - 1), + sample[i - 1], newVal - 1, "get the changed value during the loop" ); assert.sameValue( - Reflect.set(sample, 0, N(7)), + Reflect.set(sample, 0, 7), true, "re-set a value for sample[0]" ); } assert.sameValue( - Reflect.set(sample, i, N(newVal)), + Reflect.set(sample, i, newVal), true, "set value during iteration" ); @@ -41,7 +41,7 @@ testWithTypedArrayConstructors(function(TA, N) { newVal++; }); - assert.sameValue(sample[0], N(7), "changed values after iteration [0] == 7"); - assert.sameValue(sample[1], N(1), "changed values after iteration [1] == 1"); - assert.sameValue(sample[2], N(2), "changed values after iteration [2] == 2"); + assert.sameValue(sample[0], 7, "changed values after iteration [0] == 7"); + assert.sameValue(sample[1], 1, "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], 2, "changed values after iteration [2] == 2"); }); diff --git a/test/built-ins/TypedArray/prototype/forEach/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/forEach/values-are-not-cached.js index 7a965668d..10b311356 100644 --- a/test/built-ins/TypedArray/prototype/forEach/values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/forEach/values-are-not-cached.js @@ -16,16 +16,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); sample.forEach(function(v, i) { if (i < sample.length - 1) { - sample[i+1] = N(42); + sample[i+1] = 42; } assert.sameValue( - v, N(42), "method does not cache values before callbackfn calls" + v, 42, "method does not cache values before callbackfn calls" ); }); }); diff --git a/test/built-ins/TypedArray/prototype/includes/fromIndex-infinity.js b/test/built-ins/TypedArray/prototype/includes/fromIndex-infinity.js index f904d82a5..b9af6be50 100644 --- a/test/built-ins/TypedArray/prototype/includes/fromIndex-infinity.js +++ b/test/built-ins/TypedArray/prototype/includes/fromIndex-infinity.js @@ -29,16 +29,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 43, 41])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 43, 41]); assert.sameValue( - sample.includes(N(43), Infinity), + sample.includes(43, Infinity), false, "includes(43, Infinity)" ); assert.sameValue( - sample.includes(N(43), -Infinity), + sample.includes(43, -Infinity), true, "includes(43, -Infinity)"); }); diff --git a/test/built-ins/TypedArray/prototype/includes/fromIndex-minus-zero.js b/test/built-ins/TypedArray/prototype/includes/fromIndex-minus-zero.js index 3d4c08fb7..be2fedf7c 100644 --- a/test/built-ins/TypedArray/prototype/includes/fromIndex-minus-zero.js +++ b/test/built-ins/TypedArray/prototype/includes/fromIndex-minus-zero.js @@ -24,11 +24,11 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample; - sample = new TA(N([42, 43])); - assert.sameValue(sample.includes(N(42), -0), true, "-0 [0]"); - assert.sameValue(sample.includes(N(43), -0), true, "-0 [1]"); - assert.sameValue(sample.includes(N(44), -0), false, "-0 [2]"); + sample = new TA([42, 43]); + assert.sameValue(sample.includes(42, -0), true, "-0 [0]"); + assert.sameValue(sample.includes(43, -0), true, "-0 [1]"); + assert.sameValue(sample.includes(44, -0), false, "-0 [2]"); }); diff --git a/test/built-ins/TypedArray/prototype/includes/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/includes/get-length-uses-internal-arraylength.js index c8b6b6280..eb10a80bd 100644 --- a/test/built-ins/TypedArray/prototype/includes/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/includes/get-length-uses-internal-arraylength.js @@ -23,11 +23,11 @@ features: [TypedArray] Object.defineProperty(TypedArray.prototype, "length", {value: 0}); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([7])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([7]); Object.defineProperty(TA.prototype, "length", {value: 0}); Object.defineProperty(sample, "length", {value: 0}); - assert.sameValue(sample.includes(N(7)), true); + assert.sameValue(sample.includes(7), true); }); diff --git a/test/built-ins/TypedArray/prototype/includes/return-abrupt-tointeger-fromindex-symbol.js b/test/built-ins/TypedArray/prototype/includes/return-abrupt-tointeger-fromindex-symbol.js index cc4207aa3..5e5364d5b 100644 --- a/test/built-ins/TypedArray/prototype/includes/return-abrupt-tointeger-fromindex-symbol.js +++ b/test/built-ins/TypedArray/prototype/includes/return-abrupt-tointeger-fromindex-symbol.js @@ -24,10 +24,10 @@ features: [Symbol, TypedArray] var fromIndex = Symbol("1"); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([7])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([7]); assert.throws(TypeError, function() { - sample.includes(N(7), fromIndex); + sample.includes(7, fromIndex); }); }); diff --git a/test/built-ins/TypedArray/prototype/includes/return-abrupt-tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/includes/return-abrupt-tointeger-fromindex.js index 40a1f6dbc..b17b6e343 100644 --- a/test/built-ins/TypedArray/prototype/includes/return-abrupt-tointeger-fromindex.js +++ b/test/built-ins/TypedArray/prototype/includes/return-abrupt-tointeger-fromindex.js @@ -28,10 +28,10 @@ var fromIndex = { } }; -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([7])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([7]); assert.throws(Test262Error, function() { - sample.includes(N(7), fromIndex); + sample.includes(7, fromIndex); }); }); diff --git a/test/built-ins/TypedArray/prototype/includes/search-found-returns-true.js b/test/built-ins/TypedArray/prototype/includes/search-found-returns-true.js index 27c6e25f0..e77ace260 100644 --- a/test/built-ins/TypedArray/prototype/includes/search-found-returns-true.js +++ b/test/built-ins/TypedArray/prototype/includes/search-found-returns-true.js @@ -29,16 +29,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 42, 41])); - assert.sameValue(sample.includes(N(42)), true, "includes(42)"); - assert.sameValue(sample.includes(N(43)), true, "includes(43)"); - assert.sameValue(sample.includes(N(43), 1), true, "includes(43, 1)"); - assert.sameValue(sample.includes(N(42), 1), true, "includes(42, 1)"); - assert.sameValue(sample.includes(N(42), 2), true, "includes(42, 2)"); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 42, 41]); + assert.sameValue(sample.includes(42), true, "includes(42)"); + assert.sameValue(sample.includes(43), true, "includes(43)"); + assert.sameValue(sample.includes(43, 1), true, "includes(43, 1)"); + assert.sameValue(sample.includes(42, 1), true, "includes(42, 1)"); + assert.sameValue(sample.includes(42, 2), true, "includes(42, 2)"); - assert.sameValue(sample.includes(N(42), -4), true, "includes(42, -4)"); - assert.sameValue(sample.includes(N(42), -3), true, "includes(42, -3)"); - assert.sameValue(sample.includes(N(42), -2), true, "includes(42, -2)"); - assert.sameValue(sample.includes(N(42), -5), true, "includes(42, -5)"); + assert.sameValue(sample.includes(42, -4), true, "includes(42, -4)"); + assert.sameValue(sample.includes(42, -3), true, "includes(42, -3)"); + assert.sameValue(sample.includes(42, -2), true, "includes(42, -2)"); + assert.sameValue(sample.includes(42, -5), true, "includes(42, -5)"); }); diff --git a/test/built-ins/TypedArray/prototype/includes/search-not-found-returns-false.js b/test/built-ins/TypedArray/prototype/includes/search-not-found-returns-false.js index 8654b4d36..4000cd39b 100644 --- a/test/built-ins/TypedArray/prototype/includes/search-not-found-returns-false.js +++ b/test/built-ins/TypedArray/prototype/includes/search-not-found-returns-false.js @@ -29,14 +29,14 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample; - sample = new TA(N([42, 43, 42, 41])); - assert.sameValue(sample.includes(N(44)), false, "includes(44)"); - assert.sameValue(sample.includes(N(43), 2), false, "includes(43, 2)"); - assert.sameValue(sample.includes(N(42), 3), false, "includes(42, 3)"); - assert.sameValue(sample.includes(N(44), -4), false, "includes(44, -4)"); - assert.sameValue(sample.includes(N(44), -5), false, "includes(44, -5)"); - assert.sameValue(sample.includes(N(42), -1), false, "includes(42, -1)"); + sample = new TA([42, 43, 42, 41]); + assert.sameValue(sample.includes(44), false, "includes(44)"); + assert.sameValue(sample.includes(43, 2), false, "includes(43, 2)"); + assert.sameValue(sample.includes(42, 3), false, "includes(42, 3)"); + assert.sameValue(sample.includes(44, -4), false, "includes(44, -4)"); + assert.sameValue(sample.includes(44, -5), false, "includes(44, -5)"); + assert.sameValue(sample.includes(42, -1), false, "includes(42, -1)"); }); diff --git a/test/built-ins/TypedArray/prototype/includes/tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/includes/tointeger-fromindex.js index 9ab7c404a..9a2be979f 100644 --- a/test/built-ins/TypedArray/prototype/includes/tointeger-fromindex.js +++ b/test/built-ins/TypedArray/prototype/includes/tointeger-fromindex.js @@ -35,31 +35,31 @@ var obj = { } }; -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample; - sample = new TA(N([42, 43])); - assert.sameValue(sample.includes(N(42), "1"), false, "string [0]"); - assert.sameValue(sample.includes(N(43), "1"), true, "string [1]"); + sample = new TA([42, 43]); + assert.sameValue(sample.includes(42, "1"), false, "string [0]"); + assert.sameValue(sample.includes(43, "1"), true, "string [1]"); - assert.sameValue(sample.includes(N(42), true), false, "true [0]"); - assert.sameValue(sample.includes(N(43), true), true, "true [1]"); + assert.sameValue(sample.includes(42, true), false, "true [0]"); + assert.sameValue(sample.includes(43, true), true, "true [1]"); - assert.sameValue(sample.includes(N(42), false), true, "false [0]"); - assert.sameValue(sample.includes(N(43), false), true, "false [1]"); + assert.sameValue(sample.includes(42, false), true, "false [0]"); + assert.sameValue(sample.includes(43, false), true, "false [1]"); - assert.sameValue(sample.includes(N(42), NaN), true, "NaN [0]"); - assert.sameValue(sample.includes(N(43), NaN), true, "NaN [1]"); + assert.sameValue(sample.includes(42, NaN), true, "NaN [0]"); + assert.sameValue(sample.includes(43, NaN), true, "NaN [1]"); - assert.sameValue(sample.includes(N(42), null), true, "null [0]"); - assert.sameValue(sample.includes(N(43), null), true, "null [1]"); + assert.sameValue(sample.includes(42, null), true, "null [0]"); + assert.sameValue(sample.includes(43, null), true, "null [1]"); - assert.sameValue(sample.includes(N(42), undefined), true, "undefined [0]"); - assert.sameValue(sample.includes(N(43), undefined), true, "undefined [1]"); + assert.sameValue(sample.includes(42, undefined), true, "undefined [0]"); + assert.sameValue(sample.includes(43, undefined), true, "undefined [1]"); - assert.sameValue(sample.includes(N(42), null), true, "null [0]"); - assert.sameValue(sample.includes(N(43), null), true, "null [1]"); + assert.sameValue(sample.includes(42, null), true, "null [0]"); + assert.sameValue(sample.includes(43, null), true, "null [1]"); - assert.sameValue(sample.includes(N(42), obj), false, "object [0]"); - assert.sameValue(sample.includes(N(43), obj), true, "object [1]"); + assert.sameValue(sample.includes(42, obj), false, "object [0]"); + assert.sameValue(sample.includes(43, obj), true, "object [1]"); }); diff --git a/test/built-ins/TypedArray/prototype/indexOf/fromIndex-infinity.js b/test/built-ins/TypedArray/prototype/indexOf/fromIndex-infinity.js index e4a61ec96..a048138c0 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/fromIndex-infinity.js +++ b/test/built-ins/TypedArray/prototype/indexOf/fromIndex-infinity.js @@ -31,9 +31,9 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 43, 41])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 43, 41]); - assert.sameValue(sample.indexOf(N(43), Infinity), -1, "indexOf(43, Infinity)"); - assert.sameValue(sample.indexOf(N(43), -Infinity), 1, "indexOf(43, -Infinity)"); + assert.sameValue(sample.indexOf(43, Infinity), -1, "indexOf(43, Infinity)"); + assert.sameValue(sample.indexOf(43, -Infinity), 1, "indexOf(43, -Infinity)"); }); diff --git a/test/built-ins/TypedArray/prototype/indexOf/fromIndex-minus-zero.js b/test/built-ins/TypedArray/prototype/indexOf/fromIndex-minus-zero.js index 46fbb0550..3e4dfae8f 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/fromIndex-minus-zero.js +++ b/test/built-ins/TypedArray/prototype/indexOf/fromIndex-minus-zero.js @@ -21,10 +21,10 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample; - sample = new TA(N([42, 43])); - assert.sameValue(sample.indexOf(N(42), -0), 0, "-0 [0]"); - assert.sameValue(sample.indexOf(N(43), -0), 1, "-0 [1]"); + sample = new TA([42, 43]); + assert.sameValue(sample.indexOf(42, -0), 0, "-0 [0]"); + assert.sameValue(sample.indexOf(43, -0), 1, "-0 [1]"); }); diff --git a/test/built-ins/TypedArray/prototype/indexOf/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/indexOf/get-length-uses-internal-arraylength.js index fb3d62349..2703a0519 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/indexOf/get-length-uses-internal-arraylength.js @@ -22,11 +22,11 @@ features: [TypedArray] Object.defineProperty(TypedArray.prototype, "length", {value: 0}); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([7])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([7]); Object.defineProperty(TA.prototype, "length", {value: 0}); Object.defineProperty(sample, "length", {value: 0}); - assert.sameValue(sample.indexOf(N(7)), 0); + assert.sameValue(sample.indexOf(7), 0); }); diff --git a/test/built-ins/TypedArray/prototype/indexOf/search-found-returns-index.js b/test/built-ins/TypedArray/prototype/indexOf/search-found-returns-index.js index 4a75a3a0a..48500c1a8 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/search-found-returns-index.js +++ b/test/built-ins/TypedArray/prototype/indexOf/search-found-returns-index.js @@ -31,16 +31,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 42, 41])); - assert.sameValue(sample.indexOf(N(42)), 0, "indexOf(42)"); - assert.sameValue(sample.indexOf(N(43)), 1, "indexOf(43)"); - assert.sameValue(sample.indexOf(N(43), 1), 1, "indexOf(43, 1)"); - assert.sameValue(sample.indexOf(N(42), 1), 2, "indexOf(42, 1)"); - assert.sameValue(sample.indexOf(N(42), 2), 2, "indexOf(42, 2)"); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 42, 41]); + assert.sameValue(sample.indexOf(42), 0, "indexOf(42)"); + assert.sameValue(sample.indexOf(43), 1, "indexOf(43)"); + assert.sameValue(sample.indexOf(43, 1), 1, "indexOf(43, 1)"); + assert.sameValue(sample.indexOf(42, 1), 2, "indexOf(42, 1)"); + assert.sameValue(sample.indexOf(42, 2), 2, "indexOf(42, 2)"); - assert.sameValue(sample.indexOf(N(42), -4), 0, "indexOf(42, -4)"); - assert.sameValue(sample.indexOf(N(42), -3), 2, "indexOf(42, -3)"); - assert.sameValue(sample.indexOf(N(42), -2), 2, "indexOf(42, -2)"); - assert.sameValue(sample.indexOf(N(42), -5), 0, "indexOf(42, -5)"); + assert.sameValue(sample.indexOf(42, -4), 0, "indexOf(42, -4)"); + assert.sameValue(sample.indexOf(42, -3), 2, "indexOf(42, -3)"); + assert.sameValue(sample.indexOf(42, -2), 2, "indexOf(42, -2)"); + assert.sameValue(sample.indexOf(42, -5), 0, "indexOf(42, -5)"); }); diff --git a/test/built-ins/TypedArray/prototype/indexOf/search-not-found-returns-minus-one.js b/test/built-ins/TypedArray/prototype/indexOf/search-not-found-returns-minus-one.js index 8c0917920..ee8f513dc 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/search-not-found-returns-minus-one.js +++ b/test/built-ins/TypedArray/prototype/indexOf/search-not-found-returns-minus-one.js @@ -25,14 +25,14 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample; - sample = new TA(N([42, 43, 42, 41])); - assert.sameValue(sample.indexOf(N(44)), -1, "indexOf(44)"); - assert.sameValue(sample.indexOf(N(43), 2), -1, "indexOf(43, 2)"); - assert.sameValue(sample.indexOf(N(42), 3), -1, "indexOf(42, 3)"); - assert.sameValue(sample.indexOf(N(44), -4), -1, "indexOf(44, -4)"); - assert.sameValue(sample.indexOf(N(44), -5), -1, "indexOf(44, -5)"); - assert.sameValue(sample.indexOf(N(42), -1), -1, "indexOf(42, -1)"); + sample = new TA([42, 43, 42, 41]); + assert.sameValue(sample.indexOf(44), -1, "indexOf(44)"); + assert.sameValue(sample.indexOf(43, 2), -1, "indexOf(43, 2)"); + assert.sameValue(sample.indexOf(42, 3), -1, "indexOf(42, 3)"); + assert.sameValue(sample.indexOf(44, -4), -1, "indexOf(44, -4)"); + assert.sameValue(sample.indexOf(44, -5), -1, "indexOf(44, -5)"); + assert.sameValue(sample.indexOf(42, -1), -1, "indexOf(42, -1)"); }); diff --git a/test/built-ins/TypedArray/prototype/indexOf/tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/indexOf/tointeger-fromindex.js index 2672ddb12..f733d249c 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/tointeger-fromindex.js +++ b/test/built-ins/TypedArray/prototype/indexOf/tointeger-fromindex.js @@ -27,31 +27,31 @@ var obj = { } }; -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample; - sample = new TA(N([42, 43])); - assert.sameValue(sample.indexOf(N(42), "1"), -1, "string [0]"); - assert.sameValue(sample.indexOf(N(43), "1"), 1, "string [1]"); + sample = new TA([42, 43]); + assert.sameValue(sample.indexOf(42, "1"), -1, "string [0]"); + assert.sameValue(sample.indexOf(43, "1"), 1, "string [1]"); - assert.sameValue(sample.indexOf(N(42), true), -1, "true [0]"); - assert.sameValue(sample.indexOf(N(43), true), 1, "true [1]"); + assert.sameValue(sample.indexOf(42, true), -1, "true [0]"); + assert.sameValue(sample.indexOf(43, true), 1, "true [1]"); - assert.sameValue(sample.indexOf(N(42), false), 0, "false [0]"); - assert.sameValue(sample.indexOf(N(43), false), 1, "false [1]"); + assert.sameValue(sample.indexOf(42, false), 0, "false [0]"); + assert.sameValue(sample.indexOf(43, false), 1, "false [1]"); - assert.sameValue(sample.indexOf(N(42), NaN), 0, "NaN [0]"); - assert.sameValue(sample.indexOf(N(43), NaN), 1, "NaN [1]"); + assert.sameValue(sample.indexOf(42, NaN), 0, "NaN [0]"); + assert.sameValue(sample.indexOf(43, NaN), 1, "NaN [1]"); - assert.sameValue(sample.indexOf(N(42), null), 0, "null [0]"); - assert.sameValue(sample.indexOf(N(43), null), 1, "null [1]"); + assert.sameValue(sample.indexOf(42, null), 0, "null [0]"); + assert.sameValue(sample.indexOf(43, null), 1, "null [1]"); - assert.sameValue(sample.indexOf(N(42), undefined), 0, "undefined [0]"); - assert.sameValue(sample.indexOf(N(43), undefined), 1, "undefined [1]"); + assert.sameValue(sample.indexOf(42, undefined), 0, "undefined [0]"); + assert.sameValue(sample.indexOf(43, undefined), 1, "undefined [1]"); - assert.sameValue(sample.indexOf(N(42), null), 0, "null [0]"); - assert.sameValue(sample.indexOf(N(43), null), 1, "null [1]"); + assert.sameValue(sample.indexOf(42, null), 0, "null [0]"); + assert.sameValue(sample.indexOf(43, null), 1, "null [1]"); - assert.sameValue(sample.indexOf(N(42), obj), -1, "object [0]"); - assert.sameValue(sample.indexOf(N(43), obj), 1, "object [1]"); + assert.sameValue(sample.indexOf(42, obj), -1, "object [0]"); + assert.sameValue(sample.indexOf(43, obj), 1, "object [1]"); }); diff --git a/test/built-ins/TypedArray/prototype/join/custom-separator-result-from-tostring-on-each-simple-value.js b/test/built-ins/TypedArray/prototype/join/custom-separator-result-from-tostring-on-each-simple-value.js index 13cb0624a..694f81db0 100644 --- a/test/built-ins/TypedArray/prototype/join/custom-separator-result-from-tostring-on-each-simple-value.js +++ b/test/built-ins/TypedArray/prototype/join/custom-separator-result-from-tostring-on-each-simple-value.js @@ -29,8 +29,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([1, 0, 2, 3, 42, 127])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([1, 0, 2, 3, 42, 127]); var result; diff --git a/test/built-ins/TypedArray/prototype/join/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/join/get-length-uses-internal-arraylength.js index a98f8b84e..558829704 100644 --- a/test/built-ins/TypedArray/prototype/join/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/join/get-length-uses-internal-arraylength.js @@ -32,8 +32,8 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); Object.defineProperty(TA.prototype, "length", desc); Object.defineProperty(sample, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/join/result-from-tostring-on-each-simple-value.js b/test/built-ins/TypedArray/prototype/join/result-from-tostring-on-each-simple-value.js index dd6f98103..b6d91a035 100644 --- a/test/built-ins/TypedArray/prototype/join/result-from-tostring-on-each-simple-value.js +++ b/test/built-ins/TypedArray/prototype/join/result-from-tostring-on-each-simple-value.js @@ -28,8 +28,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([1, 0, 2, 3, 42, 127])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([1, 0, 2, 3, 42, 127]); var result = sample.join(); diff --git a/test/built-ins/TypedArray/prototype/keys/iter-prototype.js b/test/built-ins/TypedArray/prototype/keys/iter-prototype.js index a01464f54..fd5509ac6 100644 --- a/test/built-ins/TypedArray/prototype/keys/iter-prototype.js +++ b/test/built-ins/TypedArray/prototype/keys/iter-prototype.js @@ -17,8 +17,8 @@ features: [Symbol.iterator, TypedArray] var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]()); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([0, 42, 64])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([0, 42, 64]); var iter = sample.keys(); assert.sameValue(Object.getPrototypeOf(iter), ArrayIteratorProto); diff --git a/test/built-ins/TypedArray/prototype/keys/return-itor.js b/test/built-ins/TypedArray/prototype/keys/return-itor.js index e0fa5bdfb..f496130b6 100644 --- a/test/built-ins/TypedArray/prototype/keys/return-itor.js +++ b/test/built-ins/TypedArray/prototype/keys/return-itor.js @@ -15,8 +15,8 @@ features: [TypedArray] var sample = [0, 42, 64]; -testWithTypedArrayConstructors(function(TA, N) { - var typedArray = new TA(N(sample)); +testWithTypedArrayConstructors(function(TA) { + var typedArray = new TA(sample); var itor = typedArray.keys(); var next = itor.next(); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/fromIndex-infinity.js b/test/built-ins/TypedArray/prototype/lastIndexOf/fromIndex-infinity.js index 6e828e8c5..118fa2981 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/fromIndex-infinity.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/fromIndex-infinity.js @@ -24,9 +24,9 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 43, 41])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 43, 41]); - assert.sameValue(sample.lastIndexOf(N(43), Infinity), 2, "lastIndexOf(43, Infinity)"); - assert.sameValue(sample.lastIndexOf(N(43), -Infinity), -1, "lastIndexOf(43, -Infinity)"); + assert.sameValue(sample.lastIndexOf(43, Infinity), 2, "lastIndexOf(43, Infinity)"); + assert.sameValue(sample.lastIndexOf(43, -Infinity), -1, "lastIndexOf(43, -Infinity)"); }); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/fromIndex-minus-zero.js b/test/built-ins/TypedArray/prototype/lastIndexOf/fromIndex-minus-zero.js index c18cd6c68..1cf02d329 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/fromIndex-minus-zero.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/fromIndex-minus-zero.js @@ -21,10 +21,10 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample; - sample = new TA(N([42, 43])); - assert.sameValue(sample.lastIndexOf(N(42), -0), 0, "-0 [0]"); - assert.sameValue(sample.lastIndexOf(N(43), -0), -1, "-0 [1]"); + sample = new TA([42, 43]); + assert.sameValue(sample.lastIndexOf(42, -0), 0, "-0 [0]"); + assert.sameValue(sample.lastIndexOf(43, -0), -1, "-0 [1]"); }); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/lastIndexOf/get-length-uses-internal-arraylength.js index cc846e7ec..076d0b8d8 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/get-length-uses-internal-arraylength.js @@ -22,11 +22,11 @@ features: [TypedArray] Object.defineProperty(TypedArray.prototype, "length", {value: 0}); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([7])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([7]); Object.defineProperty(TA.prototype, "length", {value: 0}); Object.defineProperty(sample, "length", {value: 0}); - assert.sameValue(sample.lastIndexOf(N(7)), 0); + assert.sameValue(sample.lastIndexOf(7), 0); }); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/search-found-returns-index.js b/test/built-ins/TypedArray/prototype/lastIndexOf/search-found-returns-index.js index cfcae34fe..ecf7b2a84 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/search-found-returns-index.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/search-found-returns-index.js @@ -30,28 +30,28 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 42, 41])); - assert.sameValue(sample.lastIndexOf(N(42)), 2, "lastIndexOf(42)"); - assert.sameValue(sample.lastIndexOf(N(43)), 1, "lastIndexOf(43)"); - assert.sameValue(sample.lastIndexOf(N(41)), 3, "lastIndexOf(41)"); - assert.sameValue(sample.lastIndexOf(N(41), 3), 3, "lastIndexOf(41, 3)"); - assert.sameValue(sample.lastIndexOf(N(41), 4), 3, "lastIndexOf(41, 4)"); - assert.sameValue(sample.lastIndexOf(N(43), 1), 1, "lastIndexOf(43, 1)"); - assert.sameValue(sample.lastIndexOf(N(43), 2), 1, "lastIndexOf(43, 2)"); - assert.sameValue(sample.lastIndexOf(N(43), 3), 1, "lastIndexOf(43, 3)"); - assert.sameValue(sample.lastIndexOf(N(43), 4), 1, "lastIndexOf(43, 4)"); - assert.sameValue(sample.lastIndexOf(N(42), 0), 0, "lastIndexOf(42, 0)"); - assert.sameValue(sample.lastIndexOf(N(42), 1), 0, "lastIndexOf(42, 1)"); - assert.sameValue(sample.lastIndexOf(N(42), 2), 2, "lastIndexOf(42, 2)"); - assert.sameValue(sample.lastIndexOf(N(42), 3), 2, "lastIndexOf(42, 3)"); - assert.sameValue(sample.lastIndexOf(N(42), 4), 2, "lastIndexOf(42, 4)"); - assert.sameValue(sample.lastIndexOf(N(42), -4), 0, "lastIndexOf(42, -4)"); - assert.sameValue(sample.lastIndexOf(N(42), -3), 0, "lastIndexOf(42, -3)"); - assert.sameValue(sample.lastIndexOf(N(42), -2), 2, "lastIndexOf(42, -2)"); - assert.sameValue(sample.lastIndexOf(N(42), -1), 2, "lastIndexOf(42, -1)"); - assert.sameValue(sample.lastIndexOf(N(43), -3), 1, "lastIndexOf(43, -3)"); - assert.sameValue(sample.lastIndexOf(N(43), -2), 1, "lastIndexOf(43, -2)"); - assert.sameValue(sample.lastIndexOf(N(43), -1), 1, "lastIndexOf(43, -1)"); - assert.sameValue(sample.lastIndexOf(N(41), -1), 3, "lastIndexOf(41, -1)"); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 42, 41]); + assert.sameValue(sample.lastIndexOf(42), 2, "lastIndexOf(42)"); + assert.sameValue(sample.lastIndexOf(43), 1, "lastIndexOf(43)"); + assert.sameValue(sample.lastIndexOf(41), 3, "lastIndexOf(41)"); + assert.sameValue(sample.lastIndexOf(41, 3), 3, "lastIndexOf(41, 3)"); + assert.sameValue(sample.lastIndexOf(41, 4), 3, "lastIndexOf(41, 4)"); + assert.sameValue(sample.lastIndexOf(43, 1), 1, "lastIndexOf(43, 1)"); + assert.sameValue(sample.lastIndexOf(43, 2), 1, "lastIndexOf(43, 2)"); + assert.sameValue(sample.lastIndexOf(43, 3), 1, "lastIndexOf(43, 3)"); + assert.sameValue(sample.lastIndexOf(43, 4), 1, "lastIndexOf(43, 4)"); + assert.sameValue(sample.lastIndexOf(42, 0), 0, "lastIndexOf(42, 0)"); + assert.sameValue(sample.lastIndexOf(42, 1), 0, "lastIndexOf(42, 1)"); + assert.sameValue(sample.lastIndexOf(42, 2), 2, "lastIndexOf(42, 2)"); + assert.sameValue(sample.lastIndexOf(42, 3), 2, "lastIndexOf(42, 3)"); + assert.sameValue(sample.lastIndexOf(42, 4), 2, "lastIndexOf(42, 4)"); + assert.sameValue(sample.lastIndexOf(42, -4), 0, "lastIndexOf(42, -4)"); + assert.sameValue(sample.lastIndexOf(42, -3), 0, "lastIndexOf(42, -3)"); + assert.sameValue(sample.lastIndexOf(42, -2), 2, "lastIndexOf(42, -2)"); + assert.sameValue(sample.lastIndexOf(42, -1), 2, "lastIndexOf(42, -1)"); + assert.sameValue(sample.lastIndexOf(43, -3), 1, "lastIndexOf(43, -3)"); + assert.sameValue(sample.lastIndexOf(43, -2), 1, "lastIndexOf(43, -2)"); + assert.sameValue(sample.lastIndexOf(43, -1), 1, "lastIndexOf(43, -1)"); + assert.sameValue(sample.lastIndexOf(41, -1), 3, "lastIndexOf(41, -1)"); }); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/search-not-found-returns-minus-one.js b/test/built-ins/TypedArray/prototype/lastIndexOf/search-not-found-returns-minus-one.js index 2094a40b3..4669b5fc5 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/search-not-found-returns-minus-one.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/search-not-found-returns-minus-one.js @@ -25,18 +25,18 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample; - sample = new TA(N([42, 43, 42, 41])); - assert.sameValue(sample.lastIndexOf(N(44)), -1, "lastIndexOf(44)"); - assert.sameValue(sample.lastIndexOf(N(44), -4), -1, "lastIndexOf(44, -4)"); - assert.sameValue(sample.lastIndexOf(N(44), -5), -1, "lastIndexOf(44, -5)"); - assert.sameValue(sample.lastIndexOf(N(42), -5), -1, "lastIndexOf(42, -5)"); - assert.sameValue(sample.lastIndexOf(N(43), -4), -1, "lastIndexOf(43, -4)"); - assert.sameValue(sample.lastIndexOf(N(43), -5), -1, "lastIndexOf(43, -5)"); - assert.sameValue(sample.lastIndexOf(N(41), 0), -1, "lastIndexOf(41, 0)"); - assert.sameValue(sample.lastIndexOf(N(41), 1), -1, "lastIndexOf(41, 1)"); - assert.sameValue(sample.lastIndexOf(N(41), 2), -1, "lastIndexOf(41, 2)"); - assert.sameValue(sample.lastIndexOf(N(43), 0), -1, "lastIndexOf(43, 0)"); + sample = new TA([42, 43, 42, 41]); + assert.sameValue(sample.lastIndexOf(44), -1, "lastIndexOf(44)"); + assert.sameValue(sample.lastIndexOf(44, -4), -1, "lastIndexOf(44, -4)"); + assert.sameValue(sample.lastIndexOf(44, -5), -1, "lastIndexOf(44, -5)"); + assert.sameValue(sample.lastIndexOf(42, -5), -1, "lastIndexOf(42, -5)"); + assert.sameValue(sample.lastIndexOf(43, -4), -1, "lastIndexOf(43, -4)"); + assert.sameValue(sample.lastIndexOf(43, -5), -1, "lastIndexOf(43, -5)"); + assert.sameValue(sample.lastIndexOf(41, 0), -1, "lastIndexOf(41, 0)"); + assert.sameValue(sample.lastIndexOf(41, 1), -1, "lastIndexOf(41, 1)"); + assert.sameValue(sample.lastIndexOf(41, 2), -1, "lastIndexOf(41, 2)"); + assert.sameValue(sample.lastIndexOf(43, 0), -1, "lastIndexOf(43, 0)"); }); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/lastIndexOf/tointeger-fromindex.js index c516ee8ca..5d47be334 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/tointeger-fromindex.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/tointeger-fromindex.js @@ -27,31 +27,31 @@ var obj = { } }; -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample; - sample = new TA(N([42, 43])); - assert.sameValue(sample.lastIndexOf(N(42), "1"), 0, "string [0]"); - assert.sameValue(sample.lastIndexOf(N(43), "1"), 1, "string [1]"); + sample = new TA([42, 43]); + assert.sameValue(sample.lastIndexOf(42, "1"), 0, "string [0]"); + assert.sameValue(sample.lastIndexOf(43, "1"), 1, "string [1]"); - assert.sameValue(sample.lastIndexOf(N(42), true), 0, "true [0]"); - assert.sameValue(sample.lastIndexOf(N(43), true), 1, "true [1]"); + assert.sameValue(sample.lastIndexOf(42, true), 0, "true [0]"); + assert.sameValue(sample.lastIndexOf(43, true), 1, "true [1]"); - assert.sameValue(sample.lastIndexOf(N(42), false), 0, "false [0]"); - assert.sameValue(sample.lastIndexOf(N(43), false), -1, "false [1]"); + assert.sameValue(sample.lastIndexOf(42, false), 0, "false [0]"); + assert.sameValue(sample.lastIndexOf(43, false), -1, "false [1]"); - assert.sameValue(sample.lastIndexOf(N(42), NaN), 0, "NaN [0]"); - assert.sameValue(sample.lastIndexOf(N(43), NaN), -1, "NaN [1]"); + assert.sameValue(sample.lastIndexOf(42, NaN), 0, "NaN [0]"); + assert.sameValue(sample.lastIndexOf(43, NaN), -1, "NaN [1]"); - assert.sameValue(sample.lastIndexOf(N(42), null), 0, "null [0]"); - assert.sameValue(sample.lastIndexOf(N(43), null), -1, "null [1]"); + assert.sameValue(sample.lastIndexOf(42, null), 0, "null [0]"); + assert.sameValue(sample.lastIndexOf(43, null), -1, "null [1]"); - assert.sameValue(sample.lastIndexOf(N(42), undefined), 0, "undefined [0]"); - assert.sameValue(sample.lastIndexOf(N(43), undefined), -1, "undefined [1]"); + assert.sameValue(sample.lastIndexOf(42, undefined), 0, "undefined [0]"); + assert.sameValue(sample.lastIndexOf(43, undefined), -1, "undefined [1]"); - assert.sameValue(sample.lastIndexOf(N(42), null), 0, "null [0]"); - assert.sameValue(sample.lastIndexOf(N(43), null), -1, "null [1]"); + assert.sameValue(sample.lastIndexOf(42, null), 0, "null [0]"); + assert.sameValue(sample.lastIndexOf(43, null), -1, "null [1]"); - assert.sameValue(sample.lastIndexOf(N(42), obj), 0, "object [0]"); - assert.sameValue(sample.lastIndexOf(N(43), obj), 1, "object [1]"); + assert.sameValue(sample.lastIndexOf(42, obj), 0, "object [0]"); + assert.sameValue(sample.lastIndexOf(43, obj), 1, "object [1]"); }); diff --git a/test/built-ins/TypedArray/prototype/map/arraylength-internal.js b/test/built-ins/TypedArray/prototype/map/arraylength-internal.js index 39b34ae8a..bb7186fc8 100644 --- a/test/built-ins/TypedArray/prototype/map/arraylength-internal.js +++ b/test/built-ins/TypedArray/prototype/map/arraylength-internal.js @@ -14,7 +14,7 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample1 = new TA(42); var loop = 0; @@ -22,7 +22,7 @@ testWithTypedArrayConstructors(function(TA, N) { sample1.map(function() { loop++; - return N(0); + return 0; }); assert.sameValue(loop, 42, "data descriptor"); @@ -38,7 +38,7 @@ testWithTypedArrayConstructors(function(TA, N) { sample2.map(function() { loop++; - return N(0); + return 0; }); assert.sameValue(loop, 4, "accessor descriptor"); }); diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-with-thisarg.js index b0442e5e2..7b0fcfcf2 100644 --- a/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-with-thisarg.js +++ b/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-with-thisarg.js @@ -17,32 +17,32 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); var results = []; var thisArg = ["test262", 0, "ecma262", 0]; sample.map(function() { results.push(arguments); - return N(0); + return 0; }, thisArg); assert.sameValue(results.length, 3, "results.length"); assert.sameValue(thisArg.length, 4, "thisArg.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); + assert.sameValue(results[0][0], 42, "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); + assert.sameValue(results[1][0], 43, "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); + assert.sameValue(results[2][0], 44, "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-without-thisarg.js index 506f3e1ed..12ce6c784 100644 --- a/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-without-thisarg.js +++ b/test/built-ins/TypedArray/prototype/map/callbackfn-arguments-without-thisarg.js @@ -17,30 +17,30 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); var results = []; sample.map(function() { results.push(arguments); - return N(0); + return 0; }); assert.sameValue(results.length, 3, "results.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); + assert.sameValue(results[0][0], 42, "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); + assert.sameValue(results[1][0], 43, "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); + assert.sameValue(results[2][0], 44, "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/map/callbackfn-detachbuffer.js index 72d775dfe..a183289a0 100644 --- a/test/built-ins/TypedArray/prototype/map/callbackfn-detachbuffer.js +++ b/test/built-ins/TypedArray/prototype/map/callbackfn-detachbuffer.js @@ -28,7 +28,7 @@ testWithTypedArrayConstructors(function(TA) { } $DETACHBUFFER(sample.buffer); loops++; - return N(0); + return 0; }); }); diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-no-interaction-over-non-integer-properties.js b/test/built-ins/TypedArray/prototype/map/callbackfn-no-interaction-over-non-integer-properties.js index eff8277d6..e097d50ce 100644 --- a/test/built-ins/TypedArray/prototype/map/callbackfn-no-interaction-over-non-integer-properties.js +++ b/test/built-ins/TypedArray/prototype/map/callbackfn-no-interaction-over-non-integer-properties.js @@ -18,8 +18,8 @@ includes: [testTypedArray.js, compareArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([7, 8])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([7, 8]); var results = []; @@ -28,7 +28,7 @@ testWithTypedArrayConstructors(function(TA, N) { sample.map(function() { results.push(arguments); - return N(0); + return 0; }); assert.sameValue(results.length, 2, "results.length"); @@ -36,6 +36,6 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); - assert.sameValue(results[0][0], N(7), "results[0][0] - kValue"); - assert.sameValue(results[1][0], N(8), "results[1][0] - kValue"); + assert.sameValue(results[0][0], 7, "results[0][0] - kValue"); + assert.sameValue(results[1][0], 8, "results[1][0] - kValue"); }); diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-return-affects-returned-object.js b/test/built-ins/TypedArray/prototype/map/callbackfn-return-affects-returned-object.js index b05d96894..6f19e2277 100644 --- a/test/built-ins/TypedArray/prototype/map/callbackfn-return-affects-returned-object.js +++ b/test/built-ins/TypedArray/prototype/map/callbackfn-return-affects-returned-object.js @@ -19,13 +19,13 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([1, 2, 4])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([1, 2, 4]); var result = sample.map(function(v) { - return v * N(3); + return v * 3; }); - assert.sameValue(result[0], N(3), "result[0] == 3"); - assert.sameValue(result[1], N(6), "result[1] == 6"); - assert.sameValue(result[2], N(12), "result[2] == 12"); + assert.sameValue(result[0], 3, "result[0] == 3"); + assert.sameValue(result[1], 6, "result[1] == 6"); + assert.sameValue(result[2], 12, "result[2] == 12"); }); diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/map/callbackfn-return-does-not-change-instance.js index 311fbde66..fe298618b 100644 --- a/test/built-ins/TypedArray/prototype/map/callbackfn-return-does-not-change-instance.js +++ b/test/built-ins/TypedArray/prototype/map/callbackfn-return-does-not-change-instance.js @@ -10,16 +10,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample1 = new TA(3); - sample1[1] = N(1); + sample1[1] = 1; sample1.map(function() { - return N(42); + return 42; }); - assert.sameValue(sample1[0], N(0), "[0] == 0"); - assert.sameValue(sample1[1], N(1), "[1] == 1"); - assert.sameValue(sample1[2], N(0), "[2] == 0"); + assert.sameValue(sample1[0], 0, "[0] == 0"); + assert.sameValue(sample1[1], 1, "[1] == 1"); + assert.sameValue(sample1[2], 0, "[2] == 0"); }); diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-return-does-not-copy-non-integer-properties.js b/test/built-ins/TypedArray/prototype/map/callbackfn-return-does-not-copy-non-integer-properties.js index d9fcda6ca..cbe3316cd 100644 --- a/test/built-ins/TypedArray/prototype/map/callbackfn-return-does-not-copy-non-integer-properties.js +++ b/test/built-ins/TypedArray/prototype/map/callbackfn-return-does-not-copy-non-integer-properties.js @@ -17,15 +17,15 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([7, 8])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([7, 8]); var bar = Symbol("1"); sample.foo = 42; sample[bar] = 1; var result = sample.map(function() { - return N(0); + return 0; }); assert.sameValue(result.length, 2, "result.length"); diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/map/callbackfn-set-value-during-interaction.js index b401826c6..ddc93200a 100644 --- a/test/built-ins/TypedArray/prototype/map/callbackfn-set-value-during-interaction.js +++ b/test/built-ins/TypedArray/prototype/map/callbackfn-set-value-during-interaction.js @@ -11,33 +11,33 @@ includes: [testTypedArray.js] features: [Reflect.set, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); var newVal = 0; sample.map(function(val, i) { if (i > 0) { assert.sameValue( - sample[i - 1], N(newVal - 1), + sample[i - 1], newVal - 1, "get the changed value during the loop" ); assert.sameValue( - Reflect.set(sample, 0, N(7)), + Reflect.set(sample, 0, 7), true, "re-set a value for sample[0]" ); } assert.sameValue( - Reflect.set(sample, i, N(newVal)), + Reflect.set(sample, i, newVal), true, "set value during iteration" ); newVal++; - return N(0); + return 0; }); - assert.sameValue(sample[0], N(7), "changed values after iteration [0] == 7"); - assert.sameValue(sample[1], N(1), "changed values after iteration [1] == 1"); - assert.sameValue(sample[2], N(2), "changed values after iteration [2] == 2"); + assert.sameValue(sample[0], 7, "changed values after iteration [0] == 7"); + assert.sameValue(sample[1], 1, "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], 2, "changed values after iteration [2] == 2"); }); diff --git a/test/built-ins/TypedArray/prototype/map/callbackfn-this.js b/test/built-ins/TypedArray/prototype/map/callbackfn-this.js index 46d990972..43d3159bc 100644 --- a/test/built-ins/TypedArray/prototype/map/callbackfn-this.js +++ b/test/built-ins/TypedArray/prototype/map/callbackfn-this.js @@ -21,14 +21,14 @@ features: [TypedArray] var expected = (function() { return this; })(); var thisArg = {}; -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample = new TA(3); var results1 = []; sample.map(function() { results1.push(this); - return N(0); + return 0; }); assert.sameValue(results1.length, 3, "results1"); @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(function(TA, N) { sample.map(function() { results2.push(this); - return N(0); + return 0; }, thisArg); assert.sameValue(results2.length, 3, "results2"); diff --git a/test/built-ins/TypedArray/prototype/map/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/map/values-are-not-cached.js index e7d87ff1d..8900d596a 100644 --- a/test/built-ins/TypedArray/prototype/map/values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/map/values-are-not-cached.js @@ -11,18 +11,18 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); sample.map(function(v, i) { if (i < sample.length - 1) { - sample[i+1] = N(42); + sample[i+1] = 42; } assert.sameValue( - v, N(42), "method does not cache values before callbackfn calls" + v, 42, "method does not cache values before callbackfn calls" ); - return N(0); + return 0; }); }); diff --git a/test/built-ins/TypedArray/prototype/reduce/callbackfn-arguments-custom-accumulator.js b/test/built-ins/TypedArray/prototype/reduce/callbackfn-arguments-custom-accumulator.js index 3ed389aff..c99ad441b 100644 --- a/test/built-ins/TypedArray/prototype/reduce/callbackfn-arguments-custom-accumulator.js +++ b/test/built-ins/TypedArray/prototype/reduce/callbackfn-arguments-custom-accumulator.js @@ -26,8 +26,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); var results = []; @@ -40,19 +40,19 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue(results[0].length, 4, "results[0].length"); assert.sameValue(results[0][0], 7, "results[0][0] - accumulator"); - assert.sameValue(results[0][1], N(42), "results[0][1] - kValue"); + assert.sameValue(results[0][1], 42, "results[0][1] - kValue"); assert.sameValue(results[0][2], 0, "results[0][2] - k"); assert.sameValue(results[0][3], sample, "results[0][3] - this"); assert.sameValue(results[1].length, 4, "results[1].length"); assert.sameValue(results[1][0], 8, "results[1][0] - accumulator"); - assert.sameValue(results[1][1], N(43), "results[1][1] - kValue"); + assert.sameValue(results[1][1], 43, "results[1][1] - kValue"); assert.sameValue(results[1][2], 1, "results[1][2] - k"); assert.sameValue(results[1][3], sample, "results[1][3] - this"); assert.sameValue(results[2].length, 4, "results[2].length"); assert.sameValue(results[2][0], 9, "results[2][0] - accumulator"); - assert.sameValue(results[2][1], N(44), "results[2][1] - kValue"); + assert.sameValue(results[2][1], 44, "results[2][1] - kValue"); assert.sameValue(results[2][2], 2, "results[2][2] - k"); assert.sameValue(results[2][3], sample, "results[2][3] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/reduce/callbackfn-arguments-default-accumulator.js b/test/built-ins/TypedArray/prototype/reduce/callbackfn-arguments-default-accumulator.js index bdf5f7c64..f293ef1b9 100644 --- a/test/built-ins/TypedArray/prototype/reduce/callbackfn-arguments-default-accumulator.js +++ b/test/built-ins/TypedArray/prototype/reduce/callbackfn-arguments-default-accumulator.js @@ -33,27 +33,27 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); var results = []; sample.reduce(function(accumulator) { results.push(arguments); - return accumulator - N(1); + return accumulator - 1; }); assert.sameValue(results.length, 2, "results.length"); assert.sameValue(results[0].length, 4, "results[1].length"); - assert.sameValue(results[0][0], N(42), "results[1][0] - accumulator"); - assert.sameValue(results[0][1], N(43), "results[1][1] - kValue"); + assert.sameValue(results[0][0], 42, "results[1][0] - accumulator"); + assert.sameValue(results[0][1], 43, "results[1][1] - kValue"); assert.sameValue(results[0][2], 1, "results[1][2] - k"); assert.sameValue(results[0][3], sample, "results[1][3] - this"); assert.sameValue(results[1].length, 4, "results[2].length"); - assert.sameValue(results[1][0], N(41), "results[2][0] - accumulator"); - assert.sameValue(results[1][1], N(44), "results[2][1] - kValue"); + assert.sameValue(results[1][0], 41, "results[2][0] - accumulator"); + assert.sameValue(results[1][1], 44, "results[2][1] - kValue"); assert.sameValue(results[1][2], 2, "results[2][2] - k"); assert.sameValue(results[1][3], sample, "results[2][3] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/reduce/callbackfn-no-iteration-over-non-integer-properties.js b/test/built-ins/TypedArray/prototype/reduce/callbackfn-no-iteration-over-non-integer-properties.js index 14911508c..18982a9d3 100644 --- a/test/built-ins/TypedArray/prototype/reduce/callbackfn-no-iteration-over-non-integer-properties.js +++ b/test/built-ins/TypedArray/prototype/reduce/callbackfn-no-iteration-over-non-integer-properties.js @@ -26,8 +26,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([7, 8])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([7, 8]); var results = []; @@ -43,6 +43,6 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue(results[0][2], 0, "results[0][2] - k"); assert.sameValue(results[1][2], 1, "results[1][2] - k"); - assert.sameValue(results[0][1], N(7), "results[0][1] - kValue"); - assert.sameValue(results[1][1], N(8), "results[1][1] - kValue"); + assert.sameValue(results[0][1], 7, "results[0][1] - kValue"); + assert.sameValue(results[1][1], 8, "results[1][1] - kValue"); }); diff --git a/test/built-ins/TypedArray/prototype/reduce/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/reduce/callbackfn-return-does-not-change-instance.js index 8c0dcd9aa..6969dd9b5 100644 --- a/test/built-ins/TypedArray/prototype/reduce/callbackfn-return-does-not-change-instance.js +++ b/test/built-ins/TypedArray/prototype/reduce/callbackfn-return-does-not-change-instance.js @@ -8,14 +8,14 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([0, 1, 0])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([0, 1, 0]); sample.reduce(function() { return 42; }, 7); - assert.sameValue(sample[0], N(0), "[0] == 0"); - assert.sameValue(sample[1], N(1), "[1] == 1"); - assert.sameValue(sample[2], N(0), "[2] == 0"); + assert.sameValue(sample[0], 0, "[0] == 0"); + assert.sameValue(sample[1], 1, "[1] == 1"); + assert.sameValue(sample[2], 0, "[2] == 0"); }); diff --git a/test/built-ins/TypedArray/prototype/reduce/callbackfn-set-value-during-iteration.js b/test/built-ins/TypedArray/prototype/reduce/callbackfn-set-value-during-iteration.js index 0afa1860c..41ae9c0c7 100644 --- a/test/built-ins/TypedArray/prototype/reduce/callbackfn-set-value-during-iteration.js +++ b/test/built-ins/TypedArray/prototype/reduce/callbackfn-set-value-during-iteration.js @@ -18,24 +18,24 @@ includes: [testTypedArray.js] features: [Reflect.set, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); var newVal = 0; sample.reduce(function(acc, val, i) { if (i > 0) { assert.sameValue( - sample[i - 1], N(newVal - 1), + sample[i - 1], newVal - 1, "get the changed value during the loop" ); assert.sameValue( - Reflect.set(sample, 0, N(7)), + Reflect.set(sample, 0, 7), true, "re-set a value for sample[0]" ); } assert.sameValue( - Reflect.set(sample, i, N(newVal)), + Reflect.set(sample, i, newVal), true, "set value during iteration" ); @@ -43,7 +43,7 @@ testWithTypedArrayConstructors(function(TA, N) { newVal++; }, 0); - assert.sameValue(sample[0], N(7), "changed values after iteration [0] == 7"); - assert.sameValue(sample[1], N(1), "changed values after iteration [1] == 1"); - assert.sameValue(sample[2], N(2), "changed values after iteration [2] == 2"); + assert.sameValue(sample[0], 7, "changed values after iteration [0] == 7"); + assert.sameValue(sample[1], 1, "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], 2, "changed values after iteration [2] == 2"); }); diff --git a/test/built-ins/TypedArray/prototype/reduce/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/reduce/get-length-uses-internal-arraylength.js index b72ca4671..53f976f0f 100644 --- a/test/built-ins/TypedArray/prototype/reduce/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/reduce/get-length-uses-internal-arraylength.js @@ -30,8 +30,8 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); var calls = 0; Object.defineProperty(TA.prototype, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/reduce/result-is-last-callbackfn-return.js b/test/built-ins/TypedArray/prototype/reduce/result-is-last-callbackfn-return.js index 99ae68cef..17280f159 100644 --- a/test/built-ins/TypedArray/prototype/reduce/result-is-last-callbackfn-return.js +++ b/test/built-ins/TypedArray/prototype/reduce/result-is-last-callbackfn-return.js @@ -34,11 +34,11 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var calls, result; calls = 0; - result = new TA(N([1, 2, 3])).reduce(function() { + result = new TA([1, 2, 3]).reduce(function() { calls++; if (calls == 2) { @@ -48,7 +48,7 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue(result, 42, "using default accumulator"); calls = 0; - result = new TA(N([1, 2, 3])).reduce(function() { + result = new TA([1, 2, 3]).reduce(function() { calls++; if (calls == 3) { diff --git a/test/built-ins/TypedArray/prototype/reduce/result-of-any-type.js b/test/built-ins/TypedArray/prototype/reduce/result-of-any-type.js index 3ff22b46f..0519cc88a 100644 --- a/test/built-ins/TypedArray/prototype/reduce/result-of-any-type.js +++ b/test/built-ins/TypedArray/prototype/reduce/result-of-any-type.js @@ -34,8 +34,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); [ ["test262", "string"], ["", "empty string"], diff --git a/test/built-ins/TypedArray/prototype/reduce/return-first-value-without-callbackfn.js b/test/built-ins/TypedArray/prototype/reduce/return-first-value-without-callbackfn.js index 965cec5c2..236b332e4 100644 --- a/test/built-ins/TypedArray/prototype/reduce/return-first-value-without-callbackfn.js +++ b/test/built-ins/TypedArray/prototype/reduce/return-first-value-without-callbackfn.js @@ -31,12 +31,12 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var called = false; - var result = new TA(N([42])).reduce(function() { + var result = new TA([42]).reduce(function() { called = true; }); - assert.sameValue(result, N(42)); + assert.sameValue(result, 42); assert.sameValue(called, false); }); diff --git a/test/built-ins/TypedArray/prototype/reduce/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/reduce/values-are-not-cached.js index ecb194d96..e091df1f9 100644 --- a/test/built-ins/TypedArray/prototype/reduce/values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/reduce/values-are-not-cached.js @@ -26,16 +26,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); sample.reduce(function(a, v, i) { if (i < sample.length - 1) { - sample[i+1] = N(42); + sample[i+1] = 42; } assert.sameValue( - v, N(42), "method does not cache values before callbackfn calls" + v, 42, "method does not cache values before callbackfn calls" ); }, 0); }); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-arguments-custom-accumulator.js b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-arguments-custom-accumulator.js index c280aeef0..aecfae24e 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-arguments-custom-accumulator.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-arguments-custom-accumulator.js @@ -27,8 +27,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); var results = []; @@ -41,19 +41,19 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue(results[0].length, 4, "results[0].length"); assert.sameValue(results[0][0], 7, "results[0][0] - accumulator"); - assert.sameValue(results[0][1], N(44), "results[0][1] - kValue"); + assert.sameValue(results[0][1], 44, "results[0][1] - kValue"); assert.sameValue(results[0][2], 2, "results[0][2] - k"); assert.sameValue(results[0][3], sample, "results[0][3] - this"); assert.sameValue(results[1].length, 4, "results[1].length"); assert.sameValue(results[1][0], 8, "results[1][0] - accumulator"); - assert.sameValue(results[1][1], N(43), "results[1][1] - kValue"); + assert.sameValue(results[1][1], 43, "results[1][1] - kValue"); assert.sameValue(results[1][2], 1, "results[1][2] - k"); assert.sameValue(results[1][3], sample, "results[1][3] - this"); assert.sameValue(results[2].length, 4, "results[2].length"); assert.sameValue(results[2][0], 9, "results[2][0] - accumulator"); - assert.sameValue(results[2][1], N(42), "results[2][1] - kValue"); + assert.sameValue(results[2][1], 42, "results[2][1] - kValue"); assert.sameValue(results[2][2], 0, "results[2][2] - k"); assert.sameValue(results[2][3], sample, "results[2][3] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-arguments-default-accumulator.js b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-arguments-default-accumulator.js index e689c9fe7..51509985e 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-arguments-default-accumulator.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-arguments-default-accumulator.js @@ -36,27 +36,27 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); var results = []; sample.reduceRight(function(accumulator) { results.push(arguments); - return accumulator + N(1); + return accumulator + 1; }); assert.sameValue(results.length, 2, "results.length"); assert.sameValue(results[0].length, 4, "results[1].length"); - assert.sameValue(results[0][0], N(44), "results[1][0] - accumulator"); - assert.sameValue(results[0][1], N(43), "results[1][1] - kValue"); + assert.sameValue(results[0][0], 44, "results[1][0] - accumulator"); + assert.sameValue(results[0][1], 43, "results[1][1] - kValue"); assert.sameValue(results[0][2], 1, "results[1][2] - k"); assert.sameValue(results[0][3], sample, "results[1][3] - this"); assert.sameValue(results[1].length, 4, "results[2].length"); - assert.sameValue(results[1][0], N(45), "results[2][0] - accumulator"); - assert.sameValue(results[1][1], N(42), "results[2][1] - kValue"); + assert.sameValue(results[1][0], 45, "results[2][0] - accumulator"); + assert.sameValue(results[1][1], 42, "results[2][1] - kValue"); assert.sameValue(results[1][2], 0, "results[2][2] - k"); assert.sameValue(results[1][3], sample, "results[2][3] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-no-iteration-over-non-integer-properties.js b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-no-iteration-over-non-integer-properties.js index c807f650a..b81c9a91e 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-no-iteration-over-non-integer-properties.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-no-iteration-over-non-integer-properties.js @@ -27,8 +27,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([7, 8])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([7, 8]); var results = []; @@ -44,6 +44,6 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue(results[0][2], 1, "results[0][2] - k"); assert.sameValue(results[1][2], 0, "results[1][2] - k"); - assert.sameValue(results[0][1], N(8), "results[0][1] - kValue"); - assert.sameValue(results[1][1], N(7), "results[1][1] - kValue"); + assert.sameValue(results[0][1], 8, "results[0][1] - kValue"); + assert.sameValue(results[1][1], 7, "results[1][1] - kValue"); }); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-return-does-not-change-instance.js index 294eb33ea..d1c746ffa 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-return-does-not-change-instance.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-return-does-not-change-instance.js @@ -8,14 +8,14 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([0, 1, 0])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([0, 1, 0]); sample.reduceRight(function() { return 42; }, 7); - assert.sameValue(sample[0], N(0), "[0] == 0"); - assert.sameValue(sample[1], N(1), "[1] == 1"); - assert.sameValue(sample[2], N(0), "[2] == 0"); + assert.sameValue(sample[0], 0, "[0] == 0"); + assert.sameValue(sample[1], 1, "[1] == 1"); + assert.sameValue(sample[2], 0, "[2] == 0"); }); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-set-value-during-iteration.js b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-set-value-during-iteration.js index 62c9ef47a..290f197c0 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-set-value-during-iteration.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/callbackfn-set-value-during-iteration.js @@ -18,24 +18,24 @@ includes: [testTypedArray.js] features: [Reflect.set, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); var newVal = 0; sample.reduceRight(function(acc, val, i) { if (i < sample.length - 1) { assert.sameValue( - sample[i + 1], N(newVal - 1), + sample[i + 1], newVal - 1, "get the changed value during the loop" ); assert.sameValue( - Reflect.set(sample, 2, N(7)), + Reflect.set(sample, 2, 7), true, "re-set a value for sample[2]" ); } assert.sameValue( - Reflect.set(sample, i, N(newVal)), + Reflect.set(sample, i, newVal), true, "set value during iteration" ); @@ -43,7 +43,7 @@ testWithTypedArrayConstructors(function(TA, N) { newVal++; }, 0); - assert.sameValue(sample[0], N(2), "changed values after iteration [0] == 2"); - assert.sameValue(sample[1], N(1), "changed values after iteration [1] == 1"); - assert.sameValue(sample[2], N(7), "changed values after iteration [2] == 7"); + assert.sameValue(sample[0], 2, "changed values after iteration [0] == 2"); + assert.sameValue(sample[1], 1, "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], 7, "changed values after iteration [2] == 7"); }); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/reduceRight/get-length-uses-internal-arraylength.js index b1ff04f5d..32c560242 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/get-length-uses-internal-arraylength.js @@ -30,8 +30,8 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); var calls = 0; Object.defineProperty(TA.prototype, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/result-is-last-callbackfn-return.js b/test/built-ins/TypedArray/prototype/reduceRight/result-is-last-callbackfn-return.js index 41771b6f7..67504f27b 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/result-is-last-callbackfn-return.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/result-is-last-callbackfn-return.js @@ -36,11 +36,11 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var calls, result; calls = 0; - result = new TA(N([1, 2, 3])).reduceRight(function() { + result = new TA([1, 2, 3]).reduceRight(function() { calls++; if (calls == 2) { @@ -50,7 +50,7 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue(result, 42, "using default accumulator"); calls = 0; - result = new TA(N([1, 2, 3])).reduceRight(function() { + result = new TA([1, 2, 3]).reduceRight(function() { calls++; if (calls == 3) { diff --git a/test/built-ins/TypedArray/prototype/reduceRight/result-of-any-type.js b/test/built-ins/TypedArray/prototype/reduceRight/result-of-any-type.js index 2cb4a4f62..a7f2d6df8 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/result-of-any-type.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/result-of-any-type.js @@ -36,8 +36,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); [ ["test262", "string"], ["", "empty string"], diff --git a/test/built-ins/TypedArray/prototype/reduceRight/return-first-value-without-callbackfn.js b/test/built-ins/TypedArray/prototype/reduceRight/return-first-value-without-callbackfn.js index 7992c27c3..7100baf43 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/return-first-value-without-callbackfn.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/return-first-value-without-callbackfn.js @@ -32,12 +32,12 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var called = false; - var result = new TA(N([42])).reduceRight(function() { + var result = new TA([42]).reduceRight(function() { called = true; }); - assert.sameValue(result, N(42)); + assert.sameValue(result, 42); assert.sameValue(called, false); }); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/reduceRight/values-are-not-cached.js index 014ba87dd..fb93d3e20 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/values-are-not-cached.js @@ -27,16 +27,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([44, 43, 42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([44, 43, 42]); sample.reduceRight(function(a, v, i) { if (i > 0) { - sample[i-1] = N(42); + sample[i-1] = 42; } assert.sameValue( - v, N(42), "method does not cache values before callbackfn calls" + v, 42, "method does not cache values before callbackfn calls" ); }, 0); }); diff --git a/test/built-ins/TypedArray/prototype/reverse/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/reverse/get-length-uses-internal-arraylength.js index 35150f289..4a51f2ffb 100644 --- a/test/built-ins/TypedArray/prototype/reverse/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/reverse/get-length-uses-internal-arraylength.js @@ -30,8 +30,8 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); Object.defineProperty(TA.prototype, "length", desc); Object.defineProperty(sample, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/reverse/reverts.js b/test/built-ins/TypedArray/prototype/reverse/reverts.js index be321a62f..5bec740e5 100644 --- a/test/built-ins/TypedArray/prototype/reverse/reverts.js +++ b/test/built-ins/TypedArray/prototype/reverse/reverts.js @@ -21,37 +21,37 @@ features: [TypedArray] var buffer = new ArrayBuffer(64); -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample = new TA(buffer, 0, 4); var other = new TA(buffer, 0, 5); - sample[0] = N(42); - sample[1] = N(43); - sample[2] = N(2); - sample[3] = N(1); - other[4] = N(7); + sample[0] = 42; + sample[1] = 43; + sample[2] = 2; + sample[3] = 1; + other[4] = 7; sample.reverse(); assert( - compareArray(sample, N([1, 2, 43, 42])) + compareArray(sample, [1, 2, 43, 42]) ); assert( - compareArray(other, N([1, 2, 43, 42, 7])) + compareArray(other, [1, 2, 43, 42, 7]) ); - sample[0] = N(7); - sample[1] = N(17); - sample[2] = N(1); - sample[3] = N(0); - other[4] = N(42); + sample[0] = 7; + sample[1] = 17; + sample[2] = 1; + sample[3] = 0; + other[4] = 42; other.reverse(); assert( - compareArray(other, N([42, 0, 1, 17, 7])) + compareArray(other, [42, 0, 1, 17, 7]) ); assert( - compareArray(sample, N([42, 0, 1, 17])) + compareArray(sample, [42, 0, 1, 17]) ); }); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-offset-tointeger.js b/test/built-ins/TypedArray/prototype/set/array-arg-offset-tointeger.js index c0e88a13d..a5ab52773 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-offset-tointeger.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-offset-tointeger.js @@ -18,78 +18,78 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample; - sample = new TA(N([1, 2])); - sample.set([N(42)], ""); - assert(compareArray(sample, N([42, 2])), "the empty string"); + sample = new TA([1, 2]); + sample.set([42], ""); + assert(compareArray(sample, [42, 2]), "the empty string"); - sample = new TA(N([1, 2])); - sample.set([N(42)], "0"); - assert(compareArray(sample, N([42, 2])), "'0'"); + sample = new TA([1, 2]); + sample.set([42], "0"); + assert(compareArray(sample, [42, 2]), "'0'"); - sample = new TA(N([1, 2])); - sample.set([N(42)], false); - assert(compareArray(sample, N([42, 2])), "false"); + sample = new TA([1, 2]); + sample.set([42], false); + assert(compareArray(sample, [42, 2]), "false"); - sample = new TA(N([1, 2])); - sample.set([N(42)], 0.1); - assert(compareArray(sample, N([42, 2])), "0.1"); + sample = new TA([1, 2]); + sample.set([42], 0.1); + assert(compareArray(sample, [42, 2]), "0.1"); - sample = new TA(N([1, 2])); - sample.set([N(42)], 0.9); - assert(compareArray(sample, N([42, 2])), "0.9"); + sample = new TA([1, 2]); + sample.set([42], 0.9); + assert(compareArray(sample, [42, 2]), "0.9"); - sample = new TA(N([1, 2])); - sample.set([N(42)], -0.5); - assert(compareArray(sample, N([42, 2])), "-0.5"); + sample = new TA([1, 2]); + sample.set([42], -0.5); + assert(compareArray(sample, [42, 2]), "-0.5"); - sample = new TA(N([1, 2])); - sample.set([N(42)], 1.1); - assert(compareArray(sample, N([1, 42])), "1.1"); + sample = new TA([1, 2]); + sample.set([42], 1.1); + assert(compareArray(sample, [1, 42]), "1.1"); - sample = new TA(N([1, 2])); - sample.set([N(42)], NaN); - assert(compareArray(sample, N([42, 2])), "NaN"); + sample = new TA([1, 2]); + sample.set([42], NaN); + assert(compareArray(sample, [42, 2]), "NaN"); - sample = new TA(N([1, 2])); - sample.set([N(42)], null); - assert(compareArray(sample, N([42, 2])), "null"); + sample = new TA([1, 2]); + sample.set([42], null); + assert(compareArray(sample, [42, 2]), "null"); - sample = new TA(N([1, 2])); - sample.set([N(42)], undefined); - assert(compareArray(sample, N([42, 2])), "undefined"); + sample = new TA([1, 2]); + sample.set([42], undefined); + assert(compareArray(sample, [42, 2]), "undefined"); - sample = new TA(N([1, 2])); - sample.set([N(42)], {}); - assert(compareArray(sample, N([42, 2])), "{}"); + sample = new TA([1, 2]); + sample.set([42], {}); + assert(compareArray(sample, [42, 2]), "{}"); - sample = new TA(N([1, 2])); - sample.set([N(42)], []); - assert(compareArray(sample, N([42, 2])), "[]"); + sample = new TA([1, 2]); + sample.set([42], []); + assert(compareArray(sample, [42, 2]), "[]"); - sample = new TA(N([1, 2])); - sample.set([N(42)], [0]); - assert(compareArray(sample, N([42, 2])), "[0]"); + sample = new TA([1, 2]); + sample.set([42], [0]); + assert(compareArray(sample, [42, 2]), "[0]"); - sample = new TA(N([1, 2])); - sample.set([N(42)], true); - assert(compareArray(sample, N([1, 42])), "true"); + sample = new TA([1, 2]); + sample.set([42], true); + assert(compareArray(sample, [1, 42]), "true"); - sample = new TA(N([1, 2])); - sample.set([N(42)], "1"); - assert(compareArray(sample, N([1, 42])), "'1'"); + sample = new TA([1, 2]); + sample.set([42], "1"); + assert(compareArray(sample, [1, 42]), "'1'"); - sample = new TA(N([1, 2])); - sample.set([N(42)], [1]); - assert(compareArray(sample, N([1, 42])), "[1]"); + sample = new TA([1, 2]); + sample.set([42], [1]); + assert(compareArray(sample, [1, 42]), "[1]"); - sample = new TA(N([1, 2])); - sample.set([N(42)], { valueOf: function() {return 1;} }); - assert(compareArray(sample, N([1, 42])), "valueOf"); + sample = new TA([1, 2]); + sample.set([42], { valueOf: function() {return 1;} }); + assert(compareArray(sample, [1, 42]), "valueOf"); - sample = new TA(N([1, 2])); - sample.set([N(42)], { toString: function() {return 1;} }); - assert(compareArray(sample, N([1, 42])), "toString"); + sample = new TA([1, 2]); + sample.set([42], { toString: function() {return 1;} }); + assert(compareArray(sample, [1, 42]), "toString"); }); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-get-length.js b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-get-length.js index e4b1b7726..2c67c5cc4 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-get-length.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-get-length.js @@ -24,8 +24,8 @@ Object.defineProperty(obj, "length", { } }); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([1, 2, 3])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([1, 2, 3]); assert.throws(Test262Error, function() { sample.set(obj); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-get-value.js b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-get-value.js index c96f7bcb9..afe080030 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-get-value.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-get-value.js @@ -22,12 +22,12 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var obj = { length: 4, - "0": N(42), - "1": N(43), - "3": N(44) + "0": 42, + "1": 43, + "3": 44 }; Object.defineProperty(obj, "2", { get: function() { @@ -35,14 +35,14 @@ testWithTypedArrayConstructors(function(TA, N) { } }); - var sample = new TA(N([1, 2, 3, 4])); + var sample = new TA([1, 2, 3, 4]); assert.throws(Test262Error, function() { sample.set(obj); }); assert( - compareArray(sample, N([42, 43, 3, 4])), + compareArray(sample, [42, 43, 3, 4]), "values are set until exception" ); }); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length-symbol.js b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length-symbol.js index a1c8bd795..f5b2289d8 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length-symbol.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length-symbol.js @@ -21,8 +21,8 @@ var obj = { length: Symbol("1") }; -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([1, 2, 3])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([1, 2, 3]); assert.throws(TypeError, function() { sample.set(obj); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length.js b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length.js index bac8f5b74..8252ebbef 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-length.js @@ -33,8 +33,8 @@ var obj2 = { } }; -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([1, 2, 3])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([1, 2, 3]); assert.throws(Test262Error, function() { sample.set(obj1); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value-symbol.js b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value-symbol.js index db48b41d7..2afc27a6f 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value-symbol.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value-symbol.js @@ -22,23 +22,23 @@ includes: [testTypedArray.js, compareArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var obj = { length: 4, - "0": N(42), - "1": N(43), + "0": 42, + "1": 43, "2": Symbol("1"), - "3": N(44) + "3": 44 }; - var sample = new TA(N([1, 2, 3, 4])); + var sample = new TA([1, 2, 3, 4]); assert.throws(TypeError, function() { sample.set(obj); }); assert( - compareArray(sample, N([42, 43, 3, 4])), + compareArray(sample, [42, 43, 3, 4]), "values are set until exception" ); }); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value.js b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value.js index 6348580e2..438001533 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value.js @@ -22,27 +22,27 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var obj = { length: 4, - "0": N(42), - "1": N(43), + "0": 42, + "1": 43, "2": { valueOf: function() { throw new Test262Error(); } }, - "3": N(44) + "3": 44 }; - var sample = new TA(N([1, 2, 3, 4])); + var sample = new TA([1, 2, 3, 4]); assert.throws(Test262Error, function() { sample.set(obj); }); assert( - compareArray(sample, N([42, 43, 3, 4])), + compareArray(sample, [42, 43, 3, 4]), "values are set until exception" ); }); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-toobject-offset.js b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-toobject-offset.js index 78a3c00d0..d36712393 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-toobject-offset.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-toobject-offset.js @@ -17,8 +17,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([1, 2, 3])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([1, 2, 3]); assert.throws(TypeError, function() { sample.set(undefined); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-set-values-in-order.js b/test/built-ins/TypedArray/prototype/set/array-arg-set-values-in-order.js index 95ef44d9f..9c1603a30 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-set-values-in-order.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-set-values-in-order.js @@ -22,7 +22,7 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample = new TA(5); var calls = []; var obj = { @@ -32,7 +32,7 @@ testWithTypedArrayConstructors(function(TA, N) { get: function() { calls.push(0); calls.push(sample.join()); - return N(42); + return 42; } }); @@ -40,7 +40,7 @@ testWithTypedArrayConstructors(function(TA, N) { get: function() { calls.push(1); calls.push(sample.join()); - return N(43); + return 43; } }); @@ -48,7 +48,7 @@ testWithTypedArrayConstructors(function(TA, N) { get: function() { calls.push(2); calls.push(sample.join()); - return N(44); + return 44; } }); @@ -61,7 +61,7 @@ testWithTypedArrayConstructors(function(TA, N) { sample.set(obj, 1); assert( - compareArray(sample, N([0, 42, 43, 44, 0])), + compareArray(sample, [0, 42, 43, 44, 0]), "values are set for src length" ); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-set-values.js b/test/built-ins/TypedArray/prototype/set/array-arg-set-values.js index 5490305d0..6e53dbc94 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-set-values.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-set-values.js @@ -22,42 +22,42 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var src = N([42, 43]); +testWithTypedArrayConstructors(function(TA) { + var src = [42, 43]; var srcObj = { length: 2, - '0': N(7), - '1': N(17) + '0': 7, + '1': 17 }; var sample, result; - sample = new TA(N([1, 2, 3, 4])); + sample = new TA([1, 2, 3, 4]); result = sample.set(src, 0); - assert(compareArray(sample, N([42, 43, 3, 4])), "offset: 0, result: " + sample); + assert(compareArray(sample, [42, 43, 3, 4]), "offset: 0, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA(N([1, 2, 3, 4])); + sample = new TA([1, 2, 3, 4]); result = sample.set(src, 1); - assert(compareArray(sample, N([1, 42, 43, 4])), "offset: 1, result: " + sample); + assert(compareArray(sample, [1, 42, 43, 4]), "offset: 1, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA(N([1, 2, 3, 4])); + sample = new TA([1, 2, 3, 4]); result = sample.set(src, 2); - assert(compareArray(sample, N([1, 2, 42, 43])), "offset: 2, result: " + sample); + assert(compareArray(sample, [1, 2, 42, 43]), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA(N([1, 2, 3, 4])); + sample = new TA([1, 2, 3, 4]); result = sample.set(srcObj, 0); - assert(compareArray(sample, N([7, 17, 3, 4])), "offset: 0, result: " + sample); + assert(compareArray(sample, [7, 17, 3, 4]), "offset: 0, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA(N([1, 2, 3, 4])); + sample = new TA([1, 2, 3, 4]); result = sample.set(srcObj, 1); - assert(compareArray(sample, N([1, 7, 17, 4])), "offset: 1, result: " + sample); + assert(compareArray(sample, [1, 7, 17, 4]), "offset: 1, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA(N([1, 2, 3, 4])); + sample = new TA([1, 2, 3, 4]); result = sample.set(srcObj, 2); - assert(compareArray(sample, N([1, 2, 7, 17])), "offset: 2, result: " + sample); + assert(compareArray(sample, [1, 2, 7, 17]), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); }); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-type-conversions.js b/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-type-conversions.js index 78ed1b455..e9dce1b65 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-type-conversions.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-src-tonumber-value-type-conversions.js @@ -22,10 +22,10 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var obj1 = { valueOf: function() { - return N(42); + return 42; } }; @@ -38,14 +38,14 @@ testWithTypedArrayConstructors(function(TA, N) { // undefined and NaN covered on typedArrayConversions var nullish; try { - nullish = N(null); + nullish = null; } catch (e) { nullish = 0n; } var arr = ["1", "", false, true, nullish, obj1, obj2, [], [1]]; var sample = new TA(arr.length); - var expected = new TA(N([1, 0, 0, 1, 0, 42, 42, 0, 1])); + var expected = new TA([1, 0, 0, 1, 0, 42, 42, 0, 1]); sample.set(arr); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-src-values-are-not-cached.js b/test/built-ins/TypedArray/prototype/set/array-arg-src-values-are-not-cached.js index 8931748ec..a3750490f 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-src-values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-src-values-are-not-cached.js @@ -22,26 +22,26 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample = new TA(5); var obj = { length: 5, - '1': N(7), - '2': N(7), - '3': N(7), - '4': N(7) + '1': 7, + '2': 7, + '3': 7, + '4': 7 }; Object.defineProperty(obj, 0, { get: function() { - obj[1] = N(43); - obj[2] = N(44); - obj[3] = N(45); - obj[4] = N(46); - return N(42); + obj[1] = 43; + obj[2] = 44; + obj[3] = 45; + obj[4] = 46; + return 42; } }); sample.set(obj); - assert(compareArray(sample, N([42, 43, 44, 45, 46]))); + assert(compareArray(sample, [42, 43, 44, 45, 46])); }); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-target-arraylength-internal.js b/test/built-ins/TypedArray/prototype/set/array-arg-target-arraylength-internal.js index 4a6e1ee39..97bead5c9 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-target-arraylength-internal.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-target-arraylength-internal.js @@ -29,13 +29,13 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample = new TA(2); Object.defineProperty(TA.prototype, "length", desc); Object.defineProperty(sample, "length", desc); - sample.set(N([42, 43])); + sample.set([42, 43]); assert.sameValue(getCalls, 0, "ignores length properties"); }); diff --git a/test/built-ins/TypedArray/prototype/set/array-arg-targetbuffer-detached-on-get-src-value-throws.js b/test/built-ins/TypedArray/prototype/set/array-arg-targetbuffer-detached-on-get-src-value-throws.js index e77c0bdfd..eed7db083 100644 --- a/test/built-ins/TypedArray/prototype/set/array-arg-targetbuffer-detached-on-get-src-value-throws.js +++ b/test/built-ins/TypedArray/prototype/set/array-arg-targetbuffer-detached-on-get-src-value-throws.js @@ -22,11 +22,11 @@ includes: [testTypedArray.js, detachArrayBuffer.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([1, 2, 3])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([1, 2, 3]); var obj = { length: 3, - "0": N(42) + "0": 42 }; Object.defineProperty(obj, 1, { get: function() { diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-offset-tointeger.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-offset-tointeger.js index 2bdb3ded3..7f63cb996 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-offset-tointeger.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-offset-tointeger.js @@ -15,79 +15,79 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample; - var src = new TA(N([42])); + var src = new TA([42]); - sample = new TA(N([1, 2])); + sample = new TA([1, 2]); sample.set(src, ""); - assert(compareArray(sample, N([42, 2])), "the empty string"); + assert(compareArray(sample, [42, 2]), "the empty string"); - sample = new TA(N([1, 2])); + sample = new TA([1, 2]); sample.set(src, "0"); - assert(compareArray(sample, N([42, 2])), "'0'"); + assert(compareArray(sample, [42, 2]), "'0'"); - sample = new TA(N([1, 2])); + sample = new TA([1, 2]); sample.set(src, false); - assert(compareArray(sample, N([42, 2])), "false"); + assert(compareArray(sample, [42, 2]), "false"); - sample = new TA(N([1, 2])); + sample = new TA([1, 2]); sample.set(src, 0.1); - assert(compareArray(sample, N([42, 2])), "0.1"); + assert(compareArray(sample, [42, 2]), "0.1"); - sample = new TA(N([1, 2])); + sample = new TA([1, 2]); sample.set(src, 0.9); - assert(compareArray(sample, N([42, 2])), "0.9"); + assert(compareArray(sample, [42, 2]), "0.9"); - sample = new TA(N([1, 2])); + sample = new TA([1, 2]); sample.set(src, -0.5); - assert(compareArray(sample, N([42, 2])), "-0.5"); + assert(compareArray(sample, [42, 2]), "-0.5"); - sample = new TA(N([1, 2])); + sample = new TA([1, 2]); sample.set(src, 1.1); - assert(compareArray(sample, N([1, 42])), "1.1"); + assert(compareArray(sample, [1, 42]), "1.1"); - sample = new TA(N([1, 2])); + sample = new TA([1, 2]); sample.set(src, NaN); - assert(compareArray(sample, N([42, 2])), "NaN"); + assert(compareArray(sample, [42, 2]), "NaN"); - sample = new TA(N([1, 2])); + sample = new TA([1, 2]); sample.set(src, null); - assert(compareArray(sample, N([42, 2])), "null"); + assert(compareArray(sample, [42, 2]), "null"); - sample = new TA(N([1, 2])); + sample = new TA([1, 2]); sample.set(src, undefined); - assert(compareArray(sample, N([42, 2])), "undefined"); + assert(compareArray(sample, [42, 2]), "undefined"); - sample = new TA(N([1, 2])); + sample = new TA([1, 2]); sample.set(src, {}); - assert(compareArray(sample, N([42, 2])), "{}"); + assert(compareArray(sample, [42, 2]), "{}"); - sample = new TA(N([1, 2])); + sample = new TA([1, 2]); sample.set(src, []); - assert(compareArray(sample, N([42, 2])), "[]"); + assert(compareArray(sample, [42, 2]), "[]"); - sample = new TA(N([1, 2])); + sample = new TA([1, 2]); sample.set(src, [0]); - assert(compareArray(sample, N([42, 2])), "[0]"); + assert(compareArray(sample, [42, 2]), "[0]"); - sample = new TA(N([1, 2])); + sample = new TA([1, 2]); sample.set(src, true); - assert(compareArray(sample, N([1, 42])), "true"); + assert(compareArray(sample, [1, 42]), "true"); - sample = new TA(N([1, 2])); + sample = new TA([1, 2]); sample.set(src, "1"); - assert(compareArray(sample, N([1, 42])), "'1'"); + assert(compareArray(sample, [1, 42]), "'1'"); - sample = new TA(N([1, 2])); + sample = new TA([1, 2]); sample.set(src, [1]); - assert(compareArray(sample, N([1, 42])), "[1]"); + assert(compareArray(sample, [1, 42]), "[1]"); - sample = new TA(N([1, 2])); + sample = new TA([1, 2]); sample.set(src, { valueOf: function() {return 1;} }); - assert(compareArray(sample, N([1, 42])), "valueOf"); + assert(compareArray(sample, [1, 42]), "valueOf"); - sample = new TA(N([1, 2])); + sample = new TA([1, 2]); sample.set(src, { toString: function() {return 1;} }); - assert(compareArray(sample, N([1, 42])), "toString"); + assert(compareArray(sample, [1, 42]), "toString"); }); diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type.js index 4f21a918d..4ba857e03 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type.js @@ -26,26 +26,26 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var other = TA === Float32Array ? Float64Array : Float32Array; if (typeof BigInt !== "undefined") other = TA === BigInt64Array ? BigUint64Array : TA === BigUint64Array ? BigInt64Array : other; - var src = new other(N([42, 43])); + var src = new other([42, 43]); var sample, result; - sample = new TA(N([1, 2, 3, 4])); + sample = new TA([1, 2, 3, 4]); result = sample.set(src, 0); - assert(compareArray(sample, N([42, 43, 3, 4])), "offset: 0, result: " + sample); + assert(compareArray(sample, [42, 43, 3, 4]), "offset: 0, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA(N([1, 2, 3, 4])); + sample = new TA([1, 2, 3, 4]); result = sample.set(src, 1); - assert(compareArray(sample, N([1, 42, 43, 4])), "offset: 1, result: " + sample); + assert(compareArray(sample, [1, 42, 43, 4]), "offset: 1, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA(N([1, 2, 3, 4])); + sample = new TA([1, 2, 3, 4]); result = sample.set(src, 2); - assert(compareArray(sample, N([1, 2, 42, 43])), "offset: 2, result: " + sample); + assert(compareArray(sample, [1, 2, 42, 43]), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); }); diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type.js index 4dcde7c09..b91574785 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type.js @@ -29,22 +29,22 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample, result; - var src = new TA(N([42, 43])); + var src = new TA([42, 43]); - sample = new TA(N([1, 2, 3, 4])); + sample = new TA([1, 2, 3, 4]); result = sample.set(src, 1); - assert(compareArray(sample, N([1, 42, 43, 4])), "offset: 1, result: " + sample); + assert(compareArray(sample, [1, 42, 43, 4]), "offset: 1, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA(N([1, 2, 3, 4])); + sample = new TA([1, 2, 3, 4]); result = sample.set(src, 0); - assert(compareArray(sample, N([42, 43, 3, 4])), "offset: 0, result: " + sample); + assert(compareArray(sample, [42, 43, 3, 4]), "offset: 0, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA(N([1, 2, 3, 4])); + sample = new TA([1, 2, 3, 4]); result = sample.set(src, 2); - assert(compareArray(sample, N([1, 2, 42, 43])), "offset: 2, result: " + sample); + assert(compareArray(sample, [1, 2, 42, 43]), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); }); diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type.js index bd3256da6..02d15ddee 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type.js @@ -30,24 +30,24 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample, src, result; - sample = new TA(N([1, 2, 3, 4])); + sample = new TA([1, 2, 3, 4]); src = new TA(sample.buffer, 0, 2); result = sample.set(src, 0); - assert(compareArray(sample, N([1, 2, 3, 4])), "offset: 0, result: " + sample); + assert(compareArray(sample, [1, 2, 3, 4]), "offset: 0, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA(N([1, 2, 3, 4])); + sample = new TA([1, 2, 3, 4]); src = new TA(sample.buffer, 0, 2); result = sample.set(src, 1); - assert(compareArray(sample, N([1, 1, 2, 4])), "offset: 1, result: " + sample); + assert(compareArray(sample, [1, 1, 2, 4]), "offset: 1, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA(N([1, 2, 3, 4])); + sample = new TA([1, 2, 3, 4]); src = new TA(sample.buffer, 0, 2); result = sample.set(src, 2); - assert(compareArray(sample, N([1, 2, 1, 2])), "offset: 2, result: " + sample); + assert(compareArray(sample, [1, 2, 1, 2]), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); }); diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-arraylength-internal.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-arraylength-internal.js index 0009dae86..864172b96 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-arraylength-internal.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-arraylength-internal.js @@ -28,9 +28,9 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample = new TA(2); - var src = new TA(N([42, 43])); + var src = new TA([42, 43]); Object.defineProperty(TA.prototype, "length", desc); Object.defineProperty(src, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-byteoffset-internal.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-byteoffset-internal.js index 811c2c86a..498ac5fc8 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-byteoffset-internal.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-byteoffset-internal.js @@ -25,14 +25,14 @@ var desc = { Object.defineProperty(TypedArray.prototype, "byteOffset", desc); -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample = new TA(2); - var src = new TA(N([42, 43])); + var src = new TA([42, 43]); var differentTA = TA === Uint8Array ? Int8Array : Uint8Array; if (typeof BigInt !== "undefined") differentTA = TA === BigInt64Array ? BigUint64Array : TA === BigUint64Array ? BigInt64Array : differentTA; - var src2 = new differentTA(N([42, 43])); + var src2 = new differentTA([42, 43]); var src3 = new differentTA(sample.buffer, 0, 2); Object.defineProperty(TA.prototype, "byteOffset", desc); diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-arraylength-internal.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-arraylength-internal.js index df8f06859..fe251f1f1 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-arraylength-internal.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-arraylength-internal.js @@ -29,9 +29,9 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample = new TA(2); - var src = new TA(N([42, 43])); + var src = new TA([42, 43]); Object.defineProperty(TA.prototype, "length", desc); Object.defineProperty(sample, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-byteoffset-internal.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-byteoffset-internal.js index 29dd574df..ac5b8f6cb 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-byteoffset-internal.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-byteoffset-internal.js @@ -26,14 +26,14 @@ var desc = { Object.defineProperty(TypedArray.prototype, "byteOffset", desc); -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample = new TA(2); - var src = new TA(N([42, 43])); + var src = new TA([42, 43]); var differentTA = TA === Uint8Array ? Int8Array : Uint8Array; if (typeof BigInt !== "undefined") differentTA = TA === BigInt64Array ? BigUint64Array : TA === BigUint64Array ? BigInt64Array : differentTA; - var src2 = new differentTA(N([42, 43])); + var src2 = new differentTA([42, 43]); var src3 = new differentTA(sample.buffer, 0, 2); Object.defineProperty(TA.prototype, "byteOffset", desc); diff --git a/test/built-ins/TypedArray/prototype/slice/arraylength-internal.js b/test/built-ins/TypedArray/prototype/slice/arraylength-internal.js index 8cf705583..2c9e7cba3 100644 --- a/test/built-ins/TypedArray/prototype/slice/arraylength-internal.js +++ b/test/built-ins/TypedArray/prototype/slice/arraylength-internal.js @@ -23,8 +23,8 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); Object.defineProperty(TA.prototype, "length", desc); Object.defineProperty(sample, "length", desc); @@ -32,7 +32,7 @@ testWithTypedArrayConstructors(function(TA, N) { var result = sample.slice(); assert.sameValue(getCalls, 0, "ignores length properties"); - assert.sameValue(result[0], N(42)); - assert.sameValue(result[1], N(43)); + assert.sameValue(result[0], 42); + assert.sameValue(result[1], 43); assert.sameValue(result.hasOwnProperty(2), false); }); diff --git a/test/built-ins/TypedArray/prototype/slice/infinity.js b/test/built-ins/TypedArray/prototype/slice/infinity.js index 7fda1ec89..a93cd713a 100644 --- a/test/built-ins/TypedArray/prototype/slice/infinity.js +++ b/test/built-ins/TypedArray/prototype/slice/infinity.js @@ -7,11 +7,11 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); assert( - compareArray(sample.slice(-Infinity), N([40, 41, 42, 43])), + compareArray(sample.slice(-Infinity), [40, 41, 42, 43]), "start == -Infinity" ); assert( @@ -23,7 +23,7 @@ testWithTypedArrayConstructors(function(TA, N) { "end == -Infinity" ); assert( - compareArray(sample.slice(0, Infinity), N([40, 41, 42, 43])), + compareArray(sample.slice(0, Infinity), [40, 41, 42, 43]), "end == Infinity" ); }); diff --git a/test/built-ins/TypedArray/prototype/slice/minus-zero.js b/test/built-ins/TypedArray/prototype/slice/minus-zero.js index b4c000bc0..c597dadec 100644 --- a/test/built-ins/TypedArray/prototype/slice/minus-zero.js +++ b/test/built-ins/TypedArray/prototype/slice/minus-zero.js @@ -9,15 +9,15 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); assert( - compareArray(sample.slice(-0), N([40, 41, 42, 43])), + compareArray(sample.slice(-0), [40, 41, 42, 43]), "start == -0" ); assert( - compareArray(sample.slice(-0, 4), N([40, 41, 42, 43])), + compareArray(sample.slice(-0, 4), [40, 41, 42, 43]), "start == -0, end == length" ); assert( diff --git a/test/built-ins/TypedArray/prototype/slice/result-does-not-copy-ordinary-properties.js b/test/built-ins/TypedArray/prototype/slice/result-does-not-copy-ordinary-properties.js index ca2b9d8e9..91df72a33 100644 --- a/test/built-ins/TypedArray/prototype/slice/result-does-not-copy-ordinary-properties.js +++ b/test/built-ins/TypedArray/prototype/slice/result-does-not-copy-ordinary-properties.js @@ -9,8 +9,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([41, 42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([41, 42, 43, 44]); sample.foo = 42; var result = sample.slice(); diff --git a/test/built-ins/TypedArray/prototype/slice/results-with-different-length.js b/test/built-ins/TypedArray/prototype/slice/results-with-different-length.js index b6a62afb8..34a4ad11b 100644 --- a/test/built-ins/TypedArray/prototype/slice/results-with-different-length.js +++ b/test/built-ins/TypedArray/prototype/slice/results-with-different-length.js @@ -7,47 +7,47 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); function testRes(result, expected, msg) { assert(compareArray(result, expected), msg + ", result: [" + result + "]"); } - testRes(sample.slice(1), N([41, 42, 43]), "begin == 1"); - testRes(sample.slice(2), N([42, 43]), "begin == 2"); - testRes(sample.slice(3), N([43]), "begin == 3"); + testRes(sample.slice(1), [41, 42, 43], "begin == 1"); + testRes(sample.slice(2), [42, 43], "begin == 2"); + testRes(sample.slice(3), [43], "begin == 3"); - testRes(sample.slice(1, 4), N([41, 42, 43]), "begin == 1, end == length"); - testRes(sample.slice(2, 4), N([42, 43]), "begin == 2, end == length"); - testRes(sample.slice(3, 4), N([43]), "begin == 3, end == length"); + testRes(sample.slice(1, 4), [41, 42, 43], "begin == 1, end == length"); + testRes(sample.slice(2, 4), [42, 43], "begin == 2, end == length"); + testRes(sample.slice(3, 4), [43], "begin == 3, end == length"); - testRes(sample.slice(0, 1), N([40]), "begin == 0, end == 1"); - testRes(sample.slice(0, 2), N([40, 41]), "begin == 0, end == 2"); - testRes(sample.slice(0, 3), N([40, 41, 42]), "begin == 0, end == 3"); + testRes(sample.slice(0, 1), [40], "begin == 0, end == 1"); + testRes(sample.slice(0, 2), [40, 41], "begin == 0, end == 2"); + testRes(sample.slice(0, 3), [40, 41, 42], "begin == 0, end == 3"); - testRes(sample.slice(-1), N([43]), "begin == -1"); - testRes(sample.slice(-2), N([42, 43]), "begin == -2"); - testRes(sample.slice(-3), N([41, 42, 43]), "begin == -3"); + testRes(sample.slice(-1), [43], "begin == -1"); + testRes(sample.slice(-2), [42, 43], "begin == -2"); + testRes(sample.slice(-3), [41, 42, 43], "begin == -3"); - testRes(sample.slice(-1, 4), N([43]), "begin == -1, end == length"); - testRes(sample.slice(-2, 4), N([42, 43]), "begin == -2, end == length"); - testRes(sample.slice(-3, 4), N([41, 42, 43]), "begin == -3, end == length"); + testRes(sample.slice(-1, 4), [43], "begin == -1, end == length"); + testRes(sample.slice(-2, 4), [42, 43], "begin == -2, end == length"); + testRes(sample.slice(-3, 4), [41, 42, 43], "begin == -3, end == length"); - testRes(sample.slice(0, -1), N([40, 41, 42]), "begin == 0, end == -1"); - testRes(sample.slice(0, -2), N([40, 41]), "begin == 0, end == -2"); - testRes(sample.slice(0, -3), N([40]), "begin == 0, end == -3"); + testRes(sample.slice(0, -1), [40, 41, 42], "begin == 0, end == -1"); + testRes(sample.slice(0, -2), [40, 41], "begin == 0, end == -2"); + testRes(sample.slice(0, -3), [40], "begin == 0, end == -3"); - testRes(sample.slice(-0, -1), N([40, 41, 42]), "begin == -0, end == -1"); - testRes(sample.slice(-0, -2), N([40, 41]), "begin == -0, end == -2"); - testRes(sample.slice(-0, -3), N([40]), "begin == -0, end == -3"); + testRes(sample.slice(-0, -1), [40, 41, 42], "begin == -0, end == -1"); + testRes(sample.slice(-0, -2), [40, 41], "begin == -0, end == -2"); + testRes(sample.slice(-0, -3), [40], "begin == -0, end == -3"); - testRes(sample.slice(-2, -1), N([42]), "length == 4, begin == -2, end == -1"); - testRes(sample.slice(1, -1), N([41, 42]), "length == 4, begin == 1, end == -1"); - testRes(sample.slice(1, -2), N([41]), "length == 4, begin == 1, end == -2"); - testRes(sample.slice(2, -1), N([42]), "length == 4, begin == 2, end == -1"); + testRes(sample.slice(-2, -1), [42], "length == 4, begin == -2, end == -1"); + testRes(sample.slice(1, -1), [41, 42], "length == 4, begin == 1, end == -1"); + testRes(sample.slice(1, -2), [41], "length == 4, begin == 1, end == -2"); + testRes(sample.slice(2, -1), [42], "length == 4, begin == 2, end == -1"); - testRes(sample.slice(-1, 5), N([43]), "begin == -1, end > length"); - testRes(sample.slice(-2, 4), N([42, 43]), "begin == -2, end > length"); - testRes(sample.slice(-3, 4), N([41, 42, 43]), "begin == -3, end > length"); + testRes(sample.slice(-1, 5), [43], "begin == -1, end > length"); + testRes(sample.slice(-2, 4), [42, 43], "begin == -2, end > length"); + testRes(sample.slice(-3, 4), [41, 42, 43], "begin == -3, end > length"); }); diff --git a/test/built-ins/TypedArray/prototype/slice/results-with-empty-length.js b/test/built-ins/TypedArray/prototype/slice/results-with-empty-length.js index a3c749057..7cd44b9c6 100644 --- a/test/built-ins/TypedArray/prototype/slice/results-with-empty-length.js +++ b/test/built-ins/TypedArray/prototype/slice/results-with-empty-length.js @@ -7,8 +7,8 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); function testRes(result, msg) { assert.sameValue(result.length, 0, msg); diff --git a/test/built-ins/TypedArray/prototype/slice/results-with-same-length.js b/test/built-ins/TypedArray/prototype/slice/results-with-same-length.js index 904efd50b..d89cbbdf5 100644 --- a/test/built-ins/TypedArray/prototype/slice/results-with-same-length.js +++ b/test/built-ins/TypedArray/prototype/slice/results-with-same-length.js @@ -7,15 +7,15 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); function testRes(result, msg) { assert.sameValue(result.length, 4, msg); - assert.sameValue(result[0], N(40), msg + " & result[0] === 40"); - assert.sameValue(result[1], N(41), msg + " & result[1] === 41"); - assert.sameValue(result[2], N(42), msg + " & result[2] === 42"); - assert.sameValue(result[3], N(43), msg + " & result[3] === 43"); + assert.sameValue(result[0], 40, msg + " & result[0] === 40"); + assert.sameValue(result[1], 41, msg + " & result[1] === 41"); + assert.sameValue(result[2], 42, msg + " & result[2] === 42"); + assert.sameValue(result[3], 43, msg + " & result[3] === 43"); } testRes(sample.slice(0), "begin == 0"); diff --git a/test/built-ins/TypedArray/prototype/slice/set-values-from-different-ctor-type.js b/test/built-ins/TypedArray/prototype/slice/set-values-from-different-ctor-type.js index 89f322ce0..c0195b705 100644 --- a/test/built-ins/TypedArray/prototype/slice/set-values-from-different-ctor-type.js +++ b/test/built-ins/TypedArray/prototype/slice/set-values-from-different-ctor-type.js @@ -32,8 +32,8 @@ features: [Symbol.species, TypedArray] var arr = [42, 43, 44]; -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N(arr)); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(arr); var other = TA === Int8Array ? Uint8Array : Int8Array; if (typeof BigInt !== "undefined") { other = TA === BigInt64Array ? BigUint64Array : @@ -44,7 +44,7 @@ testWithTypedArrayConstructors(function(TA, N) { var result = sample.slice(); - assert(compareArray(result, N(arr)), "values are set"); + assert(compareArray(result, arr), "values are set"); assert.notSameValue(result.buffer, sample.buffer, "creates a new buffer"); assert.sameValue(result.constructor, other, "used the custom ctor"); }); diff --git a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-abrupt.js b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-abrupt.js index d0f2d147b..d7baa426e 100644 --- a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-abrupt.js +++ b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-abrupt.js @@ -26,8 +26,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); Object.defineProperty(sample, "constructor", { get: function() { diff --git a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-inherited.js b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-inherited.js index d2d7667a9..79c9df2a7 100644 --- a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-inherited.js +++ b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-inherited.js @@ -26,8 +26,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); var calls = 0; var result; diff --git a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-returns-throws.js b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-returns-throws.js index 9910c9b4e..c048632f2 100644 --- a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-returns-throws.js +++ b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor-returns-throws.js @@ -28,8 +28,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); sample.constructor = 42; assert.throws(TypeError, function() { diff --git a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor.js b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor.js index ca237fb6d..c09681ec0 100644 --- a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor.js +++ b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-ctor.js @@ -26,8 +26,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); var calls = 0; var result; diff --git a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor-invocation.js b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor-invocation.js index 15acea7c6..d1642f1b7 100644 --- a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor-invocation.js +++ b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor-invocation.js @@ -36,8 +36,8 @@ includes: [testTypedArray.js] features: [Symbol.species, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42]); var result, ctorThis; sample.constructor = {}; diff --git a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor-returns-another-instance.js b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor-returns-another-instance.js index 6b95f571b..7bb19f5df 100644 --- a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor-returns-another-instance.js +++ b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor-returns-another-instance.js @@ -36,8 +36,8 @@ includes: [testTypedArray.js, compareArray.js] features: [Symbol.species, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40]); var other = new Int8Array([1, 0, 1]); var result; diff --git a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor.js b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor.js index 5a5151e72..0477a0fd4 100644 --- a/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor.js +++ b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor.js @@ -36,8 +36,8 @@ includes: [testTypedArray.js, compareArray.js] features: [Symbol.species, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42]); var calls = 0; var result; @@ -50,5 +50,5 @@ testWithTypedArrayConstructors(function(TA, N) { result = sample.slice(1); assert.sameValue(calls, 1, "ctor called once"); - assert(compareArray(result, N([41, 42])), "expected object"); + assert(compareArray(result, [41, 42]), "expected object"); }); diff --git a/test/built-ins/TypedArray/prototype/slice/tointeger-end.js b/test/built-ins/TypedArray/prototype/slice/tointeger-end.js index df15d831c..2a9be9406 100644 --- a/test/built-ins/TypedArray/prototype/slice/tointeger-end.js +++ b/test/built-ins/TypedArray/prototype/slice/tointeger-end.js @@ -20,28 +20,28 @@ var obj = { } }; -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); assert(compareArray(sample.slice(0, false), []), "false"); - assert(compareArray(sample.slice(0, true), N([40])), "true"); + assert(compareArray(sample.slice(0, true), [40]), "true"); assert(compareArray(sample.slice(0, NaN), []), "NaN"); assert(compareArray(sample.slice(0, null), []), "null"); - assert(compareArray(sample.slice(0, undefined), N([40, 41, 42, 43])), "undefined"); + assert(compareArray(sample.slice(0, undefined), [40, 41, 42, 43]), "undefined"); assert(compareArray(sample.slice(0, 0.6), []), "0.6"); - assert(compareArray(sample.slice(0, 1.1), N([40])), "1.1"); - assert(compareArray(sample.slice(0, 1.5), N([40])), "1.5"); + assert(compareArray(sample.slice(0, 1.1), [40]), "1.1"); + assert(compareArray(sample.slice(0, 1.5), [40]), "1.5"); assert(compareArray(sample.slice(0, -0.6), []), "-0.6"); - assert(compareArray(sample.slice(0, -1.1), N([40, 41, 42])), "-1.1"); - assert(compareArray(sample.slice(0, -1.5), N([40, 41, 42])), "-1.5"); + assert(compareArray(sample.slice(0, -1.1), [40, 41, 42]), "-1.1"); + assert(compareArray(sample.slice(0, -1.5), [40, 41, 42]), "-1.5"); - assert(compareArray(sample.slice(0, "3"), N([40, 41, 42])), "string"); + assert(compareArray(sample.slice(0, "3"), [40, 41, 42]), "string"); assert( compareArray( sample.slice(0, obj), - N([40, 41]) + [40, 41] ), "object" ); diff --git a/test/built-ins/TypedArray/prototype/slice/tointeger-start.js b/test/built-ins/TypedArray/prototype/slice/tointeger-start.js index 353ac46e2..f67ee090c 100644 --- a/test/built-ins/TypedArray/prototype/slice/tointeger-start.js +++ b/test/built-ins/TypedArray/prototype/slice/tointeger-start.js @@ -19,29 +19,29 @@ var obj = { } }; -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); - assert(compareArray(sample.slice(false), N([40, 41, 42, 43])), "false"); - assert(compareArray(sample.slice(true), N([41, 42, 43])), "true"); + assert(compareArray(sample.slice(false), [40, 41, 42, 43]), "false"); + assert(compareArray(sample.slice(true), [41, 42, 43]), "true"); - assert(compareArray(sample.slice(NaN), N([40, 41, 42, 43])), "NaN"); - assert(compareArray(sample.slice(null), N([40, 41, 42, 43])), "null"); - assert(compareArray(sample.slice(undefined), N([40, 41, 42, 43])), "undefined"); + assert(compareArray(sample.slice(NaN), [40, 41, 42, 43]), "NaN"); + assert(compareArray(sample.slice(null), [40, 41, 42, 43]), "null"); + assert(compareArray(sample.slice(undefined), [40, 41, 42, 43]), "undefined"); - assert(compareArray(sample.slice(1.1), N([41, 42, 43])), "1.1"); - assert(compareArray(sample.slice(1.5), N([41, 42, 43])), "1.5"); - assert(compareArray(sample.slice(0.6), N([40, 41, 42, 43])), "0.6"); + assert(compareArray(sample.slice(1.1), [41, 42, 43]), "1.1"); + assert(compareArray(sample.slice(1.5), [41, 42, 43]), "1.5"); + assert(compareArray(sample.slice(0.6), [40, 41, 42, 43]), "0.6"); - assert(compareArray(sample.slice(-1.5), N([43])), "-1.5"); - assert(compareArray(sample.slice(-1.1), N([43])), "-1.1"); - assert(compareArray(sample.slice(-0.6), N([40, 41, 42, 43])), "-0.6"); + assert(compareArray(sample.slice(-1.5), [43]), "-1.5"); + assert(compareArray(sample.slice(-1.1), [43]), "-1.1"); + assert(compareArray(sample.slice(-0.6), [40, 41, 42, 43]), "-0.6"); - assert(compareArray(sample.slice("3"), N([43])), "string"); + assert(compareArray(sample.slice("3"), [43]), "string"); assert( compareArray( sample.slice(obj), - N([42, 43]) + [42, 43] ), "object" ); diff --git a/test/built-ins/TypedArray/prototype/some/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/some/callbackfn-arguments-with-thisarg.js index cb579688a..57fbcf3f5 100644 --- a/test/built-ins/TypedArray/prototype/some/callbackfn-arguments-with-thisarg.js +++ b/test/built-ins/TypedArray/prototype/some/callbackfn-arguments-with-thisarg.js @@ -27,8 +27,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); var results = []; var thisArg = ["test262", 0, "ecma262", 0]; @@ -41,17 +41,17 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue(thisArg.length, 4, "thisArg.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); + assert.sameValue(results[0][0], 42, "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); + assert.sameValue(results[1][0], 43, "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); + assert.sameValue(results[2][0], 44, "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/some/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/some/callbackfn-arguments-without-thisarg.js index 44d890c4d..fff82e93b 100644 --- a/test/built-ins/TypedArray/prototype/some/callbackfn-arguments-without-thisarg.js +++ b/test/built-ins/TypedArray/prototype/some/callbackfn-arguments-without-thisarg.js @@ -27,8 +27,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); var results = []; @@ -39,17 +39,17 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue(results.length, 3, "results.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], N(42), "results[0][0] - kValue"); + assert.sameValue(results[0][0], 42, "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], N(43), "results[1][0] - kValue"); + assert.sameValue(results[1][0], 43, "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], N(44), "results[2][0] - kValue"); + assert.sameValue(results[2][0], 44, "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/some/callbackfn-no-interaction-over-non-integer.js b/test/built-ins/TypedArray/prototype/some/callbackfn-no-interaction-over-non-integer.js index f28e0d907..d7a55a444 100644 --- a/test/built-ins/TypedArray/prototype/some/callbackfn-no-interaction-over-non-integer.js +++ b/test/built-ins/TypedArray/prototype/some/callbackfn-no-interaction-over-non-integer.js @@ -18,8 +18,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([7, 8])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([7, 8]); var results = []; @@ -35,6 +35,6 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue(results[0][1], 0, "results[0][1] - key"); assert.sameValue(results[1][1], 1, "results[1][1] - key"); - assert.sameValue(results[0][0], N(7), "results[0][0] - value"); - assert.sameValue(results[1][0], N(8), "results[1][0] - value"); + assert.sameValue(results[0][0], 7, "results[0][0] - value"); + assert.sameValue(results[1][0], 8, "results[1][0] - value"); }); diff --git a/test/built-ins/TypedArray/prototype/some/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/some/callbackfn-return-does-not-change-instance.js index e7df5442d..ddfedf5af 100644 --- a/test/built-ins/TypedArray/prototype/some/callbackfn-return-does-not-change-instance.js +++ b/test/built-ins/TypedArray/prototype/some/callbackfn-return-does-not-change-instance.js @@ -25,14 +25,14 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42]); sample.some(function() { return 0; }); - assert.sameValue(sample[0], N(40), "[0] == 40"); - assert.sameValue(sample[1], N(41), "[1] == 41"); - assert.sameValue(sample[2], N(42), "[2] == 42"); + assert.sameValue(sample[0], 40, "[0] == 40"); + assert.sameValue(sample[1], 41, "[1] == 41"); + assert.sameValue(sample[2], 42, "[2] == 42"); }); diff --git a/test/built-ins/TypedArray/prototype/some/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/some/callbackfn-set-value-during-interaction.js index c779dbb04..da68b8a16 100644 --- a/test/built-ins/TypedArray/prototype/some/callbackfn-set-value-during-interaction.js +++ b/test/built-ins/TypedArray/prototype/some/callbackfn-set-value-during-interaction.js @@ -25,24 +25,24 @@ includes: [testTypedArray.js] features: [Reflect.set, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); var newVal = 0; sample.some(function(val, i) { if (i > 0) { assert.sameValue( - sample[i - 1], N(newVal - 1), + sample[i - 1], newVal - 1, "get the changed value during the loop" ); assert.sameValue( - Reflect.set(sample, 0, N(7)), + Reflect.set(sample, 0, 7), true, "re-set a value for sample[0]" ); } assert.sameValue( - Reflect.set(sample, i, N(newVal)), + Reflect.set(sample, i, newVal), true, "set value during iteration" ); @@ -50,7 +50,7 @@ testWithTypedArrayConstructors(function(TA, N) { newVal++; }); - assert.sameValue(sample[0], N(7), "changed values after iteration [0] == 7"); - assert.sameValue(sample[1], N(1), "changed values after iteration [1] == 1"); - assert.sameValue(sample[2], N(2), "changed values after iteration [2] == 2"); + assert.sameValue(sample[0], 7, "changed values after iteration [0] == 7"); + assert.sameValue(sample[1], 1, "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], 2, "changed values after iteration [2] == 2"); }); diff --git a/test/built-ins/TypedArray/prototype/some/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/some/get-length-uses-internal-arraylength.js index 14c21cab2..3fd958a92 100644 --- a/test/built-ins/TypedArray/prototype/some/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/some/get-length-uses-internal-arraylength.js @@ -30,8 +30,8 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43]); var calls = 0; Object.defineProperty(TA.prototype, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/some/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/some/values-are-not-cached.js index 12fc43d9c..c8a3c2cde 100644 --- a/test/built-ins/TypedArray/prototype/some/values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/some/values-are-not-cached.js @@ -25,16 +25,16 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44]); sample.some(function(v, i) { if (i < sample.length - 1) { - sample[i+1] = N(42); + sample[i+1] = 42; } assert.sameValue( - v, N(42), "method does not cache values before callbackfn calls" + v, 42, "method does not cache values before callbackfn calls" ); }); }); diff --git a/test/built-ins/TypedArray/prototype/sort/arraylength-internal.js b/test/built-ins/TypedArray/prototype/sort/arraylength-internal.js index 833ed4cd1..543c4eaa6 100644 --- a/test/built-ins/TypedArray/prototype/sort/arraylength-internal.js +++ b/test/built-ins/TypedArray/prototype/sort/arraylength-internal.js @@ -22,8 +22,8 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 42, 42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 42, 42]); getCalls = 0; Object.defineProperty(TA.prototype, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/sort/comparefn-call-throws.js b/test/built-ins/TypedArray/prototype/sort/comparefn-call-throws.js index 6754d8523..3370975d0 100644 --- a/test/built-ins/TypedArray/prototype/sort/comparefn-call-throws.js +++ b/test/built-ins/TypedArray/prototype/sort/comparefn-call-throws.js @@ -25,8 +25,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44, 45, 46])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44, 45, 46]); var calls = 0; var comparefn = function() { diff --git a/test/built-ins/TypedArray/prototype/sort/comparefn-calls.js b/test/built-ins/TypedArray/prototype/sort/comparefn-calls.js index 52ba9cce2..6c0602182 100644 --- a/test/built-ins/TypedArray/prototype/sort/comparefn-calls.js +++ b/test/built-ins/TypedArray/prototype/sort/comparefn-calls.js @@ -22,8 +22,8 @@ var expectedThis = (function() { return this; })(); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 42, 42, 42, 42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 42, 42, 42, 42]); var calls = []; var comparefn = function() { @@ -36,7 +36,7 @@ testWithTypedArrayConstructors(function(TA, N) { calls.forEach(function(args) { assert.sameValue(args[0], expectedThis, "comparefn is called no specific this"); assert.sameValue(args[1].length, 2, "comparefn is always called with 2 args"); - assert.sameValue(args[1][0], N(42), "x is a listed value"); - assert.sameValue(args[1][0], N(42), "y is a listed value"); + assert.sameValue(args[1][0], 42, "x is a listed value"); + assert.sameValue(args[1][0], 42, "y is a listed value"); }); }); diff --git a/test/built-ins/TypedArray/prototype/sort/comparefn-nonfunction-call-throws.js b/test/built-ins/TypedArray/prototype/sort/comparefn-nonfunction-call-throws.js index a2e5cf0ef..dceb36d66 100644 --- a/test/built-ins/TypedArray/prototype/sort/comparefn-nonfunction-call-throws.js +++ b/test/built-ins/TypedArray/prototype/sort/comparefn-nonfunction-call-throws.js @@ -18,8 +18,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43, 44, 45, 46])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([42, 43, 44, 45, 46]); assert.throws(TypeError, function() { sample.sort(null); diff --git a/test/built-ins/TypedArray/prototype/sort/return-same-instance.js b/test/built-ins/TypedArray/prototype/sort/return-same-instance.js index e45ad5eaf..f95885080 100644 --- a/test/built-ins/TypedArray/prototype/sort/return-same-instance.js +++ b/test/built-ins/TypedArray/prototype/sort/return-same-instance.js @@ -14,8 +14,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([2, 1])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([2, 1]); var result = sample.sort(); assert.sameValue(sample, result, "without comparefn"); diff --git a/test/built-ins/TypedArray/prototype/sort/sortcompare-with-no-tostring.js b/test/built-ins/TypedArray/prototype/sort/sortcompare-with-no-tostring.js index ec42fb069..f3bb0cac0 100644 --- a/test/built-ins/TypedArray/prototype/sort/sortcompare-with-no-tostring.js +++ b/test/built-ins/TypedArray/prototype/sort/sortcompare-with-no-tostring.js @@ -20,8 +20,8 @@ features: [TypedArray] var origToString = Number.prototype.toString; -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([20, 100, 3])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([20, 100, 3]); var result = sample.sort(); - assert(compareArray(result, N([3, 20, 100]))); + assert(compareArray(result, [3, 20, 100])); }); diff --git a/test/built-ins/TypedArray/prototype/sort/sorted-values.js b/test/built-ins/TypedArray/prototype/sort/sorted-values.js index ad3515350..83d870e9e 100644 --- a/test/built-ins/TypedArray/prototype/sort/sorted-values.js +++ b/test/built-ins/TypedArray/prototype/sort/sorted-values.js @@ -14,20 +14,20 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { +testWithTypedArrayConstructors(function(TA) { var sample; - sample = new TA(N([4, 3, 2, 1])).sort(); - assert(compareArray(sample, N([1, 2, 3, 4])), "descending values"); + sample = new TA([4, 3, 2, 1]).sort(); + assert(compareArray(sample, [1, 2, 3, 4]), "descending values"); - sample = new TA(N([3, 4, 1, 2])).sort(); - assert(compareArray(sample, N([1, 2, 3, 4])), "mixed numbers"); + sample = new TA([3, 4, 1, 2]).sort(); + assert(compareArray(sample, [1, 2, 3, 4]), "mixed numbers"); - sample = new TA(N([3, 4, 3, 1, 0, 1, 2])).sort(); - assert(compareArray(sample, N([0, 1, 1, 2, 3, 3, 4])), "repeating numbers"); + sample = new TA([3, 4, 3, 1, 0, 1, 2]).sort(); + assert(compareArray(sample, [0, 1, 1, 2, 3, 3, 4]), "repeating numbers"); - sample = new TA(N([1, 0, -0, 2])).sort(); - assert(compareArray(sample, N([0, 0, 1, 2])), "0s"); + sample = new TA([1, 0, -0, 2]).sort(); + assert(compareArray(sample, [0, 0, 1, 2]), "0s"); }); testWithTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/subarray/infinity.js b/test/built-ins/TypedArray/prototype/subarray/infinity.js index df67a42c1..8a2746492 100644 --- a/test/built-ins/TypedArray/prototype/subarray/infinity.js +++ b/test/built-ins/TypedArray/prototype/subarray/infinity.js @@ -9,11 +9,11 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); assert( - compareArray(sample.subarray(-Infinity), N([40, 41, 42, 43])), + compareArray(sample.subarray(-Infinity), [40, 41, 42, 43]), "begin == -Infinity" ); assert( @@ -25,7 +25,7 @@ testWithTypedArrayConstructors(function(TA, N) { "end == -Infinity" ); assert( - compareArray(sample.subarray(0, Infinity), N([40, 41, 42, 43])), + compareArray(sample.subarray(0, Infinity), [40, 41, 42, 43]), "end == Infinity" ); }); diff --git a/test/built-ins/TypedArray/prototype/subarray/minus-zero.js b/test/built-ins/TypedArray/prototype/subarray/minus-zero.js index def5ab035..de714ad46 100644 --- a/test/built-ins/TypedArray/prototype/subarray/minus-zero.js +++ b/test/built-ins/TypedArray/prototype/subarray/minus-zero.js @@ -9,15 +9,15 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); assert( - compareArray(sample.subarray(-0), N([40, 41, 42, 43])), + compareArray(sample.subarray(-0), [40, 41, 42, 43]), "begin == -0" ); assert( - compareArray(sample.subarray(-0, 4), N([40, 41, 42, 43])), + compareArray(sample.subarray(-0, 4), [40, 41, 42, 43]), "being == -0, end == length" ); assert( diff --git a/test/built-ins/TypedArray/prototype/subarray/result-does-not-copy-ordinary-properties.js b/test/built-ins/TypedArray/prototype/subarray/result-does-not-copy-ordinary-properties.js index f08f99d50..c8e9e0d6c 100644 --- a/test/built-ins/TypedArray/prototype/subarray/result-does-not-copy-ordinary-properties.js +++ b/test/built-ins/TypedArray/prototype/subarray/result-does-not-copy-ordinary-properties.js @@ -12,8 +12,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([41, 42, 43, 44])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([41, 42, 43, 44]); var result; sample.foo = 42; diff --git a/test/built-ins/TypedArray/prototype/subarray/result-is-new-instance-from-same-ctor.js b/test/built-ins/TypedArray/prototype/subarray/result-is-new-instance-from-same-ctor.js index f995d6a5f..a507518bb 100644 --- a/test/built-ins/TypedArray/prototype/subarray/result-is-new-instance-from-same-ctor.js +++ b/test/built-ins/TypedArray/prototype/subarray/result-is-new-instance-from-same-ctor.js @@ -12,8 +12,8 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); var result = sample.subarray(1); assert.sameValue( @@ -25,7 +25,7 @@ testWithTypedArrayConstructors(function(TA, N) { assert(result instanceof TA, "instanceof"); assert( - compareArray(sample, N([40, 41, 42, 43])), + compareArray(sample, [40, 41, 42, 43]), "original sample remains the same" ); }); diff --git a/test/built-ins/TypedArray/prototype/subarray/result-is-new-instance-with-shared-buffer.js b/test/built-ins/TypedArray/prototype/subarray/result-is-new-instance-with-shared-buffer.js index 704a2feb3..ff3925eb6 100644 --- a/test/built-ins/TypedArray/prototype/subarray/result-is-new-instance-with-shared-buffer.js +++ b/test/built-ins/TypedArray/prototype/subarray/result-is-new-instance-with-shared-buffer.js @@ -12,8 +12,8 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); var buffer = sample.buffer; var result = sample.subarray(1); @@ -21,15 +21,15 @@ testWithTypedArrayConstructors(function(TA, N) { assert.sameValue(result.buffer, sample.buffer, "shared buffer"); assert.sameValue(sample.buffer, buffer, "original buffer is preserved"); - sample[1] = N(100); + sample[1] = 100; assert( - compareArray(result, N([100, 42, 43])), + compareArray(result, [100, 42, 43]), "changes on the original sample values affect the new instance" ); - result[1] = N(111); + result[1] = 111; assert( - compareArray(sample, N([40, 100, 111, 43])), + compareArray(sample, [40, 100, 111, 43]), "changes on the new instance values affect the original sample" ); }); diff --git a/test/built-ins/TypedArray/prototype/subarray/results-with-different-length.js b/test/built-ins/TypedArray/prototype/subarray/results-with-different-length.js index 89c9846ea..c206e2462 100644 --- a/test/built-ins/TypedArray/prototype/subarray/results-with-different-length.js +++ b/test/built-ins/TypedArray/prototype/subarray/results-with-different-length.js @@ -12,47 +12,47 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); function testRes(result, expected, msg) { assert(compareArray(result, expected), msg + ", result: [" + result + "]"); } - testRes(sample.subarray(1), N([41, 42, 43]), "begin == 1"); - testRes(sample.subarray(2), N([42, 43]), "begin == 2"); - testRes(sample.subarray(3), N([43]), "begin == 3"); + testRes(sample.subarray(1), [41, 42, 43], "begin == 1"); + testRes(sample.subarray(2), [42, 43], "begin == 2"); + testRes(sample.subarray(3), [43], "begin == 3"); - testRes(sample.subarray(1, 4), N([41, 42, 43]), "begin == 1, end == length"); - testRes(sample.subarray(2, 4), N([42, 43]), "begin == 2, end == length"); - testRes(sample.subarray(3, 4), N([43]), "begin == 3, end == length"); + testRes(sample.subarray(1, 4), [41, 42, 43], "begin == 1, end == length"); + testRes(sample.subarray(2, 4), [42, 43], "begin == 2, end == length"); + testRes(sample.subarray(3, 4), [43], "begin == 3, end == length"); - testRes(sample.subarray(0, 1), N([40]), "begin == 0, end == 1"); - testRes(sample.subarray(0, 2), N([40, 41]), "begin == 0, end == 2"); - testRes(sample.subarray(0, 3), N([40, 41, 42]), "begin == 0, end == 3"); + testRes(sample.subarray(0, 1), [40], "begin == 0, end == 1"); + testRes(sample.subarray(0, 2), [40, 41], "begin == 0, end == 2"); + testRes(sample.subarray(0, 3), [40, 41, 42], "begin == 0, end == 3"); - testRes(sample.subarray(-1), N([43]), "begin == -1"); - testRes(sample.subarray(-2), N([42, 43]), "begin == -2"); - testRes(sample.subarray(-3), N([41, 42, 43]), "begin == -3"); + testRes(sample.subarray(-1), [43], "begin == -1"); + testRes(sample.subarray(-2), [42, 43], "begin == -2"); + testRes(sample.subarray(-3), [41, 42, 43], "begin == -3"); - testRes(sample.subarray(-1, 4), N([43]), "begin == -1, end == length"); - testRes(sample.subarray(-2, 4), N([42, 43]), "begin == -2, end == length"); - testRes(sample.subarray(-3, 4), N([41, 42, 43]), "begin == -3, end == length"); + testRes(sample.subarray(-1, 4), [43], "begin == -1, end == length"); + testRes(sample.subarray(-2, 4), [42, 43], "begin == -2, end == length"); + testRes(sample.subarray(-3, 4), [41, 42, 43], "begin == -3, end == length"); - testRes(sample.subarray(0, -1), N([40, 41, 42]), "begin == 0, end == -1"); - testRes(sample.subarray(0, -2), N([40, 41]), "begin == 0, end == -2"); - testRes(sample.subarray(0, -3), N([40]), "begin == 0, end == -3"); + testRes(sample.subarray(0, -1), [40, 41, 42], "begin == 0, end == -1"); + testRes(sample.subarray(0, -2), [40, 41], "begin == 0, end == -2"); + testRes(sample.subarray(0, -3), [40], "begin == 0, end == -3"); - testRes(sample.subarray(-0, -1), N([40, 41, 42]), "begin == -0, end == -1"); - testRes(sample.subarray(-0, -2), N([40, 41]), "begin == -0, end == -2"); - testRes(sample.subarray(-0, -3), N([40]), "begin == -0, end == -3"); + testRes(sample.subarray(-0, -1), [40, 41, 42], "begin == -0, end == -1"); + testRes(sample.subarray(-0, -2), [40, 41], "begin == -0, end == -2"); + testRes(sample.subarray(-0, -3), [40], "begin == -0, end == -3"); - testRes(sample.subarray(-2, -1), N([42]), "length == 4, begin == -2, end == -1"); - testRes(sample.subarray(1, -1), N([41, 42]), "length == 4, begin == 1, end == -1"); - testRes(sample.subarray(1, -2), N([41]), "length == 4, begin == 1, end == -2"); - testRes(sample.subarray(2, -1), N([42]), "length == 4, begin == 2, end == -1"); + testRes(sample.subarray(-2, -1), [42], "length == 4, begin == -2, end == -1"); + testRes(sample.subarray(1, -1), [41, 42], "length == 4, begin == 1, end == -1"); + testRes(sample.subarray(1, -2), [41], "length == 4, begin == 1, end == -2"); + testRes(sample.subarray(2, -1), [42], "length == 4, begin == 2, end == -1"); - testRes(sample.subarray(-1, 5), N([43]), "begin == -1, end > length"); - testRes(sample.subarray(-2, 4), N([42, 43]), "begin == -2, end > length"); - testRes(sample.subarray(-3, 4), N([41, 42, 43]), "begin == -3, end > length"); + testRes(sample.subarray(-1, 5), [43], "begin == -1, end > length"); + testRes(sample.subarray(-2, 4), [42, 43], "begin == -2, end > length"); + testRes(sample.subarray(-3, 4), [41, 42, 43], "begin == -3, end > length"); }); diff --git a/test/built-ins/TypedArray/prototype/subarray/results-with-empty-length.js b/test/built-ins/TypedArray/prototype/subarray/results-with-empty-length.js index 23a425836..0660a1112 100644 --- a/test/built-ins/TypedArray/prototype/subarray/results-with-empty-length.js +++ b/test/built-ins/TypedArray/prototype/subarray/results-with-empty-length.js @@ -12,8 +12,8 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); function testRes(result, msg) { assert.sameValue(result.length, 0, msg); diff --git a/test/built-ins/TypedArray/prototype/subarray/results-with-same-length.js b/test/built-ins/TypedArray/prototype/subarray/results-with-same-length.js index a78adfee1..947e95722 100644 --- a/test/built-ins/TypedArray/prototype/subarray/results-with-same-length.js +++ b/test/built-ins/TypedArray/prototype/subarray/results-with-same-length.js @@ -12,15 +12,15 @@ includes: [testTypedArray.js, compareArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); function testRes(result, msg) { assert.sameValue(result.length, 4, msg); - assert.sameValue(result[0], N(40), msg + " & result[0] === 40"); - assert.sameValue(result[1], N(41), msg + " & result[1] === 41"); - assert.sameValue(result[2], N(42), msg + " & result[2] === 42"); - assert.sameValue(result[3], N(43), msg + " & result[3] === 43"); + assert.sameValue(result[0], 40, msg + " & result[0] === 40"); + assert.sameValue(result[1], 41, msg + " & result[1] === 41"); + assert.sameValue(result[2], 42, msg + " & result[2] === 42"); + assert.sameValue(result[3], 43, msg + " & result[3] === 43"); } testRes(sample.subarray(0), "begin == 0"); diff --git a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-abrupt.js b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-abrupt.js index ca5a484fa..a7d2bc800 100644 --- a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-abrupt.js +++ b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-abrupt.js @@ -25,8 +25,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); Object.defineProperty(sample, "constructor", { get: function() { diff --git a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-inherited.js b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-inherited.js index 65771d46d..3fa39b431 100644 --- a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-inherited.js +++ b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-inherited.js @@ -25,8 +25,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); var calls = 0; var result; diff --git a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-returns-throws.js b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-returns-throws.js index 1a8b1a472..70714191e 100644 --- a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-returns-throws.js +++ b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor-returns-throws.js @@ -27,8 +27,8 @@ includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); sample.constructor = 42; assert.throws(TypeError, function() { diff --git a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor.js b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor.js index 9622a8477..6e6a65e3b 100644 --- a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor.js +++ b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-ctor.js @@ -25,8 +25,8 @@ includes: [testTypedArray.js] features: [TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); var calls = 0; var result; diff --git a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor-invocation.js b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor-invocation.js index d8931af98..0b62ffdcb 100644 --- a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor-invocation.js +++ b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor-invocation.js @@ -35,8 +35,8 @@ includes: [testTypedArray.js] features: [Symbol.species, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42]); var expectedOffset = TA.BYTES_PER_ELEMENT; var result, ctorThis; diff --git a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor-returns-another-instance.js b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor-returns-another-instance.js index 77e3c2c5b..3ed6ba00a 100644 --- a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor-returns-another-instance.js +++ b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor-returns-another-instance.js @@ -35,8 +35,8 @@ includes: [testTypedArray.js, compareArray.js] features: [Symbol.species, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40]); var other = new Int8Array([1, 0, 1]); var result; diff --git a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor.js b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor.js index 963db60dc..5dbc2cc36 100644 --- a/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor.js +++ b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor.js @@ -35,8 +35,8 @@ includes: [testTypedArray.js, compareArray.js] features: [Symbol.species, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42]); var calls = 0; var result; @@ -49,5 +49,5 @@ testWithTypedArrayConstructors(function(TA, N) { result = sample.subarray(1); assert.sameValue(calls, 1, "ctor called once"); - assert(compareArray(result, N([41, 42])), "expected subarray"); + assert(compareArray(result, [41, 42]), "expected subarray"); }); diff --git a/test/built-ins/TypedArray/prototype/subarray/tointeger-begin.js b/test/built-ins/TypedArray/prototype/subarray/tointeger-begin.js index d135984a3..abf503cb8 100644 --- a/test/built-ins/TypedArray/prototype/subarray/tointeger-begin.js +++ b/test/built-ins/TypedArray/prototype/subarray/tointeger-begin.js @@ -19,29 +19,29 @@ var obj = { } }; -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); - assert(compareArray(sample.subarray(false), N([40, 41, 42, 43])), "false"); - assert(compareArray(sample.subarray(true), N([41, 42, 43])), "true"); + assert(compareArray(sample.subarray(false), [40, 41, 42, 43]), "false"); + assert(compareArray(sample.subarray(true), [41, 42, 43]), "true"); - assert(compareArray(sample.subarray(NaN), N([40, 41, 42, 43])), "NaN"); - assert(compareArray(sample.subarray(null), N([40, 41, 42, 43])), "null"); - assert(compareArray(sample.subarray(undefined), N([40, 41, 42, 43])), "undefined"); + assert(compareArray(sample.subarray(NaN), [40, 41, 42, 43]), "NaN"); + assert(compareArray(sample.subarray(null), [40, 41, 42, 43]), "null"); + assert(compareArray(sample.subarray(undefined), [40, 41, 42, 43]), "undefined"); - assert(compareArray(sample.subarray(1.1), N([41, 42, 43])), "1.1"); - assert(compareArray(sample.subarray(1.5), N([41, 42, 43])), "1.5"); - assert(compareArray(sample.subarray(0.6), N([40, 41, 42, 43])), "0.6"); + assert(compareArray(sample.subarray(1.1), [41, 42, 43]), "1.1"); + assert(compareArray(sample.subarray(1.5), [41, 42, 43]), "1.5"); + assert(compareArray(sample.subarray(0.6), [40, 41, 42, 43]), "0.6"); - assert(compareArray(sample.subarray(-1.5), N([43])), "-1.5"); - assert(compareArray(sample.subarray(-1.1), N([43])), "-1.1"); - assert(compareArray(sample.subarray(-0.6), N([40, 41, 42, 43])), "-0.6"); + assert(compareArray(sample.subarray(-1.5), [43]), "-1.5"); + assert(compareArray(sample.subarray(-1.1), [43]), "-1.1"); + assert(compareArray(sample.subarray(-0.6), [40, 41, 42, 43]), "-0.6"); - assert(compareArray(sample.subarray("3"), N([43])), "string"); + assert(compareArray(sample.subarray("3"), [43]), "string"); assert( compareArray( sample.subarray(obj), - N([42, 43]) + [42, 43] ), "object" ); diff --git a/test/built-ins/TypedArray/prototype/subarray/tointeger-end.js b/test/built-ins/TypedArray/prototype/subarray/tointeger-end.js index ad58835fb..4797bf5b2 100644 --- a/test/built-ins/TypedArray/prototype/subarray/tointeger-end.js +++ b/test/built-ins/TypedArray/prototype/subarray/tointeger-end.js @@ -20,28 +20,28 @@ var obj = { } }; -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([40, 41, 42, 43])); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA([40, 41, 42, 43]); assert(compareArray(sample.subarray(0, false), []), "false"); - assert(compareArray(sample.subarray(0, true), N([40])), "true"); + assert(compareArray(sample.subarray(0, true), [40]), "true"); assert(compareArray(sample.subarray(0, NaN), []), "NaN"); assert(compareArray(sample.subarray(0, null), []), "null"); - assert(compareArray(sample.subarray(0, undefined), N([40, 41, 42, 43])), "undefined"); + assert(compareArray(sample.subarray(0, undefined), [40, 41, 42, 43]), "undefined"); assert(compareArray(sample.subarray(0, 0.6), []), "0.6"); - assert(compareArray(sample.subarray(0, 1.1), N([40])), "1.1"); - assert(compareArray(sample.subarray(0, 1.5), N([40])), "1.5"); + assert(compareArray(sample.subarray(0, 1.1), [40]), "1.1"); + assert(compareArray(sample.subarray(0, 1.5), [40]), "1.5"); assert(compareArray(sample.subarray(0, -0.6), []), "-0.6"); - assert(compareArray(sample.subarray(0, -1.1), N([40, 41, 42])), "-1.1"); - assert(compareArray(sample.subarray(0, -1.5), N([40, 41, 42])), "-1.5"); + assert(compareArray(sample.subarray(0, -1.1), [40, 41, 42]), "-1.1"); + assert(compareArray(sample.subarray(0, -1.5), [40, 41, 42]), "-1.5"); - assert(compareArray(sample.subarray(0, "3"), N([40, 41, 42])), "string"); + assert(compareArray(sample.subarray(0, "3"), [40, 41, 42]), "string"); assert( compareArray( sample.subarray(0, obj), - N([40, 41]) + [40, 41] ), "object" ); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/calls-tolocalestring-from-each-value.js b/test/built-ins/TypedArray/prototype/toLocaleString/calls-tolocalestring-from-each-value.js index 5c4ea06ef..ba9b11247 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/calls-tolocalestring-from-each-value.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/calls-tolocalestring-from-each-value.js @@ -46,12 +46,12 @@ if (typeof BigInt !== "undefined") { var arr = [42, 0]; var expected = ["hacks1", "hacks2"].join(separator); -testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N(arr)); +testWithTypedArrayConstructors(function(TA) { + var sample = new TA(arr); calls = []; assert.sameValue(sample.toLocaleString(), expected, "returns expected value"); assert( - compareArray(new TA(N(calls)), sample), + compareArray(new TA(calls), sample), "toLocaleString called for each item" ); }); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/calls-tostring-from-each-value.js b/test/built-ins/TypedArray/prototype/toLocaleString/calls-tostring-from-each-value.js index 5dfcf91d4..befe99716 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/calls-tostring-from-each-value.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/calls-tostring-from-each-value.js @@ -55,7 +55,7 @@ var arr = [42, 0]; var expected = ["hacks1", "hacks2"].join(separator); testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N(arr)); + var sample = new TA(arr); calls = 0; assert.sameValue(sample.toLocaleString(), expected, "returns expected value"); assert.sameValue(calls, 2, "toString called once for each item"); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/calls-valueof-from-each-value.js b/test/built-ins/TypedArray/prototype/toLocaleString/calls-valueof-from-each-value.js index 25603f372..728aaf239 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/calls-valueof-from-each-value.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/calls-valueof-from-each-value.js @@ -53,7 +53,7 @@ var arr = [42, 0]; var expected = ["hacks1", "hacks2"].join(separator); testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N(arr)); + var sample = new TA(arr); calls = 0; assert.sameValue(sample.toLocaleString(), expected, "returns expected value"); assert.sameValue(calls, 2, "valueOf called once for each item"); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/toLocaleString/get-length-uses-internal-arraylength.js index 72e76979e..04ee64e7c 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/get-length-uses-internal-arraylength.js @@ -31,7 +31,7 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([42, 43])); + var sample = new TA([42, 43]); Object.defineProperty(TA.prototype, "length", desc); Object.defineProperty(sample, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tolocalestring.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tolocalestring.js index be087cfd1..7f31b9c33 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tolocalestring.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tolocalestring.js @@ -39,7 +39,7 @@ var arr = [42, 0]; testWithTypedArrayConstructors(function(TA, N) { calls = 0; - var sample = new TA(N(arr)); + var sample = new TA(arr); assert.throws(Test262Error, function() { sample.toLocaleString(); }); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tostring.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tostring.js index 433613030..6abe3565d 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tostring.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tostring.js @@ -50,7 +50,7 @@ if (typeof BigInt !== "undefined") { var arr = [42, 0]; testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N(arr)); + var sample = new TA(arr); calls = 0; assert.throws(Test262Error, function() { sample.toLocaleString(); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-valueof.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-valueof.js index b283f1db1..424ec3a32 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-valueof.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-valueof.js @@ -51,7 +51,7 @@ if (typeof BigInt !== "undefined") { var arr = [42, 0]; testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N(arr)); + var sample = new TA(arr); calls = 0; assert.throws(Test262Error, function() { sample.toLocaleString(); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tolocalestring.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tolocalestring.js index 013f2afc3..18e315c06 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tolocalestring.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tolocalestring.js @@ -42,7 +42,7 @@ var arr = [42, 0]; testWithTypedArrayConstructors(function(TA, N) { calls = 0; - var sample = new TA(N(arr)); + var sample = new TA(arr); assert.throws(Test262Error, function() { sample.toLocaleString(); }); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tostring.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tostring.js index 9d2eed638..6bfca767b 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tostring.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tostring.js @@ -52,7 +52,7 @@ if (typeof BigInt !== "undefined") { var arr = [42, 0]; testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N(arr)); + var sample = new TA(arr); calls = 0; assert.throws(Test262Error, function() { sample.toLocaleString(); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-valueof.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-valueof.js index d70d442f5..0992a9848 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-valueof.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-valueof.js @@ -53,7 +53,7 @@ if (typeof BigInt !== "undefined") { var arr = [42, 0]; testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N(arr)); + var sample = new TA(arr); calls = 0; assert.throws(Test262Error, function() { sample.toLocaleString(); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-result.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-result.js index f5825158f..fca0e70b3 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/return-result.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-result.js @@ -36,7 +36,7 @@ var separator = ["", ""].toLocaleString(); var arr = [42, 0, 43]; testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N(arr)); + var sample = new TA(arr); var expected = sample[0].toLocaleString().toString() + separator + diff --git a/test/built-ins/TypedArray/prototype/values/iter-prototype.js b/test/built-ins/TypedArray/prototype/values/iter-prototype.js index 55913d266..df764e002 100644 --- a/test/built-ins/TypedArray/prototype/values/iter-prototype.js +++ b/test/built-ins/TypedArray/prototype/values/iter-prototype.js @@ -18,7 +18,7 @@ features: [Symbol.iterator, TypedArray] var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]()); testWithTypedArrayConstructors(function(TA, N) { - var sample = new TA(N([0, 42, 64])); + var sample = new TA([0, 42, 64]); var iter = sample.values(); assert.sameValue(Object.getPrototypeOf(iter), ArrayIteratorProto); diff --git a/test/built-ins/TypedArray/prototype/values/return-itor.js b/test/built-ins/TypedArray/prototype/values/return-itor.js index 31b9f410f..b1f3c2d50 100644 --- a/test/built-ins/TypedArray/prototype/values/return-itor.js +++ b/test/built-ins/TypedArray/prototype/values/return-itor.js @@ -15,20 +15,20 @@ features: [TypedArray] var sample = [0, 42, 64]; -testWithTypedArrayConstructors(function(TA, N) { - var typedArray = new TA(N(sample)); +testWithTypedArrayConstructors(function(TA) { + var typedArray = new TA(sample); var itor = typedArray.values(); var next = itor.next(); - assert.sameValue(next.value, N(0)); + assert.sameValue(next.value, 0); assert.sameValue(next.done, false); next = itor.next(); - assert.sameValue(next.value, N(42)); + assert.sameValue(next.value, 42); assert.sameValue(next.done, false); next = itor.next(); - assert.sameValue(next.value, N(64)); + assert.sameValue(next.value, 64); assert.sameValue(next.done, false); next = itor.next(); -- cgit v1.2.1 From dd2dfc9fb15db7c9e32bfe26a37d3acae43cd492 Mon Sep 17 00:00:00 2001 From: Leo Balter Date: Thu, 15 Feb 2018 13:27:25 -0500 Subject: remove bogus checks --- .../prototype/set/typedarray-arg-set-values-diff-buffer-other-type.js | 3 --- .../prototype/set/typedarray-arg-src-byteoffset-internal.js | 3 --- .../prototype/set/typedarray-arg-target-byteoffset-internal.js | 3 --- .../TypedArray/prototype/slice/set-values-from-different-ctor-type.js | 3 --- .../prototype/toLocaleString/calls-tolocalestring-from-each-value.js | 4 ---- .../prototype/toLocaleString/calls-tostring-from-each-value.js | 4 ---- .../prototype/toLocaleString/calls-valueof-from-each-value.js | 4 ---- .../toLocaleString/return-abrupt-from-firstelement-tolocalestring.js | 4 ---- .../toLocaleString/return-abrupt-from-firstelement-tostring.js | 4 ---- .../toLocaleString/return-abrupt-from-firstelement-valueof.js | 4 ---- .../toLocaleString/return-abrupt-from-nextelement-tolocalestring.js | 4 ---- .../toLocaleString/return-abrupt-from-nextelement-tostring.js | 4 ---- .../toLocaleString/return-abrupt-from-nextelement-valueof.js | 4 ---- 13 files changed, 48 deletions(-) diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type.js index 4ba857e03..04ddb5237 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type.js @@ -28,9 +28,6 @@ features: [TypedArray] testWithTypedArrayConstructors(function(TA) { var other = TA === Float32Array ? Float64Array : Float32Array; - if (typeof BigInt !== "undefined") - other = TA === BigInt64Array ? BigUint64Array : - TA === BigUint64Array ? BigInt64Array : other; var src = new other([42, 43]); var sample, result; diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-byteoffset-internal.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-byteoffset-internal.js index 498ac5fc8..c3bfdeb28 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-byteoffset-internal.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-byteoffset-internal.js @@ -29,9 +29,6 @@ testWithTypedArrayConstructors(function(TA) { var sample = new TA(2); var src = new TA([42, 43]); var differentTA = TA === Uint8Array ? Int8Array : Uint8Array; - if (typeof BigInt !== "undefined") - differentTA = TA === BigInt64Array ? BigUint64Array : - TA === BigUint64Array ? BigInt64Array : differentTA; var src2 = new differentTA([42, 43]); var src3 = new differentTA(sample.buffer, 0, 2); diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-byteoffset-internal.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-byteoffset-internal.js index ac5b8f6cb..9e2802617 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-byteoffset-internal.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-byteoffset-internal.js @@ -30,9 +30,6 @@ testWithTypedArrayConstructors(function(TA) { var sample = new TA(2); var src = new TA([42, 43]); var differentTA = TA === Uint8Array ? Int8Array : Uint8Array; - if (typeof BigInt !== "undefined") - differentTA = TA === BigInt64Array ? BigUint64Array : - TA === BigUint64Array ? BigInt64Array : differentTA; var src2 = new differentTA([42, 43]); var src3 = new differentTA(sample.buffer, 0, 2); diff --git a/test/built-ins/TypedArray/prototype/slice/set-values-from-different-ctor-type.js b/test/built-ins/TypedArray/prototype/slice/set-values-from-different-ctor-type.js index c0195b705..cb19d311d 100644 --- a/test/built-ins/TypedArray/prototype/slice/set-values-from-different-ctor-type.js +++ b/test/built-ins/TypedArray/prototype/slice/set-values-from-different-ctor-type.js @@ -35,9 +35,6 @@ var arr = [42, 43, 44]; testWithTypedArrayConstructors(function(TA) { var sample = new TA(arr); var other = TA === Int8Array ? Uint8Array : Int8Array; - if (typeof BigInt !== "undefined") { - other = TA === BigInt64Array ? BigUint64Array : - TA === BigUint64Array ? BigInt64Array : other; sample.constructor = {}; sample.constructor[Symbol.species] = other; diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/calls-tolocalestring-from-each-value.js b/test/built-ins/TypedArray/prototype/toLocaleString/calls-tolocalestring-from-each-value.js index ba9b11247..980670c72 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/calls-tolocalestring-from-each-value.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/calls-tolocalestring-from-each-value.js @@ -39,10 +39,6 @@ Number.prototype.toLocaleString = function() { return "hacks" + calls.length; }; -if (typeof BigInt !== "undefined") { - BigInt.prototype.toLocaleString = Number.prototype.toLocaleString; -} - var arr = [42, 0]; var expected = ["hacks1", "hacks2"].join(separator); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/calls-tostring-from-each-value.js b/test/built-ins/TypedArray/prototype/toLocaleString/calls-tostring-from-each-value.js index befe99716..530ec1055 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/calls-tostring-from-each-value.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/calls-tostring-from-each-value.js @@ -47,10 +47,6 @@ Number.prototype.toLocaleString = function() { }; }; -if (typeof BigInt !== "undefined") { - BigInt.prototype.toLocaleString = Number.prototype.toLocaleString; -} - var arr = [42, 0]; var expected = ["hacks1", "hacks2"].join(separator); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/calls-valueof-from-each-value.js b/test/built-ins/TypedArray/prototype/toLocaleString/calls-valueof-from-each-value.js index 728aaf239..328bbbf4e 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/calls-valueof-from-each-value.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/calls-valueof-from-each-value.js @@ -45,10 +45,6 @@ Number.prototype.toLocaleString = function() { }; }; -if (typeof BigInt !== "undefined") { - BigInt.prototype.toLocaleString = Number.prototype.toLocaleString; -} - var arr = [42, 0]; var expected = ["hacks1", "hacks2"].join(separator); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tolocalestring.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tolocalestring.js index 7f31b9c33..d934b70da 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tolocalestring.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tolocalestring.js @@ -31,10 +31,6 @@ Number.prototype.toLocaleString = function() { throw new Test262Error(); }; -if (typeof BigInt !== "undefined") { - BigInt.prototype.toLocaleString = Number.prototype.toLocaleString; -} - var arr = [42, 0]; testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tostring.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tostring.js index 6abe3565d..394105ef3 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tostring.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-tostring.js @@ -43,10 +43,6 @@ Number.prototype.toLocaleString = function() { }; }; -if (typeof BigInt !== "undefined") { - BigInt.prototype.toLocaleString = Number.prototype.toLocaleString; -} - var arr = [42, 0]; testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-valueof.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-valueof.js index 424ec3a32..ae7e4169e 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-valueof.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-firstelement-valueof.js @@ -44,10 +44,6 @@ Number.prototype.toLocaleString = function() { }; }; -if (typeof BigInt !== "undefined") { - BigInt.prototype.toLocaleString = Number.prototype.toLocaleString; -} - var arr = [42, 0]; testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tolocalestring.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tolocalestring.js index 18e315c06..49e02d09a 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tolocalestring.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tolocalestring.js @@ -34,10 +34,6 @@ Number.prototype.toLocaleString = function() { } }; -if (typeof BigInt !== "undefined") { - BigInt.prototype.toLocaleString = Number.prototype.toLocaleString; -} - var arr = [42, 0]; testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tostring.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tostring.js index 6bfca767b..d872475c7 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tostring.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-tostring.js @@ -45,10 +45,6 @@ Number.prototype.toLocaleString = function() { }; }; -if (typeof BigInt !== "undefined") { - BigInt.prototype.toLocaleString = Number.prototype.toLocaleString; -} - var arr = [42, 0]; testWithTypedArrayConstructors(function(TA, N) { diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-valueof.js b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-valueof.js index 0992a9848..7df9a09d4 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-valueof.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-nextelement-valueof.js @@ -46,10 +46,6 @@ Number.prototype.toLocaleString = function() { }; }; -if (typeof BigInt !== "undefined") { - BigInt.prototype.toLocaleString = Number.prototype.toLocaleString; -} - var arr = [42, 0]; testWithTypedArrayConstructors(function(TA, N) { -- cgit v1.2.1 From 296657cd90023e89218016870bd972267b4cd33a Mon Sep 17 00:00:00 2001 From: Leo Balter Date: Thu, 15 Feb 2018 13:42:03 -0500 Subject: Fix missing BigInt usage in TypedArrays --- .../TypedArrays/prototype/Symbol.toStringTag/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/bigint-Symbol.iterator.js | 6 +++--- test/built-ins/TypedArrays/prototype/buffer/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/byteLength/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/byteOffset/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/copyWithin/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/entries/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/every/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/fill/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/filter/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/find/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/findIndex/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/forEach/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/indexOf/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/join/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/keys/bigint-inherited.js | 6 +++--- .../built-ins/TypedArrays/prototype/lastIndexOf/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/length/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/map/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/reduce/bigint-inherited.js | 6 +++--- .../built-ins/TypedArrays/prototype/reduceRight/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/reverse/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/set/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/slice/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/some/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/sort/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/subarray/bigint-inherited.js | 6 +++--- .../TypedArrays/prototype/toLocaleString/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/toString/bigint-inherited.js | 6 +++--- test/built-ins/TypedArrays/prototype/values/bigint-inherited.js | 6 +++--- 30 files changed, 90 insertions(+), 90 deletions(-) diff --git a/test/built-ins/TypedArrays/prototype/Symbol.toStringTag/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/Symbol.toStringTag/bigint-inherited.js index e0372adb7..476af1cff 100644 --- a/test/built-ins/TypedArrays/prototype/Symbol.toStringTag/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/Symbol.toStringTag/bigint-inherited.js @@ -5,10 +5,10 @@ esid: sec-get-%typedarray%.prototype-@@tostringtag description: > _TypedArray_.prototype[@@toStringTag] is inherited from %TypedArray% _TypedArray_.prototype has no own property @@toStringTag -includes: [testTypedArray.js] -features: [Symbol.toStringTag, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.toStringTag, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty(Symbol.toStringTag), false); }); diff --git a/test/built-ins/TypedArrays/prototype/bigint-Symbol.iterator.js b/test/built-ins/TypedArrays/prototype/bigint-Symbol.iterator.js index 46590fe4d..149575d65 100644 --- a/test/built-ins/TypedArrays/prototype/bigint-Symbol.iterator.js +++ b/test/built-ins/TypedArrays/prototype/bigint-Symbol.iterator.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype-@@iterator description: > _TypedArray_.prototype has no own property @@iterator -includes: [testTypedArray.js] -features: [Symbol.iterator, TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, Symbol.iterator, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty(Symbol.iterator), false); }); diff --git a/test/built-ins/TypedArrays/prototype/buffer/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/buffer/bigint-inherited.js index 323b7476f..6fe2efdd5 100644 --- a/test/built-ins/TypedArrays/prototype/buffer/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/buffer/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-get-%typedarray%.prototype.buffer description: > _TypedArray_.prototype has no own property "buffer" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("buffer"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/byteLength/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/byteLength/bigint-inherited.js index 52b343265..a379f2a83 100644 --- a/test/built-ins/TypedArrays/prototype/byteLength/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/byteLength/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-get-%typedarray%.prototype.bytelength description: > _TypedArray_.prototype has no own property "byteLength" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("byteLength"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/byteOffset/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/byteOffset/bigint-inherited.js index 1d60311e0..c93aeab8c 100644 --- a/test/built-ins/TypedArrays/prototype/byteOffset/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/byteOffset/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-get-%typedarray%.prototype.byteoffset description: > _TypedArray_.prototype has no own property "byteOffset" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("byteOffset"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/copyWithin/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/copyWithin/bigint-inherited.js index db5105ac6..68d44622a 100644 --- a/test/built-ins/TypedArrays/prototype/copyWithin/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/copyWithin/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype.copywithin description: > _TypedArray_.prototype has no own property "copyWithin" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("copyWithin"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/entries/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/entries/bigint-inherited.js index 8601bc268..03017f07c 100644 --- a/test/built-ins/TypedArrays/prototype/entries/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/entries/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype.entries description: > _TypedArray_.prototype has no own property "entries" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("entries"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/every/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/every/bigint-inherited.js index 9b3da52bf..95c15ca63 100644 --- a/test/built-ins/TypedArrays/prototype/every/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/every/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype.every description: > _TypedArray_.prototype has no own property "every" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("every"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/fill/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/fill/bigint-inherited.js index b6862164e..82845b596 100644 --- a/test/built-ins/TypedArrays/prototype/fill/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/fill/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype.fill description: > _TypedArray_.prototype has no own property "fill" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("fill"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/filter/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/filter/bigint-inherited.js index 36d9019de..cbff2a5d6 100644 --- a/test/built-ins/TypedArrays/prototype/filter/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/filter/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype.filter description: > _TypedArray_.prototype has no own property "filter" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("filter"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/find/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/find/bigint-inherited.js index 828c4f4c4..ac94cd801 100644 --- a/test/built-ins/TypedArrays/prototype/find/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/find/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype.find description: > _TypedArray_.prototype has no own property "find" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("find"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/findIndex/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/findIndex/bigint-inherited.js index 63f6f2279..4a6277923 100644 --- a/test/built-ins/TypedArrays/prototype/findIndex/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/findIndex/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype.findindex description: > _TypedArray_.prototype has no own property "findIndex" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("findIndex"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/forEach/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/forEach/bigint-inherited.js index de6e9371d..409132fb1 100644 --- a/test/built-ins/TypedArrays/prototype/forEach/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/forEach/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype.foreach description: > _TypedArray_.prototype has no own property "forEach" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("forEach"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/indexOf/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/indexOf/bigint-inherited.js index 362ef22a9..7f403c3df 100644 --- a/test/built-ins/TypedArrays/prototype/indexOf/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/indexOf/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype.indexof description: > _TypedArray_.prototype has no own property "indexOf" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("indexOf"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/join/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/join/bigint-inherited.js index cc649c89f..45e858aef 100644 --- a/test/built-ins/TypedArrays/prototype/join/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/join/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype.join description: > _TypedArray_.prototype has no own property "join" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("join"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/keys/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/keys/bigint-inherited.js index f4c800c5e..6b25ac078 100644 --- a/test/built-ins/TypedArrays/prototype/keys/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/keys/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype.keys description: > _TypedArray_.prototype has no own property "keys" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("keys"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/lastIndexOf/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/lastIndexOf/bigint-inherited.js index 5a68f3fa3..2a7dd2912 100644 --- a/test/built-ins/TypedArrays/prototype/lastIndexOf/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/lastIndexOf/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype.lastindexof description: > _TypedArray_.prototype has no own property "lastIndexOf" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("lastIndexOf"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/length/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/length/bigint-inherited.js index b75ccb831..36244e7c5 100644 --- a/test/built-ins/TypedArrays/prototype/length/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/length/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-get-%typedarray%.prototype.length description: > _TypedArray_.prototype has no own property "length" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("length"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/map/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/map/bigint-inherited.js index 2d5d48aae..ace5d810d 100644 --- a/test/built-ins/TypedArrays/prototype/map/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/map/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype.map description: > _TypedArray_.prototype has no own property "map" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("map"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/reduce/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/reduce/bigint-inherited.js index d01bda709..ac0a6b751 100644 --- a/test/built-ins/TypedArrays/prototype/reduce/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/reduce/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-get-%typedarray%.prototype.reduce description: > _TypedArray_.prototype has no own property "reduce" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("reduce"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/reduceRight/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/reduceRight/bigint-inherited.js index 784e4c2b7..64c043026 100644 --- a/test/built-ins/TypedArrays/prototype/reduceRight/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/reduceRight/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype.reduceright description: > _TypedArray_.prototype has no own property "reduceRight" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("reduceRight"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/reverse/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/reverse/bigint-inherited.js index 7d8a7d6e2..b839ed245 100644 --- a/test/built-ins/TypedArrays/prototype/reverse/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/reverse/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype.reverse description: > _TypedArray_.prototype has no own property "reverse" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("reverse"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/set/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/set/bigint-inherited.js index 411b66fda..722e58490 100644 --- a/test/built-ins/TypedArrays/prototype/set/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/set/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype.set description: > _TypedArray_.prototype has no own property "set" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("set"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/slice/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/slice/bigint-inherited.js index a1ae44026..09ad236fe 100644 --- a/test/built-ins/TypedArrays/prototype/slice/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/slice/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype.slice description: > _TypedArray_.prototype has no own property "slice" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("slice"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/some/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/some/bigint-inherited.js index 4b75f87f2..5dcd257a3 100644 --- a/test/built-ins/TypedArrays/prototype/some/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/some/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype.some description: > _TypedArray_.prototype has no own property "some" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("some"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/sort/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/sort/bigint-inherited.js index 37aab5255..57d26122a 100644 --- a/test/built-ins/TypedArrays/prototype/sort/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/sort/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype.sort description: > _TypedArray_.prototype has no own property "sort" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("sort"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/subarray/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/subarray/bigint-inherited.js index 2416208a3..53901a6cb 100644 --- a/test/built-ins/TypedArrays/prototype/subarray/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/subarray/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype.subarray description: > _TypedArray_.prototype has no own property "subarray" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("subarray"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/toLocaleString/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/toLocaleString/bigint-inherited.js index d4a48e25d..b2b742d24 100644 --- a/test/built-ins/TypedArrays/prototype/toLocaleString/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/toLocaleString/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype.tolocalestring description: > _TypedArray_.prototype has no own property "toLocaleString" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("toLocaleString"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/toString/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/toString/bigint-inherited.js index 9f1b0e217..5a2319fd8 100644 --- a/test/built-ins/TypedArrays/prototype/toString/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/toString/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype.tostring description: > _TypedArray_.prototype has no own property "toString" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("toString"), false); }); diff --git a/test/built-ins/TypedArrays/prototype/values/bigint-inherited.js b/test/built-ins/TypedArrays/prototype/values/bigint-inherited.js index bd4aaec70..65b5bbf7e 100644 --- a/test/built-ins/TypedArrays/prototype/values/bigint-inherited.js +++ b/test/built-ins/TypedArrays/prototype/values/bigint-inherited.js @@ -4,10 +4,10 @@ esid: sec-%typedarray%.prototype.values description: > _TypedArray_.prototype has no own property "values" -includes: [testTypedArray.js] -features: [TypedArray] +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] ---*/ -testWithTypedArrayConstructors(function(TA) { +testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(TA.prototype.hasOwnProperty("values"), false); }); -- cgit v1.2.1 From 3325e2a516a38936686fb0163b8f8a5292f8256e Mon Sep 17 00:00:00 2001 From: Leo Balter Date: Thu, 15 Feb 2018 13:57:39 -0500 Subject: Minimize use of convertToBigInt --- .../copyWithin/BigInt/coerced-values-end.js | 24 ++--- .../copyWithin/BigInt/coerced-values-start.js | 32 +++--- .../copyWithin/BigInt/coerced-values-target.js | 32 +++--- .../prototype/copyWithin/BigInt/negative-end.js | 32 +++--- .../BigInt/negative-out-of-bounds-end.js | 40 ++++---- .../BigInt/negative-out-of-bounds-start.js | 32 +++--- .../BigInt/negative-out-of-bounds-target.js | 16 +-- .../prototype/copyWithin/BigInt/negative-start.js | 24 ++--- .../prototype/copyWithin/BigInt/negative-target.js | 12 +-- .../BigInt/non-negative-out-of-bounds-end.js | 16 +-- .../non-negative-out-of-bounds-target-and-start.js | 28 +++--- .../BigInt/non-negative-target-and-start.js | 16 +-- .../BigInt/non-negative-target-start-and-end.js | 20 ++-- .../prototype/copyWithin/BigInt/return-this.js | 2 +- .../prototype/copyWithin/BigInt/undefined-end.js | 8 +- .../prototype/entries/BigInt/iter-prototype.js | 2 +- .../prototype/entries/BigInt/return-itor.js | 6 +- .../BigInt/callbackfn-arguments-with-thisarg.js | 8 +- .../BigInt/callbackfn-arguments-without-thisarg.js | 8 +- .../callbackfn-no-interaction-over-non-integer.js | 6 +- .../callbackfn-return-does-not-change-instance.js | 8 +- .../callbackfn-set-value-during-interaction.js | 10 +- .../BigInt/get-length-uses-internal-arraylength.js | 2 +- .../every/BigInt/values-are-not-cached.js | 6 +- .../prototype/fill/BigInt/coerced-indexes.js | 28 +++--- .../fill/BigInt/fill-values-conversion-once.js | 4 +- .../BigInt/fill-values-custom-start-and-end.js | 10 +- .../fill/BigInt/fill-values-non-numeric.js | 22 ++--- .../fill/BigInt/fill-values-relative-end.js | 8 +- .../fill/BigInt/fill-values-relative-start.js | 8 +- .../prototype/fill/BigInt/fill-values.js | 4 +- .../fill/BigInt/get-length-ignores-length-prop.js | 2 +- .../fill/BigInt/return-abrupt-from-end.js | 2 +- .../fill/BigInt/return-abrupt-from-set-value.js | 2 +- .../fill/BigInt/return-abrupt-from-start.js | 2 +- .../prototype/fill/BigInt/return-this.js | 4 +- .../BigInt/callbackfn-arguments-with-thisarg.js | 8 +- .../BigInt/callbackfn-arguments-without-thisarg.js | 8 +- .../callbackfn-no-iteration-over-non-integer.js | 6 +- .../callbackfn-return-does-not-change-instance.js | 8 +- .../callbackfn-set-value-during-iteration.js | 10 +- .../filter/BigInt/result-does-not-share-buffer.js | 2 +- .../BigInt/result-full-callbackfn-returns-true.js | 2 +- .../filter/BigInt/speciesctor-get-ctor-abrupt.js | 2 +- .../BigInt/speciesctor-get-ctor-inherited.js | 2 +- .../BigInt/speciesctor-get-ctor-returns-throws.js | 2 +- .../filter/BigInt/speciesctor-get-ctor.js | 2 +- ...eciesctor-get-species-custom-ctor-invocation.js | 4 +- ...species-custom-ctor-returns-another-instance.js | 2 +- .../BigInt/speciesctor-get-species-custom-ctor.js | 4 +- .../filter/BigInt/values-are-not-cached.js | 6 +- .../prototype/filter/BigInt/values-are-set.js | 8 +- .../find/BigInt/get-length-ignores-length-prop.js | 4 +- .../find/BigInt/predicate-call-changes-value.js | 22 ++--- .../find/BigInt/predicate-call-parameters.js | 8 +- .../return-found-value-predicate-result-is-true.js | 18 ++-- .../BigInt/get-length-ignores-length-prop.js | 2 +- .../BigInt/predicate-call-changes-value.js | 16 +-- .../findIndex/BigInt/predicate-call-parameters.js | 8 +- .../return-index-predicate-result-is-true.js | 4 +- ...egative-one-if-predicate-returns-false-value.js | 2 +- .../BigInt/callbackfn-arguments-with-thisarg.js | 8 +- .../BigInt/callbackfn-arguments-without-thisarg.js | 8 +- .../callbackfn-no-interaction-over-non-integer.js | 6 +- .../callbackfn-return-does-not-change-instance.js | 8 +- .../callbackfn-set-value-during-interaction.js | 10 +- .../forEach/BigInt/values-are-not-cached.js | 6 +- .../includes/BigInt/fromIndex-infinity.js | 6 +- .../includes/BigInt/fromIndex-minus-zero.js | 8 +- .../BigInt/get-length-uses-internal-arraylength.js | 4 +- .../return-abrupt-tointeger-fromindex-symbol.js | 4 +- .../BigInt/return-abrupt-tointeger-fromindex.js | 4 +- .../includes/BigInt/search-found-returns-true.js | 20 ++-- .../BigInt/search-not-found-returns-false.js | 14 +-- .../includes/BigInt/tointeger-fromindex.js | 34 +++---- .../prototype/indexOf/BigInt/fromIndex-infinity.js | 6 +- .../indexOf/BigInt/fromIndex-minus-zero.js | 6 +- .../BigInt/get-length-uses-internal-arraylength.js | 4 +- .../indexOf/BigInt/search-found-returns-index.js | 20 ++-- .../BigInt/search-not-found-returns-minus-one.js | 14 +-- .../indexOf/BigInt/tointeger-fromindex.js | 34 +++---- ...or-result-from-tostring-on-each-simple-value.js | 2 +- .../BigInt/get-length-uses-internal-arraylength.js | 2 +- .../result-from-tostring-on-each-simple-value.js | 2 +- .../prototype/keys/BigInt/iter-prototype.js | 2 +- .../lastIndexOf/BigInt/fromIndex-infinity.js | 6 +- .../lastIndexOf/BigInt/fromIndex-minus-zero.js | 6 +- .../BigInt/get-length-uses-internal-arraylength.js | 4 +- .../BigInt/search-found-returns-index.js | 46 ++++----- .../BigInt/search-not-found-returns-minus-one.js | 22 ++--- .../lastIndexOf/BigInt/tointeger-fromindex.js | 34 +++---- .../prototype/map/BigInt/arraylength-internal.js | 4 +- .../BigInt/callbackfn-arguments-with-thisarg.js | 10 +- .../BigInt/callbackfn-arguments-without-thisarg.js | 10 +- .../map/BigInt/callbackfn-detachbuffer.js | 2 +- ...n-no-interaction-over-non-integer-properties.js | 8 +- .../callbackfn-return-affects-returned-object.js | 10 +- .../callbackfn-return-does-not-change-instance.js | 10 +- ...-return-does-not-copy-non-integer-properties.js | 4 +- .../callbackfn-set-value-during-interaction.js | 12 +-- .../prototype/map/BigInt/callbackfn-this.js | 4 +- .../prototype/map/BigInt/values-are-not-cached.js | 8 +- .../callbackfn-arguments-custom-accumulator.js | 8 +- .../callbackfn-arguments-default-accumulator.js | 12 +-- ...kfn-no-iteration-over-non-integer-properties.js | 6 +- .../callbackfn-return-does-not-change-instance.js | 8 +- .../callbackfn-set-value-during-iteration.js | 10 +- .../BigInt/get-length-uses-internal-arraylength.js | 2 +- .../BigInt/result-is-last-callbackfn-return.js | 4 +- .../prototype/reduce/BigInt/result-of-any-type.js | 2 +- .../return-first-value-without-callbackfn.js | 4 +- .../reduce/BigInt/values-are-not-cached.js | 6 +- .../callbackfn-arguments-custom-accumulator.js | 8 +- .../callbackfn-arguments-default-accumulator.js | 12 +-- ...kfn-no-iteration-over-non-integer-properties.js | 6 +- .../callbackfn-return-does-not-change-instance.js | 8 +- .../callbackfn-set-value-during-iteration.js | 10 +- .../BigInt/get-length-uses-internal-arraylength.js | 2 +- .../BigInt/result-is-last-callbackfn-return.js | 4 +- .../reduceRight/BigInt/result-of-any-type.js | 2 +- .../return-first-value-without-callbackfn.js | 4 +- .../reduceRight/BigInt/values-are-not-cached.js | 6 +- .../BigInt/get-length-uses-internal-arraylength.js | 2 +- .../TypedArray/prototype/reverse/BigInt/reverts.js | 28 +++--- .../set/BigInt/array-arg-offset-tointeger.js | 108 ++++++++++----------- .../array-arg-return-abrupt-from-src-get-length.js | 2 +- .../array-arg-return-abrupt-from-src-get-value.js | 10 +- ...ray-arg-return-abrupt-from-src-length-symbol.js | 2 +- .../array-arg-return-abrupt-from-src-length.js | 2 +- ...return-abrupt-from-src-tonumber-value-symbol.js | 10 +- ...ay-arg-return-abrupt-from-src-tonumber-value.js | 10 +- ...array-arg-return-abrupt-from-toobject-offset.js | 2 +- .../set/BigInt/array-arg-set-values-in-order.js | 8 +- .../prototype/set/BigInt/array-arg-set-values.js | 30 +++--- ...rray-arg-src-tonumber-value-type-conversions.js | 2 +- .../BigInt/array-arg-src-values-are-not-cached.js | 20 ++-- .../array-arg-target-arraylength-internal.js | 2 +- ...argetbuffer-detached-on-get-src-value-throws.js | 4 +- .../set/BigInt/typedarray-arg-offset-tointeger.js | 74 +++++++------- ...darray-arg-set-values-diff-buffer-other-type.js | 14 +-- ...edarray-arg-set-values-diff-buffer-same-type.js | 14 +-- ...edarray-arg-set-values-same-buffer-same-type.js | 12 +-- .../typedarray-arg-src-arraylength-internal.js | 2 +- .../typedarray-arg-src-byteoffset-internal.js | 4 +- .../typedarray-arg-target-arraylength-internal.js | 2 +- .../typedarray-arg-target-byteoffset-internal.js | 4 +- .../prototype/slice/BigInt/arraylength-internal.js | 6 +- .../TypedArray/prototype/slice/BigInt/infinity.js | 6 +- .../prototype/slice/BigInt/minus-zero.js | 6 +- .../result-does-not-copy-ordinary-properties.js | 2 +- .../slice/BigInt/results-with-different-length.js | 58 +++++------ .../slice/BigInt/results-with-empty-length.js | 2 +- .../slice/BigInt/results-with-same-length.js | 10 +- .../slice/BigInt/speciesctor-get-ctor-abrupt.js | 2 +- .../slice/BigInt/speciesctor-get-ctor-inherited.js | 2 +- .../BigInt/speciesctor-get-ctor-returns-throws.js | 2 +- .../prototype/slice/BigInt/speciesctor-get-ctor.js | 2 +- ...eciesctor-get-species-custom-ctor-invocation.js | 2 +- ...species-custom-ctor-returns-another-instance.js | 2 +- .../BigInt/speciesctor-get-species-custom-ctor.js | 4 +- .../prototype/slice/BigInt/tointeger-end.js | 18 ++-- .../prototype/slice/BigInt/tointeger-start.js | 28 +++--- .../BigInt/callbackfn-arguments-with-thisarg.js | 8 +- .../BigInt/callbackfn-arguments-without-thisarg.js | 8 +- .../callbackfn-no-interaction-over-non-integer.js | 6 +- .../callbackfn-return-does-not-change-instance.js | 8 +- .../callbackfn-set-value-during-interaction.js | 10 +- .../BigInt/get-length-uses-internal-arraylength.js | 2 +- .../prototype/some/BigInt/values-are-not-cached.js | 6 +- .../prototype/sort/BigInt/arraylength-internal.js | 2 +- .../prototype/sort/BigInt/comparefn-call-throws.js | 2 +- .../prototype/sort/BigInt/comparefn-calls.js | 6 +- .../BigInt/comparefn-nonfunction-call-throws.js | 2 +- .../prototype/sort/BigInt/return-same-instance.js | 2 +- .../sort/BigInt/sortcompare-with-no-tostring.js | 4 +- .../prototype/sort/BigInt/sorted-values.js | 14 +-- .../prototype/subarray/BigInt/infinity.js | 6 +- .../prototype/subarray/BigInt/minus-zero.js | 6 +- .../result-does-not-copy-ordinary-properties.js | 2 +- .../result-is-new-instance-from-same-ctor.js | 4 +- .../result-is-new-instance-with-shared-buffer.js | 10 +- .../BigInt/results-with-different-length.js | 58 +++++------ .../subarray/BigInt/results-with-empty-length.js | 2 +- .../subarray/BigInt/results-with-same-length.js | 10 +- .../subarray/BigInt/speciesctor-get-ctor-abrupt.js | 2 +- .../BigInt/speciesctor-get-ctor-inherited.js | 2 +- .../BigInt/speciesctor-get-ctor-returns-throws.js | 2 +- .../subarray/BigInt/speciesctor-get-ctor.js | 2 +- ...eciesctor-get-species-custom-ctor-invocation.js | 2 +- ...species-custom-ctor-returns-another-instance.js | 2 +- .../BigInt/speciesctor-get-species-custom-ctor.js | 4 +- .../prototype/subarray/BigInt/tointeger-begin.js | 28 +++--- .../prototype/subarray/BigInt/tointeger-end.js | 18 ++-- .../BigInt/get-length-uses-internal-arraylength.js | 2 +- .../prototype/values/BigInt/iter-prototype.js | 2 +- .../prototype/values/BigInt/return-itor.js | 6 +- .../ctors-bigint/length-arg/init-zeros.js | 18 ++-- .../object-arg/object-arg-as-array-returns.js | 4 +- .../object-arg-as-generator-iterable-returns.js | 6 +- .../object-arg-new-instance-extensibility.js | 6 +- .../object-arg/object-arg-throws-from-property.js | 4 +- ...rg-throws-setting-obj-to-primitive-typeerror.js | 2 +- .../object-arg-throws-setting-obj-to-primitive.js | 2 +- .../object-arg-throws-setting-obj-tostring.js | 2 +- ...ect-arg-throws-setting-obj-valueof-typeerror.js | 2 +- .../object-arg-throws-setting-obj-valueof.js | 2 +- .../object-arg-throws-setting-property.js | 4 +- .../BigInt/custom-ctor-returns-other-instance.js | 6 +- .../TypedArrays/from/BigInt/mapfn-arguments.js | 2 +- .../from/BigInt/mapfn-this-with-thisarg.js | 2 +- .../BigInt/mapfn-this-without-thisarg-strict.js | 2 +- .../from/BigInt/new-instance-using-custom-ctor.js | 6 +- .../from/BigInt/new-instance-with-mapfn.js | 6 +- .../from/BigInt/new-instance-without-mapfn.js | 6 +- .../from/BigInt/set-value-abrupt-completion.js | 2 +- .../DefineOwnProperty/BigInt/desc-value-throws.js | 2 +- .../BigInt/key-is-greater-than-last-index.js | 2 +- .../BigInt/key-is-lower-than-zero.js | 2 +- .../DefineOwnProperty/BigInt/key-is-minus-zero.js | 2 +- .../BigInt/key-is-not-canonical-index.js | 4 +- .../DefineOwnProperty/BigInt/key-is-not-integer.js | 14 +-- .../BigInt/key-is-not-numeric-index.js | 2 +- .../BigInt/key-is-numericindex-accessor-desc.js | 6 +- .../key-is-numericindex-desc-configurable.js | 2 +- .../key-is-numericindex-desc-not-enumerable.js | 2 +- .../key-is-numericindex-desc-not-writable.js | 2 +- .../BigInt/key-is-numericindex.js | 8 +- .../DefineOwnProperty/BigInt/key-is-symbol.js | 2 +- .../BigInt/non-extensible-new-key.js | 2 +- .../BigInt/non-extensible-redefine-key.js | 2 +- .../DefineOwnProperty/BigInt/set-value.js | 10 +- .../BigInt/this-is-not-extensible.js | 2 +- .../detached-buffer-key-is-not-numeric-index.js | 2 +- .../Get/BigInt/detached-buffer-key-is-symbol.js | 2 +- .../internals/Get/BigInt/detached-buffer.js | 2 +- .../internals/Get/BigInt/indexed-value-sab.js | 6 +- .../internals/Get/BigInt/indexed-value.js | 6 +- .../internals/Get/BigInt/key-is-not-integer.js | 2 +- .../internals/Get/BigInt/key-is-not-minus-zero.js | 2 +- .../Get/BigInt/key-is-not-numeric-index.js | 2 +- .../internals/Get/BigInt/key-is-out-of-bounds.js | 2 +- .../internals/Get/BigInt/key-is-symbol.js | 2 +- .../BigInt/detached-buffer-key-is-not-number.js | 2 +- .../BigInt/detached-buffer-key-is-symbol.js | 2 +- .../GetOwnProperty/BigInt/index-prop-desc.js | 6 +- .../GetOwnProperty/BigInt/key-is-minus-zero.js | 2 +- .../BigInt/key-is-not-canonical-index.js | 2 +- .../GetOwnProperty/BigInt/key-is-not-integer.js | 2 +- .../BigInt/key-is-not-numeric-index.js | 2 +- .../GetOwnProperty/BigInt/key-is-out-of-bounds.js | 2 +- .../GetOwnProperty/BigInt/key-is-symbol.js | 2 +- .../BigInt/detached-buffer-key-is-not-number.js | 2 +- .../BigInt/detached-buffer-key-is-symbol.js | 2 +- .../internals/HasProperty/BigInt/indexed-value.js | 2 +- .../BigInt/key-is-not-canonical-index.js | 2 +- .../integer-indexes-and-string-and-symbol-keys-.js | 2 +- .../BigInt/integer-indexes-and-string-keys.js | 2 +- .../OwnPropertyKeys/BigInt/integer-indexes.js | 2 +- .../detached-buffer-key-is-not-numeric-index.js | 2 +- .../Set/BigInt/detached-buffer-key-is-symbol.js | 2 +- .../internals/Set/BigInt/detached-buffer.js | 14 +-- .../internals/Set/BigInt/indexed-value.js | 10 +- .../internals/Set/BigInt/key-is-minus-zero.js | 2 +- .../Set/BigInt/key-is-not-canonical-index.js | 2 +- .../internals/Set/BigInt/key-is-not-integer.js | 2 +- .../Set/BigInt/key-is-not-numeric-index.js | 2 +- .../internals/Set/BigInt/key-is-out-of-bounds.js | 2 +- .../internals/Set/BigInt/key-is-symbol.js | 2 +- .../internals/Set/BigInt/tonumber-value-throws.js | 2 +- .../of/BigInt/argument-number-value-throws.js | 2 +- .../BigInt/custom-ctor-returns-other-instance.js | 4 +- .../of/BigInt/new-instance-using-custom-ctor.js | 8 +- .../TypedArrays/of/BigInt/new-instance.js | 8 +- 273 files changed, 1125 insertions(+), 1125 deletions(-) diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js index c713fdf95..6060fab6e 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js @@ -29,48 +29,48 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, 0, null), - convertToBigInt([0, 1, 2, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, null), + [0n, 1n, 2n, 3n] ), 'null value coerced to 0' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, 0, NaN), - convertToBigInt([0, 1, 2, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, NaN), + [0n, 1n, 2n, 3n] ), 'NaN value coerced to 0' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, 0, false), - convertToBigInt([0, 1, 2, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, false), + [0n, 1n, 2n, 3n] ), 'false value coerced to 0' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, 0, true), - convertToBigInt([0, 0, 2, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, true), + [0n, 0n, 2n, 3n] ), 'true value coerced to 1' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, 0, '-2'), - convertToBigInt([0, 0, 1, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, '-2'), + [0n, 0n, 1n, 3n] ), 'string "-2" value coerced to integer -2' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, 0, -2.5), - convertToBigInt([0, 0, 1, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, -2.5), + [0n, 0n, 1n, 3n] ), 'float -2.5 value coerced to integer -2' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js index 6ad29124a..6cd12a381 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js @@ -28,64 +28,64 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, undefined), - convertToBigInt([0, 0, 1, 2]) + new TA([0n, 1n, 2n, 3n]).copyWithin(1, undefined), + [0n, 0n, 1n, 2n] ), 'undefined value coerced to 0' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, false), - convertToBigInt([0, 0, 1, 2]) + new TA([0n, 1n, 2n, 3n]).copyWithin(1, false), + [0n, 0n, 1n, 2n] ), 'false value coerced to 0' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, NaN), - convertToBigInt([0, 0, 1, 2]) + new TA([0n, 1n, 2n, 3n]).copyWithin(1, NaN), + [0n, 0n, 1n, 2n] ), 'NaN value coerced to 0' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, null), - convertToBigInt([0, 0, 1, 2]) + new TA([0n, 1n, 2n, 3n]).copyWithin(1, null), + [0n, 0n, 1n, 2n] ), 'null value coerced to 0' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, true), - convertToBigInt([1, 2, 3, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(0, true), + [1n, 2n, 3n, 3n] ), 'true value coerced to 1' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, '1'), - convertToBigInt([1, 2, 3, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(0, '1'), + [1n, 2n, 3n, 3n] ), 'string "1" value coerced to 1' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, 0.5), - convertToBigInt([0, 0, 1, 2]) + new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0.5), + [0n, 0n, 1n, 2n] ), '0.5 float value coerced to integer 0' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 1.5), - convertToBigInt([1, 2, 3, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1.5), + [1n, 2n, 3n, 3n] ), '1.5 float value coerced to integer 1' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js index caaa2214e..92d409a46 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js @@ -28,64 +28,64 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(undefined, 1), - convertToBigInt([1, 2, 3, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(undefined, 1), + [1n, 2n, 3n, 3n] ), 'undefined value coerced to 0' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(false, 1), - convertToBigInt([1, 2, 3, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(false, 1), + [1n, 2n, 3n, 3n] ), 'false value coerced to 0' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(NaN, 1), - convertToBigInt([1, 2, 3, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(NaN, 1), + [1n, 2n, 3n, 3n] ), 'NaN value coerced to 0' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(null, 1), - convertToBigInt([1, 2, 3, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(null, 1), + [1n, 2n, 3n, 3n] ), 'null value coerced to 0' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(true, 0), - convertToBigInt([0, 0, 1, 2]) + new TA([0n, 1n, 2n, 3n]).copyWithin(true, 0), + [0n, 0n, 1n, 2n] ), 'true value coerced to 1' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin('1', 0), - convertToBigInt([0, 0, 1, 2]) + new TA([0n, 1n, 2n, 3n]).copyWithin('1', 0), + [0n, 0n, 1n, 2n] ), 'string "1" value coerced to 1' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0.5, 1), - convertToBigInt([1, 2, 3, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(0.5, 1), + [1n, 2n, 3n, 3n] ), '0.5 float value coerced to integer 0' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1.5, 0), - convertToBigInt([0, 0, 1, 2]) + new TA([0n, 1n, 2n, 3n]).copyWithin(1.5, 0), + [0n, 0n, 1n, 2n] ), '1.5 float value coerced to integer 1' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js index 5a01aec33..78a8c9c9a 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js @@ -31,64 +31,64 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 1, -1), - convertToBigInt([1, 2, 2, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, -1), + [1n, 2n, 2n, 3n] ), '[0, 1, 2, 3].copyWithin(0, 1, -1) -> [1, 2, 2, 3]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(2, 0, -1), - convertToBigInt([0, 1, 0, 1, 2]) + new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(2, 0, -1), + [0n, 1n, 0n, 1n, 2n] ), '[0, 1, 2, 3, 4].copyWithin(2, 0, -1) -> [0, 1, 0, 1, 2]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(1, 2, -2), - convertToBigInt([0, 2, 2, 3, 4]) + new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(1, 2, -2), + [0n, 2n, 2n, 3n, 4n] ), '[0, 1, 2, 3, 4].copyWithin(1, 2, -2) -> [0, 2, 2, 3, 4]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, -2, -1), - convertToBigInt([2, 1, 2, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(0, -2, -1), + [2n, 1n, 2n, 3n] ), '[0, 1, 2, 3].copyWithin(0, -2, -1) -> [2, 1, 2, 3]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(2, -2, -1), - convertToBigInt([0, 1, 3, 3, 4]) + new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(2, -2, -1), + [0n, 1n, 3n, 3n, 4n] ), '[0, 1, 2, 3, 4].copyWithin(2, -2, 1) -> [0, 1, 3, 3, 4]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-3, -2, -1), - convertToBigInt([0, 2, 2, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(-3, -2, -1), + [0n, 2n, 2n, 3n] ), '[0, 1, 2, 3].copyWithin(-3, -2, -1) -> [0, 2, 2, 3]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(-2, -3, -1), - convertToBigInt([0, 1, 2, 2, 3]) + new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-2, -3, -1), + [0n, 1n, 2n, 2n, 3n] ), '[0, 1, 2, 3, 4].copyWithin(-2, -3, -1) -> [0, 1, 2, 2, 3]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(-5, -2, -1), - convertToBigInt([3, 1, 2, 3, 4]) + new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-5, -2, -1), + [3n, 1n, 2n, 3n, 4n] ), '[0, 1, 2, 3, 4].copyWithin(-5, -2, -1) -> [3, 1, 2, 3, 4]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js index 245f6f482..ae1309824 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js @@ -31,80 +31,80 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 1, -10), - convertToBigInt([0, 1, 2, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, -10), + [0n, 1n, 2n, 3n] ), '[0, 1, 2, 3].copyWithin(0, 1, -10) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(0, 1, -Infinity), - convertToBigInt([1, 2, 3, 4, 5]) + new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, 1, -Infinity), + [1n, 2n, 3n, 4n, 5n] ), '[1, 2, 3, 4, 5].copyWithin(0, 1, -Infinity) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, -2, -10), - convertToBigInt([0, 1, 2, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(0, -2, -10), + [0n, 1n, 2n, 3n] ), '[0, 1, 2, 3].copyWithin(0, -2, -10) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(0, -2, -Infinity), - convertToBigInt([1, 2, 3, 4, 5]) + new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, -2, -Infinity), + [1n, 2n, 3n, 4n, 5n] ), '[1, 2, 3, 4, 5].copyWithin(0, -2, -Infinity) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, -9, -10), - convertToBigInt([0, 1, 2, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(0, -9, -10), + [0n, 1n, 2n, 3n] ), '[0, 1, 2, 3].copyWithin(0, -9, -10) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(0, -9, -Infinity), - convertToBigInt([1, 2, 3, 4, 5]) + new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, -9, -Infinity), + [1n, 2n, 3n, 4n, 5n] ), '[1, 2, 3, 4, 5].copyWithin(0, -9, -Infinity) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-3, -2, -10), - convertToBigInt([0, 1, 2, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(-3, -2, -10), + [0n, 1n, 2n, 3n] ), '[0, 1, 2, 3].copyWithin(-3, -2, -10) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(-3, -2, -Infinity), - convertToBigInt([1, 2, 3, 4, 5]) + new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-3, -2, -Infinity), + [1n, 2n, 3n, 4n, 5n] ), '[1, 2, 3, 4, 5].copyWithin(-3, -2, -Infinity) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-7, -8, -9), - convertToBigInt([0, 1, 2, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(-7, -8, -9), + [0n, 1n, 2n, 3n] ), '[0, 1, 2, 3].copyWithin(-7, -8, -9) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(-7, -8, -Infinity), - convertToBigInt([1, 2, 3, 4, 5]) + new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-7, -8, -Infinity), + [1n, 2n, 3n, 4n, 5n] ), '[1, 2, 3, 4, 5].copyWithin(-7, -8, -Infinity) -> [1, 2, 3, 4, 5]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js index 11f5b47ee..06ec98f34 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js @@ -29,64 +29,64 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, -10), - convertToBigInt([0, 1, 2, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(0, -10), + [0n, 1n, 2n, 3n] ), '[0, 1, 2, 3]).copyWithin(0, -10) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(0, -Infinity), - convertToBigInt([1, 2, 3, 4, 5]) + new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, -Infinity), + [1n, 2n, 3n, 4n, 5n] ), '[1, 2, 3, 4, 5]).copyWithin(0, -Infinity) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(2, -10), - convertToBigInt([0, 1, 0, 1, 2]) + new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(2, -10), + [0n, 1n, 0n, 1n, 2n] ), '[0, 1, 2, 3, 4]).copyWithin(2, -2) -> [0, 1, 0, 1, 2]' ); assert( compareArray( - new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(2, -Infinity), - convertToBigInt([1, 2, 1, 2, 3]) + new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(2, -Infinity), + [1n, 2n, 1n, 2n, 3n] ), '[1, 2, 3, 4, 5]).copyWithin(2, -Infinity) -> [1, 2, 1, 2, 3]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(10, -10), - convertToBigInt([0, 1, 2, 3, 4]) + new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(10, -10), + [0n, 1n, 2n, 3n, 4n] ), '[0, 1, 2, 3, 4]).copyWithin(10, -10) -> [0, 1, 2, 3, 4]' ); assert( compareArray( - new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(10, -Infinity), - convertToBigInt([1, 2, 3, 4, 5]) + new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(10, -Infinity), + [1n, 2n, 3n, 4n, 5n] ), '[1, 2, 3, 4, 5]).copyWithin(10, -Infinity) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-9, -10), - convertToBigInt([0, 1, 2, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(-9, -10), + [0n, 1n, 2n, 3n] ), '[0, 1, 2, 3].copyWithin(-9, -10) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(-9, -Infinity), - convertToBigInt([1, 2, 3, 4, 5]) + new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-9, -Infinity), + [1n, 2n, 3n, 4n, 5n] ), '[1, 2, 3, 4, 5].copyWithin(-9, -Infinity) -> [1, 2, 3, 4, 5]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js index 34c2759fe..91e2b0e5b 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js @@ -29,32 +29,32 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-10, 0), - convertToBigInt([0, 1, 2, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(-10, 0), + [0n, 1n, 2n, 3n] ), '[0, 1, 2, 3].copyWithin(-10, 0) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(-Infinity, 0), - convertToBigInt([1, 2, 3, 4, 5]) + new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-Infinity, 0), + [1n, 2n, 3n, 4n, 5n] ), '[1, 2, 3, 4, 5].copyWithin(-Infinity, 0) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(-10, 2), - convertToBigInt([2, 3, 4, 3, 4]) + new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-10, 2), + [2n, 3n, 4n, 3n, 4n] ), '[0, 1, 2, 3, 4].copyWithin(-10, 2) -> [2, 3, 4, 3, 4]' ); assert( compareArray( - new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(-Infinity, 2), - convertToBigInt([3, 4, 5, 4, 5]) + new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-Infinity, 2), + [3n, 4n, 5n, 4n, 5n] ), '[1, 2, 3, 4, 5].copyWithin(-Infinity, 2) -> [3, 4, 5, 4, 5]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js index 3ec8bf03e..36d5f2226 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js @@ -29,48 +29,48 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, -1), - convertToBigInt([3, 1, 2, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(0, -1), + [3n, 1n, 2n, 3n] ), '[0, 1, 2, 3].copyWithin(0, -1) -> [3, 1, 2, 3]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(2, -2), - convertToBigInt([0, 1, 3, 4, 4]) + new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(2, -2), + [0n, 1n, 3n, 4n, 4n] ), '[0, 1, 2, 3, 4].copyWithin(2, -2) -> [0, 1, 3, 4, 4]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(1, -2), - convertToBigInt([0, 3, 4, 3, 4]) + new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(1, -2), + [0n, 3n, 4n, 3n, 4n] ), '[0, 1, 2, 3, 4].copyWithin(1, -2) -> [0, 3, 4, 3, 4]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-1, -2), - convertToBigInt([0, 1, 2, 2]) + new TA([0n, 1n, 2n, 3n]).copyWithin(-1, -2), + [0n, 1n, 2n, 2n] ), '[0, 1, 2, 3].copyWithin(-1, -2) -> [ 0, 1, 2, 2 ]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(-2, -3), - convertToBigInt([0, 1, 2, 2, 3]) + new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-2, -3), + [0n, 1n, 2n, 2n, 3n] ), '[0, 1, 2, 3, 4].copyWithin(-2, -3) -> [0, 1, 2, 2, 3]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(-5, -2), - convertToBigInt([3, 4, 2, 3, 4]) + new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-5, -2), + [3n, 4n, 2n, 3n, 4n] ), '[0, 1, 2, 3, 4].copyWithin(-5, -2) -> [3, 4, 2, 3, 4]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js index 9227f3e6d..ec6adaedb 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js @@ -29,24 +29,24 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-1, 0), - convertToBigInt([0, 1, 2, 0]) + new TA([0n, 1n, 2n, 3n]).copyWithin(-1, 0), + [0n, 1n, 2n, 0n] ), '[0, 1, 2, 3].copyWithin(-1, 0) -> [0, 1, 2, 0]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3, 4])).copyWithin(-2, 2), - convertToBigInt([0, 1, 2, 2, 3]) + new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-2, 2), + [0n, 1n, 2n, 2n, 3n] ), '[0, 1, 2, 3, 4].copyWithin(-2, 2) -> [0, 1, 2, 2, 3]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(-1, 2), - convertToBigInt([0, 1, 2, 2]) + new TA([0n, 1n, 2n, 3n]).copyWithin(-1, 2), + [0n, 1n, 2n, 2n] ), '[0, 1, 2, 3].copyWithin(-1, 2) -> [0, 1, 2, 2]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js index dcbe8f800..16d68d51b 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js @@ -22,32 +22,32 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 1, 6), - convertToBigInt([1, 2, 3, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, 6), + [1n, 2n, 3n, 3n] ), '[0, 1, 2, 3].copyWithin(0, 1, 6) -> [1, 2, 3, 3]' ); assert( compareArray( - new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(0, 1, Infinity), - convertToBigInt([2, 3, 4, 5, 5]) + new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, 1, Infinity), + [2n, 3n, 4n, 5n, 5n] ), '[1, 2, 3, 4, 5].copyWithin(0, 1, Infinity) -> [2, 3, 4, 5, 5]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3, 4, 5])).copyWithin(1, 3, 6), - convertToBigInt([0, 3, 4, 5, 4, 5]) + new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(1, 3, 6), + [0n, 3n, 4n, 5n, 4n, 5n] ), '[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 6) -> [0, 3, 4, 5, 4, 5]' ); assert( compareArray( - new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(1, 3, Infinity), - convertToBigInt([1, 4, 5, 4, 5]) + new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(1, 3, Infinity), + [1n, 4n, 5n, 4n, 5n] ), '[1, 2, 3, 4, 5].copyWithin(1, 3, Infinity) -> [1, 4, 5, 4, 5]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js index 63fd382cf..fcb603491 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js @@ -22,52 +22,52 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3, 4, 5])).copyWithin(6, 0), - convertToBigInt([0, 1, 2, 3, 4, 5]) + new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(6, 0), + [0n, 1n, 2n, 3n, 4n, 5n] ) ); assert( compareArray( - new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(Infinity, 0), - convertToBigInt([1, 2, 3, 4, 5]) + new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(Infinity, 0), + [1n, 2n, 3n, 4n, 5n] ), '[1, 2, 3, 4, 5].copyWithin(Infinity, 0) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3, 4, 5])).copyWithin(0, 6), - convertToBigInt([0, 1, 2, 3, 4, 5]) + new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(0, 6), + [0n, 1n, 2n, 3n, 4n, 5n] ) ); assert( compareArray( - new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(0, Infinity), - convertToBigInt([1, 2, 3, 4, 5]) + new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, Infinity), + [1n, 2n, 3n, 4n, 5n] ), '[1, 2, 3, 4, 5].copyWithin(0, Infinity) -> [1, 2, 3, 4, 5]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3, 4, 5])).copyWithin(6, 6), - convertToBigInt([0, 1, 2, 3, 4, 5]) + new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(6, 6), + [0n, 1n, 2n, 3n, 4n, 5n] ) ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3, 4, 5])).copyWithin(10, 10), - convertToBigInt([0, 1, 2, 3, 4, 5]) + new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(10, 10), + [0n, 1n, 2n, 3n, 4n, 5n] ) ); assert( compareArray( - new TA(convertToBigInt([1, 2, 3, 4, 5])).copyWithin(Infinity, Infinity), - convertToBigInt([1, 2, 3, 4, 5]) + new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(Infinity, Infinity), + [1n, 2n, 3n, 4n, 5n] ), '[1, 2, 3, 4, 5].copyWithin(Infinity, Infinity) -> [1, 2, 3, 4, 5]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js index 30190b3f4..27385c45e 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js @@ -22,29 +22,29 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(convertToBigInt([1, 2, 3, 4, 5, 6])).copyWithin(0, 0), - convertToBigInt([1, 2, 3, 4, 5, 6]) + new TA([1n, 2n, 3n, 4n, 5n, 6n]).copyWithin(0, 0), + [1n, 2n, 3n, 4n, 5n, 6n] ) ); assert( compareArray( - new TA(convertToBigInt([1, 2, 3, 4, 5, 6])).copyWithin(0, 2), - convertToBigInt([3, 4, 5, 6, 5, 6]) + new TA([1n, 2n, 3n, 4n, 5n, 6n]).copyWithin(0, 2), + [3n, 4n, 5n, 6n, 5n, 6n] ) ); assert( compareArray( - new TA(convertToBigInt([1, 2, 3, 4, 5, 6])).copyWithin(3, 0), - convertToBigInt([1, 2, 3, 1, 2, 3]) + new TA([1n, 2n, 3n, 4n, 5n, 6n]).copyWithin(3, 0), + [1n, 2n, 3n, 1n, 2n, 3n] ) ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3, 4, 5])).copyWithin(1, 4), - convertToBigInt([0, 4, 5, 3, 4, 5]) + new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(1, 4), + [0n, 4n, 5n, 3n, 4n, 5n] ) ); }); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js index 25df02789..befa6e752 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js @@ -22,24 +22,24 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 0, 0), - convertToBigInt([0, 1, 2, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(0, 0, 0), + [0n, 1n, 2n, 3n] ), '[0, 1, 2, 3].copyWithin(0, 0, 0) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 0, 2), - convertToBigInt([0, 1, 2, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(0, 0, 2), + [0n, 1n, 2n, 3n] ), '[0, 1, 2, 3].copyWithin(0, 0, 2) -> [0, 1, 2, 3]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 1, 2), - convertToBigInt([1, 1, 2, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, 2), + [1n, 1n, 2n, 3n] ), '[0, 1, 2, 3].copyWithin(0, 1, 2) -> [1, 1, 2, 3]' ); @@ -57,16 +57,16 @@ testWithBigIntTypedArrayConstructors(function(TA) { */ assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(1, 0, 2), - convertToBigInt([0, 0, 1, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, 2), + [0n, 0n, 1n, 3n] ), '[0, 1, 2, 3].copyWithin(1, 0, 2) -> [0, 0, 1, 3]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3, 4, 5])).copyWithin(1, 3, 5), - convertToBigInt([0, 3, 4, 3, 4, 5]) + new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(1, 3, 5), + [0n, 3n, 4n, 3n, 4n, 5n] ), '[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 5) -> [0, 3, 4, 3, 4, 5]' ); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js index d61c44ad8..2e5c40fa4 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js @@ -29,7 +29,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(result1, sample1); - var sample2 = new TA(convertToBigInt([1, 2, 3])); + var sample2 = new TA([1n, 2n, 3n]); var result2 = sample2.copyWithin(1, 0); assert.sameValue(result2, sample2); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js index 513e762c3..360d3125f 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js @@ -29,16 +29,16 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 1, undefined), - convertToBigInt([1, 2, 3, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, undefined), + [1n, 2n, 3n, 3n] ), '[0, 1, 2, 3].copyWithin(0, 1, undefined) -> [1, 2, 3]' ); assert( compareArray( - new TA(convertToBigInt([0, 1, 2, 3])).copyWithin(0, 1), - convertToBigInt([1, 2, 3, 3]) + new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1), + [1n, 2n, 3n, 3n] ), '[0, 1, 2, 3].copyWithin(0, 1) -> [1, 2, 3, 3]' ); diff --git a/test/built-ins/TypedArray/prototype/entries/BigInt/iter-prototype.js b/test/built-ins/TypedArray/prototype/entries/BigInt/iter-prototype.js index dbce25ad3..40e4f8f5f 100644 --- a/test/built-ins/TypedArray/prototype/entries/BigInt/iter-prototype.js +++ b/test/built-ins/TypedArray/prototype/entries/BigInt/iter-prototype.js @@ -17,7 +17,7 @@ features: [BigInt, Symbol.iterator, TypedArray] var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]()); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([0, 42, 64])); + var sample = new TA([0n, 42n, 64n]); var iter = sample.entries(); assert.sameValue(Object.getPrototypeOf(iter), ArrayIteratorProto); diff --git a/test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js b/test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js index 015595422..bca03654b 100644 --- a/test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js +++ b/test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js @@ -19,15 +19,15 @@ testWithBigIntTypedArrayConstructors(function(TA) { var itor = typedArray.entries(); var next = itor.next(); - assert(compareArray(next.value, [0, convertToBigInt(0)])); + assert(compareArray(next.value, [0, 0n])); assert.sameValue(next.done, false); next = itor.next(); - assert(compareArray(next.value, [1, convertToBigInt(42)])); + assert(compareArray(next.value, [1, 42n])); assert.sameValue(next.done, false); next = itor.next(); - assert(compareArray(next.value, [2, convertToBigInt(64)])); + assert(compareArray(next.value, [2, 64n])); assert.sameValue(next.done, false); next = itor.next(); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-with-thisarg.js index e6a878b01..18ee71106 100644 --- a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-with-thisarg.js +++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-with-thisarg.js @@ -26,7 +26,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); var results = []; var thisArg = ["test262", 0, "ecma262", 0]; @@ -40,17 +40,17 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(thisArg.length, 4, "thisArg.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue"); + assert.sameValue(results[0][0], 42n, "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue"); + assert.sameValue(results[1][0], 43n, "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue"); + assert.sameValue(results[2][0], 44n, "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-without-thisarg.js index 1f2dce111..2a69123a2 100644 --- a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-without-thisarg.js +++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-arguments-without-thisarg.js @@ -26,7 +26,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); var results = []; @@ -38,17 +38,17 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(results.length, 3, "results.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue"); + assert.sameValue(results[0][0], 42n, "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue"); + assert.sameValue(results[1][0], 43n, "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue"); + assert.sameValue(results[2][0], 44n, "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-no-interaction-over-non-integer.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-no-interaction-over-non-integer.js index 678605aef..1a838503d 100644 --- a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-no-interaction-over-non-integer.js +++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-no-interaction-over-non-integer.js @@ -19,7 +19,7 @@ features: [BigInt, Symbol, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([7, 8])); + var sample = new TA([7n, 8n]); var results = []; @@ -36,6 +36,6 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(results[0][1], 0, "results[0][1] - key"); assert.sameValue(results[1][1], 1, "results[1][1] - key"); - assert.sameValue(results[0][0], convertToBigInt(7), "results[0][0] - value"); - assert.sameValue(results[1][0], convertToBigInt(8), "results[1][0] - value"); + assert.sameValue(results[0][0], 7n, "results[0][0] - value"); + assert.sameValue(results[1][0], 8n, "results[1][0] - value"); }); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-return-does-not-change-instance.js index b46f77ad0..a6396cd4d 100644 --- a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-return-does-not-change-instance.js +++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-return-does-not-change-instance.js @@ -26,13 +26,13 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42])); + var sample = new TA([40n, 41n, 42n]); sample.every(function() { return 43; }); - assert.sameValue(sample[0], convertToBigInt(40), "[0] == 40"); - assert.sameValue(sample[1], convertToBigInt(41), "[1] == 41"); - assert.sameValue(sample[2], convertToBigInt(42), "[2] == 42"); + assert.sameValue(sample[0], 40n, "[0] == 40"); + assert.sameValue(sample[1], 41n, "[1] == 41"); + assert.sameValue(sample[2], 42n, "[2] == 42"); }); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-set-value-during-interaction.js index 8949bb2f1..12f7d7a6e 100644 --- a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-set-value-during-interaction.js +++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-set-value-during-interaction.js @@ -26,7 +26,7 @@ features: [BigInt, Reflect.set, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); var newVal = 0; sample.every(function(val, i) { @@ -36,7 +36,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { "get the changed value during the loop" ); assert.sameValue( - Reflect.set(sample, 0, convertToBigInt(7)), + Reflect.set(sample, 0, 7n), true, "re-set a value for sample[0]" ); @@ -52,7 +52,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { return true; }); - assert.sameValue(sample[0], convertToBigInt(7), "changed values after iteration [0] == 7"); - assert.sameValue(sample[1], convertToBigInt(1), "changed values after iteration [1] == 1"); - assert.sameValue(sample[2], convertToBigInt(2), "changed values after iteration [2] == 2"); + assert.sameValue(sample[0], 7n, "changed values after iteration [0] == 7"); + assert.sameValue(sample[1], 1n, "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], 2n, "changed values after iteration [2] == 2"); }); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/every/BigInt/get-length-uses-internal-arraylength.js index af887bf1e..1dc89c06c 100644 --- a/test/built-ins/TypedArray/prototype/every/BigInt/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/every/BigInt/get-length-uses-internal-arraylength.js @@ -31,7 +31,7 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); var calls = 0; Object.defineProperty(TA.prototype, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/every/BigInt/values-are-not-cached.js index 5be553d1d..7eb35f741 100644 --- a/test/built-ins/TypedArray/prototype/every/BigInt/values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/every/BigInt/values-are-not-cached.js @@ -27,15 +27,15 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); sample.every(function(v, i) { if (i < sample.length - 1) { - sample[i+1] = convertToBigInt(42); + sample[i+1] = 42n; } assert.sameValue( - v, convertToBigInt(42), "method does not cache values before callbackfn calls" + v, 42n, "method does not cache values before callbackfn calls" ); return true; }); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js b/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js index 75bd12543..5467a89cd 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js @@ -33,72 +33,72 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { assert( - compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), undefined), convertToBigInt([1, 1])), + compareArray(new TA([0n, 0n]).fill(1n, undefined), [1n, 1n]), '`undefined` start coerced to 0' ); assert( - compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 0, undefined), convertToBigInt([1, 1])), + compareArray(new TA([0n, 0n]).fill(1n, 0, undefined), [1n, 1n]), 'If end is undefined, let relativeEnd be len' ); assert( - compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), null), convertToBigInt([1, 1])), + compareArray(new TA([0n, 0n]).fill(1n, null), [1n, 1n]), '`null` start coerced to 0' ); assert( - compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 0, null), convertToBigInt([0, 0])), + compareArray(new TA([0n, 0n]).fill(1n, 0, null), [0n, 0n]), '`null` end coerced to 0' ); assert( - compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), true), convertToBigInt([0, 1])), + compareArray(new TA([0n, 0n]).fill(1n, true), [0n, 1n]), '`true` start coerced to 1' ); assert( - compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 0, true), convertToBigInt([1, 0])), + compareArray(new TA([0n, 0n]).fill(1n, 0, true), [1n, 0n]), '`true` end coerced to 1' ); assert( - compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), false), convertToBigInt([1, 1])), + compareArray(new TA([0n, 0n]).fill(1n, false), [1n, 1n]), '`false` start coerced to 0' ); assert( - compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 0, false), convertToBigInt([0, 0])), + compareArray(new TA([0n, 0n]).fill(1n, 0, false), [0n, 0n]), '`false` end coerced to 0' ); assert( - compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), NaN), convertToBigInt([1, 1])), + compareArray(new TA([0n, 0n]).fill(1n, NaN), [1n, 1n]), '`NaN` start coerced to 0' ); assert( - compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 0, NaN), convertToBigInt([0, 0])), + compareArray(new TA([0n, 0n]).fill(1n, 0, NaN), [0n, 0n]), '`NaN` end coerced to 0' ); assert( - compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), '1'), convertToBigInt([0, 1])), + compareArray(new TA([0n, 0n]).fill(1n, '1'), [0n, 1n]), 'string start coerced' ); assert( - compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 0, '1'), convertToBigInt([1, 0])), + compareArray(new TA([0n, 0n]).fill(1n, 0, '1'), [1n, 0n]), 'string end coerced' ); assert( - compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 1.5), convertToBigInt([0, 1])), + compareArray(new TA([0n, 0n]).fill(1n, 1.5), [0n, 1n]), 'start as a float number coerced' ); assert( - compareArray(new TA(convertToBigInt([0, 0])).fill(convertToBigInt(1), 0, 1.5), convertToBigInt([1, 0])), + compareArray(new TA([0n, 0n]).fill(1n, 0, 1.5), [1n, 0n]), 'end as a float number coerced' ); }); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-once.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-once.js index f26998f76..2f8bfa008 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-once.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-once.js @@ -21,7 +21,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample.fill({ valueOf() { return convertToBigInt(n++); } }); assert.sameValue(n, 2, "additional unexpected ToNumber() calls"); - assert.sameValue(sample[0], convertToBigInt(1), "incorrect ToNumber result in index 0"); - assert.sameValue(sample[1], convertToBigInt(1), "incorrect ToNumber result in index 1"); + assert.sameValue(sample[0], 1n, "incorrect ToNumber result in index 0"); + assert.sameValue(sample[1], 1n, "incorrect ToNumber result in index 1"); }); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js index d429dc11e..a981ab00b 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js @@ -34,9 +34,9 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - assert(compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), 1, 2), convertToBigInt([0, 8, 0]))); - assert(compareArray(new TA(convertToBigInt([0, 0, 0, 0, 0])).fill(convertToBigInt(8), -3, 4), convertToBigInt([0, 0, 8, 8, 0]))); - assert(compareArray(new TA(convertToBigInt([0, 0, 0, 0, 0])).fill(convertToBigInt(8), -2, -1), convertToBigInt([0, 0, 0, 8, 0]))); - assert(compareArray(new TA(convertToBigInt([0, 0, 0, 0, 0])).fill(convertToBigInt(8), -1, -3), convertToBigInt([0, 0, 0, 0, 0]))); - assert(compareArray(new TA(convertToBigInt([0, 0, 0, 0, 0])).fill(convertToBigInt(8), 1, 3), convertToBigInt([0, 8, 8, 0, 0]))); + assert(compareArray(new TA([0n, 0n, 0n]).fill(8n, 1, 2), [0n, 8n, 0n])); + assert(compareArray(new TA([0n, 0n, 0n, 0n, 0n]).fill(8n, -3, 4), [0n, 0n, 8n, 8n, 0n])); + assert(compareArray(new TA([0n, 0n, 0n, 0n, 0n]).fill(8n, -2, -1), [0n, 0n, 0n, 8n, 0n])); + assert(compareArray(new TA([0n, 0n, 0n, 0n, 0n]).fill(8n, -1, -3), [0n, 0n, 0n, 0n, 0n])); + assert(compareArray(new TA([0n, 0n, 0n, 0n, 0n]).fill(8n, 1, 3), [0n, 8n, 8n, 0n, 0n])); }); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js index fdfa47987..4719ac67e 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js @@ -39,34 +39,34 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample; - sample = new TA(convertToBigInt([42])); + sample = new TA([42n]); sample.fill(false); - assert.sameValue(sample[0], convertToBigInt(0), "false => 0"); + assert.sameValue(sample[0], 0n, "false => 0"); - sample = new TA(convertToBigInt([42])); + sample = new TA([42n]); sample.fill(true); - assert.sameValue(sample[0], convertToBigInt(1), "true => 1"); + assert.sameValue(sample[0], 1n, "true => 1"); - sample = new TA(convertToBigInt([42])); + sample = new TA([42n]); sample.fill("7"); - assert.sameValue(sample[0], convertToBigInt(7), "string conversion"); + assert.sameValue(sample[0], 7n, "string conversion"); - sample = new TA(convertToBigInt([42])); + sample = new TA([42n]); sample.fill({ toString: function() { return "1"; }, valueOf: function() { - return convertToBigInt(7); + return 7n; } }); - assert.sameValue(sample[0], convertToBigInt(7), "object valueOf conversion before toString"); + assert.sameValue(sample[0], 7n, "object valueOf conversion before toString"); - sample = new TA(convertToBigInt([42])); + sample = new TA([42n]); sample.fill({ toString: function() { return "7"; } }); - assert.sameValue(sample[0], convertToBigInt(7), "object toString when valueOf is absent"); + assert.sameValue(sample[0], 7n, "object toString when valueOf is absent"); }); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js index 0f92f444b..a4cac9ffb 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js @@ -32,22 +32,22 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { assert( - compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), 0, 1), convertToBigInt([8, 0, 0])), + compareArray(new TA([0n, 0n, 0n]).fill(8n, 0, 1), [8n, 0n, 0n]), "Fill elements from custom end position" ); assert( - compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), 0, -1), convertToBigInt([8, 8, 0])), + compareArray(new TA([0n, 0n, 0n]).fill(8n, 0, -1), [8n, 8n, 0n]), "negative end sets final position to max((length + relativeEnd), 0)" ); assert( - compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), 0, 5), convertToBigInt([8, 8, 8])), + compareArray(new TA([0n, 0n, 0n]).fill(8n, 0, 5), [8n, 8n, 8n]), "end position is never higher than of length" ); assert( - compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), 0, -4), convertToBigInt([0, 0, 0])), + compareArray(new TA([0n, 0n, 0n]).fill(8n, 0, -4), [0n, 0n, 0n]), "end position is 0 when (len + relativeEnd) < 0" ); }); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js index 0d6b6f397..790d1a5f2 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-start.js @@ -30,22 +30,22 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { assert( - compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), 1), convertToBigInt([0, 8, 8])), + compareArray(new TA([0n, 0n, 0n]).fill(8n, 1), [0n, 8n, 8n]), "Fill elements from custom start position" ); assert( - compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), 4), convertToBigInt([0, 0, 0])), + compareArray(new TA([0n, 0n, 0n]).fill(8n, 4), [0n, 0n, 0n]), "start position is never higher than length" ); assert( - compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), -1), convertToBigInt([0, 0, 8])), + compareArray(new TA([0n, 0n, 0n]).fill(8n, -1), [0n, 0n, 8n]), "start < 0 sets initial position to max((len + relativeStart), 0)" ); assert( - compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8), -5), convertToBigInt([8, 8, 8])), + compareArray(new TA([0n, 0n, 0n]).fill(8n, -5), [8n, 8n, 8n]), "start position is 0 when (len + relativeStart) < 0" ); }); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js index a9c337df9..ec390d28b 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js @@ -31,14 +31,14 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { assert( compareArray( - new TA().fill(convertToBigInt(8)), + new TA().fill(8n), [] ), "does not fill an empty instance" ); assert( - compareArray(new TA(convertToBigInt([0, 0, 0])).fill(convertToBigInt(8)), convertToBigInt([8, 8, 8])), + compareArray(new TA([0n, 0n, 0n]).fill(8n), [8n, 8n, 8n]), "Default start and end indexes are 0 and this.length" ); }); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/fill/BigInt/get-length-ignores-length-prop.js index 5aa9a3a82..ec7637bc5 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/get-length-ignores-length-prop.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/get-length-ignores-length-prop.js @@ -47,5 +47,5 @@ testWithBigIntTypedArrayConstructors(function(TA) { } }); - assert.sameValue(sample.fill(convertToBigInt(1), 0), sample); + assert.sameValue(sample.fill(1n, 0), sample); }); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end.js index a97eebf74..9dd7dd553 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end.js @@ -37,6 +37,6 @@ var end = { testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA(); assert.throws(Test262Error, function() { - sample.fill(convertToBigInt(1), 0, end); + sample.fill(1n, 0, end); }); }); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js index a1c8b8bbf..c30cbf097 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js @@ -37,7 +37,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42])); + var sample = new TA([42n]); var obj = { valueOf: function() { throw new Test262Error(); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start.js index 8003e7e91..c5731f2f5 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start.js @@ -36,6 +36,6 @@ var start = { testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA(); assert.throws(Test262Error, function() { - sample.fill(convertToBigInt(1), start); + sample.fill(1n, start); }); }); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-this.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-this.js index 20697ddc3..83895854f 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/return-this.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-this.js @@ -10,11 +10,11 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample1 = new TA(); - var result1 = sample1.fill(convertToBigInt(1)); + var result1 = sample1.fill(1n); assert.sameValue(result1, sample1); var sample2 = new TA(42); - var result2 = sample2.fill(convertToBigInt(7)); + var result2 = sample2.fill(7n); assert.sameValue(result2, sample2); }); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-with-thisarg.js index d0d796be5..2d32a8a78 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-with-thisarg.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-with-thisarg.js @@ -17,7 +17,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); var results = []; var thisArg = ["test262", 0, "ecma262", 0]; @@ -30,17 +30,17 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(thisArg.length, 4, "thisArg.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue"); + assert.sameValue(results[0][0], 42n, "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue"); + assert.sameValue(results[1][0], 43n, "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue"); + assert.sameValue(results[2][0], 44n, "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-without-thisarg.js index ca3e078d2..5c9d91b6d 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-without-thisarg.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-arguments-without-thisarg.js @@ -17,7 +17,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); var results = []; @@ -28,17 +28,17 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(results.length, 3, "results.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue"); + assert.sameValue(results[0][0], 42n, "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue"); + assert.sameValue(results[1][0], 43n, "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue"); + assert.sameValue(results[2][0], 44n, "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-no-iteration-over-non-integer.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-no-iteration-over-non-integer.js index b980efe72..2162cbe16 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-no-iteration-over-non-integer.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-no-iteration-over-non-integer.js @@ -17,7 +17,7 @@ features: [BigInt, Symbol, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([7, 8])); + var sample = new TA([7n, 8n]); var results = []; @@ -33,6 +33,6 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); - assert.sameValue(results[0][0], convertToBigInt(7), "results[0][0] - kValue"); - assert.sameValue(results[1][0], convertToBigInt(8), "results[1][0] - kValue"); + assert.sameValue(results[0][0], 7n, "results[0][0] - kValue"); + assert.sameValue(results[1][0], 8n, "results[1][0] - kValue"); }); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-return-does-not-change-instance.js index 4bac77886..4ace9cecc 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-return-does-not-change-instance.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-return-does-not-change-instance.js @@ -11,13 +11,13 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample1 = new TA(3); - sample1[1] = convertToBigInt(1); + sample1[1] = 1n; sample1.filter(function() { return 42; }); - assert.sameValue(sample1[0], convertToBigInt(0), "[0] == 0"); - assert.sameValue(sample1[1], convertToBigInt(1), "[1] == 1"); - assert.sameValue(sample1[2], convertToBigInt(0), "[2] == 0"); + assert.sameValue(sample1[0], 0n, "[0] == 0"); + assert.sameValue(sample1[1], 1n, "[1] == 1"); + assert.sameValue(sample1[2], 0n, "[2] == 0"); }); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-set-value-during-iteration.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-set-value-during-iteration.js index a4e86b427..c8435afa6 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-set-value-during-iteration.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-set-value-during-iteration.js @@ -17,7 +17,7 @@ features: [BigInt, Reflect.set, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); var newVal = 0; sample.filter(function(val, i) { @@ -27,7 +27,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { "get the changed value during the loop" ); assert.sameValue( - Reflect.set(sample, 0, convertToBigInt(7)), + Reflect.set(sample, 0, 7n), true, "re-set a value for sample[0]" ); @@ -41,7 +41,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { newVal++; }); - assert.sameValue(sample[0], convertToBigInt(7), "changed values after interaction [0] == 7"); - assert.sameValue(sample[1], convertToBigInt(1), "changed values after interaction [1] == 1"); - assert.sameValue(sample[2], convertToBigInt(2), "changed values after interaction [2] == 2"); + assert.sameValue(sample[0], 7n, "changed values after interaction [0] == 7"); + assert.sameValue(sample[1], 1n, "changed values after interaction [1] == 1"); + assert.sameValue(sample[2], 2n, "changed values after interaction [2] == 2"); }); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/result-does-not-share-buffer.js b/test/built-ins/TypedArray/prototype/filter/BigInt/result-does-not-share-buffer.js index 1a84196dc..70c11fca3 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/result-does-not-share-buffer.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/result-does-not-share-buffer.js @@ -16,7 +16,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42])); + var sample = new TA([40n, 41n, 42n]); var result; result = sample.filter(function() { return true; }); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/result-full-callbackfn-returns-true.js b/test/built-ins/TypedArray/prototype/filter/BigInt/result-full-callbackfn-returns-true.js index d63ba8691..b539ca2ec 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/result-full-callbackfn-returns-true.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/result-full-callbackfn-returns-true.js @@ -17,7 +17,7 @@ features: [BigInt, Symbol, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42])); + var sample = new TA([40n, 41n, 42n]); [ true, diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-abrupt.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-abrupt.js index 9b7bc9dfc..ea71fee89 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-abrupt.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-abrupt.js @@ -27,7 +27,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); Object.defineProperty(sample, "constructor", { get: function() { diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-inherited.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-inherited.js index 35fe965b0..7de9e3d69 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-inherited.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-inherited.js @@ -27,7 +27,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); var calls = 0; var result; diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-returns-throws.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-returns-throws.js index 79e40b47c..52fb99998 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-returns-throws.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor-returns-throws.js @@ -31,7 +31,7 @@ features: [BigInt, Symbol, TypedArray] var callbackfn = function() { return true; }; testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); sample.constructor = 42; assert.throws(TypeError, function() { diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor.js index 0b64ac3ca..2fa985b26 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-ctor.js @@ -27,7 +27,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); var calls = 0; var result; diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-invocation.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-invocation.js index 1efefe1be..5b3f2af2b 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-invocation.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-invocation.js @@ -37,7 +37,7 @@ features: [BigInt, Symbol.species, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 42, 42])); + var sample = new TA([40n, 42n, 42n]); var result, ctorThis; sample.constructor = {}; @@ -47,7 +47,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { return new TA(count); }; - sample.filter(function(v) { return v === convertToBigInt(42); }); + sample.filter(function(v) { return v === 42n; }); assert.sameValue(result.length, 1, "called with 1 argument"); assert.sameValue(result[0], 2, "[0] is the new captured length"); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js index 31f2887b3..8ad970667 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js @@ -37,7 +37,7 @@ features: [BigInt, Symbol.species, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40])); + var sample = new TA([40n]); var otherTA = TA === Int8Array ? Int16Array : Int8Array; var other = new otherTA([1, 0, 1]); var result; diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor.js b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor.js index f881f792d..4e4da9bee 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/speciesctor-get-species-custom-ctor.js @@ -37,7 +37,7 @@ features: [BigInt, Symbol.species, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42])); + var sample = new TA([40n, 41n, 42n]); var calls = 0; var other, result; @@ -52,5 +52,5 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(calls, 1, "ctor called once"); assert.sameValue(result, other, "return is instance of custom constructor"); - assert(compareArray(result, convertToBigInt([40, 41, 42])), "values are set on the new obj"); + assert(compareArray(result, [40n, 41n, 42n]), "values are set on the new obj"); }); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-not-cached.js index 25b7eb24a..d2a982a31 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-not-cached.js @@ -17,15 +17,15 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); sample.filter(function(v, i) { if (i < sample.length - 1) { - sample[i+1] = convertToBigInt(42); + sample[i+1] = 42n; } assert.sameValue( - v, convertToBigInt(42), "method does not cache values before callbackfn calls" + v, 42n, "method does not cache values before callbackfn calls" ); }); }); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-set.js b/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-set.js index b7f2775f2..49c65cacf 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-set.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-set.js @@ -17,14 +17,14 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([41, 1, 42, 7])); + var sample = new TA([41n, 1n, 42n, 7n]); var result; result = sample.filter(function() { return true; }); - assert(compareArray(result, convertToBigInt([41, 1, 42, 7])), "values are set #1"); + assert(compareArray(result, [41n, 1n, 42n, 7n]), "values are set #1"); result = sample.filter(function(v) { - return v > convertToBigInt(40); + return v > 40n; }); - assert(compareArray(result, convertToBigInt([41, 42])), "values are set #2"); + assert(compareArray(result, [41n, 42n]), "values are set #2"); }); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/find/BigInt/get-length-ignores-length-prop.js index aa522e378..ebdbdf05e 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/get-length-ignores-length-prop.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/get-length-ignores-length-prop.js @@ -38,7 +38,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { } }); - var sample = new TA(convertToBigInt([42])); + var sample = new TA([42n]); Object.defineProperty(sample, "length", { get: function() { @@ -49,6 +49,6 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue( sample.find(function() { return true; }), - convertToBigInt(42) + 42n ); }); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js index 4fd9ec6f1..86be70f05 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-changes-value.js @@ -30,7 +30,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var arr = convertToBigInt([1, 2, 3]); + var arr = [1n, 2n, 3n]; var sample; var result; @@ -38,41 +38,41 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample.find(function(val, i) { sample[i] = arr[i]; - assert.sameValue(val, convertToBigInt(0), "value is not mapped to instance"); + assert.sameValue(val, 0n, "value is not mapped to instance"); }); assert(compareArray(sample, arr), "values set during each predicate call"); sample = new TA(arr); result = sample.find(function(val, i) { if ( i === 0 ) { - sample[2] = convertToBigInt(7); + sample[2] = 7n; } - return val === convertToBigInt(7); + return val === 7n; }); - assert.sameValue(result, convertToBigInt(7), "value found"); + assert.sameValue(result, 7n, "value found"); sample = new TA(arr); result = sample.find(function(val, i) { if ( i === 0 ) { - sample[2] = convertToBigInt(7); + sample[2] = 7n; } - return val === convertToBigInt(3); + return val === 3n; }); assert.sameValue(result, undefined, "value not found"); sample = new TA(arr); result = sample.find(function(val, i) { if ( i > 0 ) { - sample[0] = convertToBigInt(7); + sample[0] = 7n; } - return val === convertToBigInt(7); + return val === 7n; }); assert.sameValue(result, undefined, "value not found - changed after call"); sample = new TA(arr); result = sample.find(function() { - sample[0] = convertToBigInt(7); + sample[0] = 7n; return true; }); - assert.sameValue(result, convertToBigInt(1), "find() returns previous found value"); + assert.sameValue(result, 1n, "find() returns previous found value"); }); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-parameters.js b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-parameters.js index fb1741af5..8fc8c558b 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-parameters.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/predicate-call-parameters.js @@ -30,7 +30,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([39, 2, 62])); + var sample = new TA([39n, 2n, 62n]); var results = []; var result; @@ -43,19 +43,19 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(results.length, 3, "predicate is called for each index"); result = results[0]; - assert.sameValue(result[0], convertToBigInt(39), "results[0][0] === 39, value"); + assert.sameValue(result[0], 39n, "results[0][0] === 39, value"); assert.sameValue(result[1], 0, "results[0][1] === 0, index"); assert.sameValue(result[2], sample, "results[0][2] === sample, instance"); assert.sameValue(result.length, 3, "results[0].length === 3 arguments"); result = results[1]; - assert.sameValue(result[0], convertToBigInt(2), "results[1][0] === 2, value"); + assert.sameValue(result[0], 2n, "results[1][0] === 2, value"); assert.sameValue(result[1], 1, "results[1][1] === 1, index"); assert.sameValue(result[2], sample, "results[1][2] === sample, instance"); assert.sameValue(result.length, 3, "results[1].length === 3 arguments"); result = results[2]; - assert.sameValue(result[0], convertToBigInt(62), "results[2][0] === 62, value"); + assert.sameValue(result[0], 62n, "results[2][0] === 62, value"); assert.sameValue(result[1], 2, "results[2][1] === 2, index"); assert.sameValue(result[2], sample, "results[2][2] === sample, instance"); assert.sameValue(result.length, 3, "results[2].length === 3 arguments"); diff --git a/test/built-ins/TypedArray/prototype/find/BigInt/return-found-value-predicate-result-is-true.js b/test/built-ins/TypedArray/prototype/find/BigInt/return-found-value-predicate-result-is-true.js index c4469ae2e..32ea9abd1 100644 --- a/test/built-ins/TypedArray/prototype/find/BigInt/return-found-value-predicate-result-is-true.js +++ b/test/built-ins/TypedArray/prototype/find/BigInt/return-found-value-predicate-result-is-true.js @@ -29,7 +29,7 @@ features: [BigInt, Symbol, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([39, 2, 62])); + var sample = new TA([39n, 2n, 62n]); var called, result; called = 0; @@ -37,29 +37,29 @@ testWithBigIntTypedArrayConstructors(function(TA) { called++; return true; }); - assert.sameValue(result, convertToBigInt(39), "returned true on sample[0]"); + assert.sameValue(result, 39n, "returned true on sample[0]"); assert.sameValue(called, 1, "predicate was called once"); called = 0; result = sample.find(function(val) { called++; - return val === convertToBigInt(62); + return val === 62n; }); assert.sameValue(called, 3, "predicate was called three times"); - assert.sameValue(result, convertToBigInt(62), "returned true on sample[3]"); + assert.sameValue(result, 62n, "returned true on sample[3]"); result = sample.find(function() { return "string"; }); - assert.sameValue(result, convertToBigInt(39), "ToBoolean(string)"); + assert.sameValue(result, 39n, "ToBoolean(string)"); result = sample.find(function() { return {}; }); - assert.sameValue(result, convertToBigInt(39), "ToBoolean(object)"); + assert.sameValue(result, 39n, "ToBoolean(object)"); result = sample.find(function() { return Symbol(""); }); - assert.sameValue(result, convertToBigInt(39), "ToBoolean(symbol)"); + assert.sameValue(result, 39n, "ToBoolean(symbol)"); result = sample.find(function() { return 1; }); - assert.sameValue(result, convertToBigInt(39), "ToBoolean(number)"); + assert.sameValue(result, 39n, "ToBoolean(number)"); result = sample.find(function() { return -1; }); - assert.sameValue(result, convertToBigInt(39), "ToBoolean(negative number)"); + assert.sameValue(result, 39n, "ToBoolean(negative number)"); }); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/get-length-ignores-length-prop.js index 47ea12773..d4287dfbd 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/get-length-ignores-length-prop.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/get-length-ignores-length-prop.js @@ -36,7 +36,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { } }); - var sample = new TA(convertToBigInt([42])); + var sample = new TA([42n]); Object.defineProperty(sample, "length", { get: function() { diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js index d20b670eb..2fa760323 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-changes-value.js @@ -26,7 +26,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var arr = convertToBigInt([10, 20, 30]); + var arr = [10n, 20n, 30n]; var sample; var result; @@ -34,34 +34,34 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample.findIndex(function(val, i) { sample[i] = arr[i]; - assert.sameValue(val, convertToBigInt(0), "value is not mapped to instance"); + assert.sameValue(val, 0n, "value is not mapped to instance"); }); assert(compareArray(sample, arr), "values set during each predicate call"); sample = new TA(arr); result = sample.findIndex(function(val, i) { if ( i === 0 ) { - sample[2] = convertToBigInt(7); + sample[2] = 7n; } - return val === convertToBigInt(7); + return val === 7n; }); assert.sameValue(result, 2, "value found"); sample = new TA(arr); result = sample.findIndex(function(val, i) { if ( i === 0 ) { - sample[2] = convertToBigInt(7); + sample[2] = 7n; } - return val === convertToBigInt(30); + return val === 30n; }); assert.sameValue(result, -1, "value not found"); sample = new TA(arr); result = sample.findIndex(function(val, i) { if ( i > 0 ) { - sample[0] = convertToBigInt(7); + sample[0] = 7n; } - return val === convertToBigInt(7); + return val === 7n; }); assert.sameValue(result, -1, "value not found - changed after call"); }); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-parameters.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-parameters.js index eb73cd7e1..1025bbb24 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-parameters.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/predicate-call-parameters.js @@ -28,7 +28,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([39, 2, 62])); + var sample = new TA([39n, 2n, 62n]); var results = []; var result; @@ -41,19 +41,19 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(results.length, 3, "predicate is called for each index"); result = results[0]; - assert.sameValue(result[0], convertToBigInt(39), "results[0][0] === 39, value"); + assert.sameValue(result[0], 39n, "results[0][0] === 39, value"); assert.sameValue(result[1], 0, "results[0][1] === 0, index"); assert.sameValue(result[2], sample, "results[0][2] === sample, instance"); assert.sameValue(result.length, 3, "results[0].length === 3, arguments"); result = results[1]; - assert.sameValue(result[0], convertToBigInt(2), "results[1][0] === 2, value"); + assert.sameValue(result[0], 2n, "results[1][0] === 2, value"); assert.sameValue(result[1], 1, "results[1][1] === 1, index"); assert.sameValue(result[2], sample, "results[1][2] === sample, instance"); assert.sameValue(result.length, 3, "results[1].length === 3, arguments"); result = results[2]; - assert.sameValue(result[0], convertToBigInt(62), "results[2][0] === 62, value"); + assert.sameValue(result[0], 62n, "results[2][0] === 62, value"); assert.sameValue(result[1], 2, "results[2][1] === 2, index"); assert.sameValue(result[2], sample, "results[2][2] === sample, instance"); assert.sameValue(result.length, 3, "results[2].length === 3, arguments"); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-index-predicate-result-is-true.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-index-predicate-result-is-true.js index f19c09910..25e26d808 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-index-predicate-result-is-true.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-index-predicate-result-is-true.js @@ -28,7 +28,7 @@ features: [BigInt, Symbol, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([39, 3, 9])); + var sample = new TA([39n, 3n, 9n]); var called = 0; var result = sample.findIndex(function() { @@ -42,7 +42,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { called = 0; result = sample.findIndex(function(val) { called++; - return val === convertToBigInt(9); + return val === 9n; }); assert.sameValue(called, 3, "predicate was called three times"); diff --git a/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-negative-one-if-predicate-returns-false-value.js b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-negative-one-if-predicate-returns-false-value.js index 933985462..fcf5d800c 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-negative-one-if-predicate-returns-false-value.js +++ b/test/built-ins/TypedArray/prototype/findIndex/BigInt/return-negative-one-if-predicate-returns-false-value.js @@ -27,7 +27,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([1, 2, 3])); + var sample = new TA([1n, 2n, 3n]); var called = 0; var result = sample.findIndex(function() { diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-with-thisarg.js index ada379de2..07478cadf 100644 --- a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-with-thisarg.js +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-with-thisarg.js @@ -26,7 +26,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); var results = []; var thisArg = ["test262", 0, "ecma262", 0]; @@ -39,17 +39,17 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(thisArg.length, 4, "thisArg.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue"); + assert.sameValue(results[0][0], 42n, "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue"); + assert.sameValue(results[1][0], 43n, "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue"); + assert.sameValue(results[2][0], 44n, "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-without-thisarg.js index 81011139e..6b6bdec5c 100644 --- a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-without-thisarg.js +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-arguments-without-thisarg.js @@ -26,7 +26,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); var results = []; @@ -37,17 +37,17 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(results.length, 3, "results.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue"); + assert.sameValue(results[0][0], 42n, "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue"); + assert.sameValue(results[1][0], 43n, "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue"); + assert.sameValue(results[2][0], 44n, "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-no-interaction-over-non-integer.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-no-interaction-over-non-integer.js index 95c7e4b37..9edd63e09 100644 --- a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-no-interaction-over-non-integer.js +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-no-interaction-over-non-integer.js @@ -20,7 +20,7 @@ features: [BigInt, Symbol, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([7, 8])); + var sample = new TA([7n, 8n]); var results = []; @@ -36,6 +36,6 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); - assert.sameValue(results[0][0], convertToBigInt(7), "results[0][0] - kValue"); - assert.sameValue(results[1][0], convertToBigInt(8), "results[1][0] - kValue"); + assert.sameValue(results[0][0], 7n, "results[0][0] - kValue"); + assert.sameValue(results[1][0], 8n, "results[1][0] - kValue"); }); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-return-does-not-change-instance.js index 82da435a1..341a7decd 100644 --- a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-return-does-not-change-instance.js +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-return-does-not-change-instance.js @@ -18,13 +18,13 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample1 = new TA(3); - sample1[1] = convertToBigInt(1); + sample1[1] = 1n; sample1.forEach(function() { return 42; }); - assert.sameValue(sample1[0], convertToBigInt(0), "[0] == 0"); - assert.sameValue(sample1[1], convertToBigInt(1), "[1] == 1"); - assert.sameValue(sample1[2], convertToBigInt(0), "[2] == 0"); + assert.sameValue(sample1[0], 0n, "[0] == 0"); + assert.sameValue(sample1[1], 1n, "[1] == 1"); + assert.sameValue(sample1[2], 0n, "[2] == 0"); }); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-set-value-during-interaction.js index 2b2865b4c..9d7acf91b 100644 --- a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-set-value-during-interaction.js +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-set-value-during-interaction.js @@ -17,7 +17,7 @@ features: [BigInt, Reflect.set, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); var newVal = 0; sample.forEach(function(val, i) { @@ -27,7 +27,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { "get the changed value during the loop" ); assert.sameValue( - Reflect.set(sample, 0, convertToBigInt(7)), + Reflect.set(sample, 0, 7n), true, "re-set a value for sample[0]" ); @@ -41,7 +41,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { newVal++; }); - assert.sameValue(sample[0], convertToBigInt(7), "changed values after iteration [0] == 7"); - assert.sameValue(sample[1], convertToBigInt(1), "changed values after iteration [1] == 1"); - assert.sameValue(sample[2], convertToBigInt(2), "changed values after iteration [2] == 2"); + assert.sameValue(sample[0], 7n, "changed values after iteration [0] == 7"); + assert.sameValue(sample[1], 1n, "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], 2n, "changed values after iteration [2] == 2"); }); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/values-are-not-cached.js index d937cf44f..1fcc724f8 100644 --- a/test/built-ins/TypedArray/prototype/forEach/BigInt/values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/values-are-not-cached.js @@ -17,15 +17,15 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); sample.forEach(function(v, i) { if (i < sample.length - 1) { - sample[i+1] = convertToBigInt(42); + sample[i+1] = 42n; } assert.sameValue( - v, convertToBigInt(42), "method does not cache values before callbackfn calls" + v, 42n, "method does not cache values before callbackfn calls" ); }); }); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-infinity.js b/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-infinity.js index 0d44d7a65..56dd73515 100644 --- a/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-infinity.js +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-infinity.js @@ -30,15 +30,15 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 43, 41])); + var sample = new TA([42n, 43n, 43n, 41n]); assert.sameValue( - sample.includes(convertToBigInt(43), Infinity), + sample.includes(43n, Infinity), false, "includes(43, Infinity)" ); assert.sameValue( - sample.includes(convertToBigInt(43), -Infinity), + sample.includes(43n, -Infinity), true, "includes(43, -Infinity)"); }); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-minus-zero.js b/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-minus-zero.js index 285a7c316..83ee261a7 100644 --- a/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-minus-zero.js +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/fromIndex-minus-zero.js @@ -27,8 +27,8 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample; - sample = new TA(convertToBigInt([42, 43])); - assert.sameValue(sample.includes(convertToBigInt(42), -0), true, "-0 [0]"); - assert.sameValue(sample.includes(convertToBigInt(43), -0), true, "-0 [1]"); - assert.sameValue(sample.includes(convertToBigInt(44), -0), false, "-0 [2]"); + sample = new TA([42n, 43n]); + assert.sameValue(sample.includes(42n, -0), true, "-0 [0]"); + assert.sameValue(sample.includes(43n, -0), true, "-0 [1]"); + assert.sameValue(sample.includes(44n, -0), false, "-0 [2]"); }); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/includes/BigInt/get-length-uses-internal-arraylength.js index 85ab71b09..2117ea212 100644 --- a/test/built-ins/TypedArray/prototype/includes/BigInt/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/get-length-uses-internal-arraylength.js @@ -24,10 +24,10 @@ features: [BigInt, TypedArray] Object.defineProperty(TypedArray.prototype, "length", {value: 0}); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([7])); + var sample = new TA([7n]); Object.defineProperty(TA.prototype, "length", {value: 0}); Object.defineProperty(sample, "length", {value: 0}); - assert.sameValue(sample.includes(convertToBigInt(7)), true); + assert.sameValue(sample.includes(7n), true); }); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex-symbol.js b/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex-symbol.js index 33c8861ab..0625bfbcf 100644 --- a/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex-symbol.js +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex-symbol.js @@ -25,9 +25,9 @@ features: [BigInt, Symbol, TypedArray] var fromIndex = Symbol("1"); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([7])); + var sample = new TA([7n]); assert.throws(TypeError, function() { - sample.includes(convertToBigInt(7), fromIndex); + sample.includes(7n, fromIndex); }); }); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex.js index 6ddcb1f70..1013df57e 100644 --- a/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex.js +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-tointeger-fromindex.js @@ -29,9 +29,9 @@ var fromIndex = { }; testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([7])); + var sample = new TA([7n]); assert.throws(Test262Error, function() { - sample.includes(convertToBigInt(7), fromIndex); + sample.includes(7n, fromIndex); }); }); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/search-found-returns-true.js b/test/built-ins/TypedArray/prototype/includes/BigInt/search-found-returns-true.js index f11212ce4..3d1140a0a 100644 --- a/test/built-ins/TypedArray/prototype/includes/BigInt/search-found-returns-true.js +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/search-found-returns-true.js @@ -30,15 +30,15 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 42, 41])); - assert.sameValue(sample.includes(convertToBigInt(42)), true, "includes(42)"); - assert.sameValue(sample.includes(convertToBigInt(43)), true, "includes(43)"); - assert.sameValue(sample.includes(convertToBigInt(43), 1), true, "includes(43, 1)"); - assert.sameValue(sample.includes(convertToBigInt(42), 1), true, "includes(42, 1)"); - assert.sameValue(sample.includes(convertToBigInt(42), 2), true, "includes(42, 2)"); + var sample = new TA([42n, 43n, 42n, 41n]); + assert.sameValue(sample.includes(42n), true, "includes(42)"); + assert.sameValue(sample.includes(43n), true, "includes(43)"); + assert.sameValue(sample.includes(43n, 1), true, "includes(43, 1)"); + assert.sameValue(sample.includes(42n, 1), true, "includes(42, 1)"); + assert.sameValue(sample.includes(42n, 2), true, "includes(42, 2)"); - assert.sameValue(sample.includes(convertToBigInt(42), -4), true, "includes(42, -4)"); - assert.sameValue(sample.includes(convertToBigInt(42), -3), true, "includes(42, -3)"); - assert.sameValue(sample.includes(convertToBigInt(42), -2), true, "includes(42, -2)"); - assert.sameValue(sample.includes(convertToBigInt(42), -5), true, "includes(42, -5)"); + assert.sameValue(sample.includes(42n, -4), true, "includes(42, -4)"); + assert.sameValue(sample.includes(42n, -3), true, "includes(42, -3)"); + assert.sameValue(sample.includes(42n, -2), true, "includes(42, -2)"); + assert.sameValue(sample.includes(42n, -5), true, "includes(42, -5)"); }); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/search-not-found-returns-false.js b/test/built-ins/TypedArray/prototype/includes/BigInt/search-not-found-returns-false.js index 5bf3b9086..9d4673e8c 100644 --- a/test/built-ins/TypedArray/prototype/includes/BigInt/search-not-found-returns-false.js +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/search-not-found-returns-false.js @@ -32,11 +32,11 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample; - sample = new TA(convertToBigInt([42, 43, 42, 41])); - assert.sameValue(sample.includes(convertToBigInt(44)), false, "includes(44)"); - assert.sameValue(sample.includes(convertToBigInt(43), 2), false, "includes(43, 2)"); - assert.sameValue(sample.includes(convertToBigInt(42), 3), false, "includes(42, 3)"); - assert.sameValue(sample.includes(convertToBigInt(44), -4), false, "includes(44, -4)"); - assert.sameValue(sample.includes(convertToBigInt(44), -5), false, "includes(44, -5)"); - assert.sameValue(sample.includes(convertToBigInt(42), -1), false, "includes(42, -1)"); + sample = new TA([42n, 43n, 42n, 41n]); + assert.sameValue(sample.includes(44n), false, "includes(44)"); + assert.sameValue(sample.includes(43n, 2), false, "includes(43, 2)"); + assert.sameValue(sample.includes(42n, 3), false, "includes(42, 3)"); + assert.sameValue(sample.includes(44n, -4), false, "includes(44, -4)"); + assert.sameValue(sample.includes(44n, -5), false, "includes(44, -5)"); + assert.sameValue(sample.includes(42n, -1), false, "includes(42, -1)"); }); diff --git a/test/built-ins/TypedArray/prototype/includes/BigInt/tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/includes/BigInt/tointeger-fromindex.js index 67fbd38da..4c5872be6 100644 --- a/test/built-ins/TypedArray/prototype/includes/BigInt/tointeger-fromindex.js +++ b/test/built-ins/TypedArray/prototype/includes/BigInt/tointeger-fromindex.js @@ -38,28 +38,28 @@ var obj = { testWithBigIntTypedArrayConstructors(function(TA) { var sample; - sample = new TA(convertToBigInt([42, 43])); - assert.sameValue(sample.includes(convertToBigInt(42), "1"), false, "string [0]"); - assert.sameValue(sample.includes(convertToBigInt(43), "1"), true, "string [1]"); + sample = new TA([42n, 43n]); + assert.sameValue(sample.includes(42n, "1"), false, "string [0]"); + assert.sameValue(sample.includes(43n, "1"), true, "string [1]"); - assert.sameValue(sample.includes(convertToBigInt(42), true), false, "true [0]"); - assert.sameValue(sample.includes(convertToBigInt(43), true), true, "true [1]"); + assert.sameValue(sample.includes(42n, true), false, "true [0]"); + assert.sameValue(sample.includes(43n, true), true, "true [1]"); - assert.sameValue(sample.includes(convertToBigInt(42), false), true, "false [0]"); - assert.sameValue(sample.includes(convertToBigInt(43), false), true, "false [1]"); + assert.sameValue(sample.includes(42n, false), true, "false [0]"); + assert.sameValue(sample.includes(43n, false), true, "false [1]"); - assert.sameValue(sample.includes(convertToBigInt(42), NaN), true, "NaN [0]"); - assert.sameValue(sample.includes(convertToBigInt(43), NaN), true, "NaN [1]"); + assert.sameValue(sample.includes(42n, NaN), true, "NaN [0]"); + assert.sameValue(sample.includes(43n, NaN), true, "NaN [1]"); - assert.sameValue(sample.includes(convertToBigInt(42), null), true, "null [0]"); - assert.sameValue(sample.includes(convertToBigInt(43), null), true, "null [1]"); + assert.sameValue(sample.includes(42n, null), true, "null [0]"); + assert.sameValue(sample.includes(43n, null), true, "null [1]"); - assert.sameValue(sample.includes(convertToBigInt(42), undefined), true, "undefined [0]"); - assert.sameValue(sample.includes(convertToBigInt(43), undefined), true, "undefined [1]"); + assert.sameValue(sample.includes(42n, undefined), true, "undefined [0]"); + assert.sameValue(sample.includes(43n, undefined), true, "undefined [1]"); - assert.sameValue(sample.includes(convertToBigInt(42), null), true, "null [0]"); - assert.sameValue(sample.includes(convertToBigInt(43), null), true, "null [1]"); + assert.sameValue(sample.includes(42n, null), true, "null [0]"); + assert.sameValue(sample.includes(43n, null), true, "null [1]"); - assert.sameValue(sample.includes(convertToBigInt(42), obj), false, "object [0]"); - assert.sameValue(sample.includes(convertToBigInt(43), obj), true, "object [1]"); + assert.sameValue(sample.includes(42n, obj), false, "object [0]"); + assert.sameValue(sample.includes(43n, obj), true, "object [1]"); }); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-infinity.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-infinity.js index 38a6515cf..07bcd38a4 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-infinity.js +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-infinity.js @@ -32,8 +32,8 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 43, 41])); + var sample = new TA([42n, 43n, 43n, 41n]); - assert.sameValue(sample.indexOf(convertToBigInt(43), Infinity), -1, "indexOf(43, Infinity)"); - assert.sameValue(sample.indexOf(convertToBigInt(43), -Infinity), 1, "indexOf(43, -Infinity)"); + assert.sameValue(sample.indexOf(43n, Infinity), -1, "indexOf(43, Infinity)"); + assert.sameValue(sample.indexOf(43n, -Infinity), 1, "indexOf(43, -Infinity)"); }); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-minus-zero.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-minus-zero.js index bd141027d..90dc45150 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-minus-zero.js +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/fromIndex-minus-zero.js @@ -24,7 +24,7 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample; - sample = new TA(convertToBigInt([42, 43])); - assert.sameValue(sample.indexOf(convertToBigInt(42), -0), 0, "-0 [0]"); - assert.sameValue(sample.indexOf(convertToBigInt(43), -0), 1, "-0 [1]"); + sample = new TA([42n, 43n]); + assert.sameValue(sample.indexOf(42n, -0), 0, "-0 [0]"); + assert.sameValue(sample.indexOf(43n, -0), 1, "-0 [1]"); }); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/get-length-uses-internal-arraylength.js index 61a961bd4..9c386b222 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/BigInt/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/get-length-uses-internal-arraylength.js @@ -23,10 +23,10 @@ features: [BigInt, TypedArray] Object.defineProperty(TypedArray.prototype, "length", {value: 0}); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([7])); + var sample = new TA([7n]); Object.defineProperty(TA.prototype, "length", {value: 0}); Object.defineProperty(sample, "length", {value: 0}); - assert.sameValue(sample.indexOf(convertToBigInt(7)), 0); + assert.sameValue(sample.indexOf(7n), 0); }); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/search-found-returns-index.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/search-found-returns-index.js index e932c2689..484e16f5c 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/BigInt/search-found-returns-index.js +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/search-found-returns-index.js @@ -32,15 +32,15 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 42, 41])); - assert.sameValue(sample.indexOf(convertToBigInt(42)), 0, "indexOf(42)"); - assert.sameValue(sample.indexOf(convertToBigInt(43)), 1, "indexOf(43)"); - assert.sameValue(sample.indexOf(convertToBigInt(43), 1), 1, "indexOf(43, 1)"); - assert.sameValue(sample.indexOf(convertToBigInt(42), 1), 2, "indexOf(42, 1)"); - assert.sameValue(sample.indexOf(convertToBigInt(42), 2), 2, "indexOf(42, 2)"); + var sample = new TA([42n, 43n, 42n, 41n]); + assert.sameValue(sample.indexOf(42n), 0, "indexOf(42)"); + assert.sameValue(sample.indexOf(43n), 1, "indexOf(43)"); + assert.sameValue(sample.indexOf(43n, 1), 1, "indexOf(43, 1)"); + assert.sameValue(sample.indexOf(42n, 1), 2, "indexOf(42, 1)"); + assert.sameValue(sample.indexOf(42n, 2), 2, "indexOf(42, 2)"); - assert.sameValue(sample.indexOf(convertToBigInt(42), -4), 0, "indexOf(42, -4)"); - assert.sameValue(sample.indexOf(convertToBigInt(42), -3), 2, "indexOf(42, -3)"); - assert.sameValue(sample.indexOf(convertToBigInt(42), -2), 2, "indexOf(42, -2)"); - assert.sameValue(sample.indexOf(convertToBigInt(42), -5), 0, "indexOf(42, -5)"); + assert.sameValue(sample.indexOf(42n, -4), 0, "indexOf(42, -4)"); + assert.sameValue(sample.indexOf(42n, -3), 2, "indexOf(42, -3)"); + assert.sameValue(sample.indexOf(42n, -2), 2, "indexOf(42, -2)"); + assert.sameValue(sample.indexOf(42n, -5), 0, "indexOf(42, -5)"); }); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/search-not-found-returns-minus-one.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/search-not-found-returns-minus-one.js index 94dc9285e..2ef363213 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/BigInt/search-not-found-returns-minus-one.js +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/search-not-found-returns-minus-one.js @@ -28,11 +28,11 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample; - sample = new TA(convertToBigInt([42, 43, 42, 41])); - assert.sameValue(sample.indexOf(convertToBigInt(44)), -1, "indexOf(44)"); - assert.sameValue(sample.indexOf(convertToBigInt(43), 2), -1, "indexOf(43, 2)"); - assert.sameValue(sample.indexOf(convertToBigInt(42), 3), -1, "indexOf(42, 3)"); - assert.sameValue(sample.indexOf(convertToBigInt(44), -4), -1, "indexOf(44, -4)"); - assert.sameValue(sample.indexOf(convertToBigInt(44), -5), -1, "indexOf(44, -5)"); - assert.sameValue(sample.indexOf(convertToBigInt(42), -1), -1, "indexOf(42, -1)"); + sample = new TA([42n, 43n, 42n, 41n]); + assert.sameValue(sample.indexOf(44n), -1, "indexOf(44)"); + assert.sameValue(sample.indexOf(43n, 2), -1, "indexOf(43, 2)"); + assert.sameValue(sample.indexOf(42n, 3), -1, "indexOf(42, 3)"); + assert.sameValue(sample.indexOf(44n, -4), -1, "indexOf(44, -4)"); + assert.sameValue(sample.indexOf(44n, -5), -1, "indexOf(44, -5)"); + assert.sameValue(sample.indexOf(42n, -1), -1, "indexOf(42, -1)"); }); diff --git a/test/built-ins/TypedArray/prototype/indexOf/BigInt/tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/indexOf/BigInt/tointeger-fromindex.js index e338bf1a4..dd62589c5 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/BigInt/tointeger-fromindex.js +++ b/test/built-ins/TypedArray/prototype/indexOf/BigInt/tointeger-fromindex.js @@ -30,28 +30,28 @@ var obj = { testWithBigIntTypedArrayConstructors(function(TA) { var sample; - sample = new TA(convertToBigInt([42, 43])); - assert.sameValue(sample.indexOf(convertToBigInt(42), "1"), -1, "string [0]"); - assert.sameValue(sample.indexOf(convertToBigInt(43), "1"), 1, "string [1]"); + sample = new TA([42n, 43n]); + assert.sameValue(sample.indexOf(42n, "1"), -1, "string [0]"); + assert.sameValue(sample.indexOf(43n, "1"), 1, "string [1]"); - assert.sameValue(sample.indexOf(convertToBigInt(42), true), -1, "true [0]"); - assert.sameValue(sample.indexOf(convertToBigInt(43), true), 1, "true [1]"); + assert.sameValue(sample.indexOf(42n, true), -1, "true [0]"); + assert.sameValue(sample.indexOf(43n, true), 1, "true [1]"); - assert.sameValue(sample.indexOf(convertToBigInt(42), false), 0, "false [0]"); - assert.sameValue(sample.indexOf(convertToBigInt(43), false), 1, "false [1]"); + assert.sameValue(sample.indexOf(42n, false), 0, "false [0]"); + assert.sameValue(sample.indexOf(43n, false), 1, "false [1]"); - assert.sameValue(sample.indexOf(convertToBigInt(42), NaN), 0, "NaN [0]"); - assert.sameValue(sample.indexOf(convertToBigInt(43), NaN), 1, "NaN [1]"); + assert.sameValue(sample.indexOf(42n, NaN), 0, "NaN [0]"); + assert.sameValue(sample.indexOf(43n, NaN), 1, "NaN [1]"); - assert.sameValue(sample.indexOf(convertToBigInt(42), null), 0, "null [0]"); - assert.sameValue(sample.indexOf(convertToBigInt(43), null), 1, "null [1]"); + assert.sameValue(sample.indexOf(42n, null), 0, "null [0]"); + assert.sameValue(sample.indexOf(43n, null), 1, "null [1]"); - assert.sameValue(sample.indexOf(convertToBigInt(42), undefined), 0, "undefined [0]"); - assert.sameValue(sample.indexOf(convertToBigInt(43), undefined), 1, "undefined [1]"); + assert.sameValue(sample.indexOf(42n, undefined), 0, "undefined [0]"); + assert.sameValue(sample.indexOf(43n, undefined), 1, "undefined [1]"); - assert.sameValue(sample.indexOf(convertToBigInt(42), null), 0, "null [0]"); - assert.sameValue(sample.indexOf(convertToBigInt(43), null), 1, "null [1]"); + assert.sameValue(sample.indexOf(42n, null), 0, "null [0]"); + assert.sameValue(sample.indexOf(43n, null), 1, "null [1]"); - assert.sameValue(sample.indexOf(convertToBigInt(42), obj), -1, "object [0]"); - assert.sameValue(sample.indexOf(convertToBigInt(43), obj), 1, "object [1]"); + assert.sameValue(sample.indexOf(42n, obj), -1, "object [0]"); + assert.sameValue(sample.indexOf(43n, obj), 1, "object [1]"); }); diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/custom-separator-result-from-tostring-on-each-simple-value.js b/test/built-ins/TypedArray/prototype/join/BigInt/custom-separator-result-from-tostring-on-each-simple-value.js index 2f611e46f..df053b194 100644 --- a/test/built-ins/TypedArray/prototype/join/BigInt/custom-separator-result-from-tostring-on-each-simple-value.js +++ b/test/built-ins/TypedArray/prototype/join/BigInt/custom-separator-result-from-tostring-on-each-simple-value.js @@ -30,7 +30,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([1, 0, 2, 3, 42, 127])); + var sample = new TA([1n, 0n, 2n, 3n, 42n, 127n]); var result; diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/join/BigInt/get-length-uses-internal-arraylength.js index 24ca6f0e3..87e785727 100644 --- a/test/built-ins/TypedArray/prototype/join/BigInt/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/join/BigInt/get-length-uses-internal-arraylength.js @@ -33,7 +33,7 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); Object.defineProperty(TA.prototype, "length", desc); Object.defineProperty(sample, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/join/BigInt/result-from-tostring-on-each-simple-value.js b/test/built-ins/TypedArray/prototype/join/BigInt/result-from-tostring-on-each-simple-value.js index 186585603..ca80064ec 100644 --- a/test/built-ins/TypedArray/prototype/join/BigInt/result-from-tostring-on-each-simple-value.js +++ b/test/built-ins/TypedArray/prototype/join/BigInt/result-from-tostring-on-each-simple-value.js @@ -29,7 +29,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([1, 0, 2, 3, 42, 127])); + var sample = new TA([1n, 0n, 2n, 3n, 42n, 127n]); var result = sample.join(); diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/iter-prototype.js b/test/built-ins/TypedArray/prototype/keys/BigInt/iter-prototype.js index fd5e0a5ec..c8e5f11d8 100644 --- a/test/built-ins/TypedArray/prototype/keys/BigInt/iter-prototype.js +++ b/test/built-ins/TypedArray/prototype/keys/BigInt/iter-prototype.js @@ -18,7 +18,7 @@ features: [BigInt, Symbol.iterator, TypedArray] var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]()); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([0, 42, 64])); + var sample = new TA([0n, 42n, 64n]); var iter = sample.keys(); assert.sameValue(Object.getPrototypeOf(iter), ArrayIteratorProto); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-infinity.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-infinity.js index d7c28b130..1c0488a76 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-infinity.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-infinity.js @@ -25,8 +25,8 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 43, 41])); + var sample = new TA([42n, 43n, 43n, 41n]); - assert.sameValue(sample.lastIndexOf(convertToBigInt(43), Infinity), 2, "lastIndexOf(43, Infinity)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(43), -Infinity), -1, "lastIndexOf(43, -Infinity)"); + assert.sameValue(sample.lastIndexOf(43n, Infinity), 2, "lastIndexOf(43, Infinity)"); + assert.sameValue(sample.lastIndexOf(43n, -Infinity), -1, "lastIndexOf(43, -Infinity)"); }); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-minus-zero.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-minus-zero.js index 284d49930..bd42c0272 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-minus-zero.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/fromIndex-minus-zero.js @@ -24,7 +24,7 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample; - sample = new TA(convertToBigInt([42, 43])); - assert.sameValue(sample.lastIndexOf(convertToBigInt(42), -0), 0, "-0 [0]"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(43), -0), -1, "-0 [1]"); + sample = new TA([42n, 43n]); + assert.sameValue(sample.lastIndexOf(42n, -0), 0, "-0 [0]"); + assert.sameValue(sample.lastIndexOf(43n, -0), -1, "-0 [1]"); }); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/get-length-uses-internal-arraylength.js index 2b4daf2dd..ee9f23ff0 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/get-length-uses-internal-arraylength.js @@ -23,10 +23,10 @@ features: [BigInt, TypedArray] Object.defineProperty(TypedArray.prototype, "length", {value: 0}); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([7])); + var sample = new TA([7n]); Object.defineProperty(TA.prototype, "length", {value: 0}); Object.defineProperty(sample, "length", {value: 0}); - assert.sameValue(sample.lastIndexOf(convertToBigInt(7)), 0); + assert.sameValue(sample.lastIndexOf(7n), 0); }); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-found-returns-index.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-found-returns-index.js index 255672fa4..91ce88731 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-found-returns-index.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-found-returns-index.js @@ -31,27 +31,27 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 42, 41])); - assert.sameValue(sample.lastIndexOf(convertToBigInt(42)), 2, "lastIndexOf(42)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(43)), 1, "lastIndexOf(43)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(41)), 3, "lastIndexOf(41)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(41), 3), 3, "lastIndexOf(41, 3)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(41), 4), 3, "lastIndexOf(41, 4)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(43), 1), 1, "lastIndexOf(43, 1)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(43), 2), 1, "lastIndexOf(43, 2)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(43), 3), 1, "lastIndexOf(43, 3)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(43), 4), 1, "lastIndexOf(43, 4)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(42), 0), 0, "lastIndexOf(42, 0)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(42), 1), 0, "lastIndexOf(42, 1)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(42), 2), 2, "lastIndexOf(42, 2)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(42), 3), 2, "lastIndexOf(42, 3)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(42), 4), 2, "lastIndexOf(42, 4)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(42), -4), 0, "lastIndexOf(42, -4)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(42), -3), 0, "lastIndexOf(42, -3)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(42), -2), 2, "lastIndexOf(42, -2)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(42), -1), 2, "lastIndexOf(42, -1)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(43), -3), 1, "lastIndexOf(43, -3)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(43), -2), 1, "lastIndexOf(43, -2)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(43), -1), 1, "lastIndexOf(43, -1)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(41), -1), 3, "lastIndexOf(41, -1)"); + var sample = new TA([42n, 43n, 42n, 41n]); + assert.sameValue(sample.lastIndexOf(42n), 2, "lastIndexOf(42)"); + assert.sameValue(sample.lastIndexOf(43n), 1, "lastIndexOf(43)"); + assert.sameValue(sample.lastIndexOf(41n), 3, "lastIndexOf(41)"); + assert.sameValue(sample.lastIndexOf(41n, 3), 3, "lastIndexOf(41, 3)"); + assert.sameValue(sample.lastIndexOf(41n, 4), 3, "lastIndexOf(41, 4)"); + assert.sameValue(sample.lastIndexOf(43n, 1), 1, "lastIndexOf(43, 1)"); + assert.sameValue(sample.lastIndexOf(43n, 2), 1, "lastIndexOf(43, 2)"); + assert.sameValue(sample.lastIndexOf(43n, 3), 1, "lastIndexOf(43, 3)"); + assert.sameValue(sample.lastIndexOf(43n, 4), 1, "lastIndexOf(43, 4)"); + assert.sameValue(sample.lastIndexOf(42n, 0), 0, "lastIndexOf(42, 0)"); + assert.sameValue(sample.lastIndexOf(42n, 1), 0, "lastIndexOf(42, 1)"); + assert.sameValue(sample.lastIndexOf(42n, 2), 2, "lastIndexOf(42, 2)"); + assert.sameValue(sample.lastIndexOf(42n, 3), 2, "lastIndexOf(42, 3)"); + assert.sameValue(sample.lastIndexOf(42n, 4), 2, "lastIndexOf(42, 4)"); + assert.sameValue(sample.lastIndexOf(42n, -4), 0, "lastIndexOf(42, -4)"); + assert.sameValue(sample.lastIndexOf(42n, -3), 0, "lastIndexOf(42, -3)"); + assert.sameValue(sample.lastIndexOf(42n, -2), 2, "lastIndexOf(42, -2)"); + assert.sameValue(sample.lastIndexOf(42n, -1), 2, "lastIndexOf(42, -1)"); + assert.sameValue(sample.lastIndexOf(43n, -3), 1, "lastIndexOf(43, -3)"); + assert.sameValue(sample.lastIndexOf(43n, -2), 1, "lastIndexOf(43, -2)"); + assert.sameValue(sample.lastIndexOf(43n, -1), 1, "lastIndexOf(43, -1)"); + assert.sameValue(sample.lastIndexOf(41n, -1), 3, "lastIndexOf(41, -1)"); }); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-not-found-returns-minus-one.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-not-found-returns-minus-one.js index d53260ab8..823e43174 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-not-found-returns-minus-one.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/search-not-found-returns-minus-one.js @@ -28,15 +28,15 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample; - sample = new TA(convertToBigInt([42, 43, 42, 41])); - assert.sameValue(sample.lastIndexOf(convertToBigInt(44)), -1, "lastIndexOf(44)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(44), -4), -1, "lastIndexOf(44, -4)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(44), -5), -1, "lastIndexOf(44, -5)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(42), -5), -1, "lastIndexOf(42, -5)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(43), -4), -1, "lastIndexOf(43, -4)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(43), -5), -1, "lastIndexOf(43, -5)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(41), 0), -1, "lastIndexOf(41, 0)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(41), 1), -1, "lastIndexOf(41, 1)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(41), 2), -1, "lastIndexOf(41, 2)"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(43), 0), -1, "lastIndexOf(43, 0)"); + sample = new TA([42n, 43n, 42n, 41n]); + assert.sameValue(sample.lastIndexOf(44n), -1, "lastIndexOf(44)"); + assert.sameValue(sample.lastIndexOf(44n, -4), -1, "lastIndexOf(44, -4)"); + assert.sameValue(sample.lastIndexOf(44n, -5), -1, "lastIndexOf(44, -5)"); + assert.sameValue(sample.lastIndexOf(42n, -5), -1, "lastIndexOf(42, -5)"); + assert.sameValue(sample.lastIndexOf(43n, -4), -1, "lastIndexOf(43, -4)"); + assert.sameValue(sample.lastIndexOf(43n, -5), -1, "lastIndexOf(43, -5)"); + assert.sameValue(sample.lastIndexOf(41n, 0), -1, "lastIndexOf(41, 0)"); + assert.sameValue(sample.lastIndexOf(41n, 1), -1, "lastIndexOf(41, 1)"); + assert.sameValue(sample.lastIndexOf(41n, 2), -1, "lastIndexOf(41, 2)"); + assert.sameValue(sample.lastIndexOf(43n, 0), -1, "lastIndexOf(43, 0)"); }); diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/tointeger-fromindex.js b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/tointeger-fromindex.js index 8c591c1a7..a51656722 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/tointeger-fromindex.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/BigInt/tointeger-fromindex.js @@ -30,28 +30,28 @@ var obj = { testWithBigIntTypedArrayConstructors(function(TA) { var sample; - sample = new TA(convertToBigInt([42, 43])); - assert.sameValue(sample.lastIndexOf(convertToBigInt(42), "1"), 0, "string [0]"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(43), "1"), 1, "string [1]"); + sample = new TA([42n, 43n]); + assert.sameValue(sample.lastIndexOf(42n, "1"), 0, "string [0]"); + assert.sameValue(sample.lastIndexOf(43n, "1"), 1, "string [1]"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(42), true), 0, "true [0]"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(43), true), 1, "true [1]"); + assert.sameValue(sample.lastIndexOf(42n, true), 0, "true [0]"); + assert.sameValue(sample.lastIndexOf(43n, true), 1, "true [1]"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(42), false), 0, "false [0]"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(43), false), -1, "false [1]"); + assert.sameValue(sample.lastIndexOf(42n, false), 0, "false [0]"); + assert.sameValue(sample.lastIndexOf(43n, false), -1, "false [1]"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(42), NaN), 0, "NaN [0]"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(43), NaN), -1, "NaN [1]"); + assert.sameValue(sample.lastIndexOf(42n, NaN), 0, "NaN [0]"); + assert.sameValue(sample.lastIndexOf(43n, NaN), -1, "NaN [1]"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(42), null), 0, "null [0]"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(43), null), -1, "null [1]"); + assert.sameValue(sample.lastIndexOf(42n, null), 0, "null [0]"); + assert.sameValue(sample.lastIndexOf(43n, null), -1, "null [1]"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(42), undefined), 0, "undefined [0]"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(43), undefined), -1, "undefined [1]"); + assert.sameValue(sample.lastIndexOf(42n, undefined), 0, "undefined [0]"); + assert.sameValue(sample.lastIndexOf(43n, undefined), -1, "undefined [1]"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(42), null), 0, "null [0]"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(43), null), -1, "null [1]"); + assert.sameValue(sample.lastIndexOf(42n, null), 0, "null [0]"); + assert.sameValue(sample.lastIndexOf(43n, null), -1, "null [1]"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(42), obj), 0, "object [0]"); - assert.sameValue(sample.lastIndexOf(convertToBigInt(43), obj), 1, "object [1]"); + assert.sameValue(sample.lastIndexOf(42n, obj), 0, "object [0]"); + assert.sameValue(sample.lastIndexOf(43n, obj), 1, "object [1]"); }); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/arraylength-internal.js b/test/built-ins/TypedArray/prototype/map/BigInt/arraylength-internal.js index c74501315..a23cca257 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/arraylength-internal.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/arraylength-internal.js @@ -22,7 +22,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample1.map(function() { loop++; - return convertToBigInt(0); + return 0n; }); assert.sameValue(loop, 42, "data descriptor"); @@ -38,7 +38,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample2.map(function() { loop++; - return convertToBigInt(0); + return 0n; }); assert.sameValue(loop, 4, "accessor descriptor"); }); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-with-thisarg.js index 85ff13e4e..169a83dee 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-with-thisarg.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-with-thisarg.js @@ -18,31 +18,31 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); var results = []; var thisArg = ["test262", 0, "ecma262", 0]; sample.map(function() { results.push(arguments); - return convertToBigInt(0); + return 0n; }, thisArg); assert.sameValue(results.length, 3, "results.length"); assert.sameValue(thisArg.length, 4, "thisArg.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue"); + assert.sameValue(results[0][0], 42n, "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue"); + assert.sameValue(results[1][0], 43n, "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue"); + assert.sameValue(results[2][0], 44n, "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-without-thisarg.js index 1e12f5551..13e7c1500 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-without-thisarg.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-arguments-without-thisarg.js @@ -18,29 +18,29 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); var results = []; sample.map(function() { results.push(arguments); - return convertToBigInt(0); + return 0n; }); assert.sameValue(results.length, 3, "results.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue"); + assert.sameValue(results[0][0], 42n, "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue"); + assert.sameValue(results[1][0], 43n, "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue"); + assert.sameValue(results[2][0], 44n, "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-detachbuffer.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-detachbuffer.js index 94bf74867..d8abe4bd4 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-detachbuffer.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-detachbuffer.js @@ -28,7 +28,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { } $DETACHBUFFER(sample.buffer); loops++; - return convertToBigInt(0); + return 0n; }); }); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-no-interaction-over-non-integer-properties.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-no-interaction-over-non-integer-properties.js index a1b5639f1..e8bf86d04 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-no-interaction-over-non-integer-properties.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-no-interaction-over-non-integer-properties.js @@ -19,7 +19,7 @@ features: [BigInt, Symbol, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([7, 8])); + var sample = new TA([7n, 8n]); var results = []; @@ -28,7 +28,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample.map(function() { results.push(arguments); - return convertToBigInt(0); + return 0n; }); assert.sameValue(results.length, 2, "results.length"); @@ -36,6 +36,6 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); - assert.sameValue(results[0][0], convertToBigInt(7), "results[0][0] - kValue"); - assert.sameValue(results[1][0], convertToBigInt(8), "results[1][0] - kValue"); + assert.sameValue(results[0][0], 7n, "results[0][0] - kValue"); + assert.sameValue(results[1][0], 8n, "results[1][0] - kValue"); }); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-affects-returned-object.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-affects-returned-object.js index cfd180d1f..f2f679a6d 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-affects-returned-object.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-affects-returned-object.js @@ -20,12 +20,12 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([1, 2, 4])); + var sample = new TA([1n, 2n, 4n]); var result = sample.map(function(v) { - return v * convertToBigInt(3); + return v * 3n; }); - assert.sameValue(result[0], convertToBigInt(3), "result[0] == 3"); - assert.sameValue(result[1], convertToBigInt(6), "result[1] == 6"); - assert.sameValue(result[2], convertToBigInt(12), "result[2] == 12"); + assert.sameValue(result[0], 3n, "result[0] == 3"); + assert.sameValue(result[1], 6n, "result[1] == 6"); + assert.sameValue(result[2], 12n, "result[2] == 12"); }); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-change-instance.js index bc0f6f32b..dfd441f3c 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-change-instance.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-change-instance.js @@ -13,13 +13,13 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample1 = new TA(3); - sample1[1] = convertToBigInt(1); + sample1[1] = 1n; sample1.map(function() { - return convertToBigInt(42); + return 42n; }); - assert.sameValue(sample1[0], convertToBigInt(0), "[0] == 0"); - assert.sameValue(sample1[1], convertToBigInt(1), "[1] == 1"); - assert.sameValue(sample1[2], convertToBigInt(0), "[2] == 0"); + assert.sameValue(sample1[0], 0n, "[0] == 0"); + assert.sameValue(sample1[1], 1n, "[1] == 1"); + assert.sameValue(sample1[2], 0n, "[2] == 0"); }); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-copy-non-integer-properties.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-copy-non-integer-properties.js index a672b35bd..4783a2a1e 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-copy-non-integer-properties.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-return-does-not-copy-non-integer-properties.js @@ -18,14 +18,14 @@ features: [BigInt, Symbol, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([7, 8])); + var sample = new TA([7n, 8n]); var bar = Symbol("1"); sample.foo = 42; sample[bar] = 1; var result = sample.map(function() { - return convertToBigInt(0); + return 0n; }); assert.sameValue(result.length, 2, "result.length"); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-set-value-during-interaction.js index 2e0f7eed1..9e140cd82 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-set-value-during-interaction.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-set-value-during-interaction.js @@ -12,7 +12,7 @@ features: [BigInt, Reflect.set, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); var newVal = 0; sample.map(function(val, i) { @@ -22,7 +22,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { "get the changed value during the loop" ); assert.sameValue( - Reflect.set(sample, 0, convertToBigInt(7)), + Reflect.set(sample, 0, 7n), true, "re-set a value for sample[0]" ); @@ -34,10 +34,10 @@ testWithBigIntTypedArrayConstructors(function(TA) { ); newVal++; - return convertToBigInt(0); + return 0n; }); - assert.sameValue(sample[0], convertToBigInt(7), "changed values after iteration [0] == 7"); - assert.sameValue(sample[1], convertToBigInt(1), "changed values after iteration [1] == 1"); - assert.sameValue(sample[2], convertToBigInt(2), "changed values after iteration [2] == 2"); + assert.sameValue(sample[0], 7n, "changed values after iteration [0] == 7"); + assert.sameValue(sample[1], 1n, "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], 2n, "changed values after iteration [2] == 2"); }); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-this.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-this.js index e5ee5393c..820dfb198 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-this.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-this.js @@ -28,7 +28,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample.map(function() { results1.push(this); - return convertToBigInt(0); + return 0n; }); assert.sameValue(results1.length, 3, "results1"); @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample.map(function() { results2.push(this); - return convertToBigInt(0); + return 0n; }, thisArg); assert.sameValue(results2.length, 3, "results2"); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/map/BigInt/values-are-not-cached.js index a8665d931..6b6728228 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/values-are-not-cached.js @@ -12,17 +12,17 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); sample.map(function(v, i) { if (i < sample.length - 1) { - sample[i+1] = convertToBigInt(42); + sample[i+1] = 42n; } assert.sameValue( - v, convertToBigInt(42), "method does not cache values before callbackfn calls" + v, 42n, "method does not cache values before callbackfn calls" ); - return convertToBigInt(0); + return 0n; }); }); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-custom-accumulator.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-custom-accumulator.js index 8527302fd..6b54c191c 100644 --- a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-custom-accumulator.js +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-custom-accumulator.js @@ -27,7 +27,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); var results = []; @@ -40,19 +40,19 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(results[0].length, 4, "results[0].length"); assert.sameValue(results[0][0], 7, "results[0][0] - accumulator"); - assert.sameValue(results[0][1], convertToBigInt(42), "results[0][1] - kValue"); + assert.sameValue(results[0][1], 42n, "results[0][1] - kValue"); assert.sameValue(results[0][2], 0, "results[0][2] - k"); assert.sameValue(results[0][3], sample, "results[0][3] - this"); assert.sameValue(results[1].length, 4, "results[1].length"); assert.sameValue(results[1][0], 8, "results[1][0] - accumulator"); - assert.sameValue(results[1][1], convertToBigInt(43), "results[1][1] - kValue"); + assert.sameValue(results[1][1], 43n, "results[1][1] - kValue"); assert.sameValue(results[1][2], 1, "results[1][2] - k"); assert.sameValue(results[1][3], sample, "results[1][3] - this"); assert.sameValue(results[2].length, 4, "results[2].length"); assert.sameValue(results[2][0], 9, "results[2][0] - accumulator"); - assert.sameValue(results[2][1], convertToBigInt(44), "results[2][1] - kValue"); + assert.sameValue(results[2][1], 44n, "results[2][1] - kValue"); assert.sameValue(results[2][2], 2, "results[2][2] - k"); assert.sameValue(results[2][3], sample, "results[2][3] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-default-accumulator.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-default-accumulator.js index b4514895a..ab9e5a286 100644 --- a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-default-accumulator.js +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-arguments-default-accumulator.js @@ -34,26 +34,26 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); var results = []; sample.reduce(function(accumulator) { results.push(arguments); - return accumulator - convertToBigInt(1); + return accumulator - 1n; }); assert.sameValue(results.length, 2, "results.length"); assert.sameValue(results[0].length, 4, "results[1].length"); - assert.sameValue(results[0][0], convertToBigInt(42), "results[1][0] - accumulator"); - assert.sameValue(results[0][1], convertToBigInt(43), "results[1][1] - kValue"); + assert.sameValue(results[0][0], 42n, "results[1][0] - accumulator"); + assert.sameValue(results[0][1], 43n, "results[1][1] - kValue"); assert.sameValue(results[0][2], 1, "results[1][2] - k"); assert.sameValue(results[0][3], sample, "results[1][3] - this"); assert.sameValue(results[1].length, 4, "results[2].length"); - assert.sameValue(results[1][0], convertToBigInt(41), "results[2][0] - accumulator"); - assert.sameValue(results[1][1], convertToBigInt(44), "results[2][1] - kValue"); + assert.sameValue(results[1][0], 41n, "results[2][0] - accumulator"); + assert.sameValue(results[1][1], 44n, "results[2][1] - kValue"); assert.sameValue(results[1][2], 2, "results[2][2] - k"); assert.sameValue(results[1][3], sample, "results[2][3] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-no-iteration-over-non-integer-properties.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-no-iteration-over-non-integer-properties.js index b230de900..f8282a42e 100644 --- a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-no-iteration-over-non-integer-properties.js +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-no-iteration-over-non-integer-properties.js @@ -27,7 +27,7 @@ features: [BigInt, Symbol, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([7, 8])); + var sample = new TA([7n, 8n]); var results = []; @@ -43,6 +43,6 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(results[0][2], 0, "results[0][2] - k"); assert.sameValue(results[1][2], 1, "results[1][2] - k"); - assert.sameValue(results[0][1], convertToBigInt(7), "results[0][1] - kValue"); - assert.sameValue(results[1][1], convertToBigInt(8), "results[1][1] - kValue"); + assert.sameValue(results[0][1], 7n, "results[0][1] - kValue"); + assert.sameValue(results[1][1], 8n, "results[1][1] - kValue"); }); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-return-does-not-change-instance.js index 05a8adddf..31785cec9 100644 --- a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-return-does-not-change-instance.js +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-return-does-not-change-instance.js @@ -9,13 +9,13 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([0, 1, 0])); + var sample = new TA([0n, 1n, 0n]); sample.reduce(function() { return 42; }, 7); - assert.sameValue(sample[0], convertToBigInt(0), "[0] == 0"); - assert.sameValue(sample[1], convertToBigInt(1), "[1] == 1"); - assert.sameValue(sample[2], convertToBigInt(0), "[2] == 0"); + assert.sameValue(sample[0], 0n, "[0] == 0"); + assert.sameValue(sample[1], 1n, "[1] == 1"); + assert.sameValue(sample[2], 0n, "[2] == 0"); }); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-set-value-during-iteration.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-set-value-during-iteration.js index 395a5aea7..272879dfb 100644 --- a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-set-value-during-iteration.js +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-set-value-during-iteration.js @@ -19,7 +19,7 @@ features: [BigInt, Reflect.set, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); var newVal = 0; sample.reduce(function(acc, val, i) { @@ -29,7 +29,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { "get the changed value during the loop" ); assert.sameValue( - Reflect.set(sample, 0, convertToBigInt(7)), + Reflect.set(sample, 0, 7n), true, "re-set a value for sample[0]" ); @@ -43,7 +43,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { newVal++; }, 0); - assert.sameValue(sample[0], convertToBigInt(7), "changed values after iteration [0] == 7"); - assert.sameValue(sample[1], convertToBigInt(1), "changed values after iteration [1] == 1"); - assert.sameValue(sample[2], convertToBigInt(2), "changed values after iteration [2] == 2"); + assert.sameValue(sample[0], 7n, "changed values after iteration [0] == 7"); + assert.sameValue(sample[1], 1n, "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], 2n, "changed values after iteration [2] == 2"); }); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/get-length-uses-internal-arraylength.js index a4f6c763e..98ff2510d 100644 --- a/test/built-ins/TypedArray/prototype/reduce/BigInt/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/get-length-uses-internal-arraylength.js @@ -31,7 +31,7 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); var calls = 0; Object.defineProperty(TA.prototype, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/result-is-last-callbackfn-return.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/result-is-last-callbackfn-return.js index 83e9a723f..2c424d4c8 100644 --- a/test/built-ins/TypedArray/prototype/reduce/BigInt/result-is-last-callbackfn-return.js +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/result-is-last-callbackfn-return.js @@ -38,7 +38,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { var calls, result; calls = 0; - result = new TA(convertToBigInt([1, 2, 3])).reduce(function() { + result = new TA([1n, 2n, 3n]).reduce(function() { calls++; if (calls == 2) { @@ -48,7 +48,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(result, 42, "using default accumulator"); calls = 0; - result = new TA(convertToBigInt([1, 2, 3])).reduce(function() { + result = new TA([1n, 2n, 3n]).reduce(function() { calls++; if (calls == 3) { diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/result-of-any-type.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/result-of-any-type.js index 370a5b052..e67a68dc3 100644 --- a/test/built-ins/TypedArray/prototype/reduce/BigInt/result-of-any-type.js +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/result-of-any-type.js @@ -35,7 +35,7 @@ features: [BigInt, Symbol, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); [ ["test262", "string"], ["", "empty string"], diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/return-first-value-without-callbackfn.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/return-first-value-without-callbackfn.js index 7fbd76fa0..766bcdb62 100644 --- a/test/built-ins/TypedArray/prototype/reduce/BigInt/return-first-value-without-callbackfn.js +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/return-first-value-without-callbackfn.js @@ -33,10 +33,10 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var called = false; - var result = new TA(convertToBigInt([42])).reduce(function() { + var result = new TA([42n]).reduce(function() { called = true; }); - assert.sameValue(result, convertToBigInt(42)); + assert.sameValue(result, 42n); assert.sameValue(called, false); }); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/values-are-not-cached.js index 7b602dd9d..5362bf1dd 100644 --- a/test/built-ins/TypedArray/prototype/reduce/BigInt/values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/values-are-not-cached.js @@ -27,15 +27,15 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); sample.reduce(function(a, v, i) { if (i < sample.length - 1) { - sample[i+1] = convertToBigInt(42); + sample[i+1] = 42n; } assert.sameValue( - v, convertToBigInt(42), "method does not cache values before callbackfn calls" + v, 42n, "method does not cache values before callbackfn calls" ); }, 0); }); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-custom-accumulator.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-custom-accumulator.js index 8ecb1ff4f..1d5d7dfbf 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-custom-accumulator.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-custom-accumulator.js @@ -28,7 +28,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); var results = []; @@ -41,19 +41,19 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(results[0].length, 4, "results[0].length"); assert.sameValue(results[0][0], 7, "results[0][0] - accumulator"); - assert.sameValue(results[0][1], convertToBigInt(44), "results[0][1] - kValue"); + assert.sameValue(results[0][1], 44n, "results[0][1] - kValue"); assert.sameValue(results[0][2], 2, "results[0][2] - k"); assert.sameValue(results[0][3], sample, "results[0][3] - this"); assert.sameValue(results[1].length, 4, "results[1].length"); assert.sameValue(results[1][0], 8, "results[1][0] - accumulator"); - assert.sameValue(results[1][1], convertToBigInt(43), "results[1][1] - kValue"); + assert.sameValue(results[1][1], 43n, "results[1][1] - kValue"); assert.sameValue(results[1][2], 1, "results[1][2] - k"); assert.sameValue(results[1][3], sample, "results[1][3] - this"); assert.sameValue(results[2].length, 4, "results[2].length"); assert.sameValue(results[2][0], 9, "results[2][0] - accumulator"); - assert.sameValue(results[2][1], convertToBigInt(42), "results[2][1] - kValue"); + assert.sameValue(results[2][1], 42n, "results[2][1] - kValue"); assert.sameValue(results[2][2], 0, "results[2][2] - k"); assert.sameValue(results[2][3], sample, "results[2][3] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-default-accumulator.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-default-accumulator.js index d80202ebc..ec251e709 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-default-accumulator.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-arguments-default-accumulator.js @@ -37,26 +37,26 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); var results = []; sample.reduceRight(function(accumulator) { results.push(arguments); - return accumulator + convertToBigInt(1); + return accumulator + 1n; }); assert.sameValue(results.length, 2, "results.length"); assert.sameValue(results[0].length, 4, "results[1].length"); - assert.sameValue(results[0][0], convertToBigInt(44), "results[1][0] - accumulator"); - assert.sameValue(results[0][1], convertToBigInt(43), "results[1][1] - kValue"); + assert.sameValue(results[0][0], 44n, "results[1][0] - accumulator"); + assert.sameValue(results[0][1], 43n, "results[1][1] - kValue"); assert.sameValue(results[0][2], 1, "results[1][2] - k"); assert.sameValue(results[0][3], sample, "results[1][3] - this"); assert.sameValue(results[1].length, 4, "results[2].length"); - assert.sameValue(results[1][0], convertToBigInt(45), "results[2][0] - accumulator"); - assert.sameValue(results[1][1], convertToBigInt(42), "results[2][1] - kValue"); + assert.sameValue(results[1][0], 45n, "results[2][0] - accumulator"); + assert.sameValue(results[1][1], 42n, "results[2][1] - kValue"); assert.sameValue(results[1][2], 0, "results[2][2] - k"); assert.sameValue(results[1][3], sample, "results[2][3] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-no-iteration-over-non-integer-properties.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-no-iteration-over-non-integer-properties.js index a0f2fb513..9dc6d1771 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-no-iteration-over-non-integer-properties.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-no-iteration-over-non-integer-properties.js @@ -28,7 +28,7 @@ features: [BigInt, Symbol, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([7, 8])); + var sample = new TA([7n, 8n]); var results = []; @@ -44,6 +44,6 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(results[0][2], 1, "results[0][2] - k"); assert.sameValue(results[1][2], 0, "results[1][2] - k"); - assert.sameValue(results[0][1], convertToBigInt(8), "results[0][1] - kValue"); - assert.sameValue(results[1][1], convertToBigInt(7), "results[1][1] - kValue"); + assert.sameValue(results[0][1], 8n, "results[0][1] - kValue"); + assert.sameValue(results[1][1], 7n, "results[1][1] - kValue"); }); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-return-does-not-change-instance.js index 2bf7460bf..2dccce9e3 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-return-does-not-change-instance.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-return-does-not-change-instance.js @@ -9,13 +9,13 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([0, 1, 0])); + var sample = new TA([0n, 1n, 0n]); sample.reduceRight(function() { return 42; }, 7); - assert.sameValue(sample[0], convertToBigInt(0), "[0] == 0"); - assert.sameValue(sample[1], convertToBigInt(1), "[1] == 1"); - assert.sameValue(sample[2], convertToBigInt(0), "[2] == 0"); + assert.sameValue(sample[0], 0n, "[0] == 0"); + assert.sameValue(sample[1], 1n, "[1] == 1"); + assert.sameValue(sample[2], 0n, "[2] == 0"); }); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-set-value-during-iteration.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-set-value-during-iteration.js index d0fd3510f..7b5fc70c2 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-set-value-during-iteration.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-set-value-during-iteration.js @@ -19,7 +19,7 @@ features: [BigInt, Reflect.set, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); var newVal = 0; sample.reduceRight(function(acc, val, i) { @@ -29,7 +29,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { "get the changed value during the loop" ); assert.sameValue( - Reflect.set(sample, 2, convertToBigInt(7)), + Reflect.set(sample, 2, 7n), true, "re-set a value for sample[2]" ); @@ -43,7 +43,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { newVal++; }, 0); - assert.sameValue(sample[0], convertToBigInt(2), "changed values after iteration [0] == 2"); - assert.sameValue(sample[1], convertToBigInt(1), "changed values after iteration [1] == 1"); - assert.sameValue(sample[2], convertToBigInt(7), "changed values after iteration [2] == 7"); + assert.sameValue(sample[0], 2n, "changed values after iteration [0] == 2"); + assert.sameValue(sample[1], 1n, "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], 7n, "changed values after iteration [2] == 7"); }); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/get-length-uses-internal-arraylength.js index e2cb704a0..2aae5480c 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/get-length-uses-internal-arraylength.js @@ -31,7 +31,7 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); var calls = 0; Object.defineProperty(TA.prototype, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-is-last-callbackfn-return.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-is-last-callbackfn-return.js index feeb92f0f..140b095cb 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-is-last-callbackfn-return.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-is-last-callbackfn-return.js @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { var calls, result; calls = 0; - result = new TA(convertToBigInt([1, 2, 3])).reduceRight(function() { + result = new TA([1n, 2n, 3n]).reduceRight(function() { calls++; if (calls == 2) { @@ -50,7 +50,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(result, 42, "using default accumulator"); calls = 0; - result = new TA(convertToBigInt([1, 2, 3])).reduceRight(function() { + result = new TA([1n, 2n, 3n]).reduceRight(function() { calls++; if (calls == 3) { diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-of-any-type.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-of-any-type.js index d3731ab58..a70a4135d 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-of-any-type.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/result-of-any-type.js @@ -37,7 +37,7 @@ features: [BigInt, Symbol, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); [ ["test262", "string"], ["", "empty string"], diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/return-first-value-without-callbackfn.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/return-first-value-without-callbackfn.js index 3219fb682..71ada5949 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/return-first-value-without-callbackfn.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/return-first-value-without-callbackfn.js @@ -34,10 +34,10 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var called = false; - var result = new TA(convertToBigInt([42])).reduceRight(function() { + var result = new TA([42n]).reduceRight(function() { called = true; }); - assert.sameValue(result, convertToBigInt(42)); + assert.sameValue(result, 42n); assert.sameValue(called, false); }); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/values-are-not-cached.js index a7f5cda05..c0ae38dd7 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/values-are-not-cached.js @@ -28,15 +28,15 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([44, 43, 42])); + var sample = new TA([44n, 43n, 42n]); sample.reduceRight(function(a, v, i) { if (i > 0) { - sample[i-1] = convertToBigInt(42); + sample[i-1] = 42n; } assert.sameValue( - v, convertToBigInt(42), "method does not cache values before callbackfn calls" + v, 42n, "method does not cache values before callbackfn calls" ); }, 0); }); diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/get-length-uses-internal-arraylength.js index 7acdfdfff..0a08956c7 100644 --- a/test/built-ins/TypedArray/prototype/reverse/BigInt/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/get-length-uses-internal-arraylength.js @@ -31,7 +31,7 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); Object.defineProperty(TA.prototype, "length", desc); Object.defineProperty(sample, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/reverts.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/reverts.js index 660088f02..92aa0eb3e 100644 --- a/test/built-ins/TypedArray/prototype/reverse/BigInt/reverts.js +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/reverts.js @@ -25,33 +25,33 @@ testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA(buffer, 0, 4); var other = new TA(buffer, 0, 5); - sample[0] = convertToBigInt(42); - sample[1] = convertToBigInt(43); - sample[2] = convertToBigInt(2); - sample[3] = convertToBigInt(1); - other[4] = convertToBigInt(7); + sample[0] = 42n; + sample[1] = 43n; + sample[2] = 2n; + sample[3] = 1n; + other[4] = 7n; sample.reverse(); assert( - compareArray(sample, convertToBigInt([1, 2, 43, 42])) + compareArray(sample, [1n, 2n, 43n, 42n]) ); assert( - compareArray(other, convertToBigInt([1, 2, 43, 42, 7])) + compareArray(other, [1n, 2n, 43n, 42n, 7n]) ); - sample[0] = convertToBigInt(7); - sample[1] = convertToBigInt(17); - sample[2] = convertToBigInt(1); - sample[3] = convertToBigInt(0); - other[4] = convertToBigInt(42); + sample[0] = 7n; + sample[1] = 17n; + sample[2] = 1n; + sample[3] = 0n; + other[4] = 42n; other.reverse(); assert( - compareArray(other, convertToBigInt([42, 0, 1, 17, 7])) + compareArray(other, [42n, 0n, 1n, 17n, 7n]) ); assert( - compareArray(sample, convertToBigInt([42, 0, 1, 17])) + compareArray(sample, [42n, 0n, 1n, 17n]) ); }); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-offset-tointeger.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-offset-tointeger.js index b47dc9de6..e5d504634 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-offset-tointeger.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-offset-tointeger.js @@ -21,75 +21,75 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample; - sample = new TA(convertToBigInt([1, 2])); - sample.set([convertToBigInt(42)], ""); - assert(compareArray(sample, convertToBigInt([42, 2])), "the empty string"); + sample = new TA([1n, 2n]); + sample.set([42n], ""); + assert(compareArray(sample, [42n, 2n]), "the empty string"); - sample = new TA(convertToBigInt([1, 2])); - sample.set([convertToBigInt(42)], "0"); - assert(compareArray(sample, convertToBigInt([42, 2])), "'0'"); + sample = new TA([1n, 2n]); + sample.set([42n], "0"); + assert(compareArray(sample, [42n, 2n]), "'0'"); - sample = new TA(convertToBigInt([1, 2])); - sample.set([convertToBigInt(42)], false); - assert(compareArray(sample, convertToBigInt([42, 2])), "false"); + sample = new TA([1n, 2n]); + sample.set([42n], false); + assert(compareArray(sample, [42n, 2n]), "false"); - sample = new TA(convertToBigInt([1, 2])); - sample.set([convertToBigInt(42)], 0.1); - assert(compareArray(sample, convertToBigInt([42, 2])), "0.1"); + sample = new TA([1n, 2n]); + sample.set([42n], 0.1); + assert(compareArray(sample, [42n, 2n]), "0.1"); - sample = new TA(convertToBigInt([1, 2])); - sample.set([convertToBigInt(42)], 0.9); - assert(compareArray(sample, convertToBigInt([42, 2])), "0.9"); + sample = new TA([1n, 2n]); + sample.set([42n], 0.9); + assert(compareArray(sample, [42n, 2n]), "0.9"); - sample = new TA(convertToBigInt([1, 2])); - sample.set([convertToBigInt(42)], -0.5); - assert(compareArray(sample, convertToBigInt([42, 2])), "-0.5"); + sample = new TA([1n, 2n]); + sample.set([42n], -0.5); + assert(compareArray(sample, [42n, 2n]), "-0.5"); - sample = new TA(convertToBigInt([1, 2])); - sample.set([convertToBigInt(42)], 1.1); - assert(compareArray(sample, convertToBigInt([1, 42])), "1.1"); + sample = new TA([1n, 2n]); + sample.set([42n], 1.1); + assert(compareArray(sample, [1n, 42n]), "1.1"); - sample = new TA(convertToBigInt([1, 2])); - sample.set([convertToBigInt(42)], NaN); - assert(compareArray(sample, convertToBigInt([42, 2])), "NaN"); + sample = new TA([1n, 2n]); + sample.set([42n], NaN); + assert(compareArray(sample, [42n, 2n]), "NaN"); - sample = new TA(convertToBigInt([1, 2])); - sample.set([convertToBigInt(42)], null); - assert(compareArray(sample, convertToBigInt([42, 2])), "null"); + sample = new TA([1n, 2n]); + sample.set([42n], null); + assert(compareArray(sample, [42n, 2n]), "null"); - sample = new TA(convertToBigInt([1, 2])); - sample.set([convertToBigInt(42)], undefined); - assert(compareArray(sample, convertToBigInt([42, 2])), "undefined"); + sample = new TA([1n, 2n]); + sample.set([42n], undefined); + assert(compareArray(sample, [42n, 2n]), "undefined"); - sample = new TA(convertToBigInt([1, 2])); - sample.set([convertToBigInt(42)], {}); - assert(compareArray(sample, convertToBigInt([42, 2])), "{}"); + sample = new TA([1n, 2n]); + sample.set([42n], {}); + assert(compareArray(sample, [42n, 2n]), "{}"); - sample = new TA(convertToBigInt([1, 2])); - sample.set([convertToBigInt(42)], []); - assert(compareArray(sample, convertToBigInt([42, 2])), "[]"); + sample = new TA([1n, 2n]); + sample.set([42n], []); + assert(compareArray(sample, [42n, 2n]), "[]"); - sample = new TA(convertToBigInt([1, 2])); - sample.set([convertToBigInt(42)], [0]); - assert(compareArray(sample, convertToBigInt([42, 2])), "[0]"); + sample = new TA([1n, 2n]); + sample.set([42n], [0]); + assert(compareArray(sample, [42n, 2n]), "[0]"); - sample = new TA(convertToBigInt([1, 2])); - sample.set([convertToBigInt(42)], true); - assert(compareArray(sample, convertToBigInt([1, 42])), "true"); + sample = new TA([1n, 2n]); + sample.set([42n], true); + assert(compareArray(sample, [1n, 42n]), "true"); - sample = new TA(convertToBigInt([1, 2])); - sample.set([convertToBigInt(42)], "1"); - assert(compareArray(sample, convertToBigInt([1, 42])), "'1'"); + sample = new TA([1n, 2n]); + sample.set([42n], "1"); + assert(compareArray(sample, [1n, 42n]), "'1'"); - sample = new TA(convertToBigInt([1, 2])); - sample.set([convertToBigInt(42)], [1]); - assert(compareArray(sample, convertToBigInt([1, 42])), "[1]"); + sample = new TA([1n, 2n]); + sample.set([42n], [1]); + assert(compareArray(sample, [1n, 42n]), "[1]"); - sample = new TA(convertToBigInt([1, 2])); - sample.set([convertToBigInt(42)], { valueOf: function() {return 1;} }); - assert(compareArray(sample, convertToBigInt([1, 42])), "valueOf"); + sample = new TA([1n, 2n]); + sample.set([42n], { valueOf: function() {return 1;} }); + assert(compareArray(sample, [1n, 42n]), "valueOf"); - sample = new TA(convertToBigInt([1, 2])); - sample.set([convertToBigInt(42)], { toString: function() {return 1;} }); - assert(compareArray(sample, convertToBigInt([1, 42])), "toString"); + sample = new TA([1n, 2n]); + sample.set([42n], { toString: function() {return 1;} }); + assert(compareArray(sample, [1n, 42n]), "toString"); }); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-length.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-length.js index 2dd5b23ea..bd6a28723 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-length.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-length.js @@ -25,7 +25,7 @@ Object.defineProperty(obj, "length", { }); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([1, 2, 3])); + var sample = new TA([1n, 2n, 3n]); assert.throws(Test262Error, function() { sample.set(obj); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-value.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-value.js index 451e7bad1..237c94645 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-value.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-value.js @@ -25,9 +25,9 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var obj = { length: 4, - "0": convertToBigInt(42), - "1": convertToBigInt(43), - "3": convertToBigInt(44) + "0": 42n, + "1": 43n, + "3": 44n }; Object.defineProperty(obj, "2", { get: function() { @@ -35,14 +35,14 @@ testWithBigIntTypedArrayConstructors(function(TA) { } }); - var sample = new TA(convertToBigInt([1, 2, 3, 4])); + var sample = new TA([1n, 2n, 3n, 4n]); assert.throws(Test262Error, function() { sample.set(obj); }); assert( - compareArray(sample, convertToBigInt([42, 43, 3, 4])), + compareArray(sample, [42n, 43n, 3n, 4n]), "values are set until exception" ); }); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length-symbol.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length-symbol.js index f1a65b06e..e0393870d 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length-symbol.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length-symbol.js @@ -22,7 +22,7 @@ var obj = { }; testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([1, 2, 3])); + var sample = new TA([1n, 2n, 3n]); assert.throws(TypeError, function() { sample.set(obj); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length.js index 401a486db..f2bea7374 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-length.js @@ -34,7 +34,7 @@ var obj2 = { }; testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([1, 2, 3])); + var sample = new TA([1n, 2n, 3n]); assert.throws(Test262Error, function() { sample.set(obj1); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value-symbol.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value-symbol.js index fd9121934..683d318f0 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value-symbol.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value-symbol.js @@ -25,20 +25,20 @@ features: [BigInt, Symbol, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var obj = { length: 4, - "0": convertToBigInt(42), - "1": convertToBigInt(43), + "0": 42n, + "1": 43n, "2": Symbol("1"), - "3": convertToBigInt(44) + "3": 44n }; - var sample = new TA(convertToBigInt([1, 2, 3, 4])); + var sample = new TA([1n, 2n, 3n, 4n]); assert.throws(TypeError, function() { sample.set(obj); }); assert( - compareArray(sample, convertToBigInt([42, 43, 3, 4])), + compareArray(sample, [42n, 43n, 3n, 4n]), "values are set until exception" ); }); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value.js index af1f98349..7195d3f7d 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value.js @@ -25,24 +25,24 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var obj = { length: 4, - "0": convertToBigInt(42), - "1": convertToBigInt(43), + "0": 42n, + "1": 43n, "2": { valueOf: function() { throw new Test262Error(); } }, - "3": convertToBigInt(44) + "3": 44n }; - var sample = new TA(convertToBigInt([1, 2, 3, 4])); + var sample = new TA([1n, 2n, 3n, 4n]); assert.throws(Test262Error, function() { sample.set(obj); }); assert( - compareArray(sample, convertToBigInt([42, 43, 3, 4])), + compareArray(sample, [42n, 43n, 3n, 4n]), "values are set until exception" ); }); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-toobject-offset.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-toobject-offset.js index 8ee19ce7c..d55c05cd5 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-toobject-offset.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-toobject-offset.js @@ -18,7 +18,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([1, 2, 3])); + var sample = new TA([1n, 2n, 3n]); assert.throws(TypeError, function() { sample.set(undefined); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values-in-order.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values-in-order.js index 7a5ed9850..3eb5722ef 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values-in-order.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values-in-order.js @@ -32,7 +32,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { get: function() { calls.push(0); calls.push(sample.join()); - return convertToBigInt(42); + return 42n; } }); @@ -40,7 +40,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { get: function() { calls.push(1); calls.push(sample.join()); - return convertToBigInt(43); + return 43n; } }); @@ -48,7 +48,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { get: function() { calls.push(2); calls.push(sample.join()); - return convertToBigInt(44); + return 44n; } }); @@ -61,7 +61,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample.set(obj, 1); assert( - compareArray(sample, convertToBigInt([0, 42, 43, 44, 0])), + compareArray(sample, [0n, 42n, 43n, 44n, 0n]), "values are set for src length" ); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values.js index 3a5888726..1e3a226f8 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-set-values.js @@ -23,41 +23,41 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var src = convertToBigInt([42, 43]); + var src = [42n, 43n]; var srcObj = { length: 2, - '0': convertToBigInt(7), - '1': convertToBigInt(17) + '0': 7n, + '1': 17n }; var sample, result; - sample = new TA(convertToBigInt([1, 2, 3, 4])); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 0); - assert(compareArray(sample, convertToBigInt([42, 43, 3, 4])), "offset: 0, result: " + sample); + assert(compareArray(sample, [42n, 43n, 3n, 4n]), "offset: 0, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA(convertToBigInt([1, 2, 3, 4])); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 1); - assert(compareArray(sample, convertToBigInt([1, 42, 43, 4])), "offset: 1, result: " + sample); + assert(compareArray(sample, [1n, 42n, 43n, 4n]), "offset: 1, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA(convertToBigInt([1, 2, 3, 4])); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 2); - assert(compareArray(sample, convertToBigInt([1, 2, 42, 43])), "offset: 2, result: " + sample); + assert(compareArray(sample, [1n, 2n, 42n, 43n]), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA(convertToBigInt([1, 2, 3, 4])); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(srcObj, 0); - assert(compareArray(sample, convertToBigInt([7, 17, 3, 4])), "offset: 0, result: " + sample); + assert(compareArray(sample, [7n, 17n, 3n, 4n]), "offset: 0, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA(convertToBigInt([1, 2, 3, 4])); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(srcObj, 1); - assert(compareArray(sample, convertToBigInt([1, 7, 17, 4])), "offset: 1, result: " + sample); + assert(compareArray(sample, [1n, 7n, 17n, 4n]), "offset: 1, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA(convertToBigInt([1, 2, 3, 4])); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(srcObj, 2); - assert(compareArray(sample, convertToBigInt([1, 2, 7, 17])), "offset: 2, result: " + sample); + assert(compareArray(sample, [1n, 2n, 7n, 17n]), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); }); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-type-conversions.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-type-conversions.js index a07ffab4f..8deeed826 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-type-conversions.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-type-conversions.js @@ -25,7 +25,7 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var obj1 = { valueOf: function() { - return convertToBigInt(42); + return 42n; } }; diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-values-are-not-cached.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-values-are-not-cached.js index 3ad61f0b6..d6156af97 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-values-are-not-cached.js @@ -26,22 +26,22 @@ testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA(5); var obj = { length: 5, - '1': convertToBigInt(7), - '2': convertToBigInt(7), - '3': convertToBigInt(7), - '4': convertToBigInt(7) + '1': 7n, + '2': 7n, + '3': 7n, + '4': 7n }; Object.defineProperty(obj, 0, { get: function() { - obj[1] = convertToBigInt(43); - obj[2] = convertToBigInt(44); - obj[3] = convertToBigInt(45); - obj[4] = convertToBigInt(46); - return convertToBigInt(42); + obj[1] = 43n; + obj[2] = 44n; + obj[3] = 45n; + obj[4] = 46n; + return 42n; } }); sample.set(obj); - assert(compareArray(sample, convertToBigInt([42, 43, 44, 45, 46]))); + assert(compareArray(sample, [42n, 43n, 44n, 45n, 46n])); }); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-target-arraylength-internal.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-target-arraylength-internal.js index 95c1a9776..a6e6a3d34 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-target-arraylength-internal.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-target-arraylength-internal.js @@ -35,7 +35,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { Object.defineProperty(TA.prototype, "length", desc); Object.defineProperty(sample, "length", desc); - sample.set(convertToBigInt([42, 43])); + sample.set([42n, 43n]); assert.sameValue(getCalls, 0, "ignores length properties"); }); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-on-get-src-value-throws.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-on-get-src-value-throws.js index 7e53f4221..568e8b9b0 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-on-get-src-value-throws.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-targetbuffer-detached-on-get-src-value-throws.js @@ -23,10 +23,10 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([1, 2, 3])); + var sample = new TA([1n, 2n, 3n]); var obj = { length: 3, - "0": convertToBigInt(42) + "0": 42n }; Object.defineProperty(obj, 1, { get: function() { diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-offset-tointeger.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-offset-tointeger.js index 9d5b2478f..3b191aa4e 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-offset-tointeger.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-offset-tointeger.js @@ -17,77 +17,77 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample; - var src = new TA(convertToBigInt([42])); + var src = new TA([42n]); - sample = new TA(convertToBigInt([1, 2])); + sample = new TA([1n, 2n]); sample.set(src, ""); - assert(compareArray(sample, convertToBigInt([42, 2])), "the empty string"); + assert(compareArray(sample, [42n, 2n]), "the empty string"); - sample = new TA(convertToBigInt([1, 2])); + sample = new TA([1n, 2n]); sample.set(src, "0"); - assert(compareArray(sample, convertToBigInt([42, 2])), "'0'"); + assert(compareArray(sample, [42n, 2n]), "'0'"); - sample = new TA(convertToBigInt([1, 2])); + sample = new TA([1n, 2n]); sample.set(src, false); - assert(compareArray(sample, convertToBigInt([42, 2])), "false"); + assert(compareArray(sample, [42n, 2n]), "false"); - sample = new TA(convertToBigInt([1, 2])); + sample = new TA([1n, 2n]); sample.set(src, 0.1); - assert(compareArray(sample, convertToBigInt([42, 2])), "0.1"); + assert(compareArray(sample, [42n, 2n]), "0.1"); - sample = new TA(convertToBigInt([1, 2])); + sample = new TA([1n, 2n]); sample.set(src, 0.9); - assert(compareArray(sample, convertToBigInt([42, 2])), "0.9"); + assert(compareArray(sample, [42n, 2n]), "0.9"); - sample = new TA(convertToBigInt([1, 2])); + sample = new TA([1n, 2n]); sample.set(src, -0.5); - assert(compareArray(sample, convertToBigInt([42, 2])), "-0.5"); + assert(compareArray(sample, [42n, 2n]), "-0.5"); - sample = new TA(convertToBigInt([1, 2])); + sample = new TA([1n, 2n]); sample.set(src, 1.1); - assert(compareArray(sample, convertToBigInt([1, 42])), "1.1"); + assert(compareArray(sample, [1n, 42n]), "1.1"); - sample = new TA(convertToBigInt([1, 2])); + sample = new TA([1n, 2n]); sample.set(src, NaN); - assert(compareArray(sample, convertToBigInt([42, 2])), "NaN"); + assert(compareArray(sample, [42n, 2n]), "NaN"); - sample = new TA(convertToBigInt([1, 2])); + sample = new TA([1n, 2n]); sample.set(src, null); - assert(compareArray(sample, convertToBigInt([42, 2])), "null"); + assert(compareArray(sample, [42n, 2n]), "null"); - sample = new TA(convertToBigInt([1, 2])); + sample = new TA([1n, 2n]); sample.set(src, undefined); - assert(compareArray(sample, convertToBigInt([42, 2])), "undefined"); + assert(compareArray(sample, [42n, 2n]), "undefined"); - sample = new TA(convertToBigInt([1, 2])); + sample = new TA([1n, 2n]); sample.set(src, {}); - assert(compareArray(sample, convertToBigInt([42, 2])), "{}"); + assert(compareArray(sample, [42n, 2n]), "{}"); - sample = new TA(convertToBigInt([1, 2])); + sample = new TA([1n, 2n]); sample.set(src, []); - assert(compareArray(sample, convertToBigInt([42, 2])), "[]"); + assert(compareArray(sample, [42n, 2n]), "[]"); - sample = new TA(convertToBigInt([1, 2])); + sample = new TA([1n, 2n]); sample.set(src, [0]); - assert(compareArray(sample, convertToBigInt([42, 2])), "[0]"); + assert(compareArray(sample, [42n, 2n]), "[0]"); - sample = new TA(convertToBigInt([1, 2])); + sample = new TA([1n, 2n]); sample.set(src, true); - assert(compareArray(sample, convertToBigInt([1, 42])), "true"); + assert(compareArray(sample, [1n, 42n]), "true"); - sample = new TA(convertToBigInt([1, 2])); + sample = new TA([1n, 2n]); sample.set(src, "1"); - assert(compareArray(sample, convertToBigInt([1, 42])), "'1'"); + assert(compareArray(sample, [1n, 42n]), "'1'"); - sample = new TA(convertToBigInt([1, 2])); + sample = new TA([1n, 2n]); sample.set(src, [1]); - assert(compareArray(sample, convertToBigInt([1, 42])), "[1]"); + assert(compareArray(sample, [1n, 42n]), "[1]"); - sample = new TA(convertToBigInt([1, 2])); + sample = new TA([1n, 2n]); sample.set(src, { valueOf: function() {return 1;} }); - assert(compareArray(sample, convertToBigInt([1, 42])), "valueOf"); + assert(compareArray(sample, [1n, 42n]), "valueOf"); - sample = new TA(convertToBigInt([1, 2])); + sample = new TA([1n, 2n]); sample.set(src, { toString: function() {return 1;} }); - assert(compareArray(sample, convertToBigInt([1, 42])), "toString"); + assert(compareArray(sample, [1n, 42n]), "toString"); }); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type.js index 1b1869345..4456c5dcc 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type.js @@ -28,21 +28,21 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var other = TA === BigInt64Array ? BigUint64Array : BigInt64Array; - var src = new other(convertToBigInt([42, 43])); + var src = new other([42n, 43n]); var sample, result; - sample = new TA(convertToBigInt([1, 2, 3, 4])); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 0); - assert(compareArray(sample, convertToBigInt([42, 43, 3, 4])), "offset: 0, result: " + sample); + assert(compareArray(sample, [42n, 43n, 3n, 4n]), "offset: 0, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA(convertToBigInt([1, 2, 3, 4])); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 1); - assert(compareArray(sample, convertToBigInt([1, 42, 43, 4])), "offset: 1, result: " + sample); + assert(compareArray(sample, [1n, 42n, 43n, 4n]), "offset: 1, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA(convertToBigInt([1, 2, 3, 4])); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 2); - assert(compareArray(sample, convertToBigInt([1, 2, 42, 43])), "offset: 2, result: " + sample); + assert(compareArray(sample, [1n, 2n, 42n, 43n]), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); }); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type.js index be938ca51..d806b6a6c 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type.js @@ -31,20 +31,20 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample, result; - var src = new TA(convertToBigInt([42, 43])); + var src = new TA([42n, 43n]); - sample = new TA(convertToBigInt([1, 2, 3, 4])); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 1); - assert(compareArray(sample, convertToBigInt([1, 42, 43, 4])), "offset: 1, result: " + sample); + assert(compareArray(sample, [1n, 42n, 43n, 4n]), "offset: 1, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA(convertToBigInt([1, 2, 3, 4])); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 0); - assert(compareArray(sample, convertToBigInt([42, 43, 3, 4])), "offset: 0, result: " + sample); + assert(compareArray(sample, [42n, 43n, 3n, 4n]), "offset: 0, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA(convertToBigInt([1, 2, 3, 4])); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 2); - assert(compareArray(sample, convertToBigInt([1, 2, 42, 43])), "offset: 2, result: " + sample); + assert(compareArray(sample, [1n, 2n, 42n, 43n]), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); }); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type.js index 8daad3956..ab1454760 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type.js @@ -33,21 +33,21 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample, src, result; - sample = new TA(convertToBigInt([1, 2, 3, 4])); + sample = new TA([1n, 2n, 3n, 4n]); src = new TA(sample.buffer, 0, 2); result = sample.set(src, 0); - assert(compareArray(sample, convertToBigInt([1, 2, 3, 4])), "offset: 0, result: " + sample); + assert(compareArray(sample, [1n, 2n, 3n, 4n]), "offset: 0, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA(convertToBigInt([1, 2, 3, 4])); + sample = new TA([1n, 2n, 3n, 4n]); src = new TA(sample.buffer, 0, 2); result = sample.set(src, 1); - assert(compareArray(sample, convertToBigInt([1, 1, 2, 4])), "offset: 1, result: " + sample); + assert(compareArray(sample, [1n, 1n, 2n, 4n]), "offset: 1, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); - sample = new TA(convertToBigInt([1, 2, 3, 4])); + sample = new TA([1n, 2n, 3n, 4n]); src = new TA(sample.buffer, 0, 2); result = sample.set(src, 2); - assert(compareArray(sample, convertToBigInt([1, 2, 1, 2])), "offset: 2, result: " + sample); + assert(compareArray(sample, [1n, 2n, 1n, 2n]), "offset: 2, result: " + sample); assert.sameValue(result, undefined, "returns undefined"); }); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-arraylength-internal.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-arraylength-internal.js index 9da7cbdcf..96ea335ec 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-arraylength-internal.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-arraylength-internal.js @@ -30,7 +30,7 @@ Object.defineProperty(TypedArray.prototype, "length", desc); testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA(2); - var src = new TA(convertToBigInt([42, 43])); + var src = new TA([42n, 43n]); Object.defineProperty(TA.prototype, "length", desc); Object.defineProperty(src, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-byteoffset-internal.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-byteoffset-internal.js index b75cbbd8e..35c3ace2a 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-byteoffset-internal.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-src-byteoffset-internal.js @@ -27,9 +27,9 @@ Object.defineProperty(TypedArray.prototype, "byteOffset", desc); testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA(2); - var src = new TA(convertToBigInt([42, 43])); + var src = new TA([42n, 43n]); var other = TA === BigInt64Array ? BigUint64Array : BigInt64Array; - var src2 = new other(convertToBigInt([42, 43])); + var src2 = new other([42n, 43n]); var src3 = new other(sample.buffer, 0, 2); Object.defineProperty(TA.prototype, "byteOffset", desc); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-arraylength-internal.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-arraylength-internal.js index 7eed1fff1..9f13dc2b1 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-arraylength-internal.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-arraylength-internal.js @@ -31,7 +31,7 @@ Object.defineProperty(TypedArray.prototype, "length", desc); testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA(2); - var src = new TA(convertToBigInt([42, 43])); + var src = new TA([42n, 43n]); Object.defineProperty(TA.prototype, "length", desc); Object.defineProperty(sample, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-byteoffset-internal.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-byteoffset-internal.js index ba1909dd5..13b7978fc 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-byteoffset-internal.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-byteoffset-internal.js @@ -28,9 +28,9 @@ Object.defineProperty(TypedArray.prototype, "byteOffset", desc); testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA(2); - var src = new TA(convertToBigInt([42, 43])); + var src = new TA([42n, 43n]); var other = TA === BigInt64Array ? BigUint64Array : BigInt64Array; - var src2 = new other(convertToBigInt([42, 43])); + var src2 = new other([42n, 43n]); var src3 = new other(sample.buffer, 0, 2); Object.defineProperty(TA.prototype, "byteOffset", desc); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/arraylength-internal.js b/test/built-ins/TypedArray/prototype/slice/BigInt/arraylength-internal.js index 9f97ab033..505215fb0 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/arraylength-internal.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/arraylength-internal.js @@ -24,7 +24,7 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); Object.defineProperty(TA.prototype, "length", desc); Object.defineProperty(sample, "length", desc); @@ -32,7 +32,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { var result = sample.slice(); assert.sameValue(getCalls, 0, "ignores length properties"); - assert.sameValue(result[0], convertToBigInt(42)); - assert.sameValue(result[1], convertToBigInt(43)); + assert.sameValue(result[0], 42n); + assert.sameValue(result[1], 43n); assert.sameValue(result.hasOwnProperty(2), false); }); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/infinity.js b/test/built-ins/TypedArray/prototype/slice/BigInt/infinity.js index 07f62263a..adad1dc0f 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/infinity.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/infinity.js @@ -8,10 +8,10 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); assert( - compareArray(sample.slice(-Infinity), convertToBigInt([40, 41, 42, 43])), + compareArray(sample.slice(-Infinity), [40n, 41n, 42n, 43n]), "start == -Infinity" ); assert( @@ -23,7 +23,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { "end == -Infinity" ); assert( - compareArray(sample.slice(0, Infinity), convertToBigInt([40, 41, 42, 43])), + compareArray(sample.slice(0, Infinity), [40n, 41n, 42n, 43n]), "end == Infinity" ); }); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/minus-zero.js b/test/built-ins/TypedArray/prototype/slice/BigInt/minus-zero.js index 19657957a..12245c6aa 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/minus-zero.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/minus-zero.js @@ -10,14 +10,14 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); assert( - compareArray(sample.slice(-0), convertToBigInt([40, 41, 42, 43])), + compareArray(sample.slice(-0), [40n, 41n, 42n, 43n]), "start == -0" ); assert( - compareArray(sample.slice(-0, 4), convertToBigInt([40, 41, 42, 43])), + compareArray(sample.slice(-0, 4), [40n, 41n, 42n, 43n]), "start == -0, end == length" ); assert( diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/result-does-not-copy-ordinary-properties.js b/test/built-ins/TypedArray/prototype/slice/BigInt/result-does-not-copy-ordinary-properties.js index 00b6132ac..32f3a2883 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/result-does-not-copy-ordinary-properties.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/result-does-not-copy-ordinary-properties.js @@ -10,7 +10,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([41, 42, 43, 44])); + var sample = new TA([41n, 42n, 43n, 44n]); sample.foo = 42; var result = sample.slice(); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-different-length.js b/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-different-length.js index 22c8a0abe..1db41d601 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-different-length.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-different-length.js @@ -8,46 +8,46 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); function testRes(result, expected, msg) { assert(compareArray(result, expected), msg + ", result: [" + result + "]"); } - testRes(sample.slice(1), convertToBigInt([41, 42, 43]), "begin == 1"); - testRes(sample.slice(2), convertToBigInt([42, 43]), "begin == 2"); - testRes(sample.slice(3), convertToBigInt([43]), "begin == 3"); + testRes(sample.slice(1), [41n, 42n, 43n], "begin == 1"); + testRes(sample.slice(2), [42n, 43n], "begin == 2"); + testRes(sample.slice(3), [43n], "begin == 3"); - testRes(sample.slice(1, 4), convertToBigInt([41, 42, 43]), "begin == 1, end == length"); - testRes(sample.slice(2, 4), convertToBigInt([42, 43]), "begin == 2, end == length"); - testRes(sample.slice(3, 4), convertToBigInt([43]), "begin == 3, end == length"); + testRes(sample.slice(1, 4), [41n, 42n, 43n], "begin == 1, end == length"); + testRes(sample.slice(2, 4), [42n, 43n], "begin == 2, end == length"); + testRes(sample.slice(3, 4), [43n], "begin == 3, end == length"); - testRes(sample.slice(0, 1), convertToBigInt([40]), "begin == 0, end == 1"); - testRes(sample.slice(0, 2), convertToBigInt([40, 41]), "begin == 0, end == 2"); - testRes(sample.slice(0, 3), convertToBigInt([40, 41, 42]), "begin == 0, end == 3"); + testRes(sample.slice(0, 1), [40n], "begin == 0, end == 1"); + testRes(sample.slice(0, 2), [40n, 41n], "begin == 0, end == 2"); + testRes(sample.slice(0, 3), [40n, 41n, 42n], "begin == 0, end == 3"); - testRes(sample.slice(-1), convertToBigInt([43]), "begin == -1"); - testRes(sample.slice(-2), convertToBigInt([42, 43]), "begin == -2"); - testRes(sample.slice(-3), convertToBigInt([41, 42, 43]), "begin == -3"); + testRes(sample.slice(-1), [43n], "begin == -1"); + testRes(sample.slice(-2), [42n, 43n], "begin == -2"); + testRes(sample.slice(-3), [41n, 42n, 43n], "begin == -3"); - testRes(sample.slice(-1, 4), convertToBigInt([43]), "begin == -1, end == length"); - testRes(sample.slice(-2, 4), convertToBigInt([42, 43]), "begin == -2, end == length"); - testRes(sample.slice(-3, 4), convertToBigInt([41, 42, 43]), "begin == -3, end == length"); + testRes(sample.slice(-1, 4), [43n], "begin == -1, end == length"); + testRes(sample.slice(-2, 4), [42n, 43n], "begin == -2, end == length"); + testRes(sample.slice(-3, 4), [41n, 42n, 43n], "begin == -3, end == length"); - testRes(sample.slice(0, -1), convertToBigInt([40, 41, 42]), "begin == 0, end == -1"); - testRes(sample.slice(0, -2), convertToBigInt([40, 41]), "begin == 0, end == -2"); - testRes(sample.slice(0, -3), convertToBigInt([40]), "begin == 0, end == -3"); + testRes(sample.slice(0, -1), [40n, 41n, 42n], "begin == 0, end == -1"); + testRes(sample.slice(0, -2), [40n, 41n], "begin == 0, end == -2"); + testRes(sample.slice(0, -3), [40n], "begin == 0, end == -3"); - testRes(sample.slice(-0, -1), convertToBigInt([40, 41, 42]), "begin == -0, end == -1"); - testRes(sample.slice(-0, -2), convertToBigInt([40, 41]), "begin == -0, end == -2"); - testRes(sample.slice(-0, -3), convertToBigInt([40]), "begin == -0, end == -3"); + testRes(sample.slice(-0, -1), [40n, 41n, 42n], "begin == -0, end == -1"); + testRes(sample.slice(-0, -2), [40n, 41n], "begin == -0, end == -2"); + testRes(sample.slice(-0, -3), [40n], "begin == -0, end == -3"); - testRes(sample.slice(-2, -1), convertToBigInt([42]), "length == 4, begin == -2, end == -1"); - testRes(sample.slice(1, -1), convertToBigInt([41, 42]), "length == 4, begin == 1, end == -1"); - testRes(sample.slice(1, -2), convertToBigInt([41]), "length == 4, begin == 1, end == -2"); - testRes(sample.slice(2, -1), convertToBigInt([42]), "length == 4, begin == 2, end == -1"); + testRes(sample.slice(-2, -1), [42n], "length == 4, begin == -2, end == -1"); + testRes(sample.slice(1, -1), [41n, 42n], "length == 4, begin == 1, end == -1"); + testRes(sample.slice(1, -2), [41n], "length == 4, begin == 1, end == -2"); + testRes(sample.slice(2, -1), [42n], "length == 4, begin == 2, end == -1"); - testRes(sample.slice(-1, 5), convertToBigInt([43]), "begin == -1, end > length"); - testRes(sample.slice(-2, 4), convertToBigInt([42, 43]), "begin == -2, end > length"); - testRes(sample.slice(-3, 4), convertToBigInt([41, 42, 43]), "begin == -3, end > length"); + testRes(sample.slice(-1, 5), [43n], "begin == -1, end > length"); + testRes(sample.slice(-2, 4), [42n, 43n], "begin == -2, end > length"); + testRes(sample.slice(-3, 4), [41n, 42n, 43n], "begin == -3, end > length"); }); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-empty-length.js b/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-empty-length.js index 386149b45..901805a84 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-empty-length.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-empty-length.js @@ -8,7 +8,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); function testRes(result, msg) { assert.sameValue(result.length, 0, msg); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-same-length.js b/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-same-length.js index a8cee48aa..c351ef086 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-same-length.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-same-length.js @@ -8,14 +8,14 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); function testRes(result, msg) { assert.sameValue(result.length, 4, msg); - assert.sameValue(result[0], convertToBigInt(40), msg + " & result[0] === 40"); - assert.sameValue(result[1], convertToBigInt(41), msg + " & result[1] === 41"); - assert.sameValue(result[2], convertToBigInt(42), msg + " & result[2] === 42"); - assert.sameValue(result[3], convertToBigInt(43), msg + " & result[3] === 43"); + assert.sameValue(result[0], 40n, msg + " & result[0] === 40"); + assert.sameValue(result[1], 41n, msg + " & result[1] === 41"); + assert.sameValue(result[2], 42n, msg + " & result[2] === 42"); + assert.sameValue(result[3], 43n, msg + " & result[3] === 43"); } testRes(sample.slice(0), "begin == 0"); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-abrupt.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-abrupt.js index 6294fa6b1..2a30c8664 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-abrupt.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-abrupt.js @@ -27,7 +27,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); Object.defineProperty(sample, "constructor", { get: function() { diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-inherited.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-inherited.js index 15f1e5765..d686fe084 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-inherited.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-inherited.js @@ -27,7 +27,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); var calls = 0; var result; diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-returns-throws.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-returns-throws.js index 7a742b9b8..6c2a4b88f 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-returns-throws.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor-returns-throws.js @@ -29,7 +29,7 @@ features: [BigInt, Symbol, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); sample.constructor = 42; assert.throws(TypeError, function() { diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor.js index 967579071..9d35910e5 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-ctor.js @@ -27,7 +27,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); var calls = 0; var result; diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-invocation.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-invocation.js index 5187a421f..11ddad9e1 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-invocation.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-invocation.js @@ -37,7 +37,7 @@ features: [BigInt, Symbol.species, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42])); + var sample = new TA([40n, 41n, 42n]); var result, ctorThis; sample.constructor = {}; diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js index b323cc7ec..81be8cd76 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js @@ -37,7 +37,7 @@ features: [BigInt, Symbol.species, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40])); + var sample = new TA([40n]); var other = new Int8Array([1, 0, 1]); var result; diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor.js b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor.js index 00a426e10..5965ce367 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/speciesctor-get-species-custom-ctor.js @@ -37,7 +37,7 @@ features: [BigInt, Symbol.species, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42])); + var sample = new TA([40n, 41n, 42n]); var calls = 0; var result; @@ -50,5 +50,5 @@ testWithBigIntTypedArrayConstructors(function(TA) { result = sample.slice(1); assert.sameValue(calls, 1, "ctor called once"); - assert(compareArray(result, convertToBigInt([41, 42])), "expected object"); + assert(compareArray(result, [41n, 42n]), "expected object"); }); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-end.js b/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-end.js index 979b2df9f..b43e92dc1 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-end.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-end.js @@ -21,27 +21,27 @@ var obj = { }; testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); assert(compareArray(sample.slice(0, false), []), "false"); - assert(compareArray(sample.slice(0, true), convertToBigInt([40])), "true"); + assert(compareArray(sample.slice(0, true), [40n]), "true"); assert(compareArray(sample.slice(0, NaN), []), "NaN"); assert(compareArray(sample.slice(0, null), []), "null"); - assert(compareArray(sample.slice(0, undefined), convertToBigInt([40, 41, 42, 43])), "undefined"); + assert(compareArray(sample.slice(0, undefined), [40n, 41n, 42n, 43n]), "undefined"); assert(compareArray(sample.slice(0, 0.6), []), "0.6"); - assert(compareArray(sample.slice(0, 1.1), convertToBigInt([40])), "1.1"); - assert(compareArray(sample.slice(0, 1.5), convertToBigInt([40])), "1.5"); + assert(compareArray(sample.slice(0, 1.1), [40n]), "1.1"); + assert(compareArray(sample.slice(0, 1.5), [40n]), "1.5"); assert(compareArray(sample.slice(0, -0.6), []), "-0.6"); - assert(compareArray(sample.slice(0, -1.1), convertToBigInt([40, 41, 42])), "-1.1"); - assert(compareArray(sample.slice(0, -1.5), convertToBigInt([40, 41, 42])), "-1.5"); + assert(compareArray(sample.slice(0, -1.1), [40n, 41n, 42n]), "-1.1"); + assert(compareArray(sample.slice(0, -1.5), [40n, 41n, 42n]), "-1.5"); - assert(compareArray(sample.slice(0, "3"), convertToBigInt([40, 41, 42])), "string"); + assert(compareArray(sample.slice(0, "3"), [40n, 41n, 42n]), "string"); assert( compareArray( sample.slice(0, obj), - convertToBigInt([40, 41]) + [40n, 41n] ), "object" ); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-start.js b/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-start.js index 8ce0fde83..3b5bb606c 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-start.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-start.js @@ -20,28 +20,28 @@ var obj = { }; testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); - assert(compareArray(sample.slice(false), convertToBigInt([40, 41, 42, 43])), "false"); - assert(compareArray(sample.slice(true), convertToBigInt([41, 42, 43])), "true"); + assert(compareArray(sample.slice(false), [40n, 41n, 42n, 43n]), "false"); + assert(compareArray(sample.slice(true), [41n, 42n, 43n]), "true"); - assert(compareArray(sample.slice(NaN), convertToBigInt([40, 41, 42, 43])), "NaN"); - assert(compareArray(sample.slice(null), convertToBigInt([40, 41, 42, 43])), "null"); - assert(compareArray(sample.slice(undefined), convertToBigInt([40, 41, 42, 43])), "undefined"); + assert(compareArray(sample.slice(NaN), [40n, 41n, 42n, 43n]), "NaN"); + assert(compareArray(sample.slice(null), [40n, 41n, 42n, 43n]), "null"); + assert(compareArray(sample.slice(undefined), [40n, 41n, 42n, 43n]), "undefined"); - assert(compareArray(sample.slice(1.1), convertToBigInt([41, 42, 43])), "1.1"); - assert(compareArray(sample.slice(1.5), convertToBigInt([41, 42, 43])), "1.5"); - assert(compareArray(sample.slice(0.6), convertToBigInt([40, 41, 42, 43])), "0.6"); + assert(compareArray(sample.slice(1.1), [41n, 42n, 43n]), "1.1"); + assert(compareArray(sample.slice(1.5), [41n, 42n, 43n]), "1.5"); + assert(compareArray(sample.slice(0.6), [40n, 41n, 42n, 43n]), "0.6"); - assert(compareArray(sample.slice(-1.5), convertToBigInt([43])), "-1.5"); - assert(compareArray(sample.slice(-1.1), convertToBigInt([43])), "-1.1"); - assert(compareArray(sample.slice(-0.6), convertToBigInt([40, 41, 42, 43])), "-0.6"); + assert(compareArray(sample.slice(-1.5), [43n]), "-1.5"); + assert(compareArray(sample.slice(-1.1), [43n]), "-1.1"); + assert(compareArray(sample.slice(-0.6), [40n, 41n, 42n, 43n]), "-0.6"); - assert(compareArray(sample.slice("3"), convertToBigInt([43])), "string"); + assert(compareArray(sample.slice("3"), [43n]), "string"); assert( compareArray( sample.slice(obj), - convertToBigInt([42, 43]) + [42n, 43n] ), "object" ); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-with-thisarg.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-with-thisarg.js index df0c06fc3..737691cf6 100644 --- a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-with-thisarg.js +++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-with-thisarg.js @@ -28,7 +28,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); var results = []; var thisArg = ["test262", 0, "ecma262", 0]; @@ -41,17 +41,17 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(thisArg.length, 4, "thisArg.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue"); + assert.sameValue(results[0][0], 42n, "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue"); + assert.sameValue(results[1][0], 43n, "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue"); + assert.sameValue(results[2][0], 44n, "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-without-thisarg.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-without-thisarg.js index 4f52490ef..08f138ace 100644 --- a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-without-thisarg.js +++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-arguments-without-thisarg.js @@ -28,7 +28,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); var results = []; @@ -39,17 +39,17 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(results.length, 3, "results.length"); assert.sameValue(results[0].length, 3, "results[0].length"); - assert.sameValue(results[0][0], convertToBigInt(42), "results[0][0] - kValue"); + assert.sameValue(results[0][0], 42n, "results[0][0] - kValue"); assert.sameValue(results[0][1], 0, "results[0][1] - k"); assert.sameValue(results[0][2], sample, "results[0][2] - this"); assert.sameValue(results[1].length, 3, "results[1].length"); - assert.sameValue(results[1][0], convertToBigInt(43), "results[1][0] - kValue"); + assert.sameValue(results[1][0], 43n, "results[1][0] - kValue"); assert.sameValue(results[1][1], 1, "results[1][1] - k"); assert.sameValue(results[1][2], sample, "results[1][2] - this"); assert.sameValue(results[2].length, 3, "results[2].length"); - assert.sameValue(results[2][0], convertToBigInt(44), "results[2][0] - kValue"); + assert.sameValue(results[2][0], 44n, "results[2][0] - kValue"); assert.sameValue(results[2][1], 2, "results[2][1] - k"); assert.sameValue(results[2][2], sample, "results[2][2] - this"); }); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-no-interaction-over-non-integer.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-no-interaction-over-non-integer.js index b01b5e621..df9b85c7c 100644 --- a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-no-interaction-over-non-integer.js +++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-no-interaction-over-non-integer.js @@ -19,7 +19,7 @@ features: [BigInt, Symbol, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([7, 8])); + var sample = new TA([7n, 8n]); var results = []; @@ -35,6 +35,6 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(results[0][1], 0, "results[0][1] - key"); assert.sameValue(results[1][1], 1, "results[1][1] - key"); - assert.sameValue(results[0][0], convertToBigInt(7), "results[0][0] - value"); - assert.sameValue(results[1][0], convertToBigInt(8), "results[1][0] - value"); + assert.sameValue(results[0][0], 7n, "results[0][0] - value"); + assert.sameValue(results[1][0], 8n, "results[1][0] - value"); }); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-return-does-not-change-instance.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-return-does-not-change-instance.js index 19a6337d0..2ea584f16 100644 --- a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-return-does-not-change-instance.js +++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-return-does-not-change-instance.js @@ -26,13 +26,13 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42])); + var sample = new TA([40n, 41n, 42n]); sample.some(function() { return 0; }); - assert.sameValue(sample[0], convertToBigInt(40), "[0] == 40"); - assert.sameValue(sample[1], convertToBigInt(41), "[1] == 41"); - assert.sameValue(sample[2], convertToBigInt(42), "[2] == 42"); + assert.sameValue(sample[0], 40n, "[0] == 40"); + assert.sameValue(sample[1], 41n, "[1] == 41"); + assert.sameValue(sample[2], 42n, "[2] == 42"); }); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-set-value-during-interaction.js index 4a2331d42..641b2a0cb 100644 --- a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-set-value-during-interaction.js +++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-set-value-during-interaction.js @@ -26,7 +26,7 @@ features: [BigInt, Reflect.set, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); var newVal = 0; sample.some(function(val, i) { @@ -36,7 +36,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { "get the changed value during the loop" ); assert.sameValue( - Reflect.set(sample, 0, convertToBigInt(7)), + Reflect.set(sample, 0, 7n), true, "re-set a value for sample[0]" ); @@ -50,7 +50,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { newVal++; }); - assert.sameValue(sample[0], convertToBigInt(7), "changed values after iteration [0] == 7"); - assert.sameValue(sample[1], convertToBigInt(1), "changed values after iteration [1] == 1"); - assert.sameValue(sample[2], convertToBigInt(2), "changed values after iteration [2] == 2"); + assert.sameValue(sample[0], 7n, "changed values after iteration [0] == 7"); + assert.sameValue(sample[1], 1n, "changed values after iteration [1] == 1"); + assert.sameValue(sample[2], 2n, "changed values after iteration [2] == 2"); }); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/some/BigInt/get-length-uses-internal-arraylength.js index 2135d10ca..bca0d658f 100644 --- a/test/built-ins/TypedArray/prototype/some/BigInt/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/some/BigInt/get-length-uses-internal-arraylength.js @@ -31,7 +31,7 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); var calls = 0; Object.defineProperty(TA.prototype, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/values-are-not-cached.js b/test/built-ins/TypedArray/prototype/some/BigInt/values-are-not-cached.js index bd1d209f8..c4918d6bb 100644 --- a/test/built-ins/TypedArray/prototype/some/BigInt/values-are-not-cached.js +++ b/test/built-ins/TypedArray/prototype/some/BigInt/values-are-not-cached.js @@ -26,15 +26,15 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44])); + var sample = new TA([42n, 43n, 44n]); sample.some(function(v, i) { if (i < sample.length - 1) { - sample[i+1] = convertToBigInt(42); + sample[i+1] = 42n; } assert.sameValue( - v, convertToBigInt(42), "method does not cache values before callbackfn calls" + v, 42n, "method does not cache values before callbackfn calls" ); }); }); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/arraylength-internal.js b/test/built-ins/TypedArray/prototype/sort/BigInt/arraylength-internal.js index b8436a5f3..8a3d5a7f8 100644 --- a/test/built-ins/TypedArray/prototype/sort/BigInt/arraylength-internal.js +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/arraylength-internal.js @@ -23,7 +23,7 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 42, 42])); + var sample = new TA([42n, 42n, 42n]); getCalls = 0; Object.defineProperty(TA.prototype, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-call-throws.js b/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-call-throws.js index d319341a7..668f33e06 100644 --- a/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-call-throws.js +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-call-throws.js @@ -26,7 +26,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44, 45, 46])); + var sample = new TA([42n, 43n, 44n, 45n, 46n]); var calls = 0; var comparefn = function() { diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-calls.js b/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-calls.js index c058cddac..0e8846c13 100644 --- a/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-calls.js +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-calls.js @@ -23,7 +23,7 @@ var expectedThis = (function() { })(); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 42, 42, 42, 42])); + var sample = new TA([42n, 42n, 42n, 42n, 42n]); var calls = []; var comparefn = function() { @@ -36,7 +36,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { calls.forEach(function(args) { assert.sameValue(args[0], expectedThis, "comparefn is called no specific this"); assert.sameValue(args[1].length, 2, "comparefn is always called with 2 args"); - assert.sameValue(args[1][0], convertToBigInt(42), "x is a listed value"); - assert.sameValue(args[1][0], convertToBigInt(42), "y is a listed value"); + assert.sameValue(args[1][0], 42n, "x is a listed value"); + assert.sameValue(args[1][0], 42n, "y is a listed value"); }); }); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-nonfunction-call-throws.js b/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-nonfunction-call-throws.js index 80f23f618..4770b66da 100644 --- a/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-nonfunction-call-throws.js +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/comparefn-nonfunction-call-throws.js @@ -19,7 +19,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43, 44, 45, 46])); + var sample = new TA([42n, 43n, 44n, 45n, 46n]); assert.throws(TypeError, function() { sample.sort(null); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/return-same-instance.js b/test/built-ins/TypedArray/prototype/sort/BigInt/return-same-instance.js index d3ad6056f..702f45015 100644 --- a/test/built-ins/TypedArray/prototype/sort/BigInt/return-same-instance.js +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/return-same-instance.js @@ -15,7 +15,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([2, 1])); + var sample = new TA([2n, 1n]); var result = sample.sort(); assert.sameValue(sample, result, "without comparefn"); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/sortcompare-with-no-tostring.js b/test/built-ins/TypedArray/prototype/sort/BigInt/sortcompare-with-no-tostring.js index b7f73c650..3f6402c66 100644 --- a/test/built-ins/TypedArray/prototype/sort/BigInt/sortcompare-with-no-tostring.js +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/sortcompare-with-no-tostring.js @@ -21,7 +21,7 @@ features: [BigInt, TypedArray] var origToString = Number.prototype.toString; testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([20, 100, 3])); + var sample = new TA([20n, 100n, 3n]); var result = sample.sort(); - assert(compareArray(result, convertToBigInt([3, 20, 100]))); + assert(compareArray(result, [3n, 20n, 100n])); }); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js b/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js index 588f1b49f..50d6e22fe 100644 --- a/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js @@ -17,17 +17,17 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample; - sample = new TA(convertToBigInt([4, 3, 2, 1])).sort(); - assert(compareArray(sample, convertToBigInt([1, 2, 3, 4])), "descending values"); + sample = new TA([4n, 3n, 2n, 1n]).sort(); + assert(compareArray(sample, [1n, 2n, 3n, 4n]), "descending values"); - sample = new TA(convertToBigInt([3, 4, 1, 2])).sort(); - assert(compareArray(sample, convertToBigInt([1, 2, 3, 4])), "mixed numbers"); + sample = new TA([3n, 4n, 1n, 2n]).sort(); + assert(compareArray(sample, [1n, 2n, 3n, 4n]), "mixed numbers"); - sample = new TA(convertToBigInt([3, 4, 3, 1, 0, 1, 2])).sort(); - assert(compareArray(sample, convertToBigInt([0, 1, 1, 2, 3, 3, 4])), "repeating numbers"); + sample = new TA([3n, 4n, 3n, 1n, 0n, 1n, 2n]).sort(); + assert(compareArray(sample, [0n, 1n, 1n, 2n, 3n, 3n, 4n]), "repeating numbers"); sample = new TA(convertToBigInt([1, 0, -0, 2])).sort(); - assert(compareArray(sample, convertToBigInt([0, 0, 1, 2])), "0s"); + assert(compareArray(sample, [0n, 0n, 1n, 2n]), "0s"); }); testWithBigIntTypedArrayConstructors(function(TA) { diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/infinity.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/infinity.js index 0ac7cb592..fc6786978 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/infinity.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/infinity.js @@ -10,10 +10,10 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); assert( - compareArray(sample.subarray(-Infinity), convertToBigInt([40, 41, 42, 43])), + compareArray(sample.subarray(-Infinity), [40n, 41n, 42n, 43n]), "begin == -Infinity" ); assert( @@ -25,7 +25,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { "end == -Infinity" ); assert( - compareArray(sample.subarray(0, Infinity), convertToBigInt([40, 41, 42, 43])), + compareArray(sample.subarray(0, Infinity), [40n, 41n, 42n, 43n]), "end == Infinity" ); }); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/minus-zero.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/minus-zero.js index a0349c375..b71e445c7 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/minus-zero.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/minus-zero.js @@ -10,14 +10,14 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); assert( - compareArray(sample.subarray(-0), convertToBigInt([40, 41, 42, 43])), + compareArray(sample.subarray(-0), [40n, 41n, 42n, 43n]), "begin == -0" ); assert( - compareArray(sample.subarray(-0, 4), convertToBigInt([40, 41, 42, 43])), + compareArray(sample.subarray(-0, 4), [40n, 41n, 42n, 43n]), "being == -0, end == length" ); assert( diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/result-does-not-copy-ordinary-properties.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/result-does-not-copy-ordinary-properties.js index 17f2b3a4c..af87b3756 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/result-does-not-copy-ordinary-properties.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/result-does-not-copy-ordinary-properties.js @@ -13,7 +13,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([41, 42, 43, 44])); + var sample = new TA([41n, 42n, 43n, 44n]); var result; sample.foo = 42; diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-from-same-ctor.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-from-same-ctor.js index d4b9a09a7..0d0362394 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-from-same-ctor.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-from-same-ctor.js @@ -13,7 +13,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); var result = sample.subarray(1); assert.sameValue( @@ -25,7 +25,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert(result instanceof TA, "instanceof"); assert( - compareArray(sample, convertToBigInt([40, 41, 42, 43])), + compareArray(sample, [40n, 41n, 42n, 43n]), "original sample remains the same" ); }); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-with-shared-buffer.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-with-shared-buffer.js index 87801c85e..ee1198833 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-with-shared-buffer.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/result-is-new-instance-with-shared-buffer.js @@ -13,7 +13,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); var buffer = sample.buffer; var result = sample.subarray(1); @@ -21,15 +21,15 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue(result.buffer, sample.buffer, "shared buffer"); assert.sameValue(sample.buffer, buffer, "original buffer is preserved"); - sample[1] = convertToBigInt(100); + sample[1] = 100n; assert( - compareArray(result, convertToBigInt([100, 42, 43])), + compareArray(result, [100n, 42n, 43n]), "changes on the original sample values affect the new instance" ); - result[1] = convertToBigInt(111); + result[1] = 111n; assert( - compareArray(sample, convertToBigInt([40, 100, 111, 43])), + compareArray(sample, [40n, 100n, 111n, 43n]), "changes on the new instance values affect the original sample" ); }); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-different-length.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-different-length.js index 3be58ad56..ff0787469 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-different-length.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-different-length.js @@ -13,46 +13,46 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); function testRes(result, expected, msg) { assert(compareArray(result, expected), msg + ", result: [" + result + "]"); } - testRes(sample.subarray(1), convertToBigInt([41, 42, 43]), "begin == 1"); - testRes(sample.subarray(2), convertToBigInt([42, 43]), "begin == 2"); - testRes(sample.subarray(3), convertToBigInt([43]), "begin == 3"); + testRes(sample.subarray(1), [41n, 42n, 43n], "begin == 1"); + testRes(sample.subarray(2), [42n, 43n], "begin == 2"); + testRes(sample.subarray(3), [43n], "begin == 3"); - testRes(sample.subarray(1, 4), convertToBigInt([41, 42, 43]), "begin == 1, end == length"); - testRes(sample.subarray(2, 4), convertToBigInt([42, 43]), "begin == 2, end == length"); - testRes(sample.subarray(3, 4), convertToBigInt([43]), "begin == 3, end == length"); + testRes(sample.subarray(1, 4), [41n, 42n, 43n], "begin == 1, end == length"); + testRes(sample.subarray(2, 4), [42n, 43n], "begin == 2, end == length"); + testRes(sample.subarray(3, 4), [43n], "begin == 3, end == length"); - testRes(sample.subarray(0, 1), convertToBigInt([40]), "begin == 0, end == 1"); - testRes(sample.subarray(0, 2), convertToBigInt([40, 41]), "begin == 0, end == 2"); - testRes(sample.subarray(0, 3), convertToBigInt([40, 41, 42]), "begin == 0, end == 3"); + testRes(sample.subarray(0, 1), [40n], "begin == 0, end == 1"); + testRes(sample.subarray(0, 2), [40n, 41n], "begin == 0, end == 2"); + testRes(sample.subarray(0, 3), [40n, 41n, 42n], "begin == 0, end == 3"); - testRes(sample.subarray(-1), convertToBigInt([43]), "begin == -1"); - testRes(sample.subarray(-2), convertToBigInt([42, 43]), "begin == -2"); - testRes(sample.subarray(-3), convertToBigInt([41, 42, 43]), "begin == -3"); + testRes(sample.subarray(-1), [43n], "begin == -1"); + testRes(sample.subarray(-2), [42n, 43n], "begin == -2"); + testRes(sample.subarray(-3), [41n, 42n, 43n], "begin == -3"); - testRes(sample.subarray(-1, 4), convertToBigInt([43]), "begin == -1, end == length"); - testRes(sample.subarray(-2, 4), convertToBigInt([42, 43]), "begin == -2, end == length"); - testRes(sample.subarray(-3, 4), convertToBigInt([41, 42, 43]), "begin == -3, end == length"); + testRes(sample.subarray(-1, 4), [43n], "begin == -1, end == length"); + testRes(sample.subarray(-2, 4), [42n, 43n], "begin == -2, end == length"); + testRes(sample.subarray(-3, 4), [41n, 42n, 43n], "begin == -3, end == length"); - testRes(sample.subarray(0, -1), convertToBigInt([40, 41, 42]), "begin == 0, end == -1"); - testRes(sample.subarray(0, -2), convertToBigInt([40, 41]), "begin == 0, end == -2"); - testRes(sample.subarray(0, -3), convertToBigInt([40]), "begin == 0, end == -3"); + testRes(sample.subarray(0, -1), [40n, 41n, 42n], "begin == 0, end == -1"); + testRes(sample.subarray(0, -2), [40n, 41n], "begin == 0, end == -2"); + testRes(sample.subarray(0, -3), [40n], "begin == 0, end == -3"); - testRes(sample.subarray(-0, -1), convertToBigInt([40, 41, 42]), "begin == -0, end == -1"); - testRes(sample.subarray(-0, -2), convertToBigInt([40, 41]), "begin == -0, end == -2"); - testRes(sample.subarray(-0, -3), convertToBigInt([40]), "begin == -0, end == -3"); + testRes(sample.subarray(-0, -1), [40n, 41n, 42n], "begin == -0, end == -1"); + testRes(sample.subarray(-0, -2), [40n, 41n], "begin == -0, end == -2"); + testRes(sample.subarray(-0, -3), [40n], "begin == -0, end == -3"); - testRes(sample.subarray(-2, -1), convertToBigInt([42]), "length == 4, begin == -2, end == -1"); - testRes(sample.subarray(1, -1), convertToBigInt([41, 42]), "length == 4, begin == 1, end == -1"); - testRes(sample.subarray(1, -2), convertToBigInt([41]), "length == 4, begin == 1, end == -2"); - testRes(sample.subarray(2, -1), convertToBigInt([42]), "length == 4, begin == 2, end == -1"); + testRes(sample.subarray(-2, -1), [42n], "length == 4, begin == -2, end == -1"); + testRes(sample.subarray(1, -1), [41n, 42n], "length == 4, begin == 1, end == -1"); + testRes(sample.subarray(1, -2), [41n], "length == 4, begin == 1, end == -2"); + testRes(sample.subarray(2, -1), [42n], "length == 4, begin == 2, end == -1"); - testRes(sample.subarray(-1, 5), convertToBigInt([43]), "begin == -1, end > length"); - testRes(sample.subarray(-2, 4), convertToBigInt([42, 43]), "begin == -2, end > length"); - testRes(sample.subarray(-3, 4), convertToBigInt([41, 42, 43]), "begin == -3, end > length"); + testRes(sample.subarray(-1, 5), [43n], "begin == -1, end > length"); + testRes(sample.subarray(-2, 4), [42n, 43n], "begin == -2, end > length"); + testRes(sample.subarray(-3, 4), [41n, 42n, 43n], "begin == -3, end > length"); }); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-empty-length.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-empty-length.js index f31ec8448..310d1bc6d 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-empty-length.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-empty-length.js @@ -13,7 +13,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); function testRes(result, msg) { assert.sameValue(result.length, 0, msg); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-same-length.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-same-length.js index 8e51f899f..79e579374 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-same-length.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/results-with-same-length.js @@ -13,14 +13,14 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); function testRes(result, msg) { assert.sameValue(result.length, 4, msg); - assert.sameValue(result[0], convertToBigInt(40), msg + " & result[0] === 40"); - assert.sameValue(result[1], convertToBigInt(41), msg + " & result[1] === 41"); - assert.sameValue(result[2], convertToBigInt(42), msg + " & result[2] === 42"); - assert.sameValue(result[3], convertToBigInt(43), msg + " & result[3] === 43"); + assert.sameValue(result[0], 40n, msg + " & result[0] === 40"); + assert.sameValue(result[1], 41n, msg + " & result[1] === 41"); + assert.sameValue(result[2], 42n, msg + " & result[2] === 42"); + assert.sameValue(result[3], 43n, msg + " & result[3] === 43"); } testRes(sample.subarray(0), "begin == 0"); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-abrupt.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-abrupt.js index 5f66e654f..9ed4e0900 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-abrupt.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-abrupt.js @@ -26,7 +26,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); Object.defineProperty(sample, "constructor", { get: function() { diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-inherited.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-inherited.js index 0e70b7051..67841f442 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-inherited.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-inherited.js @@ -26,7 +26,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); var calls = 0; var result; diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-returns-throws.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-returns-throws.js index fc8c9cad0..696732371 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-returns-throws.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor-returns-throws.js @@ -28,7 +28,7 @@ features: [BigInt, Symbol, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); sample.constructor = 42; assert.throws(TypeError, function() { diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor.js index e552af771..a05460004 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-ctor.js @@ -26,7 +26,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); var calls = 0; var result; diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-invocation.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-invocation.js index 1747a44ea..ebde38088 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-invocation.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-invocation.js @@ -36,7 +36,7 @@ features: [BigInt, Symbol.species, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42])); + var sample = new TA([40n, 41n, 42n]); var expectedOffset = TA.BYTES_PER_ELEMENT; var result, ctorThis; diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js index 1993db3f6..ee537263a 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js @@ -36,7 +36,7 @@ features: [BigInt, Symbol.species, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40])); + var sample = new TA([40n]); var other = new Int8Array([1, 0, 1]); var result; diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor.js index 7b11bb596..01b0dbd9b 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/speciesctor-get-species-custom-ctor.js @@ -36,7 +36,7 @@ features: [BigInt, Symbol.species, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42])); + var sample = new TA([40n, 41n, 42n]); var calls = 0; var result; @@ -49,5 +49,5 @@ testWithBigIntTypedArrayConstructors(function(TA) { result = sample.subarray(1); assert.sameValue(calls, 1, "ctor called once"); - assert(compareArray(result, convertToBigInt([41, 42])), "expected subarray"); + assert(compareArray(result, [41n, 42n]), "expected subarray"); }); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-begin.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-begin.js index 6a7885155..3d9ff3c0f 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-begin.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-begin.js @@ -20,28 +20,28 @@ var obj = { }; testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); - assert(compareArray(sample.subarray(false), convertToBigInt([40, 41, 42, 43])), "false"); - assert(compareArray(sample.subarray(true), convertToBigInt([41, 42, 43])), "true"); + assert(compareArray(sample.subarray(false), [40n, 41n, 42n, 43n]), "false"); + assert(compareArray(sample.subarray(true), [41n, 42n, 43n]), "true"); - assert(compareArray(sample.subarray(NaN), convertToBigInt([40, 41, 42, 43])), "NaN"); - assert(compareArray(sample.subarray(null), convertToBigInt([40, 41, 42, 43])), "null"); - assert(compareArray(sample.subarray(undefined), convertToBigInt([40, 41, 42, 43])), "undefined"); + assert(compareArray(sample.subarray(NaN), [40n, 41n, 42n, 43n]), "NaN"); + assert(compareArray(sample.subarray(null), [40n, 41n, 42n, 43n]), "null"); + assert(compareArray(sample.subarray(undefined), [40n, 41n, 42n, 43n]), "undefined"); - assert(compareArray(sample.subarray(1.1), convertToBigInt([41, 42, 43])), "1.1"); - assert(compareArray(sample.subarray(1.5), convertToBigInt([41, 42, 43])), "1.5"); - assert(compareArray(sample.subarray(0.6), convertToBigInt([40, 41, 42, 43])), "0.6"); + assert(compareArray(sample.subarray(1.1), [41n, 42n, 43n]), "1.1"); + assert(compareArray(sample.subarray(1.5), [41n, 42n, 43n]), "1.5"); + assert(compareArray(sample.subarray(0.6), [40n, 41n, 42n, 43n]), "0.6"); - assert(compareArray(sample.subarray(-1.5), convertToBigInt([43])), "-1.5"); - assert(compareArray(sample.subarray(-1.1), convertToBigInt([43])), "-1.1"); - assert(compareArray(sample.subarray(-0.6), convertToBigInt([40, 41, 42, 43])), "-0.6"); + assert(compareArray(sample.subarray(-1.5), [43n]), "-1.5"); + assert(compareArray(sample.subarray(-1.1), [43n]), "-1.1"); + assert(compareArray(sample.subarray(-0.6), [40n, 41n, 42n, 43n]), "-0.6"); - assert(compareArray(sample.subarray("3"), convertToBigInt([43])), "string"); + assert(compareArray(sample.subarray("3"), [43n]), "string"); assert( compareArray( sample.subarray(obj), - convertToBigInt([42, 43]) + [42n, 43n] ), "object" ); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-end.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-end.js index f847b6d27..8885220a3 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-end.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-end.js @@ -21,27 +21,27 @@ var obj = { }; testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([40, 41, 42, 43])); + var sample = new TA([40n, 41n, 42n, 43n]); assert(compareArray(sample.subarray(0, false), []), "false"); - assert(compareArray(sample.subarray(0, true), convertToBigInt([40])), "true"); + assert(compareArray(sample.subarray(0, true), [40n]), "true"); assert(compareArray(sample.subarray(0, NaN), []), "NaN"); assert(compareArray(sample.subarray(0, null), []), "null"); - assert(compareArray(sample.subarray(0, undefined), convertToBigInt([40, 41, 42, 43])), "undefined"); + assert(compareArray(sample.subarray(0, undefined), [40n, 41n, 42n, 43n]), "undefined"); assert(compareArray(sample.subarray(0, 0.6), []), "0.6"); - assert(compareArray(sample.subarray(0, 1.1), convertToBigInt([40])), "1.1"); - assert(compareArray(sample.subarray(0, 1.5), convertToBigInt([40])), "1.5"); + assert(compareArray(sample.subarray(0, 1.1), [40n]), "1.1"); + assert(compareArray(sample.subarray(0, 1.5), [40n]), "1.5"); assert(compareArray(sample.subarray(0, -0.6), []), "-0.6"); - assert(compareArray(sample.subarray(0, -1.1), convertToBigInt([40, 41, 42])), "-1.1"); - assert(compareArray(sample.subarray(0, -1.5), convertToBigInt([40, 41, 42])), "-1.5"); + assert(compareArray(sample.subarray(0, -1.1), [40n, 41n, 42n]), "-1.1"); + assert(compareArray(sample.subarray(0, -1.5), [40n, 41n, 42n]), "-1.5"); - assert(compareArray(sample.subarray(0, "3"), convertToBigInt([40, 41, 42])), "string"); + assert(compareArray(sample.subarray(0, "3"), [40n, 41n, 42n]), "string"); assert( compareArray( sample.subarray(0, obj), - convertToBigInt([40, 41]) + [40n, 41n] ), "object" ); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/get-length-uses-internal-arraylength.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/get-length-uses-internal-arraylength.js index f1662225c..688cfb239 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/get-length-uses-internal-arraylength.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/get-length-uses-internal-arraylength.js @@ -31,7 +31,7 @@ var desc = { Object.defineProperty(TypedArray.prototype, "length", desc); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); Object.defineProperty(TA.prototype, "length", desc); Object.defineProperty(sample, "length", desc); diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/iter-prototype.js b/test/built-ins/TypedArray/prototype/values/BigInt/iter-prototype.js index 72b1bd610..607aa0256 100644 --- a/test/built-ins/TypedArray/prototype/values/BigInt/iter-prototype.js +++ b/test/built-ins/TypedArray/prototype/values/BigInt/iter-prototype.js @@ -18,7 +18,7 @@ features: [BigInt, Symbol.iterator, TypedArray] var ArrayIteratorProto = Object.getPrototypeOf([][Symbol.iterator]()); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([0, 42, 64])); + var sample = new TA([0n, 42n, 64n]); var iter = sample.values(); assert.sameValue(Object.getPrototypeOf(iter), ArrayIteratorProto); diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/return-itor.js b/test/built-ins/TypedArray/prototype/values/BigInt/return-itor.js index 576a97a0e..dc2904754 100644 --- a/test/built-ins/TypedArray/prototype/values/BigInt/return-itor.js +++ b/test/built-ins/TypedArray/prototype/values/BigInt/return-itor.js @@ -20,15 +20,15 @@ testWithBigIntTypedArrayConstructors(function(TA) { var itor = typedArray.values(); var next = itor.next(); - assert.sameValue(next.value, convertToBigInt(0)); + assert.sameValue(next.value, 0n); assert.sameValue(next.done, false); next = itor.next(); - assert.sameValue(next.value, convertToBigInt(42)); + assert.sameValue(next.value, 42n); assert.sameValue(next.done, false); next = itor.next(); - assert.sameValue(next.value, convertToBigInt(64)); + assert.sameValue(next.value, 64n); assert.sameValue(next.done, false); next = itor.next(); diff --git a/test/built-ins/TypedArrays/ctors-bigint/length-arg/init-zeros.js b/test/built-ins/TypedArrays/ctors-bigint/length-arg/init-zeros.js index 41bb0a8e2..78d52f9ae 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/length-arg/init-zeros.js +++ b/test/built-ins/TypedArrays/ctors-bigint/length-arg/init-zeros.js @@ -43,13 +43,13 @@ features: [BigInt, TypedArray] testWithTypedArrayConstructors(function(TA) { var subject = new TA(9); - assert.sameValue(subject[0], convertToBigInt(0), 'index 0'); - assert.sameValue(subject[1], convertToBigInt(0), 'index 1'); - assert.sameValue(subject[2], convertToBigInt(0), 'index 2'); - assert.sameValue(subject[3], convertToBigInt(0), 'index 3'); - assert.sameValue(subject[4], convertToBigInt(0), 'index 4'); - assert.sameValue(subject[5], convertToBigInt(0), 'index 5'); - assert.sameValue(subject[6], convertToBigInt(0), 'index 6'); - assert.sameValue(subject[7], convertToBigInt(0), 'index 7'); - assert.sameValue(subject[8], convertToBigInt(0), 'index 8'); + assert.sameValue(subject[0], 0n, 'index 0'); + assert.sameValue(subject[1], 0n, 'index 1'); + assert.sameValue(subject[2], 0n, 'index 2'); + assert.sameValue(subject[3], 0n, 'index 3'); + assert.sameValue(subject[4], 0n, 'index 4'); + assert.sameValue(subject[5], 0n, 'index 5'); + assert.sameValue(subject[6], 0n, 'index 6'); + assert.sameValue(subject[7], 0n, 'index 7'); + assert.sameValue(subject[8], 0n, 'index 8'); }); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-array-returns.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-array-returns.js index 84ada078a..ee21ba4cf 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-array-returns.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-array-returns.js @@ -21,8 +21,8 @@ var obj = [7, 42]; testWithTypedArrayConstructors(function(TA) { var typedArray = new TA(convertToBigInt(obj)); assert.sameValue(typedArray.length, 2); - assert.sameValue(typedArray[0], convertToBigInt(7)); - assert.sameValue(typedArray[1], convertToBigInt(42)); + assert.sameValue(typedArray[0], 7n); + assert.sameValue(typedArray[1], 42n); assert.sameValue(typedArray.constructor, TA); assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); }); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-generator-iterable-returns.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-generator-iterable-returns.js index db9597546..c7236d4ad 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-generator-iterable-returns.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-generator-iterable-returns.js @@ -18,13 +18,13 @@ features: [BigInt, TypedArray] testWithTypedArrayConstructors(function(TA) { var obj = (function *() { - yield convertToBigInt(7); yield convertToBigInt(42); + yield 7n; yield 42n; })(); var typedArray = new TA(obj); assert.sameValue(typedArray.length, 2); - assert.sameValue(typedArray[0], convertToBigInt(7)); - assert.sameValue(typedArray[1], convertToBigInt(42)); + assert.sameValue(typedArray[0], 7n); + assert.sameValue(typedArray[1], 42n); assert.sameValue(typedArray.constructor, TA); assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); }); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-new-instance-extensibility.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-new-instance-extensibility.js index 9536f2456..553714277 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-new-instance-extensibility.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-new-instance-extensibility.js @@ -31,9 +31,9 @@ features: [BigInt, TypedArray] testWithTypedArrayConstructors(function(TA) { var obj = { - "0": convertToBigInt(0), - "1": convertToBigInt(1), - "2": convertToBigInt(2), + "0": 0n, + "1": 1n, + "2": 2n, length: 3 }; diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-from-property.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-from-property.js index 41e153911..340d5da44 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-from-property.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-from-property.js @@ -32,8 +32,8 @@ Object.defineProperty(obj, "2", { }); testWithTypedArrayConstructors(function(TA) { - obj[0] = convertToBigInt(0); - obj[1] = convertToBigInt(0); + obj[0] = 0n; + obj[1] = 0n; assert.throws(Test262Error, function() { new TA(obj); }); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive-typeerror.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive-typeerror.js index 50dd3b1a3..68d8c0f63 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive-typeerror.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive-typeerror.js @@ -69,7 +69,7 @@ testWithTypedArrayConstructors(function(TA) { }; assert.throws(TypeError, function() { - new TA([convertToBigInt(8), sample]); + new TA([8n, sample]); }, "abrupt completion from sample @@toPrimitive"); assert.sameValue(toPrimitive, 1, "toPrimitive was called once"); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive.js index f468bdea7..f8fc44562 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-to-primitive.js @@ -67,7 +67,7 @@ testWithTypedArrayConstructors(function(TA) { }; assert.throws(Test262Error, function() { - new TA([convertToBigInt(8), sample]); + new TA([8n, sample]); }, "abrupt completion from sample @@toPrimitive"); assert.sameValue(toPrimitive, 1, "toPrimitive was called once"); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-tostring.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-tostring.js index 1b507ccbf..6ce9f8ca5 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-tostring.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-tostring.js @@ -80,7 +80,7 @@ testWithTypedArrayConstructors(function(TA) { }; assert.throws(Test262Error, function() { - new TA([convertToBigInt(8), sample]); + new TA([8n, sample]); }, "abrupt completion from ToNumber(sample)"); assert.sameValue(valueOf, 1, "valueOf called once"); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof-typeerror.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof-typeerror.js index aeb3eb632..c0f9e7269 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof-typeerror.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof-typeerror.js @@ -81,7 +81,7 @@ testWithTypedArrayConstructors(function(TA) { }; assert.throws(TypeError, function() { - new TA([convertToBigInt(8), sample]); + new TA([8n, sample]); }, "abrupt completion from ToNumber(sample)"); assert.sameValue(valueOf, 1, "valueOf called once"); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof.js index 361426d2c..6919d931a 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-obj-valueof.js @@ -75,7 +75,7 @@ testWithTypedArrayConstructors(function(TA) { }; assert.throws(Test262Error, function() { - new TA([convertToBigInt(8), sample]); + new TA([8n, sample]); }, "abrupt completion from ToNumber(sample)"); assert.sameValue(valueOf, 1, "valueOf called once"); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-property.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-property.js index df7564b9d..b752780da 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-property.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-throws-setting-property.js @@ -32,8 +32,8 @@ var obj = { }; testWithTypedArrayConstructors(function(TA) { - obj[0] = convertToBigInt(0); - obj[1] = convertToBigInt(0); + obj[0] = 0n; + obj[1] = 0n; assert.throws(Test262Error, function() { new TA(obj); }); diff --git a/test/built-ins/TypedArrays/from/BigInt/custom-ctor-returns-other-instance.js b/test/built-ins/TypedArrays/from/BigInt/custom-ctor-returns-other-instance.js index 14f59cfd4..b2102fe1b 100644 --- a/test/built-ins/TypedArrays/from/BigInt/custom-ctor-returns-other-instance.js +++ b/test/built-ins/TypedArrays/from/BigInt/custom-ctor-returns-other-instance.js @@ -24,10 +24,10 @@ features: [BigInt, Symbol.iterator, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sourceItor = convertToBigInt([1, 2]); + var sourceItor = [1n, 2n]; var sourceObj = { - 0: convertToBigInt(0), - 1: convertToBigInt(0), + 0: 0n, + 1: 0n, length: 2 }; diff --git a/test/built-ins/TypedArrays/from/BigInt/mapfn-arguments.js b/test/built-ins/TypedArrays/from/BigInt/mapfn-arguments.js index a84021d47..d39985829 100644 --- a/test/built-ins/TypedArrays/from/BigInt/mapfn-arguments.js +++ b/test/built-ins/TypedArrays/from/BigInt/mapfn-arguments.js @@ -27,7 +27,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { k: k, argsLength: arguments.length }); - return convertToBigInt(0); + return 0n; }; TA.from(source, mapfn); diff --git a/test/built-ins/TypedArrays/from/BigInt/mapfn-this-with-thisarg.js b/test/built-ins/TypedArrays/from/BigInt/mapfn-this-with-thisarg.js index b748126af..24eebdf81 100644 --- a/test/built-ins/TypedArrays/from/BigInt/mapfn-this-with-thisarg.js +++ b/test/built-ins/TypedArrays/from/BigInt/mapfn-this-with-thisarg.js @@ -26,7 +26,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { var results = []; var mapfn = function() { results.push(this); - return convertToBigInt(0); + return 0n; }; TA.from(source, mapfn, thisArg); diff --git a/test/built-ins/TypedArrays/from/BigInt/mapfn-this-without-thisarg-strict.js b/test/built-ins/TypedArrays/from/BigInt/mapfn-this-without-thisarg-strict.js index 9b575c2a9..f8f0b282f 100644 --- a/test/built-ins/TypedArrays/from/BigInt/mapfn-this-without-thisarg-strict.js +++ b/test/built-ins/TypedArrays/from/BigInt/mapfn-this-without-thisarg-strict.js @@ -26,7 +26,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { var results = []; var mapfn = function() { results.push(this); - return convertToBigInt(0); + return 0n; }; TA.from(source, mapfn); diff --git a/test/built-ins/TypedArrays/from/BigInt/new-instance-using-custom-ctor.js b/test/built-ins/TypedArrays/from/BigInt/new-instance-using-custom-ctor.js index 7e6bc6169..82a37b242 100644 --- a/test/built-ins/TypedArrays/from/BigInt/new-instance-using-custom-ctor.js +++ b/test/built-ins/TypedArrays/from/BigInt/new-instance-using-custom-ctor.js @@ -21,9 +21,9 @@ testWithBigIntTypedArrayConstructors(function(TA) { var result = TA.from.call(ctor, convertToBigInt(source)); assert.sameValue(result.length, 3); - assert.sameValue(result[0], convertToBigInt(42)); - assert.sameValue(result[1], convertToBigInt(43)); - assert.sameValue(result[2], convertToBigInt(42)); + assert.sameValue(result[0], 42n); + assert.sameValue(result[1], 43n); + assert.sameValue(result[2], 42n); assert.sameValue(result.constructor, TA); assert.sameValue(Object.getPrototypeOf(result), TA.prototype); assert.sameValue(called, 1); diff --git a/test/built-ins/TypedArrays/from/BigInt/new-instance-with-mapfn.js b/test/built-ins/TypedArrays/from/BigInt/new-instance-with-mapfn.js index 48ee4d285..7de5fda26 100644 --- a/test/built-ins/TypedArrays/from/BigInt/new-instance-with-mapfn.js +++ b/test/built-ins/TypedArrays/from/BigInt/new-instance-with-mapfn.js @@ -17,9 +17,9 @@ testWithBigIntTypedArrayConstructors(function(TA) { var result = TA.from(source, mapfn); assert.sameValue(result.length, 3); - assert.sameValue(result[0], convertToBigInt(84)); - assert.sameValue(result[1], convertToBigInt(86)); - assert.sameValue(result[2], convertToBigInt(84)); + assert.sameValue(result[0], 84n); + assert.sameValue(result[1], 86n); + assert.sameValue(result[2], 84n); assert.sameValue(result.constructor, TA); assert.sameValue(Object.getPrototypeOf(result), TA.prototype); }); diff --git a/test/built-ins/TypedArrays/from/BigInt/new-instance-without-mapfn.js b/test/built-ins/TypedArrays/from/BigInt/new-instance-without-mapfn.js index af95e8015..61f45e35e 100644 --- a/test/built-ins/TypedArrays/from/BigInt/new-instance-without-mapfn.js +++ b/test/built-ins/TypedArrays/from/BigInt/new-instance-without-mapfn.js @@ -13,9 +13,9 @@ var source = [42, 43, 42]; testWithBigIntTypedArrayConstructors(function(TA) { var result = TA.from(convertToBigInt(source)); assert.sameValue(result.length, 3); - assert.sameValue(result[0], convertToBigInt(42)); - assert.sameValue(result[1], convertToBigInt(43)); - assert.sameValue(result[2], convertToBigInt(42)); + assert.sameValue(result[0], 42n); + assert.sameValue(result[1], 43n); + assert.sameValue(result[2], 42n); assert.sameValue(result.constructor, TA); assert.sameValue(Object.getPrototypeOf(result), TA.prototype); }); diff --git a/test/built-ins/TypedArrays/from/BigInt/set-value-abrupt-completion.js b/test/built-ins/TypedArrays/from/BigInt/set-value-abrupt-completion.js index 34ee679a5..7259e8a03 100644 --- a/test/built-ins/TypedArrays/from/BigInt/set-value-abrupt-completion.js +++ b/test/built-ins/TypedArrays/from/BigInt/set-value-abrupt-completion.js @@ -26,7 +26,7 @@ var obj = { }; testWithBigIntTypedArrayConstructors(function(TA) { - var source = [convertToBigInt(42), obj, convertToBigInt(1)]; + var source = [42n, obj, 1n]; var lastValue; var mapfn = function(kValue) { lastValue = kValue; diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/desc-value-throws.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/desc-value-throws.js index 016d41b63..d4dbc7267 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/desc-value-throws.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/desc-value-throws.js @@ -32,7 +32,7 @@ var obj = { }; testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42])); + var sample = new TA([42n]); assert.throws(Test262Error, function() { Object.defineProperty(sample, "0", {value: obj}); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-greater-than-last-index.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-greater-than-last-index.js index d48eb4afb..c558041e1 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-greater-than-last-index.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-greater-than-last-index.js @@ -21,7 +21,7 @@ features: [BigInt, Reflect, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); assert.sameValue( Reflect.defineProperty(sample, "2", { diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-lower-than-zero.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-lower-than-zero.js index faaf037c3..c9ff53898 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-lower-than-zero.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-lower-than-zero.js @@ -19,7 +19,7 @@ features: [BigInt, Reflect, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); assert.sameValue( Reflect.defineProperty(sample, "-1", { diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-minus-zero.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-minus-zero.js index 2c838c345..73dcde780 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-minus-zero.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-minus-zero.js @@ -31,6 +31,6 @@ testWithBigIntTypedArrayConstructors(function(TA) { false, "defineProperty returns false" ); - assert.sameValue(sample[0], convertToBigInt(0), "does not change the value for [0]"); + assert.sameValue(sample[0], 0n, "does not change the value for [0]"); assert.sameValue(sample["-0"], undefined, "does define a value for ['-0']"); }); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-canonical-index.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-canonical-index.js index c87d89cf9..616875f7e 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-canonical-index.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-canonical-index.js @@ -37,7 +37,7 @@ var acDesc = { testWithBigIntTypedArrayConstructors(function(TA) { keys.forEach(function(key) { var dataDesc = { - value: convertToBigInt(42), + value: 42n, writable: true, configurable: true }; @@ -50,7 +50,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { "return true after defining data property [" + key + "]" ); - assert.sameValue(sample1[key], convertToBigInt(42), "value is set to [" + key + "]"); + assert.sameValue(sample1[key], 42n, "value is set to [" + key + "]"); verifyNotEnumerable(sample1, key); verifyWritable(sample1, key); verifyConfigurable(sample1, key); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-integer.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-integer.js index 0d3d3cc79..15bc69fb4 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-integer.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-integer.js @@ -29,7 +29,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { false, "0.1" ); - assert.sameValue(sample[0], convertToBigInt(0), "'0.1' - does not change the value for [0]"); + assert.sameValue(sample[0], 0n, "'0.1' - does not change the value for [0]"); assert.sameValue( sample["0.1"], undefined, @@ -47,7 +47,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { "0.000001" ); assert.sameValue( - sample[0], convertToBigInt(0), + sample[0], 0n, "'0.000001' - does not change the value for [0]" ); assert.sameValue( @@ -66,7 +66,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { false, "1.1" ); - assert.sameValue(sample[1], convertToBigInt(0), "'1.1' - does not change the value for [1]"); + assert.sameValue(sample[1], 0n, "'1.1' - does not change the value for [1]"); assert.sameValue( sample["1.1"], undefined, @@ -84,11 +84,11 @@ testWithBigIntTypedArrayConstructors(function(TA) { "Infinity" ); assert.sameValue( - sample[0], convertToBigInt(0), + sample[0], 0n, "'Infinity' - does not change the value for [0]" ); assert.sameValue( - sample[1], convertToBigInt(0), + sample[1], 0n, "'Infinity' - does not change the value for [1]" ); assert.sameValue( @@ -108,11 +108,11 @@ testWithBigIntTypedArrayConstructors(function(TA) { "-Infinity" ); assert.sameValue( - sample[0], convertToBigInt(0), + sample[0], 0n, "'-Infinity' - does not change the value for [0]" ); assert.sameValue( - sample[1], convertToBigInt(0), + sample[1], 0n, "'-Infinity' - does not change the value for [1]" ); assert.sameValue( diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-numeric-index.js index 8f262daeb..b68c6553c 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-numeric-index.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-not-numeric-index.js @@ -18,7 +18,7 @@ features: [BigInt, Reflect, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); assert.sameValue( Reflect.defineProperty(sample, "foo", {value:42}), diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-accessor-desc.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-accessor-desc.js index 21ab9cfc3..4b4b60ffd 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-accessor-desc.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-accessor-desc.js @@ -31,7 +31,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { false, "get accessor" ); - assert.sameValue(sample[0], convertToBigInt(0), "get accessor - side effect check"); + assert.sameValue(sample[0], 0n, "get accessor - side effect check"); assert.sameValue( Reflect.defineProperty(sample, "0", { @@ -41,7 +41,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { false, "set accessor" ); - assert.sameValue(sample[0], convertToBigInt(0), "set accessor - side effect check"); + assert.sameValue(sample[0], 0n, "set accessor - side effect check"); assert.sameValue( Reflect.defineProperty(sample, "0", { @@ -54,5 +54,5 @@ testWithBigIntTypedArrayConstructors(function(TA) { false, "get and set accessors" ); - assert.sameValue(sample[0], convertToBigInt(0), "get and set accessors - side effect check"); + assert.sameValue(sample[0], 0n, "get and set accessors - side effect check"); }); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-configurable.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-configurable.js index f928a3f93..51fd77203 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-configurable.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-configurable.js @@ -31,5 +31,5 @@ testWithBigIntTypedArrayConstructors(function(TA) { false, "defineProperty's result" ); - assert.sameValue(sample[0], convertToBigInt(0), "side effect check"); + assert.sameValue(sample[0], 0n, "side effect check"); }); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-not-enumerable.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-not-enumerable.js index 79a56222a..37315f7c9 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-not-enumerable.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-not-enumerable.js @@ -31,5 +31,5 @@ testWithBigIntTypedArrayConstructors(function(TA) { false, "defineProperty's result" ); - assert.sameValue(sample[0], convertToBigInt(0), "side effect check"); + assert.sameValue(sample[0], 0n, "side effect check"); }); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-not-writable.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-not-writable.js index 6f6483b90..26f4363fe 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-not-writable.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-not-writable.js @@ -31,5 +31,5 @@ testWithBigIntTypedArrayConstructors(function(TA) { false, "defineProperty's result" ); - assert.sameValue(sample[0], convertToBigInt(0), "side effect check"); + assert.sameValue(sample[0], 0n, "side effect check"); }); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex.js index 5f994cd86..3e8241ca0 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-numericindex.js @@ -19,11 +19,11 @@ features: [BigInt, Reflect, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 42])); + var sample = new TA([42n, 42n]); assert.sameValue( Reflect.defineProperty(sample, "0", { - value: convertToBigInt(8), + value: 8n, configurable: false, enumerable: true, writable: true @@ -31,10 +31,10 @@ testWithBigIntTypedArrayConstructors(function(TA) { true ); - assert.sameValue(sample[0], convertToBigInt(8), "property value was set"); + assert.sameValue(sample[0], 8n, "property value was set"); var desc = Object.getOwnPropertyDescriptor(sample, "0"); - assert.sameValue(desc.value, convertToBigInt(8), "desc.value"); + assert.sameValue(desc.value, 8n, "desc.value"); assert.sameValue(desc.writable, true, "property is writable"); verifyEnumerable(sample, "0"); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-symbol.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-symbol.js index 467e89a93..08c9d1064 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/key-is-symbol.js @@ -16,7 +16,7 @@ features: [BigInt, Reflect, Symbol, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); var s1 = Symbol("foo"); assert.sameValue( diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/non-extensible-new-key.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/non-extensible-new-key.js index 5357f3bc0..d3b2694fb 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/non-extensible-new-key.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/non-extensible-new-key.js @@ -18,7 +18,7 @@ features: [BigInt, Reflect, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); Object.preventExtensions(sample); assert.sameValue( diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/non-extensible-redefine-key.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/non-extensible-redefine-key.js index eb6e41027..81c7894db 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/non-extensible-redefine-key.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/non-extensible-redefine-key.js @@ -18,7 +18,7 @@ features: [BigInt, Reflect, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); sample.foo = true; sample.bar = true; diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/set-value.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/set-value.js index f17b06837..1bcba5b21 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/set-value.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/set-value.js @@ -26,20 +26,20 @@ features: [BigInt, Reflect, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([0, 0])); + var sample = new TA([0n, 0n]); assert.sameValue( - Reflect.defineProperty(sample, "0", {value: convertToBigInt(1)}), + Reflect.defineProperty(sample, "0", {value: 1n}), true, "set value for sample[0] returns true" ); assert.sameValue( - Reflect.defineProperty(sample, "1", {value: convertToBigInt(2)}), + Reflect.defineProperty(sample, "1", {value: 2n}), true, "set value for sample[1] returns true" ); - assert.sameValue(sample[0], convertToBigInt(1), "sample[0]"); - assert.sameValue(sample[1], convertToBigInt(2), "sample[1]"); + assert.sameValue(sample[0], 1n, "sample[0]"); + assert.sameValue(sample[1], 2n, "sample[1]"); }); diff --git a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/this-is-not-extensible.js b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/this-is-not-extensible.js index 04664a126..df15ab556 100644 --- a/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/this-is-not-extensible.js +++ b/test/built-ins/TypedArrays/internals/DefineOwnProperty/BigInt/this-is-not-extensible.js @@ -18,7 +18,7 @@ features: [BigInt, Reflect, Symbol, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); Object.preventExtensions(sample); diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer-key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer-key-is-not-numeric-index.js index b9caa2ddf..21b3b11b1 100644 --- a/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer-key-is-not-numeric-index.js +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer-key-is-not-numeric-index.js @@ -18,7 +18,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); sample.foo = "test262"; $DETACHBUFFER(sample.buffer); diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer-key-is-symbol.js b/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer-key-is-symbol.js index 9af111a76..fe0e8c412 100644 --- a/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer-key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer-key-is-symbol.js @@ -16,7 +16,7 @@ features: [BigInt, Symbol, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); $DETACHBUFFER(sample.buffer); var s = Symbol("1"); diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer.js b/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer.js index 74b9a69d8..0ac96a863 100644 --- a/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer.js +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/detached-buffer.js @@ -18,7 +18,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42])); + var sample = new TA([42n]); $DETACHBUFFER(sample.buffer); assert.throws(TypeError, function() { diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/indexed-value-sab.js b/test/built-ins/TypedArrays/internals/Get/BigInt/indexed-value-sab.js index b599b430c..e8e27c666 100644 --- a/test/built-ins/TypedArrays/internals/Get/BigInt/indexed-value-sab.js +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/indexed-value-sab.js @@ -21,8 +21,8 @@ Object.defineProperty(proto, "1", throwDesc); testWithBigIntTypedArrayConstructors(function(TA) { var sab = new SharedArrayBuffer(TA.BYTES_PER_ELEMENT * 2); var sample = new TA(sab); - sample.set([convertToBigInt(42), convertToBigInt(1)]); + sample.set([42n, 1n]); - assert.sameValue(sample["0"], convertToBigInt(42)); - assert.sameValue(sample["1"], convertToBigInt(1)); + assert.sameValue(sample["0"], 42n); + assert.sameValue(sample["1"], 1n); }); diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/indexed-value.js b/test/built-ins/TypedArrays/internals/Get/BigInt/indexed-value.js index d97004b83..6cc015407 100644 --- a/test/built-ins/TypedArrays/internals/Get/BigInt/indexed-value.js +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/indexed-value.js @@ -27,8 +27,8 @@ Object.defineProperty(proto, "0", throwDesc); Object.defineProperty(proto, "1", throwDesc); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 1])); + var sample = new TA([42n, 1n]); - assert.sameValue(sample["0"], convertToBigInt(42)); - assert.sameValue(sample["1"], convertToBigInt(1)); + assert.sameValue(sample["0"], 42n); + assert.sameValue(sample["1"], 1n); }); diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-integer.js b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-integer.js index 8f844f550..862178d03 100644 --- a/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-integer.js +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-integer.js @@ -31,7 +31,7 @@ Object.defineProperty(proto, "1.1", { }); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); assert.sameValue(sample["1.1"], undefined); }); diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-minus-zero.js b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-minus-zero.js index 30917db64..792e32064 100644 --- a/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-minus-zero.js +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-minus-zero.js @@ -31,7 +31,7 @@ Object.defineProperty(proto, "-0", { }); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); assert.sameValue(sample["-0"], undefined); }); diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-numeric-index.js index 8eb2c0714..3167ddf0c 100644 --- a/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-numeric-index.js +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-not-numeric-index.js @@ -20,7 +20,7 @@ features: [BigInt, TypedArray] TypedArray.prototype.baz = "test262"; testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); assert.sameValue( sample.foo, undefined, diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-out-of-bounds.js b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-out-of-bounds.js index b8f0b02a6..583b7c549 100644 --- a/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-out-of-bounds.js +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-out-of-bounds.js @@ -35,7 +35,7 @@ Object.defineProperty(proto, "2", throwDesc); Object.defineProperty(proto, "3", throwDesc); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); assert.sameValue(sample["-1"], undefined); assert.sameValue(sample["2"], undefined); diff --git a/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-symbol.js b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-symbol.js index 52113ec86..11e80f8d8 100644 --- a/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/Get/BigInt/key-is-symbol.js @@ -19,7 +19,7 @@ var parentKey = Symbol("2"); TypedArray.prototype[parentKey] = "test262"; testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42])); + var sample = new TA([42n]); var s1 = Symbol("1"); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer-key-is-not-number.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer-key-is-not-number.js index 6148dbea1..6f7ad44ab 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer-key-is-not-number.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer-key-is-not-number.js @@ -18,7 +18,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); $DETACHBUFFER(sample.buffer); assert.sameValue( diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer-key-is-symbol.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer-key-is-symbol.js index ecd044e13..e316218f5 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer-key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/detached-buffer-key-is-symbol.js @@ -18,7 +18,7 @@ features: [BigInt, Symbol, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); $DETACHBUFFER(sample.buffer); var s = Symbol("foo"); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/index-prop-desc.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/index-prop-desc.js index 34c96bd49..ad44eb8d3 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/index-prop-desc.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/index-prop-desc.js @@ -20,16 +20,16 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); var desc0 = Object.getOwnPropertyDescriptor(sample, 0); - assert.sameValue(desc0.value, convertToBigInt(42), "value", "desc0.value === 42"); + assert.sameValue(desc0.value, 42n, "value", "desc0.value === 42"); assert.sameValue(desc0.writable, true, "index descriptor is writable [0]"); verifyEnumerable(sample, "0", "index descriptor is enumerable [0]"); verifyNotConfigurable(sample, "0", "index descriptor is not configurable [0]"); var desc1 = Object.getOwnPropertyDescriptor(sample, 1); - assert.sameValue(desc1.value, convertToBigInt(43), "value", "desc1.value === 43"); + assert.sameValue(desc1.value, 43n, "value", "desc1.value === 43"); assert.sameValue(desc1.writable, true, "index descriptor is writable [1]"); verifyEnumerable(sample, "1", "index descriptor is enumerable [1]"); verifyNotConfigurable(sample, "1", "index descriptor is not configurable [1]"); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-minus-zero.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-minus-zero.js index 1b4f76c0f..598deda2c 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-minus-zero.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-minus-zero.js @@ -30,7 +30,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42])); + var sample = new TA([42n]); // -0 as a number value is converted to "0" before calling [[GetOwnProperty]] assert.sameValue(Object.getOwnPropertyDescriptor(sample, "-0"), undefined); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-canonical-index.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-canonical-index.js index b9a163b79..02f46bd6d 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-canonical-index.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-canonical-index.js @@ -28,7 +28,7 @@ var keys = [ testWithBigIntTypedArrayConstructors(function(TA) { keys.forEach(function(key) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); assert.sameValue( Object.getOwnPropertyDescriptor(sample, key), diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-integer.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-integer.js index bc8674429..e52e033aa 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-integer.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-integer.js @@ -24,7 +24,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); assert.sameValue(Object.getOwnPropertyDescriptor(sample, "1.1"), undefined); assert.sameValue(Object.getOwnPropertyDescriptor(sample, "0.1"), undefined); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-numeric-index.js index d00d1a626..e65c23ad9 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-numeric-index.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-not-numeric-index.js @@ -19,7 +19,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); assert.sameValue( Object.getOwnPropertyDescriptor(sample, "undef"), diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-out-of-bounds.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-out-of-bounds.js index 8bb915de6..71e5d5ef7 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-out-of-bounds.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-out-of-bounds.js @@ -25,7 +25,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42])); + var sample = new TA([42n]); assert.sameValue(Object.getOwnPropertyDescriptor(sample, "-1"), undefined); assert.sameValue(Object.getOwnPropertyDescriptor(sample, "-42"), undefined); diff --git a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-symbol.js b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-symbol.js index dd1cbdfb5..c5509a0d9 100644 --- a/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/GetOwnProperty/BigInt/key-is-symbol.js @@ -19,7 +19,7 @@ features: [BigInt, Symbol, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); var s = Symbol("foo"); Object.defineProperty(sample, s, { value: "baz" }); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer-key-is-not-number.js b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer-key-is-not-number.js index d4495d2e1..aeda046b0 100644 --- a/test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer-key-is-not-number.js +++ b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer-key-is-not-number.js @@ -19,7 +19,7 @@ features: [BigInt, Reflect, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); Object.defineProperty(sample, "bar", { value: 42 }); $DETACHBUFFER(sample.buffer); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer-key-is-symbol.js b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer-key-is-symbol.js index 50df7a49c..44475d9aa 100644 --- a/test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer-key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/detached-buffer-key-is-symbol.js @@ -21,7 +21,7 @@ var s1 = Symbol("foo"); var s2 = Symbol("bar"); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); Object.defineProperty(sample, s1, { value: "baz" }); $DETACHBUFFER(sample.buffer); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/BigInt/indexed-value.js b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/indexed-value.js index f01eb8689..9133ae261 100644 --- a/test/built-ins/TypedArrays/internals/HasProperty/BigInt/indexed-value.js +++ b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/indexed-value.js @@ -25,7 +25,7 @@ features: [BigInt, Reflect, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); assert.sameValue(Reflect.has(sample, 0), true); assert.sameValue(Reflect.has(sample, 1), true); diff --git a/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-not-canonical-index.js b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-not-canonical-index.js index ecd5dd725..a92f3346e 100644 --- a/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-not-canonical-index.js +++ b/test/built-ins/TypedArrays/internals/HasProperty/BigInt/key-is-not-canonical-index.js @@ -43,7 +43,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { delete TypedArray.prototype[key]; - Object.defineProperty(sample, key, {value: convertToBigInt(42)}); + Object.defineProperty(sample, key, {value: 42n}); assert.sameValue( Reflect.has(sample, key), true, diff --git a/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-and-symbol-keys-.js b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-and-symbol-keys-.js index 42adcfeba..6f64fa646 100644 --- a/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-and-symbol-keys-.js +++ b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-and-symbol-keys-.js @@ -24,7 +24,7 @@ TypedArray.prototype[3] = 42; TypedArray.prototype.bar = 42; testWithBigIntTypedArrayConstructors(function(TA) { - var sample1 = new TA(convertToBigInt([42, 42, 42])); + var sample1 = new TA([42n, 42n, 42n]); sample1[s1] = 42; sample1[s2] = 42; sample1.test262 = 42; diff --git a/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-keys.js b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-keys.js index e3d78dac4..8de17148b 100644 --- a/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-keys.js +++ b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-keys.js @@ -21,7 +21,7 @@ TypedArray.prototype[3] = 42; TypedArray.prototype.bar = 42; testWithBigIntTypedArrayConstructors(function(TA) { - var sample1 = new TA(convertToBigInt([42, 42, 42])); + var sample1 = new TA([42n, 42n, 42n]); sample1.test262 = 42; sample1.ecma262 = 42; var result1 = Reflect.ownKeys(sample1); diff --git a/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes.js b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes.js index 9217b4627..88f6f3b8f 100644 --- a/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes.js +++ b/test/built-ins/TypedArrays/internals/OwnPropertyKeys/BigInt/integer-indexes.js @@ -18,7 +18,7 @@ features: [BigInt, Reflect, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample1 = new TA(convertToBigInt([42, 42, 42])); + var sample1 = new TA([42n, 42n, 42n]); var result1 = Reflect.ownKeys(sample1); assert(compareArray(result1, ["0", "1", "2"]), "result1"); diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer-key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer-key-is-not-numeric-index.js index e7980f308..87f24f8f6 100644 --- a/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer-key-is-not-numeric-index.js +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer-key-is-not-numeric-index.js @@ -18,7 +18,7 @@ features: [BigInt, Reflect, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); $DETACHBUFFER(sample.buffer); assert.sameValue(Reflect.set(sample, "foo", "test262"), true); diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer-key-is-symbol.js b/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer-key-is-symbol.js index c7311063b..f22e808ba 100644 --- a/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer-key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer-key-is-symbol.js @@ -18,7 +18,7 @@ features: [BigInt, Symbol, Reflect, TypedArray] var s = Symbol("1"); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); $DETACHBUFFER(sample.buffer); assert.sameValue(Reflect.set(sample, s, "test262"), true); diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer.js b/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer.js index 2a27fff80..614f7779c 100644 --- a/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer.js +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/detached-buffer.js @@ -26,31 +26,31 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42])); + var sample = new TA([42n]); $DETACHBUFFER(sample.buffer); assert.throws(TypeError, function() { - sample[0] = convertToBigInt(1); + sample[0] = 1n; }, "valid numeric index"); assert.throws(TypeError, function() { - sample["1.1"] = convertToBigInt(1); + sample["1.1"] = 1n; }, "detach buffer runs before checking for 1.1"); assert.throws(TypeError, function() { - sample["-0"] = convertToBigInt(1); + sample["-0"] = 1n; }, "detach buffer runs before checking for -0"); assert.throws(TypeError, function() { - sample["-1"] = convertToBigInt(1); + sample["-1"] = 1n; }, "detach buffer runs before checking for -1"); assert.throws(TypeError, function() { - sample["1"] = convertToBigInt(1); + sample["1"] = 1n; }, "detach buffer runs before checking for key == length"); assert.throws(TypeError, function() { - sample["2"] = convertToBigInt(1); + sample["2"] = 1n; }, "detach buffer runs before checking for key > length"); var obj = { diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/indexed-value.js b/test/built-ins/TypedArrays/internals/Set/BigInt/indexed-value.js index 5203e21c9..71c914f87 100644 --- a/test/built-ins/TypedArrays/internals/Set/BigInt/indexed-value.js +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/indexed-value.js @@ -33,11 +33,11 @@ Object.defineProperty(proto, "0", throwDesc); Object.defineProperty(proto, "1", throwDesc); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42, 43])); + var sample = new TA([42n, 43n]); - assert.sameValue(Reflect.set(sample, "0", convertToBigInt(1)), true, "sample[0]"); - assert.sameValue(sample[0], convertToBigInt(1), "sample[0] value is set"); + assert.sameValue(Reflect.set(sample, "0", 1n), true, "sample[0]"); + assert.sameValue(sample[0], 1n, "sample[0] value is set"); - assert.sameValue(Reflect.set(sample, "1", convertToBigInt(42)), true, "sample[1]"); - assert.sameValue(sample[1], convertToBigInt(42), "sample[1] value is set"); + assert.sameValue(Reflect.set(sample, "1", 42n), true, "sample[1]"); + assert.sameValue(sample[1], 42n, "sample[1] value is set"); }); diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-minus-zero.js b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-minus-zero.js index 6fcd8dead..e937c4d28 100644 --- a/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-minus-zero.js +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-minus-zero.js @@ -24,7 +24,7 @@ features: [BigInt, Reflect, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42])); + var sample = new TA([42n]); assert.sameValue(Reflect.set(sample, "-0", 1), false, "-0"); assert.sameValue(sample.hasOwnProperty("-0"), false, "has no property [-0]"); diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-canonical-index.js b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-canonical-index.js index f2760e7e1..9a1296fa5 100644 --- a/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-canonical-index.js +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-canonical-index.js @@ -26,7 +26,7 @@ var keys = [ testWithBigIntTypedArrayConstructors(function(TA) { keys.forEach(function(key) { - var sample = new TA(convertToBigInt([42])); + var sample = new TA([42n]); assert.sameValue( Reflect.set(sample, key, "ecma262"), diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-integer.js b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-integer.js index 758cc1072..1d8e72b14 100644 --- a/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-integer.js +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-integer.js @@ -24,7 +24,7 @@ features: [BigInt, Reflect, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42])); + var sample = new TA([42n]); assert.sameValue(Reflect.set(sample, "1.1", 1), false, "1.1"); assert.sameValue(Reflect.set(sample, "0.0001", 1), false, "0.0001"); diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-numeric-index.js b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-numeric-index.js index 842de9dd0..602820de9 100644 --- a/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-numeric-index.js +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-not-numeric-index.js @@ -18,7 +18,7 @@ features: [BigInt, Reflect, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42])); + var sample = new TA([42n]); assert.sameValue( Reflect.set(sample, "test262", "ecma262"), diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-out-of-bounds.js b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-out-of-bounds.js index 3031a6ed9..a9a4d8b0a 100644 --- a/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-out-of-bounds.js +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-out-of-bounds.js @@ -25,7 +25,7 @@ features: [BigInt, Reflect, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42])); + var sample = new TA([42n]); assert.sameValue(Reflect.set(sample, "-1", 1), false, "-1"); assert.sameValue(Reflect.set(sample, "1", 1), false, "1"); diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-symbol.js b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-symbol.js index 184ae7abc..e63baedb0 100644 --- a/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-symbol.js +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/key-is-symbol.js @@ -19,7 +19,7 @@ var s1 = Symbol("1"); var s2 = Symbol("2"); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42])); + var sample = new TA([42n]); assert.sameValue( Reflect.set(sample, s1, "ecma262"), diff --git a/test/built-ins/TypedArrays/internals/Set/BigInt/tonumber-value-throws.js b/test/built-ins/TypedArrays/internals/Set/BigInt/tonumber-value-throws.js index a967ec01c..a91f3fbe6 100644 --- a/test/built-ins/TypedArrays/internals/Set/BigInt/tonumber-value-throws.js +++ b/test/built-ins/TypedArrays/internals/Set/BigInt/tonumber-value-throws.js @@ -24,7 +24,7 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt([42])); + var sample = new TA([42n]); var obj = { valueOf: function() { diff --git a/test/built-ins/TypedArrays/of/BigInt/argument-number-value-throws.js b/test/built-ins/TypedArrays/of/BigInt/argument-number-value-throws.js index fd22b08b1..16c8a9104 100644 --- a/test/built-ins/TypedArrays/of/BigInt/argument-number-value-throws.js +++ b/test/built-ins/TypedArrays/of/BigInt/argument-number-value-throws.js @@ -22,7 +22,7 @@ testWithTypedArrayConstructors(function(TA) { var obj1 = { valueOf() { lastValue = "obj1"; - return convertToBigInt(42); + return 42n; } }; var obj2 = { diff --git a/test/built-ins/TypedArrays/of/BigInt/custom-ctor-returns-other-instance.js b/test/built-ins/TypedArrays/of/BigInt/custom-ctor-returns-other-instance.js index 3c289e0a8..1454ab1c8 100644 --- a/test/built-ins/TypedArrays/of/BigInt/custom-ctor-returns-other-instance.js +++ b/test/built-ins/TypedArrays/of/BigInt/custom-ctor-returns-other-instance.js @@ -25,9 +25,9 @@ testWithTypedArrayConstructors(function(TA) { return custom; }; - result = TypedArray.of.call(ctor, convertToBigInt(1), convertToBigInt(2), convertToBigInt(3)); + result = TypedArray.of.call(ctor, 1n, 2n, 3n); assert.sameValue(result, custom, "using iterator, same length"); - result = TypedArray.of.call(ctor, convertToBigInt(1), convertToBigInt(2)); + result = TypedArray.of.call(ctor, 1n, 2n); assert.sameValue(result, custom, "using iterator, higher length"); }); diff --git a/test/built-ins/TypedArrays/of/BigInt/new-instance-using-custom-ctor.js b/test/built-ins/TypedArrays/of/BigInt/new-instance-using-custom-ctor.js index 58641f945..ec64f6fc6 100644 --- a/test/built-ins/TypedArrays/of/BigInt/new-instance-using-custom-ctor.js +++ b/test/built-ins/TypedArrays/of/BigInt/new-instance-using-custom-ctor.js @@ -18,11 +18,11 @@ testWithTypedArrayConstructors(function(TA) { }; - var result = TA.of.call(ctor, convertToBigInt(42), convertToBigInt(43), convertToBigInt(42)); + var result = TA.of.call(ctor, 42n, 43n, 42n); assert.sameValue(result.length, 3); - assert.sameValue(result[0], convertToBigInt(42)); - assert.sameValue(result[1], convertToBigInt(43)); - assert.sameValue(result[2], convertToBigInt(42)); + assert.sameValue(result[0], 42n); + assert.sameValue(result[1], 43n); + assert.sameValue(result[2], 42n); assert.sameValue(result.constructor, TA); assert.sameValue(called, 1); }); diff --git a/test/built-ins/TypedArrays/of/BigInt/new-instance.js b/test/built-ins/TypedArrays/of/BigInt/new-instance.js index 7e9cc745c..94329f185 100644 --- a/test/built-ins/TypedArrays/of/BigInt/new-instance.js +++ b/test/built-ins/TypedArrays/of/BigInt/new-instance.js @@ -24,11 +24,11 @@ features: [BigInt, TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - var result = TA.of(convertToBigInt(42), convertToBigInt(43), convertToBigInt(false)); + var result = TA.of(42n, 43n, convertToBigInt(false)); assert.sameValue(result.length, 3); - assert.sameValue(result[0], convertToBigInt(42)); - assert.sameValue(result[1], convertToBigInt(43)); - assert.sameValue(result[2], convertToBigInt(0)); + assert.sameValue(result[0], 42n); + assert.sameValue(result[1], 43n); + assert.sameValue(result[2], 0n); assert.sameValue(result.constructor, TA); assert.sameValue(Object.getPrototypeOf(result), TA.prototype); }); -- cgit v1.2.1 From c6cd53594089d5ef80da752b7875b1cd01d73540 Mon Sep 17 00:00:00 2001 From: Leo Balter Date: Thu, 15 Feb 2018 14:33:06 -0500 Subject: Last cases of convertToBigInt --- harness/testBigIntTypedArray.js | 4 ---- test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js | 4 +--- .../every/BigInt/callbackfn-set-value-during-interaction.js | 6 +++--- .../TypedArray/prototype/fill/BigInt/fill-values-conversion-once.js | 6 +++--- .../filter/BigInt/callbackfn-set-value-during-iteration.js | 6 +++--- .../forEach/BigInt/callbackfn-set-value-during-interaction.js | 6 +++--- test/built-ins/TypedArray/prototype/keys/BigInt/return-itor.js | 4 ++-- .../prototype/map/BigInt/callbackfn-set-value-during-interaction.js | 6 +++--- .../reduce/BigInt/callbackfn-set-value-during-iteration.js | 6 +++--- .../reduceRight/BigInt/callbackfn-set-value-during-iteration.js | 6 +++--- .../set/BigInt/array-arg-src-tonumber-value-type-conversions.js | 5 ++--- .../prototype/slice/BigInt/set-values-from-different-ctor-type.js | 6 +++--- .../some/BigInt/callbackfn-set-value-during-interaction.js | 6 +++--- test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js | 2 +- .../toLocaleString/BigInt/calls-tolocalestring-from-each-value.js | 5 ++--- .../toLocaleString/BigInt/calls-tostring-from-each-value.js | 4 ++-- .../toLocaleString/BigInt/calls-valueof-from-each-value.js | 3 +-- .../BigInt/return-abrupt-from-firstelement-tolocalestring.js | 4 +--- .../BigInt/return-abrupt-from-firstelement-tostring.js | 4 +--- .../BigInt/return-abrupt-from-firstelement-valueof.js | 4 +--- .../BigInt/return-abrupt-from-nextelement-tolocalestring.js | 4 +--- .../BigInt/return-abrupt-from-nextelement-tostring.js | 4 +--- .../toLocaleString/BigInt/return-abrupt-from-nextelement-valueof.js | 4 +--- .../TypedArray/prototype/toLocaleString/BigInt/return-result.js | 4 +--- test/built-ins/TypedArray/prototype/values/BigInt/return-itor.js | 4 +--- .../ctors-bigint/object-arg/object-arg-as-array-returns.js | 4 +--- .../from/BigInt/mapfn-this-without-thisarg-non-strict.js | 5 ++--- .../TypedArrays/from/BigInt/new-instance-using-custom-ctor.js | 4 +--- test/built-ins/TypedArrays/from/BigInt/new-instance-with-mapfn.js | 6 ++---- .../built-ins/TypedArrays/from/BigInt/new-instance-without-mapfn.js | 4 +--- test/built-ins/TypedArrays/of/BigInt/new-instance.js | 2 +- 31 files changed, 54 insertions(+), 88 deletions(-) diff --git a/harness/testBigIntTypedArray.js b/harness/testBigIntTypedArray.js index 4b0e332d8..dc6d50f93 100644 --- a/harness/testBigIntTypedArray.js +++ b/harness/testBigIntTypedArray.js @@ -18,10 +18,6 @@ var BigIntTypedArrayConstructors = [ */ var TypedArray = Object.getPrototypeOf(Int8Array); -function convertToBigInt(x) { - return (Array.isArray(x)) ? x.map(convertToBigInt) : BigInt(x); -} - /** * Callback for testing a typed array constructor. * diff --git a/test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js b/test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js index bca03654b..b5e3a5f02 100644 --- a/test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js +++ b/test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js @@ -12,10 +12,8 @@ includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ -var sample = [0, 42, 64]; - testWithBigIntTypedArrayConstructors(function(TA) { - var typedArray = new TA(convertToBigInt(sample)); + var typedArray = new TA([0n, 42n, 64n]); var itor = typedArray.entries(); var next = itor.next(); diff --git a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-set-value-during-interaction.js index 12f7d7a6e..74ce8659e 100644 --- a/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-set-value-during-interaction.js +++ b/test/built-ins/TypedArray/prototype/every/BigInt/callbackfn-set-value-during-interaction.js @@ -27,12 +27,12 @@ features: [BigInt, Reflect.set, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([42n, 43n, 44n]); - var newVal = 0; + var newVal = 0n; sample.every(function(val, i) { if (i > 0) { assert.sameValue( - sample[i - 1], convertToBigInt(newVal - 1), + sample[i - 1], newVal - 1n, "get the changed value during the loop" ); assert.sameValue( @@ -42,7 +42,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { ); } assert.sameValue( - Reflect.set(sample, i, convertToBigInt(newVal)), + Reflect.set(sample, i, newVal), true, "set value during iteration" ); diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-once.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-once.js index 2f8bfa008..c87b864f9 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-once.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-conversion-once.js @@ -17,10 +17,10 @@ features: [BigInt, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA(2); - var n = 1; - sample.fill({ valueOf() { return convertToBigInt(n++); } }); + var n = 1n; + sample.fill({ valueOf() { return n++; } }); - assert.sameValue(n, 2, "additional unexpected ToNumber() calls"); + assert.sameValue(n, 2n, "additional unexpected ToNumber() calls"); assert.sameValue(sample[0], 1n, "incorrect ToNumber result in index 0"); assert.sameValue(sample[1], 1n, "incorrect ToNumber result in index 1"); }); diff --git a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-set-value-during-iteration.js b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-set-value-during-iteration.js index c8435afa6..dbf09b798 100644 --- a/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-set-value-during-iteration.js +++ b/test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-set-value-during-iteration.js @@ -18,12 +18,12 @@ features: [BigInt, Reflect.set, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([42n, 43n, 44n]); - var newVal = 0; + var newVal = 0n; sample.filter(function(val, i) { if (i > 0) { assert.sameValue( - sample[i - 1], convertToBigInt(newVal - 1), + sample[i - 1], newVal - 1n, "get the changed value during the loop" ); assert.sameValue( @@ -33,7 +33,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { ); } assert.sameValue( - Reflect.set(sample, i, convertToBigInt(newVal)), + Reflect.set(sample, i, newVal), true, "set value during interaction" ); diff --git a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-set-value-during-interaction.js index 9d7acf91b..13bd7fb01 100644 --- a/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-set-value-during-interaction.js +++ b/test/built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-set-value-during-interaction.js @@ -18,12 +18,12 @@ features: [BigInt, Reflect.set, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([42n, 43n, 44n]); - var newVal = 0; + var newVal = 0n; sample.forEach(function(val, i) { if (i > 0) { assert.sameValue( - sample[i - 1], convertToBigInt(newVal - 1), + sample[i - 1], newVal - 1n, "get the changed value during the loop" ); assert.sameValue( @@ -33,7 +33,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { ); } assert.sameValue( - Reflect.set(sample, i, convertToBigInt(newVal)), + Reflect.set(sample, i, newVal), true, "set value during iteration" ); diff --git a/test/built-ins/TypedArray/prototype/keys/BigInt/return-itor.js b/test/built-ins/TypedArray/prototype/keys/BigInt/return-itor.js index e4bc1b0ba..6bccf1c2d 100644 --- a/test/built-ins/TypedArray/prototype/keys/BigInt/return-itor.js +++ b/test/built-ins/TypedArray/prototype/keys/BigInt/return-itor.js @@ -13,10 +13,10 @@ includes: [testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ -var sample = [0, 42, 64]; +var sample = [0n, 42n, 64n]; testWithBigIntTypedArrayConstructors(function(TA) { - var typedArray = new TA(convertToBigInt(sample)); + var typedArray = new TA(sample); var itor = typedArray.keys(); var next = itor.next(); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-set-value-during-interaction.js index 9e140cd82..df41cb459 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-set-value-during-interaction.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/callbackfn-set-value-during-interaction.js @@ -13,12 +13,12 @@ features: [BigInt, Reflect.set, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([42n, 43n, 44n]); - var newVal = 0; + var newVal = 0n; sample.map(function(val, i) { if (i > 0) { assert.sameValue( - sample[i - 1], convertToBigInt(newVal - 1), + sample[i - 1], newVal - 1n, "get the changed value during the loop" ); assert.sameValue( @@ -28,7 +28,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { ); } assert.sameValue( - Reflect.set(sample, i, convertToBigInt(newVal)), + Reflect.set(sample, i, newVal), true, "set value during iteration" ); diff --git a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-set-value-during-iteration.js b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-set-value-during-iteration.js index 272879dfb..d77a8ebda 100644 --- a/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-set-value-during-iteration.js +++ b/test/built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-set-value-during-iteration.js @@ -20,12 +20,12 @@ features: [BigInt, Reflect.set, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([42n, 43n, 44n]); - var newVal = 0; + var newVal = 0n; sample.reduce(function(acc, val, i) { if (i > 0) { assert.sameValue( - sample[i - 1], convertToBigInt(newVal - 1), + sample[i - 1], newVal - 1n, "get the changed value during the loop" ); assert.sameValue( @@ -35,7 +35,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { ); } assert.sameValue( - Reflect.set(sample, i, convertToBigInt(newVal)), + Reflect.set(sample, i, newVal), true, "set value during iteration" ); diff --git a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-set-value-during-iteration.js b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-set-value-during-iteration.js index 7b5fc70c2..3442517c0 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-set-value-during-iteration.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-set-value-during-iteration.js @@ -20,12 +20,12 @@ features: [BigInt, Reflect.set, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([42n, 43n, 44n]); - var newVal = 0; + var newVal = 0n; sample.reduceRight(function(acc, val, i) { if (i < sample.length - 1) { assert.sameValue( - sample[i + 1], convertToBigInt(newVal - 1), + sample[i + 1], newVal - 1n, "get the changed value during the loop" ); assert.sameValue( @@ -35,7 +35,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { ); } assert.sameValue( - Reflect.set(sample, i, convertToBigInt(newVal)), + Reflect.set(sample, i, newVal), true, "set value during iteration" ); diff --git a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-type-conversions.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-type-conversions.js index 8deeed826..d3d5c1aa4 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-type-conversions.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-src-tonumber-value-type-conversions.js @@ -35,11 +35,10 @@ testWithBigIntTypedArrayConstructors(function(TA) { } }; - // undefined and NaN covered on typedArrayConversions - var arr = ["1", "", false, true, nullish, obj1, obj2, [], [1]]; + var arr = [false, true, obj1, [], [1]]; var sample = new TA(arr.length); - var expected = new TA(convertToBigInt([1, 0, 0, 1, 42, 42, 0, 1])); + var expected = new TA([0n, 1n, 42n, 0n, 1n]); sample.set(arr); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/set-values-from-different-ctor-type.js b/test/built-ins/TypedArray/prototype/slice/BigInt/set-values-from-different-ctor-type.js index 93b074f1f..092bf2e7d 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/set-values-from-different-ctor-type.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/set-values-from-different-ctor-type.js @@ -30,10 +30,10 @@ includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, Symbol.species, TypedArray] ---*/ -var arr = [42, 43, 44]; +var arr = [42n 43n, 44n]; testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt(arr)); + var sample = new TA(arr); var other = TA === BigInt64Array ? BigUint64Array : BigInt64Array; sample.constructor = {}; @@ -41,7 +41,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { var result = sample.slice(); - assert(compareArray(result, convertToBigInt(arr)), "values are set"); + assert(compareArray(result, arr), "values are set"); assert.notSameValue(result.buffer, sample.buffer, "creates a new buffer"); assert.sameValue(result.constructor, other, "used the custom ctor"); }); diff --git a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-set-value-during-interaction.js b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-set-value-during-interaction.js index 641b2a0cb..c248960d3 100644 --- a/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-set-value-during-interaction.js +++ b/test/built-ins/TypedArray/prototype/some/BigInt/callbackfn-set-value-during-interaction.js @@ -27,12 +27,12 @@ features: [BigInt, Reflect.set, TypedArray] testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([42n, 43n, 44n]); - var newVal = 0; + var newVal = 0n; sample.some(function(val, i) { if (i > 0) { assert.sameValue( - sample[i - 1], convertToBigInt(newVal - 1), + sample[i - 1], newVal - 1n, "get the changed value during the loop" ); assert.sameValue( @@ -42,7 +42,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { ); } assert.sameValue( - Reflect.set(sample, i, convertToBigInt(newVal)), + Reflect.set(sample, i, newVal), true, "set value during iteration" ); diff --git a/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js b/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js index 50d6e22fe..57b491551 100644 --- a/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js @@ -26,7 +26,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample = new TA([3n, 4n, 3n, 1n, 0n, 1n, 2n]).sort(); assert(compareArray(sample, [0n, 1n, 1n, 2n, 3n, 3n, 4n]), "repeating numbers"); - sample = new TA(convertToBigInt([1, 0, -0, 2])).sort(); + sample = new TA([1n, 0n, -0n, 2n]).sort(); assert(compareArray(sample, [0n, 0n, 1n, 2n]), "0s"); }); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tolocalestring-from-each-value.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tolocalestring-from-each-value.js index c40f36561..82cd346b9 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tolocalestring-from-each-value.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tolocalestring-from-each-value.js @@ -39,15 +39,14 @@ BigInt.prototype.toLocaleString = function() { return "hacks" + calls.length; }; -var arr = [42, 0]; var expected = ["hacks1", "hacks2"].join(separator); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt(arr)); + var sample = new TA([42n, 0n]); calls = []; assert.sameValue(sample.toLocaleString(), expected, "returns expected value"); assert( - compareArray(new TA(convertToBigInt(calls)), sample), + compareArray(new TA(calls), sample), "toLocaleString called for each item" ); }); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tostring-from-each-value.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tostring-from-each-value.js index 9a9fe93d0..7fb9d6393 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tostring-from-each-value.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-tostring-from-each-value.js @@ -47,11 +47,11 @@ BigInt.prototype.toLocaleString = function() { }; }; -var arr = [42, 0]; +var arr = [42n, 0n]; var expected = ["hacks1", "hacks2"].join(separator); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt(arr)); + var sample = new TA(arr); calls = 0; assert.sameValue(sample.toLocaleString(), expected, "returns expected value"); assert.sameValue(calls, 2, "toString called once for each item"); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-valueof-from-each-value.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-valueof-from-each-value.js index b01c60feb..ea5464d98 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-valueof-from-each-value.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/calls-valueof-from-each-value.js @@ -45,11 +45,10 @@ BigInt.prototype.toLocaleString = function() { }; }; -var arr = [42, 0]; var expected = ["hacks1", "hacks2"].join(separator); testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt(arr)); + var sample = new TA([42n, 0n]); calls = 0; assert.sameValue(sample.toLocaleString(), expected, "returns expected value"); assert.sameValue(calls, 2, "valueOf called once for each item"); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tolocalestring.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tolocalestring.js index 378b4e5b8..e018468cc 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tolocalestring.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tolocalestring.js @@ -31,11 +31,9 @@ BigInt.prototype.toLocaleString = function() { throw new Test262Error(); }; -var arr = [42, 0]; - testWithBigIntTypedArrayConstructors(function(TA) { calls = 0; - var sample = new TA(convertToBigInt(arr)); + var sample = new TA([42n, 0n]); assert.throws(Test262Error, function() { sample.toLocaleString(); }); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tostring.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tostring.js index 3398b29ef..058f684c3 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tostring.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-tostring.js @@ -43,10 +43,8 @@ BigInt.prototype.toLocaleString = function() { }; }; -var arr = [42, 0]; - testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt(arr)); + var sample = new TA([42n, 0n]); calls = 0; assert.throws(Test262Error, function() { sample.toLocaleString(); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-valueof.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-valueof.js index fceea34ef..96259ba5d 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-valueof.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-firstelement-valueof.js @@ -44,10 +44,8 @@ BigInt.prototype.toLocaleString = function() { }; }; -var arr = [42, 0]; - testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt(arr)); + var sample = new TA([42n, 0n]); calls = 0; assert.throws(Test262Error, function() { sample.toLocaleString(); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tolocalestring.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tolocalestring.js index 1bac9b691..987146990 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tolocalestring.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tolocalestring.js @@ -34,11 +34,9 @@ BigInt.prototype.toLocaleString = function() { } }; -var arr = [42, 0]; - testWithBigIntTypedArrayConstructors(function(TA) { calls = 0; - var sample = new TA(convertToBigInt(arr)); + var sample = new TA([42n, 0n]); assert.throws(Test262Error, function() { sample.toLocaleString(); }); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tostring.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tostring.js index 3c45b81c1..cc0bd5ee6 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tostring.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-tostring.js @@ -45,10 +45,8 @@ BigInt.prototype.toLocaleString = function() { }; }; -var arr = [42, 0]; - testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt(arr)); + var sample = new TA([42n, 0n]); calls = 0; assert.throws(Test262Error, function() { sample.toLocaleString(); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-valueof.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-valueof.js index f683ad285..152095ebe 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-valueof.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-nextelement-valueof.js @@ -46,10 +46,8 @@ BigInt.prototype.toLocaleString = function() { }; }; -var arr = [42, 0]; - testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt(arr)); + var sample = new TA([42n, 0n]); calls = 0; assert.throws(Test262Error, function() { sample.toLocaleString(); diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-result.js b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-result.js index c3588c70f..99772306f 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-result.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/BigInt/return-result.js @@ -33,10 +33,8 @@ features: [BigInt, TypedArray] var separator = ["", ""].toLocaleString(); -var arr = [42, 0, 43]; - testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA(convertToBigInt(arr)); + var sample = new TA([42n, 0n, 43n]); var expected = sample[0].toLocaleString().toString() + separator + diff --git a/test/built-ins/TypedArray/prototype/values/BigInt/return-itor.js b/test/built-ins/TypedArray/prototype/values/BigInt/return-itor.js index dc2904754..3924cb3b4 100644 --- a/test/built-ins/TypedArray/prototype/values/BigInt/return-itor.js +++ b/test/built-ins/TypedArray/prototype/values/BigInt/return-itor.js @@ -13,10 +13,8 @@ includes: [testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ -var sample = [0, 42, 64]; - testWithBigIntTypedArrayConstructors(function(TA) { - var typedArray = new TA(convertToBigInt(sample)); + var typedArray = new TA([0n, 42n, 64n]); var itor = typedArray.values(); var next = itor.next(); diff --git a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-array-returns.js b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-array-returns.js index ee21ba4cf..c9a6b0652 100644 --- a/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-array-returns.js +++ b/test/built-ins/TypedArrays/ctors-bigint/object-arg/object-arg-as-array-returns.js @@ -16,10 +16,8 @@ includes: [testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ -var obj = [7, 42]; - testWithTypedArrayConstructors(function(TA) { - var typedArray = new TA(convertToBigInt(obj)); + var typedArray = new TA([7n, 42n]); assert.sameValue(typedArray.length, 2); assert.sameValue(typedArray[0], 7n); assert.sameValue(typedArray[1], 42n); diff --git a/test/built-ins/TypedArrays/from/BigInt/mapfn-this-without-thisarg-non-strict.js b/test/built-ins/TypedArrays/from/BigInt/mapfn-this-without-thisarg-non-strict.js index b16d6f9cc..410c3244d 100644 --- a/test/built-ins/TypedArrays/from/BigInt/mapfn-this-without-thisarg-non-strict.js +++ b/test/built-ins/TypedArrays/from/BigInt/mapfn-this-without-thisarg-non-strict.js @@ -20,17 +20,16 @@ flags: [noStrict] features: [BigInt, TypedArray] ---*/ -var source = [42, 43]; var global = this; testWithBigIntTypedArrayConstructors(function(TA) { var results = []; var mapfn = function(x) { results.push(this); - return convertToBigInt(x); + return x; }; - TA.from(convertToBigInt(source), mapfn); + TA.from([42n, 43n], mapfn); assert.sameValue(results.length, 2); assert.sameValue(results[0], global); diff --git a/test/built-ins/TypedArrays/from/BigInt/new-instance-using-custom-ctor.js b/test/built-ins/TypedArrays/from/BigInt/new-instance-using-custom-ctor.js index 82a37b242..cd012fc88 100644 --- a/test/built-ins/TypedArrays/from/BigInt/new-instance-using-custom-ctor.js +++ b/test/built-ins/TypedArrays/from/BigInt/new-instance-using-custom-ctor.js @@ -8,8 +8,6 @@ includes: [testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ -var source = [42, 43, 42]; - testWithBigIntTypedArrayConstructors(function(TA) { var called = 0; @@ -19,7 +17,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { return new TA(len); }; - var result = TA.from.call(ctor, convertToBigInt(source)); + var result = TA.from.call(ctor, [42n, 43n, 42n]); assert.sameValue(result.length, 3); assert.sameValue(result[0], 42n); assert.sameValue(result[1], 43n); diff --git a/test/built-ins/TypedArrays/from/BigInt/new-instance-with-mapfn.js b/test/built-ins/TypedArrays/from/BigInt/new-instance-with-mapfn.js index 7de5fda26..600bf2a1f 100644 --- a/test/built-ins/TypedArrays/from/BigInt/new-instance-with-mapfn.js +++ b/test/built-ins/TypedArrays/from/BigInt/new-instance-with-mapfn.js @@ -8,14 +8,12 @@ includes: [testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ -var source = [42, 43, 42]; - testWithBigIntTypedArrayConstructors(function(TA) { var mapfn = function(kValue) { - return convertToBigInt(kValue * 2); + return kValue * 2n; }; - var result = TA.from(source, mapfn); + var result = TA.from([42n, 43n, 42n], mapfn); assert.sameValue(result.length, 3); assert.sameValue(result[0], 84n); assert.sameValue(result[1], 86n); diff --git a/test/built-ins/TypedArrays/from/BigInt/new-instance-without-mapfn.js b/test/built-ins/TypedArrays/from/BigInt/new-instance-without-mapfn.js index 61f45e35e..1243cb6aa 100644 --- a/test/built-ins/TypedArrays/from/BigInt/new-instance-without-mapfn.js +++ b/test/built-ins/TypedArrays/from/BigInt/new-instance-without-mapfn.js @@ -8,10 +8,8 @@ includes: [testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ -var source = [42, 43, 42]; - testWithBigIntTypedArrayConstructors(function(TA) { - var result = TA.from(convertToBigInt(source)); + var result = TA.from([42n, 43n, 42n]); assert.sameValue(result.length, 3); assert.sameValue(result[0], 42n); assert.sameValue(result[1], 43n); diff --git a/test/built-ins/TypedArrays/of/BigInt/new-instance.js b/test/built-ins/TypedArrays/of/BigInt/new-instance.js index 94329f185..e71afc1b0 100644 --- a/test/built-ins/TypedArrays/of/BigInt/new-instance.js +++ b/test/built-ins/TypedArrays/of/BigInt/new-instance.js @@ -24,7 +24,7 @@ features: [BigInt, TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - var result = TA.of(42n, 43n, convertToBigInt(false)); + var result = TA.of(42n, 43n, 0n); assert.sameValue(result.length, 3); assert.sameValue(result[0], 42n); assert.sameValue(result[1], 43n); -- cgit v1.2.1 From 77096157d10fcb6d72696456c5a9302ab29ba62a Mon Sep 17 00:00:00 2001 From: Leo Balter Date: Thu, 15 Feb 2018 14:38:00 -0500 Subject: fix syntax typo --- .../prototype/slice/BigInt/set-values-from-different-ctor-type.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/set-values-from-different-ctor-type.js b/test/built-ins/TypedArray/prototype/slice/BigInt/set-values-from-different-ctor-type.js index 092bf2e7d..53ee40eba 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/set-values-from-different-ctor-type.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/set-values-from-different-ctor-type.js @@ -30,7 +30,7 @@ includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, Symbol.species, TypedArray] ---*/ -var arr = [42n 43n, 44n]; +var arr = [42n, 43n, 44n]; testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA(arr); -- cgit v1.2.1 From 857f1d429b939c6feef1951041b5c91c9f3a8b4a Mon Sep 17 00:00:00 2001 From: Leo Balter Date: Thu, 15 Feb 2018 17:51:52 -0500 Subject: fix bad fixings from Remove N --- .../TypedArray/prototype/fill/coerced-indexes.js | 28 +++++++++++----------- .../fill/fill-values-custom-start-and-end.js | 10 ++++---- .../prototype/fill/fill-values-relative-end.js | 8 +++---- .../prototype/fill/fill-values-relative-start.js | 8 +++---- .../TypedArray/prototype/fill/fill-values.js | 2 +- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js b/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js index 0f0dab7d8..2d512bae5 100644 --- a/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js +++ b/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js @@ -33,72 +33,72 @@ features: [TypedArray] testWithTypedArrayConstructors(function(TA) { assert( - compareArray(new TA([0, 0])).fill(1, undefined), [1, 1], + compareArray(new TA([0, 0]).fill(1, undefined), [1, 1]), '`undefined` start coerced to 0' ); assert( - compareArray(new TA([0, 0])).fill(1, 0, undefined), [1, 1], + compareArray(new TA([0, 0]).fill(1, 0, undefined), [1, 1]), 'If end is undefined, let relativeEnd be len' ); assert( - compareArray(new TA([0, 0])).fill(1, null), [1, 1], + compareArray(new TA([0, 0]).fill(1, null), [1, 1]), '`null` start coerced to 0' ); assert( - compareArray(new TA([0, 0])).fill(1, 0, null), [0, 0], + compareArray(new TA([0, 0]).fill(1, 0, null), [0, 0]), '`null` end coerced to 0' ); assert( - compareArray(new TA([0, 0])).fill(1, true), [0, 1], + compareArray(new TA([0, 0]).fill(1, true), [0, 1]), '`true` start coerced to 1' ); assert( - compareArray(new TA([0, 0])).fill(1, 0, true), [1, 0], + compareArray(new TA([0, 0]).fill(1, 0, true), [1, 0]), '`true` end coerced to 1' ); assert( - compareArray(new TA([0, 0])).fill(1, false), [1, 1], + compareArray(new TA([0, 0]).fill(1, false), [1, 1]), '`false` start coerced to 0' ); assert( - compareArray(new TA([0, 0])).fill(1, 0, false), [0, 0], + compareArray(new TA([0, 0]).fill(1, 0, false), [0, 0]), '`false` end coerced to 0' ); assert( - compareArray(new TA([0, 0])).fill(1, NaN), [1, 1], + compareArray(new TA([0, 0]).fill(1, NaN), [1, 1]), '`NaN` start coerced to 0' ); assert( - compareArray(new TA([0, 0])).fill(1, 0, NaN), [0, 0], + compareArray(new TA([0, 0]).fill(1, 0, NaN), [0, 0]), '`NaN` end coerced to 0' ); assert( - compareArray(new TA([0, 0])).fill(1, '1'), [0, 1], + compareArray(new TA([0, 0]).fill(1, '1'), [0, 1]), 'string start coerced' ); assert( - compareArray(new TA([0, 0])).fill(1, 0, '1'), [1, 0], + compareArray(new TA([0, 0]).fill(1, 0, '1'), [1, 0]), 'string end coerced' ); assert( - compareArray(new TA([0, 0])).fill(1, 1.5), [0, 1], + compareArray(new TA([0, 0]).fill(1, 1.5), [0, 1]), 'start as a float number coerced' ); assert( - compareArray(new TA([0, 0])).fill(1, 0, 1.5), [1, 0], + compareArray(new TA([0, 0]).fill(1, 0, 1.5), [1, 0]), 'end as a float number coerced' ); }); diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js b/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js index ca66ad48c..2a332b54f 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js @@ -34,9 +34,9 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - assert(compareArray(new TA([0, 0, 0])).fill(8, 1, 2), [0, 8, 0]); - assert(compareArray(new TA([0, 0, 0, 0, 0])).fill(8, -3, 4), [0, 0, 8, 8, 0]); - assert(compareArray(new TA([0, 0, 0, 0, 0])).fill(8, -2, -1), [0, 0, 0, 8, 0]); - assert(compareArray(new TA([0, 0, 0, 0, 0])).fill(8, -1, -3), [0, 0, 0, 0, 0]); - assert(compareArray(new TA([0, 0, 0, 0, 0])).fill(8, 1, 3), [0, 8, 8, 0, 0]); + assert(compareArray(new TA([0, 0, 0]).fill(8, 1, 2), [0, 8, 0])); + assert(compareArray(new TA([0, 0, 0, 0, 0]).fill(8, -3, 4), [0, 0, 8, 8, 0])); + assert(compareArray(new TA([0, 0, 0, 0, 0]).fill(8, -2, -1), [0, 0, 0, 8, 0])); + assert(compareArray(new TA([0, 0, 0, 0, 0]).fill(8, -1, -3), [0, 0, 0, 0, 0])); + assert(compareArray(new TA([0, 0, 0, 0, 0]).fill(8, 1, 3), [0, 8, 8, 0, 0])); }); diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js index 13f76f482..4926fdb57 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js @@ -32,22 +32,22 @@ features: [TypedArray] testWithTypedArrayConstructors(function(TA) { assert( - compareArray(new TA([0, 0, 0])).fill(8, 0, 1), [8, 0, 0], + compareArray(new TA([0, 0, 0]).fill(8, 0, 1), [8, 0, 0]), "Fill elements from custom end position" ); assert( - compareArray(new TA([0, 0, 0])).fill(8, 0, -1), [8, 8, 0], + compareArray(new TA([0, 0, 0]).fill(8, 0, -1), [8, 8, 0]), "negative end sets final position to max((length + relativeEnd), 0)" ); assert( - compareArray(new TA([0, 0, 0])).fill(8, 0, 5), [8, 8, 8], + compareArray(new TA([0, 0, 0]).fill(8, 0, 5), [8, 8, 8]), "end position is never higher than of length" ); assert( - compareArray(new TA([0, 0, 0])).fill(8, 0, -4), [0, 0, 0], + compareArray(new TA([0, 0, 0]).fill(8, 0, -4), [0, 0, 0]), "end position is 0 when (len + relativeEnd) < 0" ); }); diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js index 245c5d856..cb89c951f 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js @@ -30,22 +30,22 @@ features: [TypedArray] testWithTypedArrayConstructors(function(TA) { assert( - compareArray(new TA([0, 0, 0])).fill(8, 1), [0, 8, 8], + compareArray(new TA([0, 0, 0]).fill(8, 1), [0, 8, 8]), "Fill elements from custom start position" ); assert( - compareArray(new TA([0, 0, 0])).fill(8, 4), [0, 0, 0], + compareArray(new TA([0, 0, 0]).fill(8, 4), [0, 0, 0]), "start position is never higher than length" ); assert( - compareArray(new TA([0, 0, 0])).fill(8, -1), [0, 0, 8], + compareArray(new TA([0, 0, 0]).fill(8, -1), [0, 0, 8]), "start < 0 sets initial position to max((len + relativeStart), 0)" ); assert( - compareArray(new TA([0, 0, 0])).fill(8, -5), [8, 8, 8], + compareArray(new TA([0, 0, 0]).fill(8, -5), [8, 8, 8]), "start position is 0 when (len + relativeStart) < 0" ); }); diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values.js b/test/built-ins/TypedArray/prototype/fill/fill-values.js index cf632e77b..7d0faa44f 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values.js @@ -38,7 +38,7 @@ testWithTypedArrayConstructors(function(TA) { ); assert( - compareArray(new TA([0, 0, 0])).fill(8), [8, 8, 8], + compareArray(new TA([0, 0, 0]).fill(8), [8, 8, 8]), "Default start and end indexes are 0 and this.length" ); }); -- cgit v1.2.1