diff --git a/test/built-ins/Array/prototype/flat/array-like-objects.js b/test/built-ins/Array/prototype/flat/array-like-objects.js index 4cd131b85b..9c9303ff1a 100644 --- a/test/built-ins/Array/prototype/flat/array-like-objects.js +++ b/test/built-ins/Array/prototype/flat/array-like-objects.js @@ -16,16 +16,16 @@ var a = getArgumentsObject([1], [2]); var actual = [].flat.call(a); assert.compareArray(actual, [1, 2], 'arguments objects'); -var a = { +a = { length: 1, 0: [1], }; -var actual = [].flat.call(a); +actual = [].flat.call(a); assert.compareArray(actual, [1], 'array-like objects'); -var a = { +a = { length: undefined, 0: [1], }; -var actual = [].flat.call(a); +actual = [].flat.call(a); assert.compareArray(actual, [], 'array-like objects; undefined length'); diff --git a/test/built-ins/Array/prototype/flat/length.js b/test/built-ins/Array/prototype/flat/length.js index 4c0896f349..e92beff304 100644 --- a/test/built-ins/Array/prototype/flat/length.js +++ b/test/built-ins/Array/prototype/flat/length.js @@ -14,6 +14,8 @@ assert.sameValue( 'The value of `Array.prototype.flat.length` is `0`' ); -verifyNotEnumerable(Array.prototype.flat, 'length'); -verifyNotWritable(Array.prototype.flat, 'length'); -verifyConfigurable(Array.prototype.flat, 'length'); +verifyProperty(Array.prototype.flat, 'length', { + enumerable: false, + writable: false, + configurable: true, +}); diff --git a/test/built-ins/Array/prototype/flat/name.js b/test/built-ins/Array/prototype/flat/name.js index 312827bc1a..18debef96f 100644 --- a/test/built-ins/Array/prototype/flat/name.js +++ b/test/built-ins/Array/prototype/flat/name.js @@ -15,6 +15,8 @@ assert.sameValue( 'The value of `Array.prototype.flat.name` is `"flat"`' ); -verifyNotEnumerable(Array.prototype.flat, 'name'); -verifyNotWritable(Array.prototype.flat, 'name'); -verifyConfigurable(Array.prototype.flat, 'name'); +verifyProperty(Array.prototype.flat, 'name', { + enumerable: false, + writable: false, + configurable: true, +}); diff --git a/test/built-ins/Array/prototype/flat/non-numeric-depth-should-not-throw.js b/test/built-ins/Array/prototype/flat/non-numeric-depth-should-not-throw.js index 68f229a243..946465094c 100644 --- a/test/built-ins/Array/prototype/flat/non-numeric-depth-should-not-throw.js +++ b/test/built-ins/Array/prototype/flat/non-numeric-depth-should-not-throw.js @@ -17,27 +17,27 @@ var actual = a.flat(depthNum); assert(compareArray(actual, expected), 'non integral string depthNum'); // object type depthNum is converted to 0 -var depthNum = {}; -var actual = a.flat(depthNum); +depthNum = {}; +actual = a.flat(depthNum); assert(compareArray(actual, expected), 'object type depthNum'); // negative infinity depthNum is converted to 0 -var depthNum = Number.NEGATIVE_INFINITY; -var actual = a.flat(depthNum); +depthNum = Number.NEGATIVE_INFINITY; +actual = a.flat(depthNum); assert(compareArray(actual, expected), 'negative infinity depthNum'); // positive zero depthNum is converted to 0 -var depthNum = +0; -var actual = a.flat(depthNum); +depthNum = +0; +actual = a.flat(depthNum); assert(compareArray(actual, expected), 'positive zero depthNum'); // negative zero depthNum is converted to 0 -var depthNum = -0; -var actual = a.flat(depthNum); +depthNum = -0; +actual = a.flat(depthNum); assert(compareArray(actual, expected), 'negative zero depthNum'); // integral string depthNum is converted to an integer -var depthNum = '1'; -var actual = a.flat(depthNum); -var expected = [1, 2] +depthNum = '1'; +actual = a.flat(depthNum); +expected = [1, 2] assert(compareArray(actual, expected), 'integral string depthNum'); diff --git a/test/built-ins/Array/prototype/flat/non-object-ctor-throws.js b/test/built-ins/Array/prototype/flat/non-object-ctor-throws.js index eb4f5ca092..1d3e595cd3 100644 --- a/test/built-ins/Array/prototype/flat/non-object-ctor-throws.js +++ b/test/built-ins/Array/prototype/flat/non-object-ctor-throws.js @@ -14,19 +14,19 @@ assert.throws(TypeError, function() { a.flat(); }, 'null value'); -var a = []; +a = []; a.constructor = 1; assert.throws(TypeError, function() { a.flat(); }, 'number value'); -var a = []; +a = []; a.constructor = 'string'; assert.throws(TypeError, function() { a.flat(); }, 'string value'); -var a = []; +a = []; a.constructor = true; assert.throws(TypeError, function() { a.flat(); diff --git a/test/built-ins/Array/prototype/flat/prop-desc.js b/test/built-ins/Array/prototype/flat/prop-desc.js index c538b2b7b7..4ee68c38d8 100644 --- a/test/built-ins/Array/prototype/flat/prop-desc.js +++ b/test/built-ins/Array/prototype/flat/prop-desc.js @@ -2,7 +2,6 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-array.prototype.flat -es6id: 22.1.3 description: Property type and descriptor. info: > 17 ECMAScript Standard Built-in Objects @@ -16,6 +15,8 @@ assert.sameValue( '`typeof Array.prototype.flat` is `function`' ); -verifyNotEnumerable(Array.prototype, 'flat'); -verifyWritable(Array.prototype, 'flat'); -verifyConfigurable(Array.prototype, 'flat'); +verifyProperty(Array.prototype, 'flat', { + enumerable: false, + writable: true, + configurable: true, +}); diff --git a/test/built-ins/Array/prototype/flat/proxy-access-count.js b/test/built-ins/Array/prototype/flat/proxy-access-count.js index 0c691e079a..9dbc4839c2 100644 --- a/test/built-ins/Array/prototype/flat/proxy-access-count.js +++ b/test/built-ins/Array/prototype/flat/proxy-access-count.js @@ -3,12 +3,24 @@ /*--- esid: sec-array.prototype.flat description: > - properties are accessed correct number of times by .flat + properties are accessed correct number of times by .flat +info: | + Array.prototype.flat( [ depth ] ) + + ... + 6. Perform ? FlattenIntoArray(A, O, sourceLen, 0, depthNum). + + FlattenIntoArray (target, source, sourceLen, start, depth [ , mapperFunction, thisArg ]) + + 3. Repeat, while sourceIndex < sourceLen + a. Let P be ! ToString(sourceIndex). + b. Let exists be ? HasProperty(source, P). + c. If exists is true, then + i. Let element be ? Get(source, P). features: [Array.prototype.flat] includes: [compareArray.js] ---*/ - const getCalls = [], hasCalls = []; const handler = { get : function (t, p, r) { getCalls.push(p); return Reflect.get(t, p, r); }, diff --git a/test/built-ins/Array/prototype/flatMap/array-like-objects.js b/test/built-ins/Array/prototype/flatMap/array-like-objects.js index a9512ff35f..8b2c597a84 100644 --- a/test/built-ins/Array/prototype/flatMap/array-like-objects.js +++ b/test/built-ins/Array/prototype/flatMap/array-like-objects.js @@ -20,16 +20,16 @@ var a = getArgumentsObject(1, 2); var actual = [].flatMap.call(a, double); assert.compareArray(actual, [2, 4], 'arguments objects'); -var a = { +a = { length: 1, 0: 1, }; -var actual = [].flatMap.call(a, double); +actual = [].flatMap.call(a, double); assert.compareArray(actual, [2], 'array-like objects'); -var a = { +a = { length: void 0, 0: 1, }; -var actual = [].flatMap.call(a, double); +actual = [].flatMap.call(a, double); assert.compareArray(actual, [], 'array-like objects; undefined length'); diff --git a/test/built-ins/Array/prototype/flatMap/length.js b/test/built-ins/Array/prototype/flatMap/length.js index c5fc1b3a36..67152cddb3 100644 --- a/test/built-ins/Array/prototype/flatMap/length.js +++ b/test/built-ins/Array/prototype/flatMap/length.js @@ -14,6 +14,8 @@ assert.sameValue( 'The value of `Array.prototype.flatmap.length` is `1`' ); -verifyNotEnumerable(Array.prototype.flatMap, 'length'); -verifyNotWritable(Array.prototype.flatMap, 'length'); -verifyConfigurable(Array.prototype.flatMap, 'length'); +verifyProperty(Array.prototype.flatMap, 'length', { + enumerable: false, + writable: false, + configurable: true, +}); diff --git a/test/built-ins/Array/prototype/flatMap/name.js b/test/built-ins/Array/prototype/flatMap/name.js index 98ea548a4b..3b5ec271c1 100644 --- a/test/built-ins/Array/prototype/flatMap/name.js +++ b/test/built-ins/Array/prototype/flatMap/name.js @@ -14,6 +14,8 @@ assert.sameValue( 'The value of `Array.prototype.flatMap.name` is `"flatMap"`' ); -verifyNotEnumerable(Array.prototype.flatMap, 'name'); -verifyNotWritable(Array.prototype.flatMap, 'name'); -verifyConfigurable(Array.prototype.flatMap, 'name'); +verifyProperty(Array.prototype.flatMap, 'name', { + enumerable: false, + writable: false, + configurable: true, +}); diff --git a/test/built-ins/Array/prototype/flatMap/non-object-ctor-throws.js b/test/built-ins/Array/prototype/flatMap/non-object-ctor-throws.js index 65767d2ce4..b54e27746a 100644 --- a/test/built-ins/Array/prototype/flatMap/non-object-ctor-throws.js +++ b/test/built-ins/Array/prototype/flatMap/non-object-ctor-throws.js @@ -14,19 +14,19 @@ assert.throws(TypeError, function() { a.flatMap(); }, 'null value'); -var a = []; +a = []; a.constructor = 1; assert.throws(TypeError, function() { a.flatMap(); }, 'number value'); -var a = []; +a = []; a.constructor = 'string'; assert.throws(TypeError, function() { a.flatMap(); }, 'string value'); -var a = []; +a = []; a.constructor = true; assert.throws(TypeError, function() { a.flatMap(); diff --git a/test/built-ins/Array/prototype/flatMap/prop-desc.js b/test/built-ins/Array/prototype/flatMap/prop-desc.js new file mode 100644 index 0000000000..1ea4930e69 --- /dev/null +++ b/test/built-ins/Array/prototype/flatMap/prop-desc.js @@ -0,0 +1,27 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.flatMap +description: Property type and descriptor. +info: > + 17 ECMAScript Standard Built-in Objects + + 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] +features: [Array.prototype.flatMap] +---*/ + +assert.sameValue( + typeof Array.prototype.flatMap, + 'function', + '`typeof Array.prototype.flatMap` is `function`' +); + +verifyProperty(Array.prototype, 'flatMap', { + enumerable: false, + writable: true, + configurable: true, +}); diff --git a/test/built-ins/Array/prototype/flatMap/proxy-access-count.js b/test/built-ins/Array/prototype/flatMap/proxy-access-count.js index 8cb851e024..8b33348c69 100644 --- a/test/built-ins/Array/prototype/flatMap/proxy-access-count.js +++ b/test/built-ins/Array/prototype/flatMap/proxy-access-count.js @@ -3,12 +3,24 @@ /*--- esid: sec-array.prototype.flatMap description: > - properties are accessed correct number of times by .flatMap + properties are accessed correct number of times by .flatMap +info: | + Array.prototype.flatMap ( mapperFunction [ , thisArg ] ) + + ... + 6. Perform ? FlattenIntoArray(A, O, sourceLen, 0, 1, mapperFunction, T). + + FlattenIntoArray (target, source, sourceLen, start, depth [ , mapperFunction, thisArg ]) + + 3. Repeat, while sourceIndex < sourceLen + a. Let P be ! ToString(sourceIndex). + b. Let exists be ? HasProperty(source, P). + c. If exists is true, then + i. Let element be ? Get(source, P). features: [Array.prototype.flat] includes: [compareArray.js] ---*/ - const getCalls = [], hasCalls = []; const handler = { get : function (t, p, r) { getCalls.push(p); return Reflect.get(t, p, r); },