diff options
Diffstat (limited to 'test/built-ins/TypedArray/prototype/fill')
46 files changed, 1123 insertions, 24 deletions
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..5467a89cd --- /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 +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] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert( + compareArray(new TA([0n, 0n]).fill(1n, undefined), [1n, 1n]), + '`undefined` start coerced to 0' + ); + + assert( + compareArray(new TA([0n, 0n]).fill(1n, 0, undefined), [1n, 1n]), + 'If end is undefined, let relativeEnd be len' + ); + + assert( + compareArray(new TA([0n, 0n]).fill(1n, null), [1n, 1n]), + '`null` start coerced to 0' + ); + + assert( + compareArray(new TA([0n, 0n]).fill(1n, 0, null), [0n, 0n]), + '`null` end coerced to 0' + ); + + assert( + compareArray(new TA([0n, 0n]).fill(1n, true), [0n, 1n]), + '`true` start coerced to 1' + ); + + assert( + compareArray(new TA([0n, 0n]).fill(1n, 0, true), [1n, 0n]), + '`true` end coerced to 1' + ); + + assert( + compareArray(new TA([0n, 0n]).fill(1n, false), [1n, 1n]), + '`false` start coerced to 0' + ); + + assert( + compareArray(new TA([0n, 0n]).fill(1n, 0, false), [0n, 0n]), + '`false` end coerced to 0' + ); + + assert( + compareArray(new TA([0n, 0n]).fill(1n, NaN), [1n, 1n]), + '`NaN` start coerced to 0' + ); + + assert( + compareArray(new TA([0n, 0n]).fill(1n, 0, NaN), [0n, 0n]), + '`NaN` end coerced to 0' + ); + + assert( + compareArray(new TA([0n, 0n]).fill(1n, '1'), [0n, 1n]), + 'string start coerced' + ); + + assert( + compareArray(new TA([0n, 0n]).fill(1n, 0, '1'), [1n, 0n]), + 'string end coerced' + ); + + assert( + compareArray(new TA([0n, 0n]).fill(1n, 1.5), [0n, 1n]), + 'start as a float number coerced' + ); + + assert( + 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/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..c87b864f9 --- /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 = 1n; + sample.fill({ valueOf() { return n++; } }); + + 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/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..5db1cfcae --- /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 +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] +features: [BigInt, TypedArray] +---*/ + +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..676d18f86 --- /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 +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] +features: [BigInt, TypedArray] +---*/ + +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..a981ab00b --- /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 +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] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + 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 new file mode 100644 index 000000000..4719ac67e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.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.fill +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([42n]); + sample.fill(false); + assert.sameValue(sample[0], 0n, "false => 0"); + + sample = new TA([42n]); + sample.fill(true); + assert.sameValue(sample[0], 1n, "true => 1"); + + sample = new TA([42n]); + sample.fill("7"); + assert.sameValue(sample[0], 7n, "string conversion"); + + sample = new TA([42n]); + sample.fill({ + toString: function() { + return "1"; + }, + valueOf: function() { + return 7n; + } + }); + assert.sameValue(sample[0], 7n, "object valueOf conversion before toString"); + + sample = new TA([42n]); + sample.fill({ + toString: function() { + return "7"; + } + }); + 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 new file mode 100644 index 000000000..a4cac9ffb --- /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 +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] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert( + compareArray(new TA([0n, 0n, 0n]).fill(8n, 0, 1), [8n, 0n, 0n]), + "Fill elements from custom end position" + ); + + assert( + 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([0n, 0n, 0n]).fill(8n, 0, 5), [8n, 8n, 8n]), + "end position is never higher than of length" + ); + + assert( + 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 new file mode 100644 index 000000000..790d1a5f2 --- /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 +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] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert( + compareArray(new TA([0n, 0n, 0n]).fill(8n, 1), [0n, 8n, 8n]), + "Fill elements from custom start position" + ); + + assert( + compareArray(new TA([0n, 0n, 0n]).fill(8n, 4), [0n, 0n, 0n]), + "start position is never higher than length" + ); + + assert( + 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([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-symbol-throws.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-symbol-throws.js new file mode 100644 index 000000000..dddad60fa --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-symbol-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.fill +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..ec390d28b --- /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 +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] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + assert( + compareArray( + new TA().fill(8n), + [] + ), + "does not fill an empty instance" + ); + + assert( + 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 new file mode 100644 index 000000000..ec7637bc5 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/get-length-ignores-length-prop.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 +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(1n, 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..f7f0936d1 --- /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. +/*--- +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 ] ] ) + + 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..897c2164b --- /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. +/*--- +esid: sec-%typedarray%.prototype.fill +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..6bf1feff5 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/length.js @@ -0,0 +1,30 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.fill +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] +features: [BigInt, TypedArray] +---*/ + +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..82e72227a --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/name.js @@ -0,0 +1,27 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.fill +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] +features: [BigInt, TypedArray] +---*/ + +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..752b7a282 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/prop-desc.js @@ -0,0 +1,19 @@ +// Copyright (C) 2016 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: > + "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] +features: [BigInt, TypedArray] +---*/ + +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..084c9ac1e --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-end-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 +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..9dd7dd553 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-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 +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(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 new file mode 100644 index 000000000..c30cbf097 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.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: > + 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([42n]); + 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..d95c9a30d --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start-as-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.fill +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..c5731f2f5 --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-start.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.fill +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(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 new file mode 100644 index 000000000..83895854f --- /dev/null +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-this.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. +/*--- +esid: sec-%typedarray%.prototype.fill +description: > + Returns `this`. +includes: [testBigIntTypedArray.js] +features: [BigInt, TypedArray] +---*/ + +testWithBigIntTypedArrayConstructors(function(TA) { + var sample1 = new TA(); + var result1 = sample1.fill(1n); + + assert.sameValue(result1, sample1); + + var sample2 = new TA(42); + var result2 = sample2.fill(7n); + 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/coerced-indexes.js b/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js index 352a91d1a..2d512bae5 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: | @@ -29,6 +28,7 @@ info: | ToInteger(end). ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { 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..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 @@ -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 ] ] ) @@ -49,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 91def14f2..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 @@ -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: | @@ -45,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 8db9082d4..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 @@ -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: | @@ -31,6 +30,7 @@ info: | final be min(relativeEnd, len). ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { 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..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 @@ -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: | @@ -59,10 +58,10 @@ testWithTypedArrayConstructors(function(TA) { sample = new TA([42]); sample.fill({ toString: function() { - return 1; + return "1"; }, valueOf: function() { - return 7; + return 7; } }); assert.sameValue(sample[0], 7, "object valueOf conversion before toString"); @@ -70,7 +69,7 @@ testWithTypedArrayConstructors(function(TA) { sample = new TA([42]); sample.fill({ toString: function() { - return 7; + return "7"; } }); 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 fe0b82d75..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 @@ -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: | @@ -28,6 +27,7 @@ info: | final be min(relativeEnd, len). ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { 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..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 @@ -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: | @@ -26,6 +25,7 @@ info: | min(relativeStart, len). ... includes: [compareArray.js, testTypedArray.js] +features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { 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 70da31da6..7d0faa44f 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: | @@ -26,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) { 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..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 @@ -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..b6c737535 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: | @@ -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 510c54526..69820f96a 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: | @@ -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 d0175e2e5..8cc26d79b 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: | @@ -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/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 7a90c2888..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 @@ -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 d57b5189c..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 @@ -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 5e4ac67a1..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 @@ -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 38c91d71a..95ce81f93 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] |