diff --git a/harness/compareArray.js b/harness/compareArray.js index b89bb51818..adf294b5e8 100644 --- a/harness/compareArray.js +++ b/harness/compareArray.js @@ -26,8 +26,8 @@ compareArray.isSameValue = function(a, b) { return a === b; }; -compareArray.format = function(thingWithALengthPropertyAndNumericIndices) { - return `[${[].map.call(thingWithALengthPropertyAndNumericIndices, String).join(', ')}]`; +compareArray.format = function(array) { + return `[${array.map(String).join(', ')}]`; }; assert.compareArray = function(actual, expected, message) { @@ -35,11 +35,8 @@ assert.compareArray = function(actual, expected, message) { assert(actual != null, `First argument shouldn't be nullish. ${message}`); assert(expected != null, `Second argument shouldn't be nullish. ${message}`); var format = compareArray.format; - var result = compareArray(actual, expected); - - // The following prevents actual and expected from being iterated and evaluated - // more than once unless absolutely necessary. - if (!result) { - assert(false, `Expected ${format(actual)} and ${format(expected)} to have the same contents. ${message}`); - } + assert( + compareArray(actual, expected), + `Expected ${format(actual)} and ${format(expected)} to have the same contents. ${message}` + ); }; diff --git a/src/async-generators/yield-spread-arr-multiple.case b/src/async-generators/yield-spread-arr-multiple.case index 4a169aac53..33f431766b 100644 --- a/src/async-generators/yield-spread-arr-multiple.case +++ b/src/async-generators/yield-spread-arr-multiple.case @@ -27,7 +27,7 @@ item.then(({ done, value }) => { item = iter.next(value); item.then(({ done, value }) => { - assert.compareArray(value, arr); + assert(compareArray(value, arr)); assert.sameValue(done, false); }).then($DONE, $DONE); }).catch($DONE); diff --git a/src/class-elements/redeclaration-symbol.case b/src/class-elements/redeclaration-symbol.case index fc7eaa468f..97317c4bbb 100644 --- a/src/class-elements/redeclaration-symbol.case +++ b/src/class-elements/redeclaration-symbol.case @@ -50,4 +50,4 @@ verifyProperty(c, y, { configurable: true }); -assert.compareArray(x, ["a", "b", "c"]); +assert(compareArray(x, ["a", "b", "c"])); diff --git a/src/class-elements/redeclaration.case b/src/class-elements/redeclaration.case index 880cbc9900..e6310ac3c5 100644 --- a/src/class-elements/redeclaration.case +++ b/src/class-elements/redeclaration.case @@ -50,4 +50,4 @@ verifyProperty(c, "y", { configurable: true }); -assert.compareArray(x, ["a", "b", "c", "d"]); +assert(compareArray(x, ["a", "b", "c", "d"])); diff --git a/src/dstr-assignment/obj-rest-order.case b/src/dstr-assignment/obj-rest-order.case index ffca419771..2448b1a18e 100644 --- a/src/dstr-assignment/obj-rest-order.case +++ b/src/dstr-assignment/obj-rest-order.case @@ -19,5 +19,5 @@ Object.defineProperty(o, Symbol('foo'), { get: () => { calls.push("Symbol(foo)") //- vals o //- body -assert.compareArray(calls, [1, 'z', 'a', "Symbol(foo)"]); +assert(compareArray(calls, [1, 'z', 'a', "Symbol(foo)"])); assert.sameValue(Object.keys(rest).length, 3); diff --git a/src/generators/yield-spread-arr-multiple.case b/src/generators/yield-spread-arr-multiple.case index 3f1db62107..9d38f78979 100644 --- a/src/generators/yield-spread-arr-multiple.case +++ b/src/generators/yield-spread-arr-multiple.case @@ -23,5 +23,5 @@ iter.next(false); item = iter.next(['a', 'b', 'c']); item = iter.next(item.value); -assert.compareArray(item.value, arr); +assert(compareArray(item.value, arr)); assert.sameValue(item.done, false); diff --git a/src/spread/obj-spread-order.case b/src/spread/obj-spread-order.case index c4585f72c0..b063476dd3 100644 --- a/src/spread/obj-spread-order.case +++ b/src/spread/obj-spread-order.case @@ -29,5 +29,5 @@ Object.defineProperty(o, Symbol('foo'), { get: () => { calls.push("Symbol(foo)") //- params obj //- body -assert.compareArray(calls, [1, 'z', 'a', "Symbol(foo)"]); +assert(compareArray(calls, [1, 'z', 'a', "Symbol(foo)"])); assert.sameValue(Object.keys(obj).length, 3); diff --git a/test/built-ins/Array/prototype/concat/Array.prototype.concat_large-typed-array.js b/test/built-ins/Array/prototype/concat/Array.prototype.concat_large-typed-array.js index 474643907c..361a990748 100644 --- a/test/built-ins/Array/prototype/concat/Array.prototype.concat_large-typed-array.js +++ b/test/built-ins/Array/prototype/concat/Array.prototype.concat_large-typed-array.js @@ -16,18 +16,21 @@ function concatTypedArray(type, elems, modulo) { ta_by_len[i] = items[i] = modulo === false ? i : elems % modulo; } var ta = new type(items); - assert.compareArray([].concat(ta, ta), [ta, ta], - '[].concat(new type(items), new type(items)) must return [ta, ta]' + assert( + compareArray([].concat(ta, ta), [ta, ta]), + 'compareArray([].concat(ta, ta), [ta, ta]) must return true' ); ta[Symbol.isConcatSpreadable] = true; assert.compareArray([].concat(ta), items, '[].concat(new type(items)) returns items'); - assert.compareArray([].concat(ta_by_len, ta_by_len), [ta_by_len, ta_by_len], - '[].concat(new type(elems), new type(elems)) must return [ta_by_len, ta_by_len]' + assert( + compareArray([].concat(ta_by_len, ta_by_len), [ta_by_len, ta_by_len]), + 'compareArray([].concat(ta_by_len, ta_by_len), [ta_by_len, ta_by_len]) must return true' ); ta_by_len[Symbol.isConcatSpreadable] = true; - assert.compareArray([].concat(ta_by_len), items, - '[].concat(new type(elems)) returns items' + assert( + compareArray([].concat(ta_by_len), items), + 'compareArray([].concat(ta_by_len), items) must return true' ); // TypedArray with fake `length`. diff --git a/test/built-ins/Array/prototype/concat/Array.prototype.concat_small-typed-array.js b/test/built-ins/Array/prototype/concat/Array.prototype.concat_small-typed-array.js index 61fd5ff389..4c8763a9d9 100644 --- a/test/built-ins/Array/prototype/concat/Array.prototype.concat_small-typed-array.js +++ b/test/built-ins/Array/prototype/concat/Array.prototype.concat_small-typed-array.js @@ -16,21 +16,21 @@ function concatTypedArray(type, elems, modulo) { ta_by_len[i] = items[i] = modulo === false ? i : elems % modulo; } var ta = new type(items); - assert.compareArray( - [].concat(ta, ta), [ta, ta], - '[].concat(new type(items), new type(items)) must return [ta, ta]' + assert( + compareArray([].concat(ta, ta), [ta, ta]), + 'compareArray([].concat(ta, ta), [ta, ta]) must return true' ); ta[Symbol.isConcatSpreadable] = true; assert.compareArray([].concat(ta), items, '[].concat(new type(items)) returns items'); - assert.compareArray( - [].concat(ta_by_len, ta_by_len), [ta_by_len, ta_by_len], - '[].concat(new type(elems), new type(elems)) must return [ta_by_len, ta_by_len]' + assert( + compareArray([].concat(ta_by_len, ta_by_len), [ta_by_len, ta_by_len]), + 'compareArray([].concat(ta_by_len, ta_by_len), [ta_by_len, ta_by_len]) must return true' ); ta_by_len[Symbol.isConcatSpreadable] = true; - assert.compareArray( - [].concat(ta_by_len), items, - '[].concat(new type(elems)) returns items' + assert( + compareArray([].concat(ta_by_len), items), + 'compareArray([].concat(ta_by_len), items) must return true' ); // TypedArray with fake `length`. diff --git a/test/built-ins/Array/prototype/copyWithin/non-negative-target-and-start.js b/test/built-ins/Array/prototype/copyWithin/non-negative-target-and-start.js index e39f637cf8..cf8f60912f 100644 --- a/test/built-ins/Array/prototype/copyWithin/non-negative-target-and-start.js +++ b/test/built-ins/Array/prototype/copyWithin/non-negative-target-and-start.js @@ -31,22 +31,18 @@ info: | includes: [compareArray.js] ---*/ -assert.compareArray( - ['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(0, 0), ['a', 'b', 'c', 'd', 'e', 'f'], - '["a", "b", "c", "d", "e", "f"].copyWithin(0, 0) must return ["a", "b", "c", "d", "e", "f"]' -); +assert(compareArray( + ['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(0, 0), ['a', 'b', 'c', 'd', 'e', 'f'] +), 'compareArray( ["a", "b", "c", "d", "e", "f"].copyWithin(0, 0), ["a", "b", "c", "d", "e", "f"] ) must return true'); -assert.compareArray( - ['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(0, 2), ['c', 'd', 'e', 'f', 'e', 'f'], - '["a", "b", "c", "d", "e", "f"].copyWithin(0, 2) must return ["c", "d", "e", "f", "e", "f"]' -); +assert(compareArray( + ['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(0, 2), ['c', 'd', 'e', 'f', 'e', 'f'] +), 'compareArray( ["a", "b", "c", "d", "e", "f"].copyWithin(0, 2), ["c", "d", "e", "f", "e", "f"] ) must return true'); -assert.compareArray( - ['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(3, 0), ['a', 'b', 'c', 'a', 'b', 'c'], - '["a", "b", "c", "d", "e", "f"].copyWithin(3, 0) must return ["a", "b", "c", "a", "b", "c"]' -); +assert(compareArray( + ['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(3, 0), ['a', 'b', 'c', 'a', 'b', 'c'] +), 'compareArray( ["a", "b", "c", "d", "e", "f"].copyWithin(3, 0), ["a", "b", "c", "a", "b", "c"] ) must return true'); -assert.compareArray( - [0, 1, 2, 3, 4, 5].copyWithin(1, 4), [0, 4, 5, 3, 4, 5], - '[0, 1, 2, 3, 4, 5].copyWithin(1, 4) must return [0, 4, 5, 3, 4, 5]' -); +assert(compareArray( + [0, 1, 2, 3, 4, 5].copyWithin(1, 4), [0, 4, 5, 3, 4, 5] +), 'compareArray( [0, 1, 2, 3, 4, 5].copyWithin(1, 4), [0, 4, 5, 3, 4, 5] ) must return true'); diff --git a/test/built-ins/Map/iterable-calls-set.js b/test/built-ins/Map/iterable-calls-set.js index acdc33f1db..3b512eb4b1 100644 --- a/test/built-ins/Map/iterable-calls-set.js +++ b/test/built-ins/Map/iterable-calls-set.js @@ -34,9 +34,9 @@ Map.prototype.set = function(k, v) { var map = new Map(iterable); -assert.sameValue(counter, 2, 'The value of counter is expected to be 2'); +assert.sameValue(counter, 2, "`Map.prototype.set` called twice."); -assert.compareArray(results[0], iterable[0], 'The value of results[0] is expected to equal the value of iterable[0]'); -assert.compareArray(results[1], iterable[1], 'The value of results[1] is expected to equal the value of iterable[1]'); -assert.sameValue(_this[0], map, 'The value of _this[0] is expected to equal the value of map'); -assert.sameValue(_this[1], map, 'The value of _this[1] is expected to equal the value of map'); +assert(compareArray(results[0], iterable[0])); +assert(compareArray(results[1], iterable[1])); +assert.sameValue(_this[0], map); +assert.sameValue(_this[1], map); diff --git a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-44.js b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-44.js index 1bf648ab0d..ad7799a2a3 100644 --- a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-44.js +++ b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-44.js @@ -12,6 +12,7 @@ includes: [compareArray.js] var str = new String("abc"); str[5] = "de"; +var expected = ["0", "1", "2", "5", "length"]; var actual = Object.getOwnPropertyNames(str); -assert.compareArray(actual, ["0", "1", "2", "5", "length"], 'The value of actual is expected to be ["0", "1", "2", "5", "length"]'); +assert(compareArray(actual, expected), 'compareArray(actual, expected) !== true'); diff --git a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-49.js b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-49.js index 6f75ee9a44..bb7f61ce94 100644 --- a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-49.js +++ b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-49.js @@ -10,6 +10,7 @@ includes: [compareArray.js] ---*/ var arr = [0, 1, 2]; +var expected = ["0", "1", "2", "length"]; var actual = Object.getOwnPropertyNames(arr); -assert.compareArray(actual, ["0", "1", "2", "length"], 'The value of actual is expected to be ["0", "1", "2", "length"]'); +assert(compareArray(actual, expected), 'compareArray(actual, expected) !== true'); diff --git a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-b-2.js b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-b-2.js index b908426941..ac9096e50c 100644 --- a/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-b-2.js +++ b/test/built-ins/Object/getOwnPropertyNames/15.2.3.4-4-b-2.js @@ -36,5 +36,6 @@ Object.defineProperty(obj, "d", { }); var actual = Object.getOwnPropertyNames(obj); +var expected = ["a", "b", "c", "d"]; -assert.compareArray(actual, ["a", "b", "c", "d"], 'The value of actual is expected to be ["a", "b", "c", "d"]'); +assert(compareArray(actual, expected), 'compareArray(actual, expected) !== true'); diff --git a/test/built-ins/Promise/race/resolved-sequence-with-rejections.js b/test/built-ins/Promise/race/resolved-sequence-with-rejections.js index 4c4596444e..a6fc274cde 100644 --- a/test/built-ins/Promise/race/resolved-sequence-with-rejections.js +++ b/test/built-ins/Promise/race/resolved-sequence-with-rejections.js @@ -30,22 +30,22 @@ let sequence = [1]; Promise.all([ a.catch(() => { sequence.push(3); - assert.sameValue(sequence.length, 3, 'The value of sequence.length is expected to be 3'); + assert.sameValue(sequence.length, 3); return checkSequence(sequence, 'Expected to be called first.'); }), Promise.race([a, b]).catch(() => { sequence.push(5); - assert.sameValue(sequence.length, 5, 'The value of sequence.length is expected to be 5'); + assert.sameValue(sequence.length, 5); return checkSequence(sequence, 'Expected to be called third.'); }), b.catch(() => { sequence.push(4); - assert.sameValue(sequence.length, 4, 'The value of sequence.length is expected to be 4'); + assert.sameValue(sequence.length, 4); return checkSequence(sequence, 'Expected to be called second.'); }) ]).then(result => { - assert.compareArray(result, [true, true, true], 'The value of result is expected to be [true, true, true]'); - assert.sameValue(sequence.length, 5, 'The value of sequence.length is expected to be 5'); + compareArray(result, [true, true, true]); + assert.sameValue(sequence.length, 5); checkSequence(sequence); }).then($DONE, $DONE); diff --git a/test/built-ins/Promise/race/resolved-sequence.js b/test/built-ins/Promise/race/resolved-sequence.js index df0b66802b..d2d67d42e8 100644 --- a/test/built-ins/Promise/race/resolved-sequence.js +++ b/test/built-ins/Promise/race/resolved-sequence.js @@ -30,22 +30,22 @@ let sequence = [1]; Promise.all([ a.then(() => { sequence.push(3); - assert.sameValue(sequence.length, 3, 'The value of sequence.length is expected to be 3'); + assert.sameValue(sequence.length, 3); return checkSequence(sequence, 'Expected to be called first.'); }), Promise.race([a, b]).then(() => { sequence.push(5); - assert.sameValue(sequence.length, 5, 'The value of sequence.length is expected to be 5'); + assert.sameValue(sequence.length, 5); return checkSequence(sequence, 'Expected to be called third.'); }), b.then(() => { sequence.push(4); - assert.sameValue(sequence.length, 4, 'The value of sequence.length is expected to be 4'); + assert.sameValue(sequence.length, 4); return checkSequence(sequence, 'Expected to be called second.'); }) ]).then(result => { - assert.compareArray(result, [true, true, true], 'The value of result is expected to be [true, true, true]'); - assert.sameValue(sequence.length, 5, 'The value of sequence.length is expected to be 5'); + compareArray(result, [true, true, true]); + assert.sameValue(sequence.length, 5); checkSequence(sequence) }).then($DONE, $DONE); sequence.push(2); diff --git a/test/built-ins/Proxy/enumerate/removed-does-not-trigger.js b/test/built-ins/Proxy/enumerate/removed-does-not-trigger.js index 5be8b4ce97..2696525469 100644 --- a/test/built-ins/Proxy/enumerate/removed-does-not-trigger.js +++ b/test/built-ins/Proxy/enumerate/removed-does-not-trigger.js @@ -23,25 +23,25 @@ for (x in p) { forInResults.push(x); } -assert.compareArray(forInResults, ["0", "1", "2"], 'The value of forInResults is expected to be ["0", "1", "2"]'); +assert(compareArray(forInResults, ["0", "1", "2"])); var forOfResults = []; for (x of p) { forOfResults.push(x); } -assert.compareArray(forOfResults, [1, 2, 3], 'The value of forOfResults is expected to be [1, 2, 3]'); +assert(compareArray(forOfResults, [1, 2, 3])); var itor = p[Symbol.iterator](); var next = itor.next(); -assert.sameValue(next.value, 1, 'The value of next.value is expected to be 1'); -assert.sameValue(next.done, false, 'The value of next.done is expected to be false'); +assert.sameValue(next.value, 1); +assert.sameValue(next.done, false); next = itor.next(); -assert.sameValue(next.value, 2, 'The value of next.value is expected to be 2'); -assert.sameValue(next.done, false, 'The value of next.done is expected to be false'); +assert.sameValue(next.value, 2); +assert.sameValue(next.done, false); next = itor.next(); -assert.sameValue(next.value, 3, 'The value of next.value is expected to be 3'); -assert.sameValue(next.done, false, 'The value of next.done is expected to be false'); +assert.sameValue(next.value, 3); +assert.sameValue(next.done, false); next = itor.next(); -assert.sameValue(next.value, undefined, 'The value of next.value is expected to equal undefined'); -assert.sameValue(next.done, true, 'The value of next.done is expected to be true'); +assert.sameValue(next.value, undefined); +assert.sameValue(next.done, true); diff --git a/test/built-ins/Reflect/getOwnPropertyDescriptor/return-from-accessor-descriptor.js b/test/built-ins/Reflect/getOwnPropertyDescriptor/return-from-accessor-descriptor.js index fd2d4bf67e..4e010227bc 100644 --- a/test/built-ins/Reflect/getOwnPropertyDescriptor/return-from-accessor-descriptor.js +++ b/test/built-ins/Reflect/getOwnPropertyDescriptor/return-from-accessor-descriptor.js @@ -45,12 +45,12 @@ Object.defineProperty(o1, 'p', { var result = Reflect.getOwnPropertyDescriptor(o1, 'p'); -assert.compareArray( - Object.getOwnPropertyNames(result), - ['get', 'set', 'enumerable', 'configurable'], - 'Object.getOwnPropertyNames(Reflect.getOwnPropertyDescriptor(o1, "p")) must return ["get", "set", "enumerable", "configurable"]' +assert( + compareArray( + Object.getOwnPropertyNames(result), ['get', 'set', 'enumerable', 'configurable'] + ) ); -assert.sameValue(result.enumerable, false, 'The value of result.enumerable is expected to be false'); -assert.sameValue(result.configurable, true, 'The value of result.configurable is expected to be true'); -assert.sameValue(result.get, fn, 'The value of result.get is expected to equal the value of fn'); -assert.sameValue(result.set, undefined, 'The value of result.set is expected to equal undefined'); +assert.sameValue(result.enumerable, false); +assert.sameValue(result.configurable, true); +assert.sameValue(result.get, fn); +assert.sameValue(result.set, undefined); diff --git a/test/built-ins/Reflect/getOwnPropertyDescriptor/return-from-data-descriptor.js b/test/built-ins/Reflect/getOwnPropertyDescriptor/return-from-data-descriptor.js index 1c00914c1c..64fac9416d 100644 --- a/test/built-ins/Reflect/getOwnPropertyDescriptor/return-from-data-descriptor.js +++ b/test/built-ins/Reflect/getOwnPropertyDescriptor/return-from-data-descriptor.js @@ -21,12 +21,12 @@ var o1 = { var result = Reflect.getOwnPropertyDescriptor(o1, 'p'); -assert.compareArray( - Object.getOwnPropertyNames(result), - ['value', 'writable', 'enumerable', 'configurable'], - 'Object.getOwnPropertyNames(Reflect.getOwnPropertyDescriptor(o1, "p")) must return ["value", "writable", "enumerable", "configurable"]' +assert( + compareArray( + Object.getOwnPropertyNames(result), ['value', 'writable', 'enumerable', 'configurable'] + ) ); -assert.sameValue(result.value, 'foo', 'The value of result.value is expected to be "foo"'); -assert.sameValue(result.enumerable, true, 'The value of result.enumerable is expected to be true'); -assert.sameValue(result.configurable, true, 'The value of result.configurable is expected to be true'); -assert.sameValue(result.writable, true, 'The value of result.writable is expected to be true'); +assert.sameValue(result.value, 'foo'); +assert.sameValue(result.enumerable, true); +assert.sameValue(result.configurable, true); +assert.sameValue(result.writable, true); diff --git a/test/built-ins/Reflect/getOwnPropertyDescriptor/symbol-property.js b/test/built-ins/Reflect/getOwnPropertyDescriptor/symbol-property.js index 5f99f47b38..5b9deb8bc6 100644 --- a/test/built-ins/Reflect/getOwnPropertyDescriptor/symbol-property.js +++ b/test/built-ins/Reflect/getOwnPropertyDescriptor/symbol-property.js @@ -27,12 +27,12 @@ o[s] = 42; var result = Reflect.getOwnPropertyDescriptor(o, s); -assert.compareArray( - Object.getOwnPropertyNames(result), - ['value', 'writable', 'enumerable', 'configurable'], - 'Object.getOwnPropertyNames(Reflect.getOwnPropertyDescriptor(o, s)) must return ["value", "writable", "enumerable", "configurable"]' +assert( + compareArray( + Object.getOwnPropertyNames(result), ['value', 'writable', 'enumerable', 'configurable'] + ) ); -assert.sameValue(result.value, 42, 'The value of result.value is expected to be 42'); -assert.sameValue(result.enumerable, true, 'The value of result.enumerable is expected to be true'); -assert.sameValue(result.configurable, true, 'The value of result.configurable is expected to be true'); -assert.sameValue(result.writable, true, 'The value of result.writable is expected to be true'); +assert.sameValue(result.value, 42); +assert.sameValue(result.enumerable, true); +assert.sameValue(result.configurable, true); +assert.sameValue(result.writable, true); diff --git a/test/built-ins/Reflect/ownKeys/return-array-with-own-keys-only.js b/test/built-ins/Reflect/ownKeys/return-array-with-own-keys-only.js index 5273bae654..2d97d8bbcb 100644 --- a/test/built-ins/Reflect/ownKeys/return-array-with-own-keys-only.js +++ b/test/built-ins/Reflect/ownKeys/return-array-with-own-keys-only.js @@ -23,4 +23,7 @@ var o = Object.create(proto); o.p1 = 42; o.p2 = 43; o.p3 = 44; -assert.compareArray(Reflect.ownKeys(o), ['p1', 'p2', 'p3'], 'Reflect.ownKeys(Object.create(proto)) must return ["p1", "p2", "p3"]'); +assert( + compareArray(Reflect.ownKeys(o), ['p1', 'p2', 'p3']), + 'return object own keys' +); diff --git a/test/built-ins/Reflect/ownKeys/return-empty-array.js b/test/built-ins/Reflect/ownKeys/return-empty-array.js index 306cc39904..9f30b8240b 100644 --- a/test/built-ins/Reflect/ownKeys/return-empty-array.js +++ b/test/built-ins/Reflect/ownKeys/return-empty-array.js @@ -15,10 +15,10 @@ includes: [compareArray.js] features: [Reflect] ---*/ -assert.compareArray(Reflect.ownKeys({}), [], 'Reflect.ownKeys({}) must return []'); +assert(compareArray(Reflect.ownKeys({}), [])); var o = { d: 42 }; delete o.d; -assert.compareArray(Reflect.ownKeys(o), [], 'Reflect.ownKeys({d: 42}) must return []'); +assert(compareArray(Reflect.ownKeys(o), [])); diff --git a/test/built-ins/Reflect/ownKeys/return-non-enumerable-keys.js b/test/built-ins/Reflect/ownKeys/return-non-enumerable-keys.js index 7948740916..115a9a15d2 100644 --- a/test/built-ins/Reflect/ownKeys/return-non-enumerable-keys.js +++ b/test/built-ins/Reflect/ownKeys/return-non-enumerable-keys.js @@ -15,14 +15,14 @@ includes: [compareArray.js] features: [Reflect] ---*/ -assert.compareArray( - Reflect.ownKeys([]), ['length'], - 'Reflect.ownKeys([]) must return ["length"]' +assert( + compareArray(Reflect.ownKeys([]), ['length']), + 'return non enumerable `length` from empty array' ); -assert.compareArray( - Reflect.ownKeys([, , 2]), ['2', 'length'], - 'Reflect.ownKeys([, , 2]) must return ["2", "length"]' +assert( + compareArray(Reflect.ownKeys([, , 2]), ['2', 'length']), + 'return array keys' ); var o = {}; @@ -35,4 +35,4 @@ Object.defineProperty(o, 'p2', { enumerable: false }); -assert.compareArray(Reflect.ownKeys(o), ['p1', 'p2'], 'Reflect.ownKeys({}) must return ["p1", "p2"]'); +assert(compareArray(Reflect.ownKeys(o), ['p1', 'p2'])); diff --git a/test/built-ins/RegExp/named-groups/groups-properties.js b/test/built-ins/RegExp/named-groups/groups-properties.js index e128962568..9d7aa66f2e 100644 --- a/test/built-ins/RegExp/named-groups/groups-properties.js +++ b/test/built-ins/RegExp/named-groups/groups-properties.js @@ -15,15 +15,16 @@ info: | ---*/ // Properties created on result.groups in textual order. -assert.compareArray(["fst", "snd"], Object.getOwnPropertyNames( - /(?.)|(?.)/u.exec("abcd").groups), '["fst", "snd"] must return the same value returned by Object.getOwnPropertyNames(\n /(?.)|(?.)/u.exec("abcd").groups)'); +assert(compareArray(["fst", "snd"], + Object.getOwnPropertyNames( + /(?.)|(?.)/u.exec("abcd").groups))); // Properties are created with Define, not Set let counter = 0; Object.defineProperty(Object.prototype, 'x', {set() { counter++; }}); let match = /(?.)/.exec('a'); let groups = match.groups; -assert.sameValue(counter, 0, 'The value of counter is expected to be 0'); +assert.sameValue(counter, 0); // Properties are writable, enumerable and configurable // (from CreateDataProperty) diff --git a/test/built-ins/RegExp/named-groups/lookbehind.js b/test/built-ins/RegExp/named-groups/lookbehind.js index 4b9061ff72..e3926bc97e 100644 --- a/test/built-ins/RegExp/named-groups/lookbehind.js +++ b/test/built-ins/RegExp/named-groups/lookbehind.js @@ -9,125 +9,38 @@ includes: [compareArray.js] ---*/ // Unicode mode -assert.compareArray( - ["f", "c"], - "abcdef".match(/(?<=(?\w){3})f/u), - '["f", "c"] must return the same value returned by "abcdef".match(/(?<=(?w){3})f/u)' -); -assert.sameValue( - "abcdef".match(/(?<=(?\w){3})f/u).groups.a, - "c", - 'The value of "abcdef".match(/(?<=(?w){3})f/u).groups.a is expected to be "c"' -); -assert.sameValue( - "abcdef".match(/(?<=(?\w){4})f/u).groups.a, - "b", - 'The value of "abcdef".match(/(?<=(?w){4})f/u).groups.a is expected to be "b"' -); -assert.sameValue( - "abcdef".match(/(?<=(?\w)+)f/u).groups.a, - "a", - 'The value of "abcdef".match(/(?<=(?w)+)f/u).groups.a is expected to be "a"' -); -assert.sameValue( - "abcdef".match(/(?<=(?\w){6})f/u), - null, - '"abcdef".match(/(?<=(?w){6})f/u) must return null' -); +assert(compareArray(["f", "c"], "abcdef".match(/(?<=(?\w){3})f/u))); +assert.sameValue("c", "abcdef".match(/(?<=(?\w){3})f/u).groups.a); +assert.sameValue("b", "abcdef".match(/(?<=(?\w){4})f/u).groups.a); +assert.sameValue("a", "abcdef".match(/(?<=(?\w)+)f/u).groups.a); +assert.sameValue(null, "abcdef".match(/(?<=(?\w){6})f/u)); -assert.compareArray( - ["f", ""], - "abcdef".match(/((?<=\w{3}))f/u), - '["f", ""] must return the same value returned by "abcdef".match(/((?<=w{3}))f/u)' -); -assert.compareArray( - ["f", ""], - "abcdef".match(/(?(?<=\w{3}))f/u), - '["f", ""] must return the same value returned by "abcdef".match(/(?(?<=w{3}))f/u)' -); +assert(compareArray(["f", ""], "abcdef".match(/((?<=\w{3}))f/u))); +assert(compareArray(["f", ""], "abcdef".match(/(?(?<=\w{3}))f/u))); -assert.compareArray( - ["f", undefined], - "abcdef".match(/(?\d){3})f/u), - '["f", undefined] must return the same value returned by "abcdef".match(/(?d){3})f/u)' -); -assert.sameValue( - "abcdef".match(/(?\D){3})f/u), - null, - '"abcdef".match(/(?D){3})f/u) must return null' -); +assert(compareArray(["f", undefined], "abcdef".match(/(?\d){3})f/u))); +assert.sameValue(null, "abcdef".match(/(?\D){3})f/u)); -assert.compareArray( - ["f", undefined], - "abcdef".match(/(?\D){3})f|f/u), - '["f", undefined] must return the same value returned by "abcdef".match(/(?D){3})f|f/u)' -); -assert.compareArray( - ["f", undefined], - "abcdef".match(/(?(?(?\D){3})f|f/u))); +assert(compareArray(["f", undefined], "abcdef".match(/(?(?\w){3})f/), - '["f", "c"] must return the same value returned by "abcdef".match(/(?<=(?w){3})f/)' -); -assert.sameValue( - "abcdef".match(/(?<=(?\w){3})f/).groups.a, - "c", - 'The value of "abcdef".match(/(?<=(?w){3})f/).groups.a is expected to be "c"' -); -assert.sameValue( - "abcdef".match(/(?<=(?\w){4})f/).groups.a, - "b", - 'The value of "abcdef".match(/(?<=(?w){4})f/).groups.a is expected to be "b"' -); -assert.sameValue( - "abcdef".match(/(?<=(?\w)+)f/).groups.a, - "a", - 'The value of "abcdef".match(/(?<=(?w)+)f/).groups.a is expected to be "a"' -); -assert.sameValue( - "abcdef".match(/(?<=(?\w){6})f/), - null, - '"abcdef".match(/(?<=(?w){6})f/) must return null' -); +assert(compareArray(["f", "c"], "abcdef".match(/(?<=(?\w){3})f/))); +assert.sameValue("c", "abcdef".match(/(?<=(?\w){3})f/).groups.a); +assert.sameValue("b", "abcdef".match(/(?<=(?\w){4})f/).groups.a); +assert.sameValue("a", "abcdef".match(/(?<=(?\w)+)f/).groups.a); +assert.sameValue(null, "abcdef".match(/(?<=(?\w){6})f/)); -assert.compareArray( - ["f", ""], - "abcdef".match(/((?<=\w{3}))f/), - '["f", ""] must return the same value returned by "abcdef".match(/((?<=w{3}))f/)' -); -assert.compareArray( - ["f", ""], - "abcdef".match(/(?(?<=\w{3}))f/), - '["f", ""] must return the same value returned by "abcdef".match(/(?(?<=w{3}))f/)' -); +assert(compareArray(["f", ""], "abcdef".match(/((?<=\w{3}))f/))); +assert(compareArray(["f", ""], "abcdef".match(/(?(?<=\w{3}))f/))); -assert.compareArray( - ["f", undefined], - "abcdef".match(/(?\d){3})f/), - '["f", undefined] must return the same value returned by "abcdef".match(/(?d){3})f/)' -); -assert.sameValue( - "abcdef".match(/(?\D){3})f/), - null, - '"abcdef".match(/(?D){3})f/) must return null' -); +assert(compareArray(["f", undefined], "abcdef".match(/(?\d){3})f/))); +assert.sameValue(null, "abcdef".match(/(?\D){3})f/)); -assert.compareArray( - ["f", undefined], - "abcdef".match(/(?\D){3})f|f/), - '["f", undefined] must return the same value returned by "abcdef".match(/(?D){3})f|f/)' -); -assert.compareArray( - ["f", undefined], - "abcdef".match(/(?(?(?\D){3})f|f/))); +assert(compareArray(["f", undefined], "abcdef".match(/(?(?.)|(?.))/u.exec("abcd").groups), '["fst", "snd"] must return the same value returned by Object.getOwnPropertyNames(\n /(?<=(?.)|(?.))/u.exec("abcd").groups)'); +assert(compareArray(["fst", "snd"], + Object.getOwnPropertyNames( + /(?<=(?.)|(?.))/u.exec("abcd").groups))); diff --git a/test/built-ins/RegExp/named-groups/non-unicode-match.js b/test/built-ins/RegExp/named-groups/non-unicode-match.js index 3dc6cdd737..7904c75e43 100644 --- a/test/built-ins/RegExp/named-groups/non-unicode-match.js +++ b/test/built-ins/RegExp/named-groups/non-unicode-match.js @@ -8,135 +8,36 @@ features: [regexp-named-groups] includes: [compareArray.js] ---*/ -assert.compareArray( - "bab".match(/(?a)/), - ["a", "a"], - '"bab".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return ["a", "a"]' -); -assert.compareArray( - "bab".match(/(?a)/), - ["a", "a"], - '"bab".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return ["a", "a"]' -); -assert.compareArray( - "bab".match(/(?<_>a)/), - ["a", "a"], - '"bab".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return ["a", "a"]' -); -assert.compareArray( - "bab".match(/(?<$>a)/), - ["a", "a"], - '"bab".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return ["a", "a"]' -); -assert.compareArray( - "bab".match(/.(?<$>a)./), - ["bab", "a"], - '"bab".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return ["bab", "a"]' -); -assert.compareArray( - "bab".match(/.(?a)(.)/), - ["bab", "a", "b"], - '"bab".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return ["bab", "a", "b"]' -); -assert.compareArray( - "bab".match(/.(?a)(?.)/), - ["bab", "a", "b"], - '"bab".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return ["bab", "a", "b"]' -); -assert.compareArray( - "bab".match(/.(?\w\w)/), - ["bab", "ab"], - '"bab".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return ["bab", "ab"]' -); -assert.compareArray( - "bab".match(/(?\w\w\w)/), - ["bab", "bab"], - '"bab".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return ["bab", "bab"]' -); -assert.compareArray( - "bab".match(/(?\w\w)(?\w)/), - ["bab", "ba", "b"], - '"bab".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return ["bab", "ba", "b"]' -); +assert(compareArray(["a", "a"], "bab".match(/(?a)/))); +assert(compareArray(["a", "a"], "bab".match(/(?a)/))); +assert(compareArray(["a", "a"], "bab".match(/(?<_>a)/))); +assert(compareArray(["a", "a"], "bab".match(/(?<$>a)/))); +assert(compareArray(["bab", "a"], "bab".match(/.(?<$>a)./))); +assert(compareArray(["bab", "a", "b"], "bab".match(/.(?a)(.)/))); +assert(compareArray(["bab", "a", "b"], "bab".match(/.(?a)(?.)/))); +assert(compareArray(["bab", "ab"], "bab".match(/.(?\w\w)/))); +assert(compareArray(["bab", "bab"], "bab".match(/(?\w\w\w)/))); +assert(compareArray(["bab", "ba", "b"], "bab".match(/(?\w\w)(?\w)/))); let {a, b, c} = /(?.)(?.)(?.)\k\k\k/.exec("abccba").groups; -assert.sameValue(a, "a", 'The value of a is expected to be "a"'); -assert.sameValue(b, "b", 'The value of b is expected to be "b"'); -assert.sameValue(c, "c", 'The value of c is expected to be "c"'); +assert.sameValue(a, "a"); +assert.sameValue(b, "b"); +assert.sameValue(c, "c"); -assert.compareArray( - "bab".match(/(?a)/), - "bab".match(/(a)/), - '"bab".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return the same value returned by "bab".match(/(a)/)' -); -assert.compareArray( - "bab".match(/(?a)/), - "bab".match(/(a)/), - '"bab".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return the same value returned by "bab".match(/(a)/)' -); -assert.compareArray( - "bab".match(/(?<_>a)/), - "bab".match(/(a)/), - '"bab".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return the same value returned by "bab".match(/(a)/)' -); -assert.compareArray( - "bab".match(/(?<$>a)/), - "bab".match(/(a)/), - '"bab".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return the same value returned by "bab".match(/(a)/)' -); -assert.compareArray( - "bab".match(/.(?<$>a)./), - "bab".match(/.(a)./), - '"bab".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return the same value returned by "bab".match(/.(a)./)' -); -assert.compareArray( - "bab".match(/.(?a)(.)/), - "bab".match(/.(a)(.)/), - '"bab".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return the same value returned by "bab".match(/.(a)(.)/)' -); -assert.compareArray( - "bab".match(/.(?a)(?.)/), - "bab".match(/.(a)(.)/), - '"bab".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return the same value returned by "bab".match(/.(a)(.)/)' -); -assert.compareArray( - "bab".match(/.(?\w\w)/), - "bab".match(/.(\w\w)/), - '"bab".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return the same value returned by "bab".match(/.(ww)/)' -); -assert.compareArray( - "bab".match(/(?\w\w\w)/), - "bab".match(/(\w\w\w)/), - '"bab".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return the same value returned by "bab".match(/(www)/)' -); -assert.compareArray( - "bab".match(/(?\w\w)(?\w)/), - "bab".match(/(\w\w)(\w)/), - '"bab".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return the same value returned by "bab".match(/(ww)(w)/)' -); +assert(compareArray("bab".match(/(a)/), "bab".match(/(?a)/))); +assert(compareArray("bab".match(/(a)/), "bab".match(/(?a)/))); +assert(compareArray("bab".match(/(a)/), "bab".match(/(?<_>a)/))); +assert(compareArray("bab".match(/(a)/), "bab".match(/(?<$>a)/))); +assert(compareArray("bab".match(/.(a)./), "bab".match(/.(?<$>a)./))); +assert(compareArray("bab".match(/.(a)(.)/), "bab".match(/.(?a)(.)/))); +assert(compareArray("bab".match(/.(a)(.)/), "bab".match(/.(?a)(?.)/))); +assert(compareArray("bab".match(/.(\w\w)/), "bab".match(/.(?\w\w)/))); +assert(compareArray("bab".match(/(\w\w\w)/), "bab".match(/(?\w\w\w)/))); +assert(compareArray("bab".match(/(\w\w)(\w)/), "bab".match(/(?\w\w)(?\w)/))); -assert.compareArray( - "bab".match(/(?b).\1/), - ["bab", "b"], - '"bab".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return ["bab", "b"]' -); -assert.compareArray( - "baba".match(/(.)(?a)\1\2/), - ["baba", "b", "a"], - '"baba".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return ["baba", "b", "a"]' -); -assert.compareArray( - "baba".match(/(.)(?a)(?\1)(\2)/), - ["baba", "b", "a", "b", "a"], - '"baba".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return ["baba", "b", "a", "b", "a"]' -); -assert.compareArray( - "<)a/), - [".)(?.)(?.)kkk/.exec("abccba").groups") must return ["a".match(/(?>)a/), - [">a", ">"], - '">a".match("/(?.)(?.)(?.)kkk/.exec("abccba").groups") must return [">a", ">"]' -); +assert(compareArray(["bab", "b"], "bab".match(/(?b).\1/))); +assert(compareArray(["baba", "b", "a"], "baba".match(/(.)(?a)\1\2/))); +assert(compareArray(["baba", "b", "a", "b", "a"], + "baba".match(/(.)(?a)(?\1)(\2)/))); +assert(compareArray(["<)a/))); +assert(compareArray([">a", ">"], ">a".match(/(?>)a/))); diff --git a/test/built-ins/RegExp/named-groups/non-unicode-references.js b/test/built-ins/RegExp/named-groups/non-unicode-references.js index e10488218b..33d62a3f0a 100644 --- a/test/built-ins/RegExp/named-groups/non-unicode-references.js +++ b/test/built-ins/RegExp/named-groups/non-unicode-references.js @@ -9,78 +9,26 @@ includes: [compareArray.js] ---*/ // Named references. -assert.compareArray( - "bab".match(/(?.).\k/), - ["bab", "b"], - '"bab".match(""bab".match(/(?b)k(?a)k/).groups") must return ["bab", "b"]' -); -assert.sameValue( - "baa".match(/(?.).\k/), - null, - '"baa".match(""bab".match(/(?b)k(?a)k/).groups") must return null' -); +assert(compareArray(["bab", "b"], "bab".match(/(?.).\k/))); +assert.sameValue(null, "baa".match(/(?.).\k/)); // Reference inside group. -assert.compareArray( - "bab".match(/(?\k\w)../), - ["bab", "b"], - '"bab".match(""bab".match(/(?b)k(?a)k/).groups") must return ["bab", "b"]' -); -assert.sameValue( - "bab".match(/(?\k\w)../).groups.a, - "b", - 'The value of "bab".match(/(?kw)../).groups.a is expected to be "b"' -); +assert(compareArray(["bab", "b"], "bab".match(/(?\k\w)../))); +assert.sameValue("b", "bab".match(/(?\k\w)../).groups.a); // Reference before group. -assert.compareArray( - "bab".match(/\k(?b)\w\k/), - ["bab", "b"], - '"bab".match(""bab".match(/(?b)k(?a)k/).groups") must return ["bab", "b"]' -); -assert.sameValue( - "bab".match(/\k(?b)\w\k/).groups.a, - "b", - 'The value of "bab".match(/k(?b)wk/).groups.a is expected to be "b"' -); -assert.compareArray( - "bab".match(/(?b)\k(?a)\k/), - ["bab", "b", "a"], - '"bab".match(""bab".match(/(?b)k(?a)k/).groups") must return ["bab", "b", "a"]' -); +assert(compareArray(["bab", "b"], "bab".match(/\k(?b)\w\k/))); +assert.sameValue("b", "bab".match(/\k(?b)\w\k/).groups.a); +assert(compareArray(["bab", "b", "a"], "bab".match(/(?b)\k(?a)\k/))); let {a, b} = "bab".match(/(?b)\k(?a)\k/).groups; -assert.sameValue(a, "a", 'The value of a is expected to be "a"'); -assert.sameValue(b, "b", 'The value of b is expected to be "b"'); +assert.sameValue(a, "a"); +assert.sameValue(b, "b"); -assert.compareArray( - "bab".match(/\k(?b)\w\k/), - ["bab", "b"], - '"bab".match(""bab".match(/(?b)k(?a)k/).groups") must return ["bab", "b"]' -); -assert.compareArray( - "bab".match(/(?b)\k(?a)\k/), - ["bab", "b", "a"], - '"bab".match(""bab".match(/(?b)k(?a)k/).groups") must return ["bab", "b", "a"]' -); +assert(compareArray(["bab", "b"], "bab".match(/\k(?b)\w\k/))); +assert(compareArray(["bab", "b", "a"], "bab".match(/(?b)\k(?a)\k/))); // Reference properties. -assert.sameValue( - /(?a)(?b)\k/.exec("aba").groups.a, - "a", - 'The value of /(?a)(?b)k/.exec("aba").groups.a is expected to be "a"' -); -assert.sameValue( - /(?a)(?b)\k/.exec("aba").groups.b, - "b", - 'The value of /(?a)(?b)k/.exec("aba").groups.b is expected to be "b"' -); -assert.sameValue( - /(?a)(?b)\k/.exec("aba").groups.c, - undefined, - 'The value of /(?a)(?b)k/.exec("aba").groups.c is expected to equal undefined' -); -assert.sameValue( - /(?a)(?b)\k|(?c)/.exec("aba").groups.c, - undefined, - 'The value of /(?a)(?b)k|(?c)/.exec("aba").groups.c is expected to equal undefined' -); +assert.sameValue("a", /(?a)(?b)\k/.exec("aba").groups.a); +assert.sameValue("b", /(?a)(?b)\k/.exec("aba").groups.b); +assert.sameValue(undefined, /(?a)(?b)\k/.exec("aba").groups.c); +assert.sameValue(undefined, /(?a)(?b)\k|(?c)/.exec("aba").groups.c); diff --git a/test/built-ins/RegExp/named-groups/unicode-match.js b/test/built-ins/RegExp/named-groups/unicode-match.js index 030f97599e..a8e1059bdb 100644 --- a/test/built-ins/RegExp/named-groups/unicode-match.js +++ b/test/built-ins/RegExp/named-groups/unicode-match.js @@ -8,149 +8,41 @@ features: [regexp-named-groups] includes: [compareArray.js] ---*/ -assert.compareArray( - "bab".match(/(?a)/u), - ["a", "a"], - '"bab".match(""bab".match(/(?.(?.(?.)))/u).groups") must return ["a", "a"]' -); -assert.compareArray( - "bab".match(/(?a)/u), - ["a", "a"], - '"bab".match(""bab".match(/(?.(?.(?.)))/u).groups") must return ["a", "a"]' -); -assert.compareArray( - "bab".match(/(?<_>a)/u), - ["a", "a"], - '"bab".match(""bab".match(/(?.(?.(?.)))/u).groups") must return ["a", "a"]' -); -assert.compareArray( - "bab".match(/(?<$>a)/u), - ["a", "a"], - '"bab".match(""bab".match(/(?.(?.(?.)))/u).groups") must return ["a", "a"]' -); -assert.compareArray( - "bab".match(/.(?<$>a)./u), - ["bab", "a"], - '"bab".match(""bab".match(/(?.(?.(?.)))/u).groups") must return ["bab", "a"]' -); -assert.compareArray( - "bab".match(/.(?a)(.)/u), - ["bab", "a", "b"], - '"bab".match(""bab".match(/(?.(?.(?.)))/u).groups") must return ["bab", "a", "b"]' -); -assert.compareArray( - "bab".match(/.(?a)(?.)/u), - ["bab", "a", "b"], - '"bab".match(""bab".match(/(?.(?.(?.)))/u).groups") must return ["bab", "a", "b"]' -); -assert.compareArray( - "bab".match(/.(?\w\w)/u), - ["bab", "ab"], - '"bab".match(""bab".match(/(?.(?.(?.)))/u).groups") must return ["bab", "ab"]' -); -assert.compareArray( - "bab".match(/(?\w\w\w)/u), - ["bab", "bab"], - '"bab".match(""bab".match(/(?.(?.(?.)))/u).groups") must return ["bab", "bab"]' -); -assert.compareArray( - "bab".match(/(?\w\w)(?\w)/u), - ["bab", "ba", "b"], - '"bab".match(""bab".match(/(?.(?.(?.)))/u).groups") must return ["bab", "ba", "b"]' -); +assert(compareArray(["a", "a"], "bab".match(/(?a)/u))); +assert(compareArray(["a", "a"], "bab".match(/(?a)/u))); +assert(compareArray(["a", "a"], "bab".match(/(?<_>a)/u))); +assert(compareArray(["a", "a"], "bab".match(/(?<$>a)/u))); +assert(compareArray(["bab", "a"], "bab".match(/.(?<$>a)./u))); +assert(compareArray(["bab", "a", "b"], "bab".match(/.(?a)(.)/u))); +assert(compareArray(["bab", "a", "b"], "bab".match(/.(?a)(?.)/u))); +assert(compareArray(["bab", "ab"], "bab".match(/.(?\w\w)/u))); +assert(compareArray(["bab", "bab"], "bab".match(/(?\w\w\w)/u))); +assert(compareArray(["bab", "ba", "b"], "bab".match(/(?\w\w)(?\w)/u))); let {a, b, c} = /(?.)(?.)(?.)\k\k\k/u.exec("abccba").groups; -assert.sameValue(a, "a", 'The value of a is expected to be "a"'); -assert.sameValue(b, "b", 'The value of b is expected to be "b"'); -assert.sameValue(c, "c", 'The value of c is expected to be "c"'); +assert.sameValue(a, "a"); +assert.sameValue(b, "b"); +assert.sameValue(c, "c"); -assert.compareArray( - "bab".match(/(?a)/u), - "bab".match(/(a)/u), - '"bab".match("/(?.)(?.)(?.)kkk/u.exec("abccba").groups") must return the same value returned by "bab".match(/(a)/u)' -); -assert.compareArray( - "bab".match(/(?a)/u), - "bab".match(/(a)/u), - '"bab".match("/(?.)(?.)(?.)kkk/u.exec("abccba").groups") must return the same value returned by "bab".match(/(a)/u)' -); -assert.compareArray( - "bab".match(/(?<_>a)/u), - "bab".match(/(a)/u), - '"bab".match("/(?.)(?.)(?.)kkk/u.exec("abccba").groups") must return the same value returned by "bab".match(/(a)/u)' -); -assert.compareArray( - "bab".match(/(?<$>a)/u), - "bab".match(/(a)/u), - '"bab".match("/(?.)(?.)(?.)kkk/u.exec("abccba").groups") must return the same value returned by "bab".match(/(a)/u)' -); -assert.compareArray( - "bab".match(/.(?<$>a)./u), - "bab".match(/.(a)./u), - '"bab".match("/(?.)(?.)(?.)kkk/u.exec("abccba").groups") must return the same value returned by "bab".match(/.(a)./u)' -); -assert.compareArray( - "bab".match(/.(?a)(.)/u), - "bab".match(/.(a)(.)/u), - '"bab".match("/(?.)(?.)(?.)kkk/u.exec("abccba").groups") must return the same value returned by "bab".match(/.(a)(.)/u)' -); -assert.compareArray( - "bab".match(/.(?a)(?.)/u), - "bab".match(/.(a)(.)/u), - '"bab".match("/(?.)(?.)(?.)kkk/u.exec("abccba").groups") must return the same value returned by "bab".match(/.(a)(.)/u)' -); -assert.compareArray( - "bab".match(/.(?\w\w)/u), - "bab".match(/.(\w\w)/u), - '"bab".match("/(?.)(?.)(?.)kkk/u.exec("abccba").groups") must return the same value returned by "bab".match(/.(ww)/u)' -); -assert.compareArray( - "bab".match(/(?\w\w\w)/u), - "bab".match(/(\w\w\w)/u), - '"bab".match("/(?.)(?.)(?.)kkk/u.exec("abccba").groups") must return the same value returned by "bab".match(/(www)/u)' -); -assert.compareArray( - "bab".match(/(?\w\w)(?\w)/u), - "bab".match(/(\w\w)(\w)/u), - '"bab".match("/(?.)(?.)(?.)kkk/u.exec("abccba").groups") must return the same value returned by "bab".match(/(ww)(w)/u)' -); +assert(compareArray("bab".match(/(a)/u), "bab".match(/(?a)/u))); +assert(compareArray("bab".match(/(a)/u), "bab".match(/(?a)/u))); +assert(compareArray("bab".match(/(a)/u), "bab".match(/(?<_>a)/u))); +assert(compareArray("bab".match(/(a)/u), "bab".match(/(?<$>a)/u))); +assert(compareArray("bab".match(/.(a)./u), "bab".match(/.(?<$>a)./u))); +assert(compareArray("bab".match(/.(a)(.)/u), "bab".match(/.(?a)(.)/u))); +assert(compareArray("bab".match(/.(a)(.)/u), "bab".match(/.(?a)(?.)/u))); +assert(compareArray("bab".match(/.(\w\w)/u), "bab".match(/.(?\w\w)/u))); +assert(compareArray("bab".match(/(\w\w\w)/u), "bab".match(/(?\w\w\w)/u))); +assert(compareArray("bab".match(/(\w\w)(\w)/u), "bab".match(/(?\w\w)(?\w)/u))); -assert.compareArray( - "bab".match(/(?b).\1/u), - ["bab", "b"], - '"bab".match("/(?.)(?.)(?.)kkk/u.exec("abccba").groups") must return ["bab", "b"]' -); -assert.compareArray( - "baba".match(/(.)(?a)\1\2/u), - ["baba", "b", "a"], - '"baba".match("/(?.)(?.)(?.)kkk/u.exec("abccba").groups") must return ["baba", "b", "a"]' -); -assert.compareArray( - "baba".match(/(.)(?a)(?\1)(\2)/u), - ["baba", "b", "a", "b", "a"], - '"baba".match("/(?.)(?.)(?.)kkk/u.exec("abccba").groups") must return ["baba", "b", "a", "b", "a"]' -); -assert.compareArray( - "<)a/u), - [".)(?.)(?.)kkk/u.exec("abccba").groups") must return ["a".match(/(?>)a/u), - [">a", ">"], - '">a".match("/(?.)(?.)(?.)kkk/u.exec("abccba").groups") must return [">a", ">"]' -); +assert(compareArray(["bab", "b"], "bab".match(/(?b).\1/u))); +assert(compareArray(["baba", "b", "a"], "baba".match(/(.)(?a)\1\2/u))); +assert(compareArray(["baba", "b", "a", "b", "a"], + "baba".match(/(.)(?a)(?\1)(\2)/u))); +assert(compareArray(["<)a/u))); +assert(compareArray([">a", ">"], ">a".match(/(?>)a/u))); // Nested groups. -assert.compareArray( - "bab".match(/(?.(?.(?.)))/u), - ["bab", "bab", "ab", "b"], - '"bab".match("/(?.)(?.)(?.)kkk/u.exec("abccba").groups") must return ["bab", "bab", "ab", "b"]' -); - -{ - let {a, b, c} = "bab".match(/(?.(?.(?.)))/u).groups - assert.sameValue(a, "bab", 'The value of a is expected to be "bab"'); - assert.sameValue(b, "ab", 'The value of b is expected to be "ab"'); - assert.sameValue(c, "b", 'The value of c is expected to be "b"'); -} +assert(compareArray(["bab", "bab", "ab", "b"], "bab".match(/(?.(?.(?.)))/u))); +assert(compareArray({a: "bab", b: "ab", c: "b"}, + "bab".match(/(?.(?.(?.)))/u).groups)); diff --git a/test/built-ins/RegExp/named-groups/unicode-references.js b/test/built-ins/RegExp/named-groups/unicode-references.js index a11097d9ef..1f95a2f40c 100644 --- a/test/built-ins/RegExp/named-groups/unicode-references.js +++ b/test/built-ins/RegExp/named-groups/unicode-references.js @@ -22,79 +22,26 @@ includes: [compareArray.js] ---*/ // Named references. -assert.compareArray( - "bab".match(/(?.).\k/u), - ["bab", "b"], - '"bab".match(""bab".match(/(?b)k(?a)k/u).groups") must return ["bab", "b"]' -); -assert.sameValue( - "baa".match(/(?.).\k/u), - null, - '"baa".match(""bab".match(/(?b)k(?a)k/u).groups") must return null' -); +assert(compareArray(["bab", "b"], "bab".match(/(?.).\k/u))); +assert.sameValue(null, "baa".match(/(?.).\k/u)); // Reference inside group. -assert.compareArray( - "bab".match(/(?\k\w)../u), - ["bab", "b"], - '"bab".match(""bab".match(/(?b)k(?a)k/u).groups") must return ["bab", "b"]' -); -assert.sameValue( - "bab".match(/(?\k\w)../u).groups.a, - "b", - 'The value of "bab".match(/(?kw)../u).groups.a is expected to be "b"' -); +assert(compareArray(["bab", "b"], "bab".match(/(?\k\w)../u))); +assert.sameValue("b", "bab".match(/(?\k\w)../u).groups.a); // Reference before group. -assert.compareArray( - "bab".match(/\k(?b)\w\k/u), - ["bab", "b"], - '"bab".match(""bab".match(/(?b)k(?a)k/u).groups") must return ["bab", "b"]' -); -assert.sameValue( - "bab".match(/\k(?b)\w\k/u).groups.a, - "b", - 'The value of "bab".match(/k(?b)wk/u).groups.a is expected to be "b"' -); -assert.compareArray( - "bab".match(/(?b)\k(?a)\k/u), - ["bab", "b", "a"], - '"bab".match(""bab".match(/(?b)k(?a)k/u).groups") must return ["bab", "b", "a"]' -); - +assert(compareArray(["bab", "b"], "bab".match(/\k(?b)\w\k/u))); +assert.sameValue("b", "bab".match(/\k(?b)\w\k/u).groups.a); +assert(compareArray(["bab", "b", "a"], "bab".match(/(?b)\k(?a)\k/u))); let {a, b} = "bab".match(/(?b)\k(?a)\k/u).groups; -assert.sameValue(a, "a", 'The value of a is expected to be "a"'); -assert.sameValue(b, "b", 'The value of b is expected to be "b"'); +assert.sameValue(a, "a"); +assert.sameValue(b, "b"); -assert.compareArray( - "bab".match(/\k(?b)\w\k/), - ["bab", "b"], - '"bab".match(""bab".match(/(?b)k(?a)k/u).groups") must return ["bab", "b"]' -); -assert.compareArray( - "bab".match(/(?b)\k(?a)\k/), - ["bab", "b", "a"], - '"bab".match(""bab".match(/(?b)k(?a)k/u).groups") must return ["bab", "b", "a"]' -); +assert(compareArray(["bab", "b"], "bab".match(/\k(?b)\w\k/))); +assert(compareArray(["bab", "b", "a"], "bab".match(/(?b)\k(?a)\k/))); // Reference properties. -assert.sameValue( - /(?a)(?b)\k/u.exec("aba").groups.a, - "a", - 'The value of /(?a)(?b)k/u.exec("aba").groups.a is expected to be "a"' -); -assert.sameValue( - /(?a)(?b)\k/u.exec("aba").groups.b, - "b", - 'The value of /(?a)(?b)k/u.exec("aba").groups.b is expected to be "b"' -); -assert.sameValue( - /(?a)(?b)\k/u.exec("aba").groups.c, - undefined, - 'The value of /(?a)(?b)k/u.exec("aba").groups.c is expected to equal undefined' -); -assert.sameValue( - /(?a)(?b)\k|(?c)/u.exec("aba").groups.c, - undefined, - 'The value of /(?a)(?b)k|(?c)/u.exec("aba").groups.c is expected to equal undefined' -); +assert.sameValue("a", /(?a)(?b)\k/u.exec("aba").groups.a); +assert.sameValue("b", /(?a)(?b)\k/u.exec("aba").groups.b); +assert.sameValue(undefined, /(?a)(?b)\k/u.exec("aba").groups.c); +assert.sameValue(undefined, /(?a)(?b)\k|(?c)/u.exec("aba").groups.c); diff --git a/test/built-ins/Temporal/Calendar/prototype/fields/long-input.js b/test/built-ins/Temporal/Calendar/prototype/fields/long-input.js index 14c855c2b9..03c7314d7d 100644 --- a/test/built-ins/Temporal/Calendar/prototype/fields/long-input.js +++ b/test/built-ins/Temporal/Calendar/prototype/fields/long-input.js @@ -25,7 +25,7 @@ const fields = { } } } -assert.compareArray( - cal.fields(fields), Array.from(fields), - 'cal.fields("{*[Symbol.iterator]() {let i = 0; while (i++ < 1000001) {yield "garbage " + i;}}}) must return the same value returned by Array.from(fields)' +assert( + compareArray(cal.fields(fields), Array.from(fields)), + 'compareArray(cal.fields(fields), Array.from(fields)) must return true' ); 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 921c450c4a..6060fab6e4 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 @@ -25,40 +25,53 @@ info: | includes: [compareArray.js, testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, null), - [0n, 1n, 2n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, null) must return [0n, 1n, 2n, 3n]' + assert( + compareArray( + new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, null), + [0n, 1n, 2n, 3n] + ), + 'null value coerced to 0' ); - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, NaN), - [0n, 1n, 2n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, NaN) must return [0n, 1n, 2n, 3n]' + assert( + compareArray( + new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, NaN), + [0n, 1n, 2n, 3n] + ), + 'NaN value coerced to 0' ); - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, false), - [0n, 1n, 2n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, false) must return [0n, 1n, 2n, 3n]' + assert( + compareArray( + new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, false), + [0n, 1n, 2n, 3n] + ), + 'false value coerced to 0' ); - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, true), - [0n, 0n, 2n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, true) must return [0n, 0n, 2n, 3n]' + assert( + compareArray( + new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, true), + [0n, 0n, 2n, 3n] + ), + 'true value coerced to 1' ); - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, '-2'), - [0n, 0n, 1n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, "-2") must return [0n, 0n, 1n, 3n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n]).copyWithin(1, 0, -2.5), - [0n, 0n, 1n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, -2.5) must return [0n, 0n, 1n, 3n]' + assert( + compareArray( + 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 5534c9e8ae..6cd12a381a 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 @@ -24,52 +24,69 @@ info: | includes: [compareArray.js, testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(1, undefined), - [0n, 0n, 1n, 2n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(1, undefined) must return [0n, 0n, 1n, 2n]' + assert( + compareArray( + new TA([0n, 1n, 2n, 3n]).copyWithin(1, undefined), + [0n, 0n, 1n, 2n] + ), + 'undefined value coerced to 0' ); - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(1, false), - [0n, 0n, 1n, 2n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(1, false) must return [0n, 0n, 1n, 2n]' + assert( + compareArray( + new TA([0n, 1n, 2n, 3n]).copyWithin(1, false), + [0n, 0n, 1n, 2n] + ), + 'false value coerced to 0' ); - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(1, NaN), - [0n, 0n, 1n, 2n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(1, NaN) must return [0n, 0n, 1n, 2n]' + assert( + compareArray( + new TA([0n, 1n, 2n, 3n]).copyWithin(1, NaN), + [0n, 0n, 1n, 2n] + ), + 'NaN value coerced to 0' ); - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(1, null), - [0n, 0n, 1n, 2n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(1, null) must return [0n, 0n, 1n, 2n]' + assert( + compareArray( + new TA([0n, 1n, 2n, 3n]).copyWithin(1, null), + [0n, 0n, 1n, 2n] + ), + 'null value coerced to 0' ); - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(0, true), - [1n, 2n, 3n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(0, true) must return [1n, 2n, 3n, 3n]' + assert( + compareArray( + new TA([0n, 1n, 2n, 3n]).copyWithin(0, true), + [1n, 2n, 3n, 3n] + ), + 'true value coerced to 1' ); - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(0, '1'), - [1n, 2n, 3n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(0, "1") must return [1n, 2n, 3n, 3n]' + assert( + compareArray( + new TA([0n, 1n, 2n, 3n]).copyWithin(0, '1'), + [1n, 2n, 3n, 3n] + ), + 'string "1" value coerced to 1' ); - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0.5), - [0n, 0n, 1n, 2n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0.5) must return [0n, 0n, 1n, 2n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n]).copyWithin(0, 1.5), - [1n, 2n, 3n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1.5) must return [1n, 2n, 3n, 3n]' + assert( + compareArray( + 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 ddf1bd7a62..92d409a46e 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 @@ -24,52 +24,69 @@ info: | includes: [compareArray.js, testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(undefined, 1), - [1n, 2n, 3n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(undefined, 1) must return [1n, 2n, 3n, 3n]' + assert( + compareArray( + new TA([0n, 1n, 2n, 3n]).copyWithin(undefined, 1), + [1n, 2n, 3n, 3n] + ), + 'undefined value coerced to 0' ); - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(false, 1), - [1n, 2n, 3n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(false, 1) must return [1n, 2n, 3n, 3n]' + assert( + compareArray( + new TA([0n, 1n, 2n, 3n]).copyWithin(false, 1), + [1n, 2n, 3n, 3n] + ), + 'false value coerced to 0' ); - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(NaN, 1), - [1n, 2n, 3n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(NaN, 1) must return [1n, 2n, 3n, 3n]' + assert( + compareArray( + new TA([0n, 1n, 2n, 3n]).copyWithin(NaN, 1), + [1n, 2n, 3n, 3n] + ), + 'NaN value coerced to 0' ); - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(null, 1), - [1n, 2n, 3n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(null, 1) must return [1n, 2n, 3n, 3n]' + assert( + compareArray( + new TA([0n, 1n, 2n, 3n]).copyWithin(null, 1), + [1n, 2n, 3n, 3n] + ), + 'null value coerced to 0' ); - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(true, 0), - [0n, 0n, 1n, 2n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(true, 0) must return [0n, 0n, 1n, 2n]' + assert( + compareArray( + new TA([0n, 1n, 2n, 3n]).copyWithin(true, 0), + [0n, 0n, 1n, 2n] + ), + 'true value coerced to 1' ); - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin('1', 0), - [0n, 0n, 1n, 2n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin("1", 0) must return [0n, 0n, 1n, 2n]' + assert( + compareArray( + new TA([0n, 1n, 2n, 3n]).copyWithin('1', 0), + [0n, 0n, 1n, 2n] + ), + 'string "1" value coerced to 1' ); - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(0.5, 1), - [1n, 2n, 3n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(0.5, 1) must return [1n, 2n, 3n, 3n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n]).copyWithin(1.5, 0), - [0n, 0n, 1n, 2n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(1.5, 0) must return [0n, 0n, 1n, 2n]' + assert( + compareArray( + 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 228883a586..78a8c9c9a6 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js @@ -27,52 +27,69 @@ info: | includes: [compareArray.js, testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, -1), - [1n, 2n, 2n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, -1) must return [1n, 2n, 2n, 3n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n, 4n]).copyWithin(2, 0, -1), - [0n, 1n, 0n, 1n, 2n], - 'new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(2, 0, -1) must return [0n, 1n, 0n, 1n, 2n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n, 4n]).copyWithin(1, 2, -2), - [0n, 2n, 2n, 3n, 4n], - 'new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(1, 2, -2) must return [0n, 2n, 2n, 3n, 4n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n]).copyWithin(0, -2, -1), - [2n, 1n, 2n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(0, -2, -1) must return [2n, 1n, 2n, 3n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n, 4n]).copyWithin(2, -2, -1), - [0n, 1n, 3n, 3n, 4n], - 'new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(2, -2, -1) must return [0n, 1n, 3n, 3n, 4n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n]).copyWithin(-3, -2, -1), - [0n, 2n, 2n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(-3, -2, -1) must return [0n, 2n, 2n, 3n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n, 4n]).copyWithin(-2, -3, -1), - [0n, 1n, 2n, 2n, 3n], - 'new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-2, -3, -1) must return [0n, 1n, 2n, 2n, 3n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n, 4n]).copyWithin(-5, -2, -1), - [3n, 1n, 2n, 3n, 4n], - 'new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-5, -2, -1) must return [3n, 1n, 2n, 3n, 4n]' + assert( + compareArray( + 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 169d93e9ce..ae13098243 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 @@ -27,64 +27,85 @@ info: | includes: [compareArray.js, testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, -10), - [0n, 1n, 2n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, -10) must return [0n, 1n, 2n, 3n]' + assert( + compareArray( + 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([1n, 2n, 3n, 4n, 5n]).copyWithin(0, 1, -Infinity), - [1n, 2n, 3n, 4n, 5n], - 'new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, 1, -Infinity) must return [1n, 2n, 3n, 4n, 5n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n]).copyWithin(0, -2, -10), - [0n, 1n, 2n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(0, -2, -10) must return [0n, 1n, 2n, 3n]' + assert( + compareArray( + 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([1n, 2n, 3n, 4n, 5n]).copyWithin(0, -2, -Infinity), - [1n, 2n, 3n, 4n, 5n], - 'new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, -2, -Infinity) must return [1n, 2n, 3n, 4n, 5n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n]).copyWithin(0, -9, -10), - [0n, 1n, 2n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(0, -9, -10) must return [0n, 1n, 2n, 3n]' + assert( + compareArray( + 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([1n, 2n, 3n, 4n, 5n]).copyWithin(0, -9, -Infinity), - [1n, 2n, 3n, 4n, 5n], - 'new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, -9, -Infinity) must return [1n, 2n, 3n, 4n, 5n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n]).copyWithin(-3, -2, -10), - [0n, 1n, 2n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(-3, -2, -10) must return [0n, 1n, 2n, 3n]' + assert( + compareArray( + 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([1n, 2n, 3n, 4n, 5n]).copyWithin(-3, -2, -Infinity), - [1n, 2n, 3n, 4n, 5n], - 'new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-3, -2, -Infinity) must return [1n, 2n, 3n, 4n, 5n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n]).copyWithin(-7, -8, -9), - [0n, 1n, 2n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(-7, -8, -9) must return [0n, 1n, 2n, 3n]' + assert( + compareArray( + 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([1n, 2n, 3n, 4n, 5n]).copyWithin(-7, -8, -Infinity), - [1n, 2n, 3n, 4n, 5n], - 'new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-7, -8, -Infinity) must return [1n, 2n, 3n, 4n, 5n]' + assert( + compareArray( + 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 e4ed620ba0..06ec98f34d 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 @@ -25,52 +25,69 @@ info: | includes: [compareArray.js, testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(0, -10), - [0n, 1n, 2n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(0, -10) must return [0n, 1n, 2n, 3n]' + assert( + compareArray( + 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([1n, 2n, 3n, 4n, 5n]).copyWithin(0, -Infinity), - [1n, 2n, 3n, 4n, 5n], - 'new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, -Infinity) must return [1n, 2n, 3n, 4n, 5n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n, 4n]).copyWithin(2, -10), - [0n, 1n, 0n, 1n, 2n], - 'new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(2, -10) must return [0n, 1n, 0n, 1n, 2n]' + assert( + compareArray( + 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([1n, 2n, 3n, 4n, 5n]).copyWithin(2, -Infinity), - [1n, 2n, 1n, 2n, 3n], - 'new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(2, -Infinity) must return [1n, 2n, 1n, 2n, 3n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n, 4n]).copyWithin(10, -10), - [0n, 1n, 2n, 3n, 4n], - 'new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(10, -10) must return [0n, 1n, 2n, 3n, 4n]' + assert( + compareArray( + 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([1n, 2n, 3n, 4n, 5n]).copyWithin(10, -Infinity), - [1n, 2n, 3n, 4n, 5n], - 'new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(10, -Infinity) must return [1n, 2n, 3n, 4n, 5n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n]).copyWithin(-9, -10), - [0n, 1n, 2n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(-9, -10) must return [0n, 1n, 2n, 3n]' + assert( + compareArray( + 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([1n, 2n, 3n, 4n, 5n]).copyWithin(-9, -Infinity), - [1n, 2n, 3n, 4n, 5n], - 'new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-9, -Infinity) must return [1n, 2n, 3n, 4n, 5n]' + assert( + compareArray( + 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 5bc8770c2e..91e2b0e5b8 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 @@ -25,28 +25,37 @@ info: | includes: [compareArray.js, testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(-10, 0), - [0n, 1n, 2n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(-10, 0) must return [0n, 1n, 2n, 3n]' + assert( + compareArray( + 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([1n, 2n, 3n, 4n, 5n]).copyWithin(-Infinity, 0), - [1n, 2n, 3n, 4n, 5n], - 'new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-Infinity, 0) must return [1n, 2n, 3n, 4n, 5n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n, 4n]).copyWithin(-10, 2), - [2n, 3n, 4n, 3n, 4n], - 'new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-10, 2) must return [2n, 3n, 4n, 3n, 4n]' + assert( + compareArray( + 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([1n, 2n, 3n, 4n, 5n]).copyWithin(-Infinity, 2), - [3n, 4n, 5n, 4n, 5n], - 'new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-Infinity, 2) must return [3n, 4n, 5n, 4n, 5n]' + assert( + compareArray( + 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 5018c30a15..36d5f22263 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js @@ -25,40 +25,53 @@ info: | includes: [compareArray.js, testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(0, -1), - [3n, 1n, 2n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(0, -1) must return [3n, 1n, 2n, 3n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n, 4n]).copyWithin(2, -2), - [0n, 1n, 3n, 4n, 4n], - 'new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(2, -2) must return [0n, 1n, 3n, 4n, 4n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n, 4n]).copyWithin(1, -2), - [0n, 3n, 4n, 3n, 4n], - 'new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(1, -2) must return [0n, 3n, 4n, 3n, 4n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n]).copyWithin(-1, -2), - [0n, 1n, 2n, 2n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(-1, -2) must return [0n, 1n, 2n, 2n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n, 4n]).copyWithin(-2, -3), - [0n, 1n, 2n, 2n, 3n], - 'new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-2, -3) must return [0n, 1n, 2n, 2n, 3n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n, 4n]).copyWithin(-5, -2), - [3n, 4n, 2n, 3n, 4n], - 'new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-5, -2) must return [3n, 4n, 2n, 3n, 4n]' + assert( + compareArray( + 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 f1a4028684..ec6adaedb3 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js @@ -25,22 +25,29 @@ info: | includes: [compareArray.js, testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(-1, 0), - [0n, 1n, 2n, 0n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(-1, 0) must return [0n, 1n, 2n, 0n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n, 4n]).copyWithin(-2, 2), - [0n, 1n, 2n, 2n, 3n], - 'new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-2, 2) must return [0n, 1n, 2n, 2n, 3n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n]).copyWithin(-1, 2), - [0n, 1n, 2n, 2n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(-1, 2) must return [0n, 1n, 2n, 2n]' + assert( + compareArray( + 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 d461fd8443..16d68d51b7 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 @@ -18,28 +18,37 @@ info: | includes: [compareArray.js, testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, 6), - [1n, 2n, 3n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, 6) must return [1n, 2n, 3n, 3n]' + assert( + compareArray( + 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([1n, 2n, 3n, 4n, 5n]).copyWithin(0, 1, Infinity), - [2n, 3n, 4n, 5n, 5n], - 'new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, 1, Infinity) must return [2n, 3n, 4n, 5n, 5n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(1, 3, 6), - [0n, 3n, 4n, 5n, 4n, 5n], - 'new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(1, 3, 6) must return [0n, 3n, 4n, 5n, 4n, 5n]' + assert( + compareArray( + 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([1n, 2n, 3n, 4n, 5n]).copyWithin(1, 3, Infinity), - [1n, 4n, 5n, 4n, 5n], - 'new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(1, 3, Infinity) must return [1n, 4n, 5n, 4n, 5n]' + assert( + compareArray( + 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 54aed61e9d..fcb6034914 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 @@ -18,46 +18,57 @@ info: | includes: [compareArray.js, testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(6, 0), - [0n, 1n, 2n, 3n, 4n, 5n], - 'new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(6, 0) must return [0n, 1n, 2n, 3n, 4n, 5n]' + assert( + compareArray( + new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(6, 0), + [0n, 1n, 2n, 3n, 4n, 5n] + ) ); - assert.compareArray( - new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(Infinity, 0), - [1n, 2n, 3n, 4n, 5n], - 'new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(Infinity, 0) must return [1n, 2n, 3n, 4n, 5n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(0, 6), - [0n, 1n, 2n, 3n, 4n, 5n], - 'new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(0, 6) must return [0n, 1n, 2n, 3n, 4n, 5n]' + assert( + compareArray( + new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(0, 6), + [0n, 1n, 2n, 3n, 4n, 5n] + ) ); - assert.compareArray( - new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, Infinity), - [1n, 2n, 3n, 4n, 5n], - 'new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, Infinity) must return [1n, 2n, 3n, 4n, 5n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(6, 6), - [0n, 1n, 2n, 3n, 4n, 5n], - 'new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(6, 6) must return [0n, 1n, 2n, 3n, 4n, 5n]' + assert( + compareArray( + new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(6, 6), + [0n, 1n, 2n, 3n, 4n, 5n] + ) ); - assert.compareArray( - new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(10, 10), - [0n, 1n, 2n, 3n, 4n, 5n], - 'new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(10, 10) must return [0n, 1n, 2n, 3n, 4n, 5n]' + assert( + compareArray( + new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(10, 10), + [0n, 1n, 2n, 3n, 4n, 5n] + ) ); - assert.compareArray( - new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(Infinity, Infinity), - [1n, 2n, 3n, 4n, 5n], - 'new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(Infinity, Infinity) must return [1n, 2n, 3n, 4n, 5n]' + assert( + compareArray( + 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 1920123508..27385c45ec 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 @@ -18,28 +18,33 @@ info: | includes: [compareArray.js, testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([1n, 2n, 3n, 4n, 5n, 6n]).copyWithin(0, 0), - [1n, 2n, 3n, 4n, 5n, 6n], - 'new TA([1n, 2n, 3n, 4n, 5n, 6n]).copyWithin(0, 0) must return [1n, 2n, 3n, 4n, 5n, 6n]' + assert( + compareArray( + new TA([1n, 2n, 3n, 4n, 5n, 6n]).copyWithin(0, 0), + [1n, 2n, 3n, 4n, 5n, 6n] + ) ); - assert.compareArray( - new TA([1n, 2n, 3n, 4n, 5n, 6n]).copyWithin(0, 2), - [3n, 4n, 5n, 6n, 5n, 6n], - 'new TA([1n, 2n, 3n, 4n, 5n, 6n]).copyWithin(0, 2) must return [3n, 4n, 5n, 6n, 5n, 6n]' + assert( + compareArray( + new TA([1n, 2n, 3n, 4n, 5n, 6n]).copyWithin(0, 2), + [3n, 4n, 5n, 6n, 5n, 6n] + ) ); - assert.compareArray( - new TA([1n, 2n, 3n, 4n, 5n, 6n]).copyWithin(3, 0), - [1n, 2n, 3n, 1n, 2n, 3n], - 'new TA([1n, 2n, 3n, 4n, 5n, 6n]).copyWithin(3, 0) must return [1n, 2n, 3n, 1n, 2n, 3n]' + assert( + compareArray( + new TA([1n, 2n, 3n, 4n, 5n, 6n]).copyWithin(3, 0), + [1n, 2n, 3n, 1n, 2n, 3n] + ) ); - assert.compareArray( - new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(1, 4), - [0n, 4n, 5n, 3n, 4n, 5n], - 'new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(1, 4) must return [0n, 4n, 5n, 3n, 4n, 5n]' + assert( + compareArray( + 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 58415caf12..befa6e7523 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 @@ -20,22 +20,28 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(0, 0, 0), - [0n, 1n, 2n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(0, 0, 0) must return [0n, 1n, 2n, 3n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n]).copyWithin(0, 0, 2), - [0n, 1n, 2n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(0, 0, 2) must return [0n, 1n, 2n, 3n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n]).copyWithin(0, 1, 2), - [1n, 1n, 2n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, 2) must return [1n, 1n, 2n, 3n]' + assert( + compareArray( + 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]' ); /* @@ -49,15 +55,19 @@ testWithBigIntTypedArrayConstructors(function(TA) { * from = 0 + 2 - 1 * to = 1 + 2 - 1 */ - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, 2), - [0n, 0n, 1n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, 2) must return [0n, 0n, 1n, 3n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(1, 3, 5), - [0n, 3n, 4n, 3n, 4n, 5n], - 'new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(1, 3, 5) must return [0n, 3n, 4n, 3n, 4n, 5n]' + assert( + compareArray( + 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/undefined-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js index 687d75eb7c..360d3125f4 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js @@ -25,16 +25,21 @@ info: | includes: [compareArray.js, testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, undefined), - [1n, 2n, 3n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, undefined) must return [1n, 2n, 3n, 3n]' + assert( + compareArray( + 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([0n, 1n, 2n, 3n]).copyWithin(0, 1), - [1n, 2n, 3n, 3n], - 'new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1) must return [1n, 2n, 3n, 3n]' + assert( + compareArray( + 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/copyWithin/bit-precision.js b/test/built-ins/TypedArray/prototype/copyWithin/bit-precision.js index a1955ba1ef..399cda2dcd 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/bit-precision.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/bit-precision.js @@ -38,11 +38,7 @@ function body(FloatArray) { length ); - assert.compareArray( - originalBytes, - copiedBytes, - 'The value of originalBytes is expected to equal the value of copiedBytes' - ); + assert(compareArray(originalBytes, copiedBytes)); } testWithTypedArrayConstructors(body, [Float32Array, Float64Array]); 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 b9defb5ba3..225f52cea7 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js @@ -27,45 +27,51 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0, 1, 2, 3]).copyWithin(1, 0, null), - [0, 1, 2, 3] - , - 'new TA([0, 1, 2, 3]).copyWithin(1, 0, null) must return [0, 1, 2, 3]' + assert( + compareArray( + new TA([0, 1, 2, 3]).copyWithin(1, 0, null), + [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([0, 1, 2, 3]).copyWithin(1, 0, NaN) must return [0, 1, 2, 3]' + assert( + compareArray( + new TA([0, 1, 2, 3]).copyWithin(1, 0, NaN), + [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([0, 1, 2, 3]).copyWithin(1, 0, false) must return [0, 1, 2, 3]' + assert( + compareArray( + new TA([0, 1, 2, 3]).copyWithin(1, 0, false), + [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([0, 1, 2, 3]).copyWithin(1, 0, true) must return [0, 0, 2, 3]' + assert( + compareArray( + new TA([0, 1, 2, 3]).copyWithin(1, 0, true), + [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([0, 1, 2, 3]).copyWithin(1, 0, "-2") must return [0, 0, 1, 3]' + assert( + compareArray( + 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([0, 1, 2, 3]).copyWithin(1, 0, -2.5), - [0, 0, 1, 3] - , - 'new TA([0, 1, 2, 3]).copyWithin(1, 0, -2.5) must return [0, 0, 1, 3]' + assert( + compareArray( + 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 f95fde26b2..45aa223aa6 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js @@ -26,51 +26,67 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0, 1, 2, 3]).copyWithin(1, undefined), - [0, 0, 1, 2], - 'new TA([0, 1, 2, 3]).copyWithin(1, undefined) must return [0, 0, 1, 2]' + assert( + compareArray( + new TA([0, 1, 2, 3]).copyWithin(1, undefined), + [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([0, 1, 2, 3]).copyWithin(1, false) must return [0, 0, 1, 2]' + assert( + compareArray( + new TA([0, 1, 2, 3]).copyWithin(1, false), + [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([0, 1, 2, 3]).copyWithin(1, NaN) must return [0, 0, 1, 2]' + assert( + compareArray( + new TA([0, 1, 2, 3]).copyWithin(1, NaN), + [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([0, 1, 2, 3]).copyWithin(1, null) must return [0, 0, 1, 2]' + assert( + compareArray( + new TA([0, 1, 2, 3]).copyWithin(1, null), + [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([0, 1, 2, 3]).copyWithin(0, true) must return [1, 2, 3, 3]' + assert( + compareArray( + new TA([0, 1, 2, 3]).copyWithin(0, true), + [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([0, 1, 2, 3]).copyWithin(0, "1") must return [1, 2, 3, 3]' + assert( + compareArray( + new TA([0, 1, 2, 3]).copyWithin(0, '1'), + [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([0, 1, 2, 3]).copyWithin(1, 0.5) must return [0, 0, 1, 2]' + assert( + compareArray( + 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([0, 1, 2, 3]).copyWithin(0, 1.5), - [1, 2, 3, 3], - 'new TA([0, 1, 2, 3]).copyWithin(0, 1.5) must return [1, 2, 3, 3]' + assert( + compareArray( + 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 fd625fc020..58813a6e65 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js @@ -26,57 +26,75 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0, 1, 2, 3]).copyWithin(undefined, 1), - [1, 2, 3, 3], - 'new TA([0, 1, 2, 3]).copyWithin(undefined, 1) must return [1, 2, 3, 3]' + assert( + compareArray( + new TA([0, 1, 2, 3]).copyWithin(undefined, 1), + [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([0, 1, 2, 3]).copyWithin(false, 1) must return [1, 2, 3, 3]' + assert( + compareArray( + new TA([0, 1, 2, 3]).copyWithin(false, 1), + [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([0, 1, 2, 3]).copyWithin(NaN, 1) must return [1, 2, 3, 3]' + assert( + compareArray( + new TA([0, 1, 2, 3]).copyWithin(NaN, 1), + [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([0, 1, 2, 3]).copyWithin(null, 1) must return [1, 2, 3, 3]' + assert( + compareArray( + new TA([0, 1, 2, 3]).copyWithin(null, 1), + [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([0, 1, 2, 3]).copyWithin(true, 0) must return [0, 0, 1, 2]' + assert( + compareArray( + new TA([0, 1, 2, 3]).copyWithin(true, 0), + [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([0, 1, 2, 3]).copyWithin("1", 0) must return [0, 0, 1, 2]' + assert( + compareArray( + new TA([0, 1, 2, 3]).copyWithin('1', 0), + [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([0, 1, 2, 3]).copyWithin(0.5, 1) must return [1, 2, 3, 3]' + assert( + compareArray( + 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([0, 1, 2, 3]).copyWithin(1.5, 0), - [0, 0, 1, 2], - 'new TA([0, 1, 2, 3]).copyWithin(1.5, 0) must return [0, 0, 1, 2]' + assert( + compareArray( + new TA([0, 1, 2, 3]).copyWithin(1.5, 0), + [0, 0, 1, 2] + ), + '1.5 float value coerced to integer 1' ); - assert.compareArray( - new TA([0, 1, 2, 3]).copyWithin({}, 1), - [1, 2, 3, 3], - 'new TA([0, 1, 2, 3]).copyWithin({}, 1) must return [1, 2, 3, 3]' + assert( + compareArray( + new TA([0, 1, 2, 3]).copyWithin({}, 1), + [1, 2, 3, 3] + ), + 'object value coerced to integer 0' ); }); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js index 7ccb76535e..cc97dacf1c 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js @@ -29,51 +29,67 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0, 1, 2, 3]).copyWithin(0, 1, -1), - [1, 2, 2, 3], - 'new TA([0, 1, 2, 3]).copyWithin(0, 1, -1) must return [1, 2, 2, 3]' + assert( + compareArray( + 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([0, 1, 2, 3, 4]).copyWithin(2, 0, -1), - [0, 1, 0, 1, 2], - 'new TA([0, 1, 2, 3, 4]).copyWithin(2, 0, -1) must return [0, 1, 0, 1, 2]' + assert( + compareArray( + 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([0, 1, 2, 3, 4]).copyWithin(1, 2, -2), - [0, 2, 2, 3, 4], - 'new TA([0, 1, 2, 3, 4]).copyWithin(1, 2, -2) must return [0, 2, 2, 3, 4]' + assert( + compareArray( + 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([0, 1, 2, 3]).copyWithin(0, -2, -1), - [2, 1, 2, 3], - 'new TA([0, 1, 2, 3]).copyWithin(0, -2, -1) must return [2, 1, 2, 3]' + assert( + compareArray( + 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([0, 1, 2, 3, 4]).copyWithin(2, -2, -1), - [0, 1, 3, 3, 4], - 'new TA([0, 1, 2, 3, 4]).copyWithin(2, -2, -1) must return [0, 1, 3, 3, 4]' + assert( + compareArray( + 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([0, 1, 2, 3]).copyWithin(-3, -2, -1), - [0, 2, 2, 3], - 'new TA([0, 1, 2, 3]).copyWithin(-3, -2, -1) must return [0, 2, 2, 3]' + assert( + compareArray( + 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([0, 1, 2, 3, 4]).copyWithin(-2, -3, -1), - [0, 1, 2, 2, 3], - 'new TA([0, 1, 2, 3, 4]).copyWithin(-2, -3, -1) must return [0, 1, 2, 2, 3]' + assert( + compareArray( + 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([0, 1, 2, 3, 4]).copyWithin(-5, -2, -1), - [3, 1, 2, 3, 4], - 'new TA([0, 1, 2, 3, 4]).copyWithin(-5, -2, -1) must return [3, 1, 2, 3, 4]' + assert( + compareArray( + 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 e1dc854ac6..6f77a75cd2 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 @@ -29,63 +29,83 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0, 1, 2, 3]).copyWithin(0, 1, -10), - [0, 1, 2, 3], - 'new TA([0, 1, 2, 3]).copyWithin(0, 1, -10) must return [0, 1, 2, 3]' + assert( + compareArray( + 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([1, 2, 3, 4, 5]).copyWithin(0, 1, -Infinity), - [1, 2, 3, 4, 5], - 'new TA([1, 2, 3, 4, 5]).copyWithin(0, 1, -Infinity) must return [1, 2, 3, 4, 5]' + assert( + compareArray( + 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([0, 1, 2, 3]).copyWithin(0, -2, -10), - [0, 1, 2, 3], - 'new TA([0, 1, 2, 3]).copyWithin(0, -2, -10) must return [0, 1, 2, 3]' + assert( + compareArray( + 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([1, 2, 3, 4, 5]).copyWithin(0, -2, -Infinity), - [1, 2, 3, 4, 5], - 'new TA([1, 2, 3, 4, 5]).copyWithin(0, -2, -Infinity) must return [1, 2, 3, 4, 5]' + assert( + compareArray( + 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([0, 1, 2, 3]).copyWithin(0, -9, -10), - [0, 1, 2, 3], - 'new TA([0, 1, 2, 3]).copyWithin(0, -9, -10) must return [0, 1, 2, 3]' + assert( + compareArray( + 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([1, 2, 3, 4, 5]).copyWithin(0, -9, -Infinity), - [1, 2, 3, 4, 5], - 'new TA([1, 2, 3, 4, 5]).copyWithin(0, -9, -Infinity) must return [1, 2, 3, 4, 5]' + assert( + compareArray( + 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([0, 1, 2, 3]).copyWithin(-3, -2, -10), - [0, 1, 2, 3], - 'new TA([0, 1, 2, 3]).copyWithin(-3, -2, -10) must return [0, 1, 2, 3]' + assert( + compareArray( + 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([1, 2, 3, 4, 5]).copyWithin(-3, -2, -Infinity), - [1, 2, 3, 4, 5], - 'new TA([1, 2, 3, 4, 5]).copyWithin(-3, -2, -Infinity) must return [1, 2, 3, 4, 5]' + assert( + compareArray( + 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([0, 1, 2, 3]).copyWithin(-7, -8, -9), - [0, 1, 2, 3], - 'new TA([0, 1, 2, 3]).copyWithin(-7, -8, -9) must return [0, 1, 2, 3]' + assert( + compareArray( + 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([1, 2, 3, 4, 5]).copyWithin(-7, -8, -Infinity), - [1, 2, 3, 4, 5], - 'new TA([1, 2, 3, 4, 5]).copyWithin(-7, -8, -Infinity) must return [1, 2, 3, 4, 5]' + assert( + compareArray( + 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 9bc486724e..456f3ed44f 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 @@ -27,51 +27,67 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0, 1, 2, 3]).copyWithin(0, -10), - [0, 1, 2, 3], - 'new TA([0, 1, 2, 3]).copyWithin(0, -10) must return [0, 1, 2, 3]' + assert( + compareArray( + 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([1, 2, 3, 4, 5]).copyWithin(0, -Infinity), - [1, 2, 3, 4, 5], - 'new TA([1, 2, 3, 4, 5]).copyWithin(0, -Infinity) must return [1, 2, 3, 4, 5]' + assert( + compareArray( + 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([0, 1, 2, 3, 4]).copyWithin(2, -10), - [0, 1, 0, 1, 2], - 'new TA([0, 1, 2, 3, 4]).copyWithin(2, -10) must return [0, 1, 0, 1, 2]' + assert( + compareArray( + 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([1, 2, 3, 4, 5]).copyWithin(2, -Infinity), - [1, 2, 1, 2, 3], - 'new TA([1, 2, 3, 4, 5]).copyWithin(2, -Infinity) must return [1, 2, 1, 2, 3]' + assert( + compareArray( + 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([0, 1, 2, 3, 4]).copyWithin(10, -10), - [0, 1, 2, 3, 4], - 'new TA([0, 1, 2, 3, 4]).copyWithin(10, -10) must return [0, 1, 2, 3, 4]' + assert( + compareArray( + 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([1, 2, 3, 4, 5]).copyWithin(10, -Infinity), - [1, 2, 3, 4, 5], - 'new TA([1, 2, 3, 4, 5]).copyWithin(10, -Infinity) must return [1, 2, 3, 4, 5]' + assert( + compareArray( + 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([0, 1, 2, 3]).copyWithin(-9, -10), - [0, 1, 2, 3], - 'new TA([0, 1, 2, 3]).copyWithin(-9, -10) must return [0, 1, 2, 3]' + assert( + compareArray( + 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([1, 2, 3, 4, 5]).copyWithin(-9, -Infinity), - [1, 2, 3, 4, 5], - 'new TA([1, 2, 3, 4, 5]).copyWithin(-9, -Infinity) must return [1, 2, 3, 4, 5]' + assert( + compareArray( + 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 4f0a77678b..2ec06c368f 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 @@ -27,27 +27,35 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0, 1, 2, 3]).copyWithin(-10, 0), - [0, 1, 2, 3], - 'new TA([0, 1, 2, 3]).copyWithin(-10, 0) must return [0, 1, 2, 3]' + assert( + compareArray( + 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([1, 2, 3, 4, 5]).copyWithin(-Infinity, 0), - [1, 2, 3, 4, 5], - 'new TA([1, 2, 3, 4, 5]).copyWithin(-Infinity, 0) must return [1, 2, 3, 4, 5]' + assert( + compareArray( + 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([0, 1, 2, 3, 4]).copyWithin(-10, 2), - [2, 3, 4, 3, 4], - 'new TA([0, 1, 2, 3, 4]).copyWithin(-10, 2) must return [2, 3, 4, 3, 4]' + assert( + compareArray( + 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([1, 2, 3, 4, 5]).copyWithin(-Infinity, 2), - [3, 4, 5, 4, 5], - 'new TA([1, 2, 3, 4, 5]).copyWithin(-Infinity, 2) must return [3, 4, 5, 4, 5]' + assert( + compareArray( + 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 7b7817d927..4035db6c24 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js @@ -27,39 +27,51 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0, 1, 2, 3]).copyWithin(0, -1), - [3, 1, 2, 3], - 'new TA([0, 1, 2, 3]).copyWithin(0, -1) must return [3, 1, 2, 3]' + assert( + compareArray( + 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([0, 1, 2, 3, 4]).copyWithin(2, -2), - [0, 1, 3, 4, 4], - 'new TA([0, 1, 2, 3, 4]).copyWithin(2, -2) must return [0, 1, 3, 4, 4]' + assert( + compareArray( + 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([0, 1, 2, 3, 4]).copyWithin(1, -2), - [0, 3, 4, 3, 4], - 'new TA([0, 1, 2, 3, 4]).copyWithin(1, -2) must return [0, 3, 4, 3, 4]' + assert( + compareArray( + 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([0, 1, 2, 3]).copyWithin(-1, -2), - [0, 1, 2, 2], - 'new TA([0, 1, 2, 3]).copyWithin(-1, -2) must return [0, 1, 2, 2]' + assert( + compareArray( + 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([0, 1, 2, 3, 4]).copyWithin(-2, -3), - [0, 1, 2, 2, 3], - 'new TA([0, 1, 2, 3, 4]).copyWithin(-2, -3) must return [0, 1, 2, 2, 3]' + assert( + compareArray( + 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([0, 1, 2, 3, 4]).copyWithin(-5, -2), - [3, 4, 2, 3, 4], - 'new TA([0, 1, 2, 3, 4]).copyWithin(-5, -2) must return [3, 4, 2, 3, 4]' + assert( + compareArray( + 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 9c0cf9df59..f6cde1f61e 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js @@ -27,21 +27,27 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0, 1, 2, 3]).copyWithin(-1, 0), - [0, 1, 2, 0], - 'new TA([0, 1, 2, 3]).copyWithin(-1, 0) must return [0, 1, 2, 0]' + assert( + compareArray( + 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([0, 1, 2, 3, 4]).copyWithin(-2, 2), - [0, 1, 2, 2, 3], - 'new TA([0, 1, 2, 3, 4]).copyWithin(-2, 2) must return [0, 1, 2, 2, 3]' + assert( + compareArray( + 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([0, 1, 2, 3]).copyWithin(-1, 2), - [0, 1, 2, 2], - 'new TA([0, 1, 2, 3]).copyWithin(-1, 2) must return [0, 1, 2, 2]' + assert( + compareArray( + 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 ae9a32fa98..f37b8a02bb 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 @@ -20,27 +20,35 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0, 1, 2, 3]).copyWithin(0, 1, 6), - [1, 2, 3, 3], - 'new TA([0, 1, 2, 3]).copyWithin(0, 1, 6) must return [1, 2, 3, 3]' + assert( + compareArray( + 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([1, 2, 3, 4, 5]).copyWithin(0, 1, Infinity), - [2, 3, 4, 5, 5], - 'new TA([1, 2, 3, 4, 5]).copyWithin(0, 1, Infinity) must return [2, 3, 4, 5, 5]' + assert( + compareArray( + 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([0, 1, 2, 3, 4, 5]).copyWithin(1, 3, 6), - [0, 3, 4, 5, 4, 5], - 'new TA([0, 1, 2, 3, 4, 5]).copyWithin(1, 3, 6) must return [0, 3, 4, 5, 4, 5]' + assert( + compareArray( + 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([1, 2, 3, 4, 5]).copyWithin(1, 3, Infinity), - [1, 4, 5, 4, 5], - 'new TA([1, 2, 3, 4, 5]).copyWithin(1, 3, Infinity) must return [1, 4, 5, 4, 5]' + assert( + compareArray( + 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 dcde6b9dc7..3862d7b7d2 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 @@ -20,45 +20,55 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0, 1, 2, 3, 4, 5]).copyWithin(6, 0), - [0, 1, 2, 3, 4, 5], - 'new TA([0, 1, 2, 3, 4, 5]).copyWithin(6, 0) must return [0, 1, 2, 3, 4, 5]' + assert( + compareArray( + new TA([0, 1, 2, 3, 4, 5]).copyWithin(6, 0), + [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([1, 2, 3, 4, 5]).copyWithin(Infinity, 0) must return [1, 2, 3, 4, 5]' + assert( + compareArray( + 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([0, 1, 2, 3, 4, 5]).copyWithin(0, 6), - [0, 1, 2, 3, 4, 5], - 'new TA([0, 1, 2, 3, 4, 5]).copyWithin(0, 6) must return [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] + ) ); - assert.compareArray( - new TA([1, 2, 3, 4, 5]).copyWithin(0, Infinity), - [1, 2, 3, 4, 5], - 'new TA([1, 2, 3, 4, 5]).copyWithin(0, Infinity) must return [1, 2, 3, 4, 5]' + assert( + compareArray( + 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([0, 1, 2, 3, 4, 5]).copyWithin(6, 6), - [0, 1, 2, 3, 4, 5], - 'new TA([0, 1, 2, 3, 4, 5]).copyWithin(6, 6) must return [0, 1, 2, 3, 4, 5]' + assert( + compareArray( + new TA([0, 1, 2, 3, 4, 5]).copyWithin(6, 6), + [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([0, 1, 2, 3, 4, 5]).copyWithin(10, 10) must return [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] + ) ); - assert.compareArray( - new TA([1, 2, 3, 4, 5]).copyWithin(Infinity, Infinity), - [1, 2, 3, 4, 5], - 'new TA([1, 2, 3, 4, 5]).copyWithin(Infinity, Infinity) must return [1, 2, 3, 4, 5]' + assert( + compareArray( + 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 49131fa38f..0cfd34c5ec 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 @@ -20,27 +20,31 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([1, 2, 3, 4, 5, 6]).copyWithin(0, 0), - [1, 2, 3, 4, 5, 6], - 'new TA([1, 2, 3, 4, 5, 6]).copyWithin(0, 0) must return [1, 2, 3, 4, 5, 6]' + assert( + compareArray( + new TA([1, 2, 3, 4, 5, 6]).copyWithin(0, 0), + [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([1, 2, 3, 4, 5, 6]).copyWithin(0, 2) must return [3, 4, 5, 6, 5, 6]' + assert( + compareArray( + new TA([1, 2, 3, 4, 5, 6]).copyWithin(0, 2), + [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([1, 2, 3, 4, 5, 6]).copyWithin(3, 0) must return [1, 2, 3, 1, 2, 3]' + assert( + compareArray( + new TA([1, 2, 3, 4, 5, 6]).copyWithin(3, 0), + [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([0, 1, 2, 3, 4, 5]).copyWithin(1, 4) must return [0, 4, 5, 3, 4, 5]' + assert( + compareArray( + 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 55aec783e4..5ce98d35e7 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 @@ -20,22 +20,28 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0, 1, 2, 3]).copyWithin(0, 0, 0), - [0, 1, 2, 3], - 'new TA([0, 1, 2, 3]).copyWithin(0, 0, 0) must return [0, 1, 2, 3]' + assert( + compareArray( + 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([0, 1, 2, 3]).copyWithin(0, 0, 2), - [0, 1, 2, 3], - 'new TA([0, 1, 2, 3]).copyWithin(0, 0, 2) must return [0, 1, 2, 3]' + assert( + compareArray( + 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([0, 1, 2, 3]).copyWithin(0, 1, 2), - [1, 1, 2, 3], - 'new TA([0, 1, 2, 3]).copyWithin(0, 1, 2) must return [1, 1, 2, 3]' + assert( + compareArray( + 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]' ); /* @@ -49,15 +55,19 @@ testWithTypedArrayConstructors(function(TA) { * from = 0 + 2 - 1 * to = 1 + 2 - 1 */ - assert.compareArray( - new TA([0, 1, 2, 3]).copyWithin(1, 0, 2), - [0, 0, 1, 3], - 'new TA([0, 1, 2, 3]).copyWithin(1, 0, 2) must return [0, 0, 1, 3]' + assert( + compareArray( + 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([0, 1, 2, 3, 4, 5]).copyWithin(1, 3, 5), - [0, 3, 4, 3, 4, 5], - 'new TA([0, 1, 2, 3, 4, 5]).copyWithin(1, 3, 5) must return [0, 3, 4, 3, 4, 5]' + assert( + compareArray( + 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/undefined-end.js b/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js index 0755eb9462..6728788061 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js @@ -27,15 +27,19 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0, 1, 2, 3]).copyWithin(0, 1, undefined), - [1, 2, 3, 3], - 'new TA([0, 1, 2, 3]).copyWithin(0, 1, undefined) must return [1, 2, 3, 3]' + assert( + compareArray( + 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([0, 1, 2, 3]).copyWithin(0, 1), - [1, 2, 3, 3], - 'new TA([0, 1, 2, 3]).copyWithin(0, 1) must return [1, 2, 3, 3]' + assert( + compareArray( + 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/BigInt/return-itor.js b/test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js index 81bd790e3b..b5e3a5f024 100644 --- a/test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js +++ b/test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js @@ -11,19 +11,24 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var typedArray = new TA([0n, 42n, 64n]); var itor = typedArray.entries(); + var next = itor.next(); - assert.compareArray(next.value, [0, 0n], 'The value of next.value is expected to be [0, 0n]'); - assert.sameValue(next.done, false, 'The value of next.done is expected to be false'); + assert(compareArray(next.value, [0, 0n])); + assert.sameValue(next.done, false); + next = itor.next(); - assert.compareArray(next.value, [1, 42n], 'The value of next.value is expected to be [1, 42n]'); - assert.sameValue(next.done, false, 'The value of next.done is expected to be false'); + assert(compareArray(next.value, [1, 42n])); + assert.sameValue(next.done, false); + next = itor.next(); - assert.compareArray(next.value, [2, 64n], 'The value of next.value is expected to be [2, 64n]'); - assert.sameValue(next.done, false, 'The value of next.done is expected to be false'); + assert(compareArray(next.value, [2, 64n])); + assert.sameValue(next.done, false); + next = itor.next(); - assert.sameValue(next.value, undefined, 'The value of next.value is expected to equal undefined'); - assert.sameValue(next.done, true, 'The value of next.done is expected to be true'); + assert.sameValue(next.value, undefined); + assert.sameValue(next.done, true); }); diff --git a/test/built-ins/TypedArray/prototype/entries/return-itor.js b/test/built-ins/TypedArray/prototype/entries/return-itor.js index 09b22d002d..a3da9e9f94 100644 --- a/test/built-ins/TypedArray/prototype/entries/return-itor.js +++ b/test/built-ins/TypedArray/prototype/entries/return-itor.js @@ -19,18 +19,18 @@ testWithTypedArrayConstructors(function(TA) { var itor = typedArray.entries(); var next = itor.next(); - assert.compareArray(next.value, [0, 0], 'The value of next.value is expected to be [0, 0]'); - assert.sameValue(next.done, false, 'The value of next.done is expected to be false'); + assert(compareArray(next.value, [0, 0])); + assert.sameValue(next.done, false); next = itor.next(); - assert.compareArray(next.value, [1, 42], 'The value of next.value is expected to be [1, 42]'); - assert.sameValue(next.done, false, 'The value of next.done is expected to be false'); + assert(compareArray(next.value, [1, 42])); + assert.sameValue(next.done, false); next = itor.next(); - assert.compareArray(next.value, [2, 64], 'The value of next.value is expected to be [2, 64]'); - assert.sameValue(next.done, false, 'The value of next.done is expected to be false'); + assert(compareArray(next.value, [2, 64])); + assert.sameValue(next.done, false); next = itor.next(); - assert.sameValue(next.value, undefined, 'The value of next.value is expected to equal undefined'); - assert.sameValue(next.done, true, 'The value of next.done is expected to be true'); + assert.sameValue(next.value, undefined); + assert.sameValue(next.done, 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 e03a01d408..5467a89cd3 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js @@ -30,64 +30,75 @@ info: | includes: [compareArray.js, testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0n, 0n]).fill(1n, undefined), - [1n, 1n], - 'new TA([0n, 0n]).fill(1n, undefined) must return [1n, 1n]' + 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], - 'new TA([0n, 0n]).fill(1n, 0, undefined) must return [1n, 1n]' + 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], 'new TA([0n, 0n]).fill(1n, null) must return [1n, 1n]'); - - assert.compareArray( - new TA([0n, 0n]).fill(1n, 0, null), - [0n, 0n], - 'new TA([0n, 0n]).fill(1n, 0, null) must return [0n, 0n]' + assert( + compareArray(new TA([0n, 0n]).fill(1n, null), [1n, 1n]), + '`null` start coerced to 0' ); - assert.compareArray(new TA([0n, 0n]).fill(1n, true), [0n, 1n], 'new TA([0n, 0n]).fill(1n, true) must return [0n, 1n]'); - - assert.compareArray( - new TA([0n, 0n]).fill(1n, 0, true), - [1n, 0n], - 'new TA([0n, 0n]).fill(1n, 0, true) must return [1n, 0n]' + 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, false), [1n, 1n], 'new TA([0n, 0n]).fill(1n, false) must return [1n, 1n]'); - - assert.compareArray( - new TA([0n, 0n]).fill(1n, 0, false), - [0n, 0n], - 'new TA([0n, 0n]).fill(1n, 0, false) must return [0n, 0n]' + assert( + compareArray(new TA([0n, 0n]).fill(1n, true), [0n, 1n]), + '`true` start coerced to 1' ); - assert.compareArray(new TA([0n, 0n]).fill(1n, NaN), [1n, 1n], 'new TA([0n, 0n]).fill(1n, NaN) must return [1n, 1n]'); - - assert.compareArray( - new TA([0n, 0n]).fill(1n, 0, NaN), - [0n, 0n], - 'new TA([0n, 0n]).fill(1n, 0, NaN) must return [0n, 0n]' + 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, '1'), [0n, 1n], 'new TA([0n, 0n]).fill(1n, "1") must return [0n, 1n]'); - - assert.compareArray( - new TA([0n, 0n]).fill(1n, 0, '1'), - [1n, 0n], - 'new TA([0n, 0n]).fill(1n, 0, "1") must return [1n, 0n]' + assert( + compareArray(new TA([0n, 0n]).fill(1n, false), [1n, 1n]), + '`false` start coerced to 0' ); - assert.compareArray(new TA([0n, 0n]).fill(1n, 1.5), [0n, 1n], 'new TA([0n, 0n]).fill(1n, 1.5) must return [0n, 1n]'); + 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, 0, 1.5), - [1n, 0n], - 'new TA([0n, 0n]).fill(1n, 0, 1.5) must return [1n, 0n]' + 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/fill-values-custom-start-and-end.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-custom-start-and-end.js index 7bfb6bd38c..a981ab00bd 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 @@ -32,34 +32,11 @@ info: | 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], - 'new TA([0n, 0n, 0n]).fill(8n, 1, 2) must return [0n, 8n, 0n]' - ); - - assert.compareArray( - new TA([0n, 0n, 0n, 0n, 0n]).fill(8n, -3, 4), - [0n, 0n, 8n, 8n, 0n], - 'new TA([0n, 0n, 0n, 0n, 0n]).fill(8n, -3, 4) must return [0n, 0n, 8n, 8n, 0n]' - ); - - assert.compareArray( - new TA([0n, 0n, 0n, 0n, 0n]).fill(8n, -2, -1), - [0n, 0n, 0n, 8n, 0n], - 'new TA([0n, 0n, 0n, 0n, 0n]).fill(8n, -2, -1) must return [0n, 0n, 0n, 8n, 0n]' - ); - - assert.compareArray( - new TA([0n, 0n, 0n, 0n, 0n]).fill(8n, -1, -3), - [0n, 0n, 0n, 0n, 0n], - 'new TA([0n, 0n, 0n, 0n, 0n]).fill(8n, -1, -3) must return [0n, 0n, 0n, 0n, 0n]' - ); - - assert.compareArray( - new TA([0n, 0n, 0n, 0n, 0n]).fill(8n, 1, 3), - [0n, 8n, 8n, 0n, 0n], - 'new TA([0n, 0n, 0n, 0n, 0n]).fill(8n, 1, 3) must return [0n, 8n, 8n, 0n, 0n]' - ); + 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-relative-end.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-relative-end.js index dd9e3b1f7e..a4cac9ffb4 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 @@ -29,28 +29,25 @@ info: | 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], - 'new TA([0n, 0n, 0n]).fill(8n, 0, 1) must return [8n, 0n, 0n]' + 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], - 'new TA([0n, 0n, 0n]).fill(8n, 0, -1) must return [8n, 8n, 0n]' + 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], - 'new TA([0n, 0n, 0n]).fill(8n, 0, 5) must return [8n, 8n, 8n]' + 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], - 'new TA([0n, 0n, 0n]).fill(8n, 0, -4) must return [0n, 0n, 0n]' + 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 index 36aeaff659..790d1a5f26 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 @@ -27,28 +27,25 @@ info: | includes: [compareArray.js, testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0n, 0n, 0n]).fill(8n, 1), - [0n, 8n, 8n], - 'new TA([0n, 0n, 0n]).fill(8n, 1) must return [0n, 8n, 8n]' + 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], - 'new TA([0n, 0n, 0n]).fill(8n, 4) must return [0n, 0n, 0n]' + 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], - 'new TA([0n, 0n, 0n]).fill(8n, -1) must return [0n, 0n, 8n]' + 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], - 'new TA([0n, 0n, 0n]).fill(8n, -5) must return [8n, 8n, 8n]' + 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.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js index e795071974..ec390d28bb 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js @@ -27,12 +27,18 @@ info: | includes: [compareArray.js, testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ -testWithBigIntTypedArrayConstructors(function(TA) { - assert.compareArray(new TA().fill(8n), [], 'new TA().fill(8n) must return []'); - assert.compareArray( - new TA([0n, 0n, 0n]).fill(8n), - [8n, 8n, 8n], - 'new TA([0n, 0n, 0n]).fill(8n) must return [8n, 8n, 8n]' +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/coerced-indexes.js b/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js index 4efb3725b8..2d512bae5c 100644 --- a/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js +++ b/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js @@ -32,73 +32,73 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0, 0]).fill(1, undefined), [1, 1], - 'new TA([0, 0]).fill(1, undefined) must return [1, 1]' + assert( + 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], - 'new TA([0, 0]).fill(1, 0, undefined) must return [1, 1]' + assert( + 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], - 'new TA([0, 0]).fill(1, null) must return [1, 1]' + assert( + 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], - 'new TA([0, 0]).fill(1, 0, null) must return [0, 0]' + assert( + 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], - 'new TA([0, 0]).fill(1, true) must return [0, 1]' + assert( + 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], - 'new TA([0, 0]).fill(1, 0, true) must return [1, 0]' + assert( + 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], - 'new TA([0, 0]).fill(1, false) must return [1, 1]' + assert( + 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], - 'new TA([0, 0]).fill(1, 0, false) must return [0, 0]' + assert( + 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], - 'new TA([0, 0]).fill(1, NaN) must return [1, 1]' + assert( + 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], - 'new TA([0, 0]).fill(1, 0, NaN) must return [0, 0]' + assert( + 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], - 'new TA([0, 0]).fill(1, "1") must return [0, 1]' + assert( + 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], - 'new TA([0, 0]).fill(1, 0, "1") must return [1, 0]' + assert( + 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], - 'new TA([0, 0]).fill(1, 1.5) must return [0, 1]' + assert( + 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], - 'new TA([0, 0]).fill(1, 0, 1.5) must return [1, 0]' + assert( + 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 26a486865f..2a332b54f4 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,25 +34,9 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - assert.compareArray(new TA([0, 0, 0]).fill(8, 1, 2), [0, 8, 0], 'new TA([0, 0, 0]).fill(8, 1, 2) must return [0, 8, 0]'); - assert.compareArray( - new TA([0, 0, 0, 0, 0]).fill(8, -3, 4), - [0, 0, 8, 8, 0], - 'new TA([0, 0, 0, 0, 0]).fill(8, -3, 4) must return [0, 0, 8, 8, 0]' - ); - assert.compareArray( - new TA([0, 0, 0, 0, 0]).fill(8, -2, -1), - [0, 0, 0, 8, 0], - 'new TA([0, 0, 0, 0, 0]).fill(8, -2, -1) must return [0, 0, 0, 8, 0]' - ); - assert.compareArray( - new TA([0, 0, 0, 0, 0]).fill(8, -1, -3), - [0, 0, 0, 0, 0], - 'new TA([0, 0, 0, 0, 0]).fill(8, -1, -3) must return [0, 0, 0, 0, 0]' - ); - assert.compareArray( - new TA([0, 0, 0, 0, 0]).fill(8, 1, 3), - [0, 8, 8, 0, 0], - 'new TA([0, 0, 0, 0, 0]).fill(8, 1, 3) must return [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 9b23bb0c83..4926fdb57a 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 @@ -31,23 +31,23 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0, 0, 0]).fill(8, 0, 1), [8, 0, 0], - 'new TA([0, 0, 0]).fill(8, 0, 1) must return [8, 0, 0]' + assert( + 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], - 'new TA([0, 0, 0]).fill(8, 0, -1) must return [8, 8, 0]' + assert( + 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], - 'new TA([0, 0, 0]).fill(8, 0, 5) must return [8, 8, 8]' + assert( + 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], - 'new TA([0, 0, 0]).fill(8, 0, -4) must return [0, 0, 0]' + assert( + 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 834bc6896e..cb89c951fd 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 @@ -29,23 +29,23 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA([0, 0, 0]).fill(8, 1), [0, 8, 8], - 'new TA([0, 0, 0]).fill(8, 1) must return [0, 8, 8]' + assert( + 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], - 'new TA([0, 0, 0]).fill(8, 4) must return [0, 0, 0]' + assert( + 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], - 'new TA([0, 0, 0]).fill(8, -1) must return [0, 0, 8]' + assert( + 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], - 'new TA([0, 0, 0]).fill(8, -5) must return [8, 8, 8]' + assert( + 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 6223b4acb6..7d0faa44f3 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values.js @@ -29,13 +29,16 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - assert.compareArray( - new TA().fill(8), [], - 'new TA().fill(8) must return []' + assert( + compareArray( + new TA().fill(8), + [] + ), + "does not fill an empty instance" ); - assert.compareArray( - new TA([0, 0, 0]).fill(8), [8, 8, 8], - 'new TA([0, 0, 0]).fill(8) must return [8, 8, 8]' + assert( + 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/filter/BigInt/result-full-callbackfn-returns-true.js b/test/built-ins/TypedArray/prototype/filter/BigInt/result-full-callbackfn-returns-true.js index b881a51938..b539ca2eca 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 @@ -15,7 +15,10 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, Symbol, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { + var sample = new TA([40n, 41n, 42n]); + [ true, 1, @@ -29,9 +32,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { 0.1, -0.1 ].forEach(function(val) { - const sample = new TA([40n, 41n, 42n]); - const result = sample.filter(() => val); - - assert.compareArray(result, sample, 'The value of result is expected to equal the value of sample'); + var result = sample.filter(function() { return val; }); + assert(compareArray(result, sample), val); }); }); 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 b8282b1677..fe301ac8f6 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 @@ -48,6 +48,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { }; result = sample.filter(function() {}); - assert.sameValue(result, other, 'The value of result is expected to equal the value of other'); - assert.compareArray(result, [1n, 0n, 1n], 'The value of result is expected to be [1n, 0n, 1n]'); + + assert.sameValue(result, other, "returned another typedarray"); + assert(compareArray(result, [1n, 0n, 1n]), "the returned object is preserved"); }); 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 175a7b3b7c..4e4da9bee0 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 @@ -35,23 +35,22 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, Symbol.species, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([40n, 41n, 42n]); var calls = 0; var other, result; - sample.constructor = {}; + sample.constructor = {}; sample.constructor[Symbol.species] = function(captured) { calls++; other = new TA(captured); return other; }; - result = sample.filter(function() { - return true; - }); + result = sample.filter(function() { return true; }); - assert.sameValue(calls, 1, 'The value of calls is expected to be 1'); - assert.sameValue(result, other, 'The value of result is expected to equal the value of other'); - assert.compareArray(result, [40n, 41n, 42n], 'The value of result is expected to be [40n, 41n, 42n]'); + assert.sameValue(calls, 1, "ctor called once"); + assert.sameValue(result, other, "return is instance of custom constructor"); + 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-set.js b/test/built-ins/TypedArray/prototype/filter/BigInt/values-are-set.js index b5c065f531..49c65cacf9 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 @@ -15,17 +15,16 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([41n, 1n, 42n, 7n]); - var result = sample.filter(function() { - return true; - }); + var result; - assert.compareArray(result, [41n, 1n, 42n, 7n], 'The value of result is expected to be [41n, 1n, 42n, 7n]'); + result = sample.filter(function() { return true; }); + assert(compareArray(result, [41n, 1n, 42n, 7n]), "values are set #1"); result = sample.filter(function(v) { return v > 40n; }); - - assert.compareArray(result, [41n, 42n], 'The value of result is expected to be [41n, 42n]'); + assert(compareArray(result, [41n, 42n]), "values are set #2"); }); 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 66578b5333..f46bf483da 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 @@ -33,6 +33,6 @@ testWithTypedArrayConstructors(function(TA) { -0.1 ].forEach(function(val) { var result = sample.filter(function() { return val; }); - assert.compareArray(result, sample, 'The value of result is expected to equal the value of sample'); + assert(compareArray(result, sample), val); }); }); 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 c58f6171ba..79547878b1 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 @@ -49,6 +49,6 @@ testWithTypedArrayConstructors(function(TA) { result = sample.filter(function() {}); - assert.sameValue(result, other, 'The value of result is expected to equal the value of other'); - assert.compareArray(result, [1, 0, 1], 'The value of result is expected to be [1, 0, 1]'); + 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/speciesctor-get-species-custom-ctor.js b/test/built-ins/TypedArray/prototype/filter/speciesctor-get-species-custom-ctor.js index 7c6df7ed9e..28e12b1352 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 @@ -50,7 +50,7 @@ testWithTypedArrayConstructors(function(TA) { result = sample.filter(function() { return true; }); - assert.sameValue(calls, 1, 'The value of calls is expected to be 1'); - assert.sameValue(result, other, 'The value of result is expected to equal the value of other'); - assert.compareArray(result, [40, 41, 42], 'The value of result is expected to be [40, 41, 42]'); + 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"); }); 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 cd9b1dadbc..c9f16b8df1 100644 --- a/test/built-ins/TypedArray/prototype/filter/values-are-set.js +++ b/test/built-ins/TypedArray/prototype/filter/values-are-set.js @@ -21,10 +21,10 @@ testWithTypedArrayConstructors(function(TA) { var result; result = sample.filter(function() { return true; }); - assert.compareArray(result, [41, 1, 42, 7], 'The value of result is expected to be [41, 1, 42, 7]'); + assert(compareArray(result, [41, 1, 42, 7]), "values are set #1"); result = sample.filter(function(v) { return v > 40; }); - assert.compareArray(result, [41, 42], 'The value of result is expected to be [41, 42]'); + assert(compareArray(result, [41, 42]), "values are set #2"); }); 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 14fc33bcba..86be70f059 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 @@ -28,57 +28,51 @@ info: | includes: [compareArray.js, testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var arr = [1n, 2n, 3n]; var sample; var result; - sample = new TA(3); + sample = new TA(3); sample.find(function(val, i) { sample[i] = arr[i]; - assert.sameValue(val, 0n, 'The value of val is expected to be 0n'); + + assert.sameValue(val, 0n, "value is not mapped to instance"); }); + assert(compareArray(sample, arr), "values set during each predicate call"); - assert.compareArray(sample, arr, 'The value of sample is expected to equal the value of arr'); sample = new TA(arr); - result = sample.find(function(val, i) { - if (i === 0) { + if ( i === 0 ) { sample[2] = 7n; } - return val === 7n; }); + assert.sameValue(result, 7n, "value found"); - assert.sameValue(result, 7n, 'The value of result is expected to be 7n'); sample = new TA(arr); - result = sample.find(function(val, i) { - if (i === 0) { + if ( i === 0 ) { sample[2] = 7n; } - return val === 3n; }); + assert.sameValue(result, undefined, "value not found"); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); sample = new TA(arr); - result = sample.find(function(val, i) { - if (i > 0) { + if ( i > 0 ) { sample[0] = 7n; } - return val === 7n; }); + assert.sameValue(result, undefined, "value not found - changed after call"); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); sample = new TA(arr); - result = sample.find(function() { sample[0] = 7n; return true; }); - - assert.sameValue(result, 1n, 'The value of result is expected to be 1n'); + assert.sameValue(result, 1n, "find() returns previous found value"); }); 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 786328e82b..0b8baa4ba4 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 @@ -38,9 +38,9 @@ testWithTypedArrayConstructors(function(TA) { sample.find(function(val, i) { sample[i] = arr[i]; - assert.sameValue(val, 0, 'The value of val is expected to be 0'); + assert.sameValue(val, 0, "value is not mapped to instance"); }); - assert.compareArray(sample, arr, 'The value of sample is expected to equal the value of arr'); + assert(compareArray(sample, arr), "values set during each predicate call"); sample = new TA(arr); result = sample.find(function(val, i) { @@ -49,7 +49,7 @@ testWithTypedArrayConstructors(function(TA) { } return val === 7; }); - assert.sameValue(result, 7, 'The value of result is expected to be 7'); + assert.sameValue(result, 7, "value found"); sample = new TA(arr); result = sample.find(function(val, i) { @@ -58,7 +58,7 @@ testWithTypedArrayConstructors(function(TA) { } return val === 3; }); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert.sameValue(result, undefined, "value not found"); sample = new TA(arr); result = sample.find(function(val, i) { @@ -67,12 +67,12 @@ testWithTypedArrayConstructors(function(TA) { } return val === 7; }); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert.sameValue(result, undefined, "value not found - changed after call"); sample = new TA(arr); result = sample.find(function() { sample[0] = 7; return true; }); - assert.sameValue(result, 1, 'The value of result is expected to be 1'); + assert.sameValue(result, 1, "find() returns previous found value"); }); 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 3f142f3d1c..2fa7603237 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 @@ -24,49 +24,44 @@ info: | includes: [compareArray.js, testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var arr = [10n, 20n, 30n]; var sample; var result; - sample = new TA(3); + sample = new TA(3); sample.findIndex(function(val, i) { sample[i] = arr[i]; - assert.sameValue(val, 0n, 'The value of val is expected to be 0n'); + + assert.sameValue(val, 0n, "value is not mapped to instance"); }); + assert(compareArray(sample, arr), "values set during each predicate call"); - assert.compareArray(sample, arr, 'The value of sample is expected to equal the value of arr'); sample = new TA(arr); - result = sample.findIndex(function(val, i) { - if (i === 0) { + if ( i === 0 ) { sample[2] = 7n; } - return val === 7n; }); + assert.sameValue(result, 2, "value found"); - assert.sameValue(result, 2, 'The value of result is expected to be 2'); sample = new TA(arr); - result = sample.findIndex(function(val, i) { - if (i === 0) { + if ( i === 0 ) { sample[2] = 7n; } - return val === 30n; }); + assert.sameValue(result, -1, "value not found"); - assert.sameValue(result, -1, 'The value of result is expected to be -1'); sample = new TA(arr); - result = sample.findIndex(function(val, i) { - if (i > 0) { + if ( i > 0 ) { sample[0] = 7n; } - return val === 7n; }); - - assert.sameValue(result, -1, 'The value of result is expected to be -1'); + assert.sameValue(result, -1, "value not found - changed after call"); }); 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 7acbc4dd41..2843859a09 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 @@ -34,9 +34,9 @@ testWithTypedArrayConstructors(function(TA) { sample.findIndex(function(val, i) { sample[i] = arr[i]; - assert.sameValue(val, 0, 'The value of val is expected to be 0'); + assert.sameValue(val, 0, "value is not mapped to instance"); }); - assert.compareArray(sample, arr, 'The value of sample is expected to equal the value of arr'); + assert(compareArray(sample, arr), "values set during each predicate call"); sample = new TA(arr); result = sample.findIndex(function(val, i) { @@ -45,7 +45,7 @@ testWithTypedArrayConstructors(function(TA) { } return val === 7; }); - assert.sameValue(result, 2, 'The value of result is expected to be 2'); + assert.sameValue(result, 2, "value found"); sample = new TA(arr); result = sample.findIndex(function(val, i) { @@ -54,7 +54,7 @@ testWithTypedArrayConstructors(function(TA) { } return val === 30; }); - assert.sameValue(result, -1, 'The value of result is expected to be -1'); + assert.sameValue(result, -1, "value not found"); sample = new TA(arr); result = sample.findIndex(function(val, i) { @@ -63,5 +63,5 @@ testWithTypedArrayConstructors(function(TA) { } return val === 7; }); - assert.sameValue(result, -1, 'The value of result is expected to be -1'); + assert.sameValue(result, -1, "value not found - changed after call"); }); diff --git a/test/built-ins/TypedArray/prototype/findLast/BigInt/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/findLast/BigInt/predicate-call-changes-value.js index dee2a7683e..9c4496c762 100644 --- a/test/built-ins/TypedArray/prototype/findLast/BigInt/predicate-call-changes-value.js +++ b/test/built-ins/TypedArray/prototype/findLast/BigInt/predicate-call-changes-value.js @@ -17,69 +17,50 @@ includes: [compareArray.js, testBigIntTypedArray.js] features: [BigInt, TypedArray, array-find-from-last] ---*/ -assert.sameValue( - typeof BigInt64Array.prototype.findLast, - 'function', - 'The value of `typeof BigInt64Array.prototype.findLast` is expected to be "function"' -); - -assert.sameValue( - typeof BigUint64Array.prototype.findLast, - 'function', - 'The value of `typeof BigUint64Array.prototype.findLast` is expected to be "function"' -); - testWithBigIntTypedArrayConstructors(function(TA) { var arr = [1n, 2n, 3n]; var sample; var result; - sample = new TA(3); + sample = new TA(3); sample.findLast(function(val, i) { sample[i] = arr[i]; - assert.sameValue(val, 0n, 'The value of val is expected to be 0n'); + + assert.sameValue(val, 0n, "value is not mapped to instance"); }); + assert(compareArray(sample, arr), "values set during each predicate call"); - assert.compareArray(sample, arr, 'The value of sample is expected to equal the value of arr'); sample = new TA(arr); - result = sample.findLast(function(val, i) { - if (i === 2) { + if ( i === 2 ) { sample[0] = 7n; } - return val === 7n; }); + assert.sameValue(result, 7n, "value found"); - assert.sameValue(result, 7n, 'The value of result is expected to be 7n'); sample = new TA(arr); - result = sample.findLast(function(val, i) { - if (i === 2) { + if ( i === 2 ) { sample[0] = 7n; } - return val === 1n; }); + assert.sameValue(result, undefined, "value not found"); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); sample = new TA(arr); - result = sample.findLast(function(val, i) { - if (i < 2) { + if ( i < 2 ) { sample[2] = 7n; } - return val === 7n; }); + assert.sameValue(result, undefined, "value not found - changed after call"); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); sample = new TA(arr); - result = sample.findLast(function() { sample[2] = 7n; return true; }); - - assert.sameValue(result, 3n, 'The value of result is expected to be 3n'); + assert.sameValue(result, 3n, "findLast() returns previous found value"); }); diff --git a/test/built-ins/TypedArray/prototype/findLast/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/findLast/predicate-call-changes-value.js index 72aaa3f559..7fc08ab8c6 100644 --- a/test/built-ins/TypedArray/prototype/findLast/predicate-call-changes-value.js +++ b/test/built-ins/TypedArray/prototype/findLast/predicate-call-changes-value.js @@ -17,18 +17,6 @@ includes: [compareArray.js, testTypedArray.js] features: [TypedArray, array-find-from-last] ---*/ -assert.sameValue( - typeof BigInt64Array.prototype.findLast, - 'function', - 'The value of `typeof BigInt64Array.prototype.findLast` is expected to be "function"' -); - -assert.sameValue( - typeof BigUint64Array.prototype.findLast, - 'function', - 'The value of `typeof BigUint64Array.prototype.findLast` is expected to be "function"' -); - testWithTypedArrayConstructors(function(TA) { var arr = [1, 2, 3]; var sample; @@ -38,9 +26,9 @@ testWithTypedArrayConstructors(function(TA) { sample.findLast(function(val, i) { sample[i] = arr[i]; - assert.sameValue(val, 0, 'The value of val is expected to be 0'); + assert.sameValue(val, 0, "value is not mapped to instance"); }); - assert.compareArray(sample, arr, 'The value of sample is expected to equal the value of arr'); + assert(compareArray(sample, arr), "values set during each predicate call"); sample = new TA(arr); result = sample.findLast(function(val, i) { @@ -49,7 +37,7 @@ testWithTypedArrayConstructors(function(TA) { } return val === 7; }); - assert.sameValue(result, 7, 'The value of result is expected to be 7'); + assert.sameValue(result, 7, "value found"); sample = new TA(arr); result = sample.findLast(function(val, i) { @@ -58,7 +46,7 @@ testWithTypedArrayConstructors(function(TA) { } return val === 1; }); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert.sameValue(result, undefined, "value not found"); sample = new TA(arr); result = sample.findLast(function(val, i) { @@ -67,12 +55,12 @@ testWithTypedArrayConstructors(function(TA) { } return val === 7; }); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert.sameValue(result, undefined, "value not found - changed after call"); sample = new TA(arr); result = sample.findLast(function() { sample[2] = 7; return true; }); - assert.sameValue(result, 3, 'The value of result is expected to be 3'); + assert.sameValue(result, 3, "findLast() returns previous found value"); }); diff --git a/test/built-ins/TypedArray/prototype/findLastIndex/BigInt/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/findLastIndex/BigInt/predicate-call-changes-value.js index 88a55407e6..6fe27a8b5b 100644 --- a/test/built-ins/TypedArray/prototype/findLastIndex/BigInt/predicate-call-changes-value.js +++ b/test/built-ins/TypedArray/prototype/findLastIndex/BigInt/predicate-call-changes-value.js @@ -16,61 +16,43 @@ includes: [compareArray.js, testBigIntTypedArray.js] features: [BigInt, TypedArray, array-find-from-last] ---*/ -assert.sameValue( - typeof BigInt64Array.prototype.findLastIndex, - 'function', - 'The value of `typeof BigInt64Array.prototype.findLastIndex` is expected to be "function"' -); - -assert.sameValue( - typeof BigUint64Array.prototype.findLastIndex, - 'function', - 'The value of `typeof BigUint64Array.prototype.findLastIndex` is expected to be "function"' -); - testWithBigIntTypedArrayConstructors(function(TA) { var arr = [10n, 20n, 30n]; var sample; var result; - sample = new TA(3); + sample = new TA(3); sample.findLastIndex(function(val, i) { sample[i] = arr[i]; - assert.sameValue(val, 0n, 'The value of val is expected to be 0n'); + + assert.sameValue(val, 0n, "value is not mapped to instance"); }); + assert(compareArray(sample, arr), "values set during each predicate call"); - assert.compareArray(sample, arr, 'The value of sample is expected to equal the value of arr'); sample = new TA(arr); - result = sample.findLastIndex(function(val, i) { - if (i === 2) { + if ( i === 2 ) { sample[0] = 7n; } - return val === 7n; }); + assert.sameValue(result, 0, "value found"); - assert.sameValue(result, 0, 'The value of result is expected to be 0'); sample = new TA(arr); - result = sample.findLastIndex(function(val, i) { - if (i === 2) { + if ( i === 2 ) { sample[0] = 7n; } - return val === 10n; }); + assert.sameValue(result, -1, "value not found"); - assert.sameValue(result, -1, 'The value of result is expected to be -1'); sample = new TA(arr); - result = sample.findLastIndex(function(val, i) { - if (i < 2) { + if ( i < 2 ) { sample[2] = 7n; } - return val === 7n; }); - - assert.sameValue(result, -1, 'The value of result is expected to be -1'); + assert.sameValue(result, -1, "value not found - changed after call"); }); diff --git a/test/built-ins/TypedArray/prototype/findLastIndex/predicate-call-changes-value.js b/test/built-ins/TypedArray/prototype/findLastIndex/predicate-call-changes-value.js index 249b04c911..5449cc1ba0 100644 --- a/test/built-ins/TypedArray/prototype/findLastIndex/predicate-call-changes-value.js +++ b/test/built-ins/TypedArray/prototype/findLastIndex/predicate-call-changes-value.js @@ -16,18 +16,6 @@ includes: [compareArray.js, testTypedArray.js] features: [TypedArray, array-find-from-last] ---*/ -assert.sameValue( - typeof BigInt64Array.prototype.findLastIndex, - 'function', - 'The value of `typeof BigInt64Array.prototype.findLastIndex` is expected to be "function"' -); - -assert.sameValue( - typeof BigUint64Array.prototype.findLastIndex, - 'function', - 'The value of `typeof BigUint64Array.prototype.findLastIndex` is expected to be "function"' -); - testWithTypedArrayConstructors(function(TA) { var arr = [10, 20, 30]; var sample; @@ -37,9 +25,9 @@ testWithTypedArrayConstructors(function(TA) { sample.findLastIndex(function(val, i) { sample[i] = arr[i]; - assert.sameValue(val, 0, 'The value of val is expected to be 0'); + assert.sameValue(val, 0, "value is not mapped to instance"); }); - assert.compareArray(sample, arr, 'The value of sample is expected to equal the value of arr'); + assert(compareArray(sample, arr), "values set during each predicate call"); sample = new TA(arr); result = sample.findLastIndex(function(val, i) { @@ -48,7 +36,7 @@ testWithTypedArrayConstructors(function(TA) { } return val === 7; }); - assert.sameValue(result, 0, 'The value of result is expected to be 0'); + assert.sameValue(result, 0, "value found"); sample = new TA(arr); result = sample.findLastIndex(function(val, i) { @@ -57,7 +45,7 @@ testWithTypedArrayConstructors(function(TA) { } return val === 10; }); - assert.sameValue(result, -1, 'The value of result is expected to be -1'); + assert.sameValue(result, -1, "value not found"); sample = new TA(arr); result = sample.findLastIndex(function(val, i) { @@ -66,5 +54,5 @@ testWithTypedArrayConstructors(function(TA) { } return val === 7; }); - assert.sameValue(result, -1, 'The value of result is expected to be -1'); + assert.sameValue(result, -1, "value not found - changed after call"); }); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js b/test/built-ins/TypedArray/prototype/map/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js index 4e40d34ee7..ed43f6485a 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/speciesctor-get-species-custom-ctor-returns-another-instance.js @@ -35,21 +35,20 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, Symbol.species, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([40n]); var otherTA = TA === BigInt64Array ? BigUint64Array : BigInt64Array; var other = new otherTA([1n, 0n, 1n]); var result; - sample.constructor = {}; + sample.constructor = {}; sample.constructor[Symbol.species] = function() { return other; }; - result = sample.map(function(a) { - return a + 7n; - }); + result = sample.map(function(a) { return a + 7n; }); - assert.sameValue(result, other, 'The value of result is expected to equal the value of other'); - assert.compareArray(result, [47n, 0n, 1n], 'The value of result is expected to be [47n, 0n, 1n]'); + assert.sameValue(result, other, "returned another typedarray"); + assert(compareArray(result, [47n, 0n, 1n]), "values are set on returned typedarray"); }); diff --git a/test/built-ins/TypedArray/prototype/map/BigInt/speciesctor-get-species-custom-ctor.js b/test/built-ins/TypedArray/prototype/map/BigInt/speciesctor-get-species-custom-ctor.js index c766b764da..45b6cb8faf 100644 --- a/test/built-ins/TypedArray/prototype/map/BigInt/speciesctor-get-species-custom-ctor.js +++ b/test/built-ins/TypedArray/prototype/map/BigInt/speciesctor-get-species-custom-ctor.js @@ -35,23 +35,22 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, Symbol.species, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([40n, 41n, 42n]); var calls = 0; var other, result; - sample.constructor = {}; + sample.constructor = {}; sample.constructor[Symbol.species] = function(len) { calls++; other = new TA(len); return other; }; - result = sample.map(function(a) { - return a + 7n; - }); + result = sample.map(function(a) { return a + 7n; }); - assert.sameValue(calls, 1, 'The value of calls is expected to be 1'); - assert.sameValue(result, other, 'The value of result is expected to equal the value of other'); - assert.compareArray(result, [47n, 48n, 49n], 'The value of result is expected to be [47n, 48n, 49n]'); + assert.sameValue(calls, 1, "ctor called once"); + assert.sameValue(result, other, "return is instance of custom constructor"); + assert(compareArray(result, [47n, 48n, 49n]), "values are set on the new obj"); }); 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 27aa967262..44fab4529e 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 @@ -65,7 +65,7 @@ function body(FloatArray) { sampleBytes = new Uint8Array(sample.buffer); resultBytes = new Uint8Array(result.buffer); - assert.compareArray(sampleBytes, resultBytes, 'The value of sampleBytes is expected to equal the value of resultBytes'); + assert(compareArray(sampleBytes, resultBytes)); } testWithTypedArrayConstructors(body, [Float32Array, Float64Array]); diff --git a/test/built-ins/TypedArray/prototype/map/speciesctor-get-species-custom-ctor-returns-another-instance.js b/test/built-ins/TypedArray/prototype/map/speciesctor-get-species-custom-ctor-returns-another-instance.js index 0b980ebe32..a13585f015 100644 --- a/test/built-ins/TypedArray/prototype/map/speciesctor-get-species-custom-ctor-returns-another-instance.js +++ b/test/built-ins/TypedArray/prototype/map/speciesctor-get-species-custom-ctor-returns-another-instance.js @@ -49,6 +49,6 @@ testWithTypedArrayConstructors(function(TA) { result = sample.map(function(a) { return a + 7; }); - assert.sameValue(result, other, 'The value of result is expected to equal the value of other'); - assert.compareArray(result, [47, 0, 1], 'The value of result is expected to be [47, 0, 1]'); + assert.sameValue(result, other, "returned another typedarray"); + assert(compareArray(result, [47, 0, 1]), "values are set on returned typedarray"); }); diff --git a/test/built-ins/TypedArray/prototype/map/speciesctor-get-species-custom-ctor.js b/test/built-ins/TypedArray/prototype/map/speciesctor-get-species-custom-ctor.js index 6ca4379f83..d6ec477494 100644 --- a/test/built-ins/TypedArray/prototype/map/speciesctor-get-species-custom-ctor.js +++ b/test/built-ins/TypedArray/prototype/map/speciesctor-get-species-custom-ctor.js @@ -50,7 +50,7 @@ testWithTypedArrayConstructors(function(TA) { result = sample.map(function(a) { return a + 7; }); - assert.sameValue(calls, 1, 'The value of calls is expected to be 1'); - assert.sameValue(result, other, 'The value of result is expected to equal the value of other'); - assert.compareArray(result, [47, 48, 49], 'The value of result is expected to be [47, 48, 49]'); + assert.sameValue(calls, 1, "ctor called once"); + assert.sameValue(result, other, "return is instance of custom constructor"); + assert(compareArray(result, [47, 48, 49]), "values are set on the new obj"); }); diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/reverts.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/reverts.js index b814a3afc3..92aa0eb3e9 100644 --- a/test/built-ins/TypedArray/prototype/reverse/BigInt/reverts.js +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/reverts.js @@ -18,25 +18,40 @@ info: | 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] = 42n; sample[1] = 43n; sample[2] = 2n; sample[3] = 1n; other[4] = 7n; + sample.reverse(); - assert.compareArray(sample, [1n, 2n, 43n, 42n], 'The value of sample is expected to be [1n, 2n, 43n, 42n]'); - assert.compareArray(other, [1n, 2n, 43n, 42n, 7n], 'The value of other is expected to be [1n, 2n, 43n, 42n, 7n]'); + assert( + compareArray(sample, [1n, 2n, 43n, 42n]) + ); + + assert( + compareArray(other, [1n, 2n, 43n, 42n, 7n]) + ); + sample[0] = 7n; sample[1] = 17n; sample[2] = 1n; sample[3] = 0n; other[4] = 42n; + other.reverse(); - assert.compareArray(other, [42n, 0n, 1n, 17n, 7n], 'The value of other is expected to be [42n, 0n, 1n, 17n, 7n]'); - assert.compareArray(sample, [42n, 0n, 1n, 17n], 'The value of sample is expected to be [42n, 0n, 1n, 17n]'); + assert( + compareArray(other, [42n, 0n, 1n, 17n, 7n]) + ); + + assert( + compareArray(sample, [42n, 0n, 1n, 17n]) + ); }); diff --git a/test/built-ins/TypedArray/prototype/reverse/reverts.js b/test/built-ins/TypedArray/prototype/reverse/reverts.js index 46fdee39fd..5bec740e5b 100644 --- a/test/built-ins/TypedArray/prototype/reverse/reverts.js +++ b/test/built-ins/TypedArray/prototype/reverse/reverts.js @@ -32,8 +32,13 @@ testWithTypedArrayConstructors(function(TA) { other[4] = 7; sample.reverse(); - assert.compareArray(sample, [1, 2, 43, 42], 'The value of sample is expected to be [1, 2, 43, 42]'); - assert.compareArray(other, [1, 2, 43, 42, 7], 'The value of other is expected to be [1, 2, 43, 42, 7]'); + assert( + compareArray(sample, [1, 2, 43, 42]) + ); + + assert( + compareArray(other, [1, 2, 43, 42, 7]) + ); sample[0] = 7; sample[1] = 17; @@ -42,6 +47,11 @@ testWithTypedArrayConstructors(function(TA) { other[4] = 42; other.reverse(); - assert.compareArray(other, [42, 0, 1, 17, 7], 'The value of other is expected to be [42, 0, 1, 17, 7]'); - assert.compareArray(sample, [42, 0, 1, 17], 'The value of sample is expected to be [42, 0, 1, 17]'); + assert( + compareArray(other, [42, 0, 1, 17, 7]) + ); + + assert( + compareArray(sample, [42, 0, 1, 17]) + ); }); 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 0c2b44ccf3..e5d5046348 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 @@ -17,72 +17,79 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample; + sample = new TA([1n, 2n]); - sample.set([42n], ''); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + sample.set([42n], ""); + assert(compareArray(sample, [42n, 2n]), "the empty string"); + sample = new TA([1n, 2n]); - sample.set([42n], '0'); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + sample.set([42n], "0"); + assert(compareArray(sample, [42n, 2n]), "'0'"); + sample = new TA([1n, 2n]); sample.set([42n], false); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + assert(compareArray(sample, [42n, 2n]), "false"); + sample = new TA([1n, 2n]); sample.set([42n], 0.1); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + assert(compareArray(sample, [42n, 2n]), "0.1"); + sample = new TA([1n, 2n]); sample.set([42n], 0.9); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + assert(compareArray(sample, [42n, 2n]), "0.9"); + sample = new TA([1n, 2n]); sample.set([42n], -0.5); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + assert(compareArray(sample, [42n, 2n]), "-0.5"); + sample = new TA([1n, 2n]); sample.set([42n], 1.1); - assert.compareArray(sample, [1n, 42n], 'The value of sample is expected to be [1n, 42n]'); + assert(compareArray(sample, [1n, 42n]), "1.1"); + sample = new TA([1n, 2n]); sample.set([42n], NaN); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + assert(compareArray(sample, [42n, 2n]), "NaN"); + sample = new TA([1n, 2n]); sample.set([42n], null); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + assert(compareArray(sample, [42n, 2n]), "null"); + sample = new TA([1n, 2n]); sample.set([42n], undefined); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + assert(compareArray(sample, [42n, 2n]), "undefined"); + sample = new TA([1n, 2n]); sample.set([42n], {}); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + assert(compareArray(sample, [42n, 2n]), "{}"); + sample = new TA([1n, 2n]); sample.set([42n], []); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + assert(compareArray(sample, [42n, 2n]), "[]"); + sample = new TA([1n, 2n]); sample.set([42n], [0]); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + assert(compareArray(sample, [42n, 2n]), "[0]"); + sample = new TA([1n, 2n]); sample.set([42n], true); - assert.compareArray(sample, [1n, 42n], 'The value of sample is expected to be [1n, 42n]'); + assert(compareArray(sample, [1n, 42n]), "true"); + sample = new TA([1n, 2n]); - sample.set([42n], '1'); - assert.compareArray(sample, [1n, 42n], 'The value of sample is expected to be [1n, 42n]'); + sample.set([42n], "1"); + assert(compareArray(sample, [1n, 42n]), "'1'"); + sample = new TA([1n, 2n]); sample.set([42n], [1]); - assert.compareArray(sample, [1n, 42n], 'The value of sample is expected to be [1n, 42n]'); + assert(compareArray(sample, [1n, 42n]), "[1]"); + sample = new TA([1n, 2n]); + sample.set([42n], { valueOf: function() {return 1;} }); + assert(compareArray(sample, [1n, 42n]), "valueOf"); - sample.set([42n], { - valueOf: function() { - return 1; - } - }); - - assert.compareArray(sample, [1n, 42n], 'The value of sample is expected to be [1n, 42n]'); sample = new TA([1n, 2n]); - - sample.set([42n], { - toString: function() { - return 1; - } - }); - - assert.compareArray(sample, [1n, 42n], 'The value of sample is expected to be [1n, 42n]'); + 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-value.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-get-value.js index b3f725e4ca..237c946458 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 @@ -21,25 +21,28 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var obj = { - length: 4, - '0': 42n, - '1': 43n, - '3': 44n - }; - - Object.defineProperty(obj, '2', { - get: function() { - throw new Test262Error(); - } - }); + length: 4, + "0": 42n, + "1": 43n, + "3": 44n + }; + Object.defineProperty(obj, "2", { + get: function() { + throw new Test262Error(); + } + }); var sample = new TA([1n, 2n, 3n, 4n]); assert.throws(Test262Error, function() { sample.set(obj); - }, 'sample.set(obj) throws a Test262Error exception'); + }); - assert.compareArray(sample, [42n, 43n, 3n, 4n], 'The value of sample is expected to be [42n, 43n, 3n, 4n]'); + assert( + 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-symbol.js b/test/built-ins/TypedArray/prototype/set/BigInt/array-arg-return-abrupt-from-src-tonumber-value-symbol.js index 943d705a8d..683d318f0c 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 @@ -21,20 +21,24 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, Symbol, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var obj = { - length: 4, - '0': 42n, - '1': 43n, - '2': Symbol('1'), - '3': 44n + length: 4, + "0": 42n, + "1": 43n, + "2": Symbol("1"), + "3": 44n }; var sample = new TA([1n, 2n, 3n, 4n]); assert.throws(TypeError, function() { sample.set(obj); - }, 'sample.set(obj) throws a TypeError exception'); + }); - assert.compareArray(sample, [42n, 43n, 3n, 4n], 'The value of sample is expected to be [42n, 43n, 3n, 4n]'); + assert( + 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 3c5fffd21e..7195d3f7d2 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 @@ -21,26 +21,28 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var obj = { - length: 4, - '0': 42n, - '1': 43n, - - '2': { - valueOf: function() { - throw new Test262Error(); - } - }, - - '3': 44n + length: 4, + "0": 42n, + "1": 43n, + "2": { + valueOf: function() { + throw new Test262Error(); + } + }, + "3": 44n }; var sample = new TA([1n, 2n, 3n, 4n]); assert.throws(Test262Error, function() { sample.set(obj); - }, 'sample.set(obj) throws a Test262Error exception'); + }); - assert.compareArray(sample, [42n, 43n, 3n, 4n], 'The value of sample is expected to be [42n, 43n, 3n, 4n]'); + assert( + compareArray(sample, [42n, 43n, 3n, 4n]), + "values are set until exception" + ); }); 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 632f1ece95..3eb5722efc 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 @@ -21,14 +21,13 @@ info: | 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); @@ -55,16 +54,19 @@ testWithBigIntTypedArrayConstructors(function(TA) { Object.defineProperty(obj, 3, { get: function() { - throw new Test262Error('Should not call obj[3]'); + throw new Test262Error("Should not call obj[3]"); } }); sample.set(obj, 1); - assert.compareArray(sample, [0n, 42n, 43n, 44n, 0n], 'The value of sample is expected to be [0n, 42n, 43n, 44n, 0n]'); - assert.compareArray( - calls, - [0, '0,0,0,0,0', 1, '0,42,0,0,0', 2, '0,42,43,0,0'], - 'The value of calls is expected to be [0, "0,0,0,0,0", 1, "0,42,0,0,0", 2, "0,42,43,0,0"]' + assert( + compareArray(sample, [0n, 42n, 43n, 44n, 0n]), + "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 index c0ba0cf7dc..1e3a226f8d 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 @@ -21,38 +21,43 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var src = [42n, 43n]; - var srcObj = { length: 2, '0': 7n, '1': 17n }; - var sample, result; + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 0); - assert.compareArray(sample, [42n, 43n, 3n, 4n], 'The value of sample is expected to be [42n, 43n, 3n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [42n, 43n, 3n, 4n]), "offset: 0, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 1); - assert.compareArray(sample, [1n, 42n, 43n, 4n], 'The value of sample is expected to be [1n, 42n, 43n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1n, 42n, 43n, 4n]), "offset: 1, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 2); - assert.compareArray(sample, [1n, 2n, 42n, 43n], 'The value of sample is expected to be [1n, 2n, 42n, 43n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1n, 2n, 42n, 43n]), "offset: 2, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(srcObj, 0); - assert.compareArray(sample, [7n, 17n, 3n, 4n], 'The value of sample is expected to be [7n, 17n, 3n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [7n, 17n, 3n, 4n]), "offset: 0, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(srcObj, 1); - assert.compareArray(sample, [1n, 7n, 17n, 4n], 'The value of sample is expected to be [1n, 7n, 17n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1n, 7n, 17n, 4n]), "offset: 1, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(srcObj, 2); - assert.compareArray(sample, [1n, 2n, 7n, 17n], 'The value of sample is expected to be [1n, 2n, 7n, 17n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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 523c3c4a26..d3d5c1aa4a 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 @@ -21,22 +21,29 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var obj1 = { - valueOf: function() { - return 42n; - } + valueOf: function() { + return 42n; + } }; var obj2 = { - toString: function() { - return '42'; - } + toString: function() { + return "42"; + } }; var arr = [false, true, obj1, [], [1]]; + var sample = new TA(arr.length); var expected = new TA([0n, 1n, 42n, 0n, 1n]); + sample.set(arr); - assert.compareArray(sample, expected, 'The value of sample is expected to equal the value of expected'); + + 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 index ea0dee6849..d6156af975 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 @@ -21,9 +21,9 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA(5); - var obj = { length: 5, '1': 7n, @@ -31,7 +31,6 @@ testWithBigIntTypedArrayConstructors(function(TA) { '3': 7n, '4': 7n }; - Object.defineProperty(obj, 0, { get: function() { obj[1] = 43n; @@ -43,5 +42,6 @@ testWithBigIntTypedArrayConstructors(function(TA) { }); sample.set(obj); - assert.compareArray(sample, [42n, 43n, 44n, 45n, 46n], 'The value of sample is expected to be [42n, 43n, 44n, 45n, 46n]'); + + assert(compareArray(sample, [42n, 43n, 44n, 45n, 46n])); }); 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 21748baf01..3b191aa4e8 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 @@ -14,73 +14,80 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample; var src = new TA([42n]); + sample = new TA([1n, 2n]); - sample.set(src, ''); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + sample.set(src, ""); + assert(compareArray(sample, [42n, 2n]), "the empty string"); + sample = new TA([1n, 2n]); - sample.set(src, '0'); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + sample.set(src, "0"); + assert(compareArray(sample, [42n, 2n]), "'0'"); + sample = new TA([1n, 2n]); sample.set(src, false); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + assert(compareArray(sample, [42n, 2n]), "false"); + sample = new TA([1n, 2n]); sample.set(src, 0.1); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + assert(compareArray(sample, [42n, 2n]), "0.1"); + sample = new TA([1n, 2n]); sample.set(src, 0.9); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + assert(compareArray(sample, [42n, 2n]), "0.9"); + sample = new TA([1n, 2n]); sample.set(src, -0.5); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + assert(compareArray(sample, [42n, 2n]), "-0.5"); + sample = new TA([1n, 2n]); sample.set(src, 1.1); - assert.compareArray(sample, [1n, 42n], 'The value of sample is expected to be [1n, 42n]'); + assert(compareArray(sample, [1n, 42n]), "1.1"); + sample = new TA([1n, 2n]); sample.set(src, NaN); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + assert(compareArray(sample, [42n, 2n]), "NaN"); + sample = new TA([1n, 2n]); sample.set(src, null); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + assert(compareArray(sample, [42n, 2n]), "null"); + sample = new TA([1n, 2n]); sample.set(src, undefined); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + assert(compareArray(sample, [42n, 2n]), "undefined"); + sample = new TA([1n, 2n]); sample.set(src, {}); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + assert(compareArray(sample, [42n, 2n]), "{}"); + sample = new TA([1n, 2n]); sample.set(src, []); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + assert(compareArray(sample, [42n, 2n]), "[]"); + sample = new TA([1n, 2n]); sample.set(src, [0]); - assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); + assert(compareArray(sample, [42n, 2n]), "[0]"); + sample = new TA([1n, 2n]); sample.set(src, true); - assert.compareArray(sample, [1n, 42n], 'The value of sample is expected to be [1n, 42n]'); + assert(compareArray(sample, [1n, 42n]), "true"); + sample = new TA([1n, 2n]); - sample.set(src, '1'); - assert.compareArray(sample, [1n, 42n], 'The value of sample is expected to be [1n, 42n]'); + sample.set(src, "1"); + assert(compareArray(sample, [1n, 42n]), "'1'"); + sample = new TA([1n, 2n]); sample.set(src, [1]); - assert.compareArray(sample, [1n, 42n], 'The value of sample is expected to be [1n, 42n]'); + assert(compareArray(sample, [1n, 42n]), "[1]"); + sample = new TA([1n, 2n]); + sample.set(src, { valueOf: function() {return 1;} }); + assert(compareArray(sample, [1n, 42n]), "valueOf"); - sample.set(src, { - valueOf: function() { - return 1; - } - }); - - assert.compareArray(sample, [1n, 42n], 'The value of sample is expected to be [1n, 42n]'); sample = new TA([1n, 2n]); - - sample.set(src, { - toString: function() { - return 1; - } - }); - - assert.compareArray(sample, [1n, 42n], 'The value of sample is expected to be [1n, 42n]'); + sample.set(src, { toString: function() {return 1;} }); + assert(compareArray(sample, [1n, 42n]), "toString"); }); 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 index cc454a6d0f..3145bc8075 100644 --- 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 @@ -1,6 +1,7 @@ // 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: > @@ -9,6 +10,7 @@ description: > includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, SharedArrayBuffer, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sab = new SharedArrayBuffer(2 * BigInt64Array.BYTES_PER_ELEMENT); var otherCtor = TA === BigInt64Array ? BigUint64Array : BigInt64Array; @@ -16,19 +18,24 @@ testWithBigIntTypedArrayConstructors(function(TA) { src[0] = 42n; src[1] = 43n; var sample, result; + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 0); - assert.compareArray(sample, [42n, 43n, 3n, 4n], 'The value of sample is expected to be [42n, 43n, 3n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [42n, 43n, 3n, 4n]), "src is SAB-backed, offset: 0, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 1); - assert.compareArray(sample, [1n, 42n, 43n, 4n], 'The value of sample is expected to be [1n, 42n, 43n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1n, 42n, 43n, 4n]), "src is SAB-backed, offset: 1, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 2); - assert.compareArray(sample, [1n, 2n, 42n, 43n], 'The value of sample is expected to be [1n, 2n, 42n, 43n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1n, 2n, 42n, 43n]), "src is SAB-backed, offset: 2, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + src = new BigInt64Array([42n, 43n]); + sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab); sample[0] = 1n; @@ -36,8 +43,9 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 0); - assert.compareArray(sample, [42n, 43n, 3n, 4n], 'The value of sample is expected to be [42n, 43n, 3n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [42n, 43n, 3n, 4n]), "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] = 1n; @@ -45,8 +53,9 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 1); - assert.compareArray(sample, [1n, 42n, 43n, 4n], 'The value of sample is expected to be [1n, 42n, 43n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1n, 42n, 43n, 4n]), "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] = 1n; @@ -54,12 +63,14 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 2); - assert.compareArray(sample, [1n, 2n, 42n, 43n], 'The value of sample is expected to be [1n, 2n, 42n, 43n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1n, 2n, 42n, 43n]), "sample is SAB-backed, offset: 2, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + var sab1 = new SharedArrayBuffer(2 * BigInt64Array.BYTES_PER_ELEMENT); src = new BigInt64Array(sab1); src[0] = 42n; src[1] = 43n; + var sab2; sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab2); @@ -68,8 +79,9 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 0); - assert.compareArray(sample, [42n, 43n, 3n, 4n], 'The value of sample is expected to be [42n, 43n, 3n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [42n, 43n, 3n, 4n]), "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] = 1n; @@ -77,8 +89,9 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 1); - assert.compareArray(sample, [1n, 42n, 43n, 4n], 'The value of sample is expected to be [1n, 42n, 43n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1n, 42n, 43n, 4n]), "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] = 1n; @@ -86,6 +99,6 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 2); - assert.compareArray(sample, [1n, 2n, 42n, 43n], 'The value of sample is expected to be [1n, 2n, 42n, 43n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1n, 2n, 42n, 43n]), "src and sample are SAB-backed, 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-other-type.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type.js index 0ced5b5ef7..4456c5dccc 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 @@ -25,20 +25,24 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var other = TA === BigInt64Array ? BigUint64Array : BigInt64Array; var src = new other([42n, 43n]); var sample, result; + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 0); - assert.compareArray(sample, [42n, 43n, 3n, 4n], 'The value of sample is expected to be [42n, 43n, 3n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [42n, 43n, 3n, 4n]), "offset: 0, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 1); - assert.compareArray(sample, [1n, 42n, 43n, 4n], 'The value of sample is expected to be [1n, 42n, 43n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1n, 42n, 43n, 4n]), "offset: 1, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 2); - assert.compareArray(sample, [1n, 2n, 42n, 43n], 'The value of sample is expected to be [1n, 2n, 42n, 43n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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-sab.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type-sab.js index 22935d7cfc..f179ba052c 100644 --- 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 @@ -9,25 +9,32 @@ description: > includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, SharedArrayBuffer, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample, result; + var sab = new SharedArrayBuffer(2 * TA.BYTES_PER_ELEMENT); var src = new TA(sab); src[0] = 42n; src[1] = 43n; + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 1); - assert.compareArray(sample, [1n, 42n, 43n, 4n], 'The value of sample is expected to be [1n, 42n, 43n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1n, 42n, 43n, 4n]), "src is SAB-backed, offset: 1, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 0); - assert.compareArray(sample, [42n, 43n, 3n, 4n], 'The value of sample is expected to be [42n, 43n, 3n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [42n, 43n, 3n, 4n]), "src is SAB-backed, offset: 0, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 2); - assert.compareArray(sample, [1n, 2n, 42n, 43n], 'The value of sample is expected to be [1n, 2n, 42n, 43n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1n, 2n, 42n, 43n]), "src is SAB-backed, offset: 2, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + src = new TA([42n, 43n]); + sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab); sample[0] = 1n; @@ -35,8 +42,9 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 1); - assert.compareArray(sample, [1n, 42n, 43n, 4n], 'The value of sample is expected to be [1n, 42n, 43n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1n, 42n, 43n, 4n]), "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] = 1n; @@ -44,8 +52,9 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 0); - assert.compareArray(sample, [42n, 43n, 3n, 4n], 'The value of sample is expected to be [42n, 43n, 3n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [42n, 43n, 3n, 4n]), "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] = 1n; @@ -53,12 +62,15 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 2); - assert.compareArray(sample, [1n, 2n, 42n, 43n], 'The value of sample is expected to be [1n, 2n, 42n, 43n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1n, 2n, 42n, 43n]), "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] = 42n; src[1] = 43n; + var sab2; sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab2); @@ -67,8 +79,9 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 1); - assert.compareArray(sample, [1n, 42n, 43n, 4n], 'The value of sample is expected to be [1n, 42n, 43n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1n, 42n, 43n, 4n]), "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] = 1n; @@ -76,8 +89,9 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 0); - assert.compareArray(sample, [42n, 43n, 3n, 4n], 'The value of sample is expected to be [42n, 43n, 3n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [42n, 43n, 3n, 4n]), "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] = 1n; @@ -85,6 +99,6 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 2); - assert.compareArray(sample, [1n, 2n, 42n, 43n], 'The value of sample is expected to be [1n, 2n, 42n, 43n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1n, 2n, 42n, 43n]), "src and sample are SAB-backed, 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 22f6e9411a..d806b6a6c3 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 @@ -28,19 +28,23 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample, result; var src = new TA([42n, 43n]); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 1); - assert.compareArray(sample, [1n, 42n, 43n, 4n], 'The value of sample is expected to be [1n, 42n, 43n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1n, 42n, 43n, 4n]), "offset: 1, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 0); - assert.compareArray(sample, [42n, 43n, 3n, 4n], 'The value of sample is expected to be [42n, 43n, 3n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [42n, 43n, 3n, 4n]), "offset: 0, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 2); - assert.compareArray(sample, [1n, 2n, 42n, 43n], 'The value of sample is expected to be [1n, 2n, 42n, 43n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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-resized.js b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type-resized.js index 48c46be0c7..7ffaf60153 100644 --- a/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type-resized.js +++ b/test/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type-resized.js @@ -12,18 +12,16 @@ features: [BigInt, TypedArray, resizable-arraybuffer] assert.sameValue( typeof ArrayBuffer.prototype.resize, 'function', - 'The value of `typeof ArrayBuffer.prototype.resize` is expected to be "function"' + 'implements ArrayBuffer.prototype.resize' ); testWithBigIntTypedArrayConstructors(function(TA) { var BPE = TA.BYTES_PER_ELEMENT; - - var ab = new ArrayBuffer(BPE * 4, { - maxByteLength: BPE * 5 - }); - + var ab = new ArrayBuffer(BPE * 4, {maxByteLength: BPE * 5}); var source = new TA(ab); var target = new TA(ab); + var expected = [10, 20, 30, 40]; + source[0] = 10n; source[1] = 20n; source[2] = 30n; @@ -31,15 +29,17 @@ testWithBigIntTypedArrayConstructors(function(TA) { try { ab.resize(BPE * 5); + expected = [10n, 20n, 30n, 40n, 0n]; } catch (_) {} target.set(source); - assert.compareArray(target, [10n, 20n, 30n, 40n, 0n], 'The value of target is expected to be [10n, 20n, 30n, 40n, 0n]'); + assert(compareArray(target, expected), 'following grow'); try { ab.resize(BPE * 3); + expected = [10n, 20n, 30n]; } catch (_) {} target.set(source); - assert.compareArray(target, [10n, 20n, 30n], 'The value of target is expected to be [10n, 20n, 30n]'); + assert(compareArray(target, expected), 'following shrink'); }); 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 index 45c0bdcc03..7e60fba139 100644 --- 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 @@ -1,6 +1,7 @@ // 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: > @@ -9,8 +10,10 @@ description: > includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, SharedArrayBuffer, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample, src, result, sab; + sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab); sample[0] = 1n; @@ -19,8 +22,9 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[3] = 4n; src = new TA(sample.buffer, 0, 2); result = sample.set(src, 0); - assert.compareArray(sample, [1n, 2n, 3n, 4n], 'The value of sample is expected to be [1n, 2n, 3n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1n, 2n, 3n, 4n]), "offset: 0, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab); sample[0] = 1n; @@ -29,8 +33,9 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[3] = 4n; src = new TA(sample.buffer, 0, 2); result = sample.set(src, 1); - assert.compareArray(sample, [1n, 1n, 2n, 4n], 'The value of sample is expected to be [1n, 1n, 2n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1n, 1n, 2n, 4n]), "offset: 1, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab); sample[0] = 1n; @@ -39,6 +44,6 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[3] = 4n; src = new TA(sample.buffer, 0, 2); result = sample.set(src, 2); - assert.compareArray(sample, [1n, 2n, 1n, 2n], 'The value of sample is expected to be [1n, 2n, 1n, 2n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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-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 5b684cdad5..ab1454760b 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 @@ -29,21 +29,25 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample, src, result; + sample = new TA([1n, 2n, 3n, 4n]); src = new TA(sample.buffer, 0, 2); result = sample.set(src, 0); - assert.compareArray(sample, [1n, 2n, 3n, 4n], 'The value of sample is expected to be [1n, 2n, 3n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1n, 2n, 3n, 4n]), "offset: 0, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + sample = new TA([1n, 2n, 3n, 4n]); src = new TA(sample.buffer, 0, 2); result = sample.set(src, 1); - assert.compareArray(sample, [1n, 1n, 2n, 4n], 'The value of sample is expected to be [1n, 1n, 2n, 4n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1n, 1n, 2n, 4n]), "offset: 1, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); + sample = new TA([1n, 2n, 3n, 4n]); src = new TA(sample.buffer, 0, 2); result = sample.set(src, 2); - assert.compareArray(sample, [1n, 2n, 1n, 2n], 'The value of sample is expected to be [1n, 2n, 1n, 2n]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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/array-arg-offset-tointeger.js b/test/built-ins/TypedArray/prototype/set/array-arg-offset-tointeger.js index f202440605..a5ab527732 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 @@ -23,73 +23,73 @@ testWithTypedArrayConstructors(function(TA) { sample = new TA([1, 2]); sample.set([42], ""); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "the empty string"); sample = new TA([1, 2]); sample.set([42], "0"); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "'0'"); sample = new TA([1, 2]); sample.set([42], false); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "false"); sample = new TA([1, 2]); sample.set([42], 0.1); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "0.1"); sample = new TA([1, 2]); sample.set([42], 0.9); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "0.9"); sample = new TA([1, 2]); sample.set([42], -0.5); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "-0.5"); sample = new TA([1, 2]); sample.set([42], 1.1); - assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); + assert(compareArray(sample, [1, 42]), "1.1"); sample = new TA([1, 2]); sample.set([42], NaN); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "NaN"); sample = new TA([1, 2]); sample.set([42], null); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "null"); sample = new TA([1, 2]); sample.set([42], undefined); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "undefined"); sample = new TA([1, 2]); sample.set([42], {}); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "{}"); sample = new TA([1, 2]); sample.set([42], []); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "[]"); sample = new TA([1, 2]); sample.set([42], [0]); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "[0]"); sample = new TA([1, 2]); sample.set([42], true); - assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); + assert(compareArray(sample, [1, 42]), "true"); sample = new TA([1, 2]); sample.set([42], "1"); - assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); + assert(compareArray(sample, [1, 42]), "'1'"); sample = new TA([1, 2]); sample.set([42], [1]); - assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); + assert(compareArray(sample, [1, 42]), "[1]"); sample = new TA([1, 2]); sample.set([42], { valueOf: function() {return 1;} }); - assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); + assert(compareArray(sample, [1, 42]), "valueOf"); sample = new TA([1, 2]); sample.set([42], { toString: function() {return 1;} }); - assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); + assert(compareArray(sample, [1, 42]), "toString"); }); 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 1e823fa667..afe0800303 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 @@ -39,10 +39,10 @@ testWithTypedArrayConstructors(function(TA) { assert.throws(Test262Error, function() { sample.set(obj); - }, 'sample.set(obj) throws a Test262Error exception'); + }); - assert.compareArray( - sample, [42, 43, 3, 4], - 'The value of sample is expected to be [42, 43, 3, 4]' + assert( + 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-symbol.js b/test/built-ins/TypedArray/prototype/set/array-arg-return-abrupt-from-src-tonumber-value-symbol.js index fd7c00690e..2afc27a6fa 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 @@ -35,10 +35,10 @@ testWithTypedArrayConstructors(function(TA) { assert.throws(TypeError, function() { sample.set(obj); - }, 'sample.set(obj) throws a TypeError exception'); + }); - assert.compareArray( - sample, [42, 43, 3, 4], - 'The value of sample is expected to be [42, 43, 3, 4]' + assert( + 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 917f111b14..438001533b 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 @@ -39,10 +39,10 @@ testWithTypedArrayConstructors(function(TA) { assert.throws(Test262Error, function() { sample.set(obj); - }, 'sample.set(obj) throws a Test262Error exception'); + }); - assert.compareArray( - sample, [42, 43, 3, 4], - 'The value of sample is expected to be [42, 43, 3, 4]' + assert( + compareArray(sample, [42, 43, 3, 4]), + "values are set until exception" ); }); 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 d239aae1d2..9c1603a30d 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 @@ -60,13 +60,13 @@ testWithTypedArrayConstructors(function(TA) { sample.set(obj, 1); - assert.compareArray( - sample, [0, 42, 43, 44, 0], - 'The value of sample is expected to be [0, 42, 43, 44, 0]' + assert( + compareArray(sample, [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"], - 'The value of calls is expected to be [0, "0,0,0,0,0", 1, "0,42,0,0,0", 2, "0,42,43,0,0"]' + 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/array-arg-set-values.js b/test/built-ins/TypedArray/prototype/set/array-arg-set-values.js index f699ea5788..6e53dbc94e 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 @@ -33,31 +33,31 @@ testWithTypedArrayConstructors(function(TA) { sample = new TA([1, 2, 3, 4]); result = sample.set(src, 0); - assert.compareArray(sample, [42, 43, 3, 4], 'The value of sample is expected to be [42, 43, 3, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [42, 43, 3, 4]), "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], 'The value of sample is expected to be [1, 42, 43, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1, 42, 43, 4]), "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], 'The value of sample is expected to be [1, 2, 42, 43]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1, 2, 42, 43]), "offset: 2, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); sample = new TA([1, 2, 3, 4]); result = sample.set(srcObj, 0); - assert.compareArray(sample, [7, 17, 3, 4], 'The value of sample is expected to be [7, 17, 3, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [7, 17, 3, 4]), "offset: 0, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); sample = new TA([1, 2, 3, 4]); result = sample.set(srcObj, 1); - assert.compareArray(sample, [1, 7, 17, 4], 'The value of sample is expected to be [1, 7, 17, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1, 7, 17, 4]), "offset: 1, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); sample = new TA([1, 2, 3, 4]); result = sample.set(srcObj, 2); - assert.compareArray(sample, [1, 2, 7, 17], 'The value of sample is expected to be [1, 2, 7, 17]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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 4c1c6e2213..02cfa8b659 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 @@ -42,7 +42,8 @@ testWithTypedArrayConstructors(function(TA) { sample.set(arr); - assert.compareArray(sample, expected, - 'The value of sample is expected to equal the value of expected' + assert( + compareArray(sample, expected), + "sample: [" + sample + "], expected: [" + expected + "]" ); }); 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 7216e1dca4..a3750490f1 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 @@ -43,5 +43,5 @@ testWithTypedArrayConstructors(function(TA) { sample.set(obj); - assert.compareArray(sample, [42, 43, 44, 45, 46], 'The value of sample is expected to be [42, 43, 44, 45, 46]'); + assert(compareArray(sample, [42, 43, 44, 45, 46])); }); diff --git a/test/built-ins/TypedArray/prototype/set/bit-precision.js b/test/built-ins/TypedArray/prototype/set/bit-precision.js index d6889d6b56..e0a9b814d4 100644 --- a/test/built-ins/TypedArray/prototype/set/bit-precision.js +++ b/test/built-ins/TypedArray/prototype/set/bit-precision.js @@ -29,7 +29,7 @@ function body(FA) { sourceBytes = new Uint8Array(source.buffer); targetBytes = new Uint8Array(target.buffer); - assert.compareArray(sourceBytes, targetBytes, 'The value of sourceBytes is expected to equal the value of targetBytes'); + assert(compareArray(sourceBytes, targetBytes)) } testWithTypedArrayConstructors(body, [Float32Array, Float64Array]); 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 2219eb601d..7f63cb9960 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 @@ -21,73 +21,73 @@ testWithTypedArrayConstructors(function(TA) { sample = new TA([1, 2]); sample.set(src, ""); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "the empty string"); sample = new TA([1, 2]); sample.set(src, "0"); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "'0'"); sample = new TA([1, 2]); sample.set(src, false); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "false"); sample = new TA([1, 2]); sample.set(src, 0.1); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "0.1"); sample = new TA([1, 2]); sample.set(src, 0.9); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "0.9"); sample = new TA([1, 2]); sample.set(src, -0.5); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "-0.5"); sample = new TA([1, 2]); sample.set(src, 1.1); - assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); + assert(compareArray(sample, [1, 42]), "1.1"); sample = new TA([1, 2]); sample.set(src, NaN); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "NaN"); sample = new TA([1, 2]); sample.set(src, null); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "null"); sample = new TA([1, 2]); sample.set(src, undefined); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "undefined"); sample = new TA([1, 2]); sample.set(src, {}); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "{}"); sample = new TA([1, 2]); sample.set(src, []); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "[]"); sample = new TA([1, 2]); sample.set(src, [0]); - assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); + assert(compareArray(sample, [42, 2]), "[0]"); sample = new TA([1, 2]); sample.set(src, true); - assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); + assert(compareArray(sample, [1, 42]), "true"); sample = new TA([1, 2]); sample.set(src, "1"); - assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); + assert(compareArray(sample, [1, 42]), "'1'"); sample = new TA([1, 2]); sample.set(src, [1]); - assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); + assert(compareArray(sample, [1, 42]), "[1]"); sample = new TA([1, 2]); sample.set(src, { valueOf: function() {return 1;} }); - assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); + assert(compareArray(sample, [1, 42]), "valueOf"); sample = new TA([1, 2]); sample.set(src, { toString: function() {return 1;} }); - assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); + assert(compareArray(sample, [1, 42]), "toString"); }); diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-sab.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-sab.js index d8e477c4ef..1b1a963887 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-sab.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-sab.js @@ -23,18 +23,18 @@ testWithTypedArrayConstructors(function(TA) { sample = new TA([1, 2, 3, 4]); result = sample.set(src, 0); - assert.compareArray(sample, [42, 43, 3, 4], 'The value of sample is expected to be [42, 43, 3, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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], 'The value of sample is expected to be [1, 42, 43, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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], 'The value of sample is expected to be [1, 2, 42, 43]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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]); @@ -46,8 +46,8 @@ testWithTypedArrayConstructors(function(TA) { sample[2] = 3; sample[3] = 4; result = sample.set(src, 0); - assert.compareArray(sample, [42, 43, 3, 4], 'The value of sample is expected to be [42, 43, 3, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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); @@ -56,8 +56,8 @@ testWithTypedArrayConstructors(function(TA) { sample[2] = 3; sample[3] = 4; result = sample.set(src, 1); - assert.compareArray(sample, [1, 42, 43, 4], 'The value of sample is expected to be [1, 42, 43, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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); @@ -66,8 +66,8 @@ testWithTypedArrayConstructors(function(TA) { sample[2] = 3; sample[3] = 4; result = sample.set(src, 2); - assert.compareArray(sample, [1, 2, 42, 43], 'The value of sample is expected to be [1, 2, 42, 43]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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); @@ -82,8 +82,8 @@ testWithTypedArrayConstructors(function(TA) { sample[2] = 3; sample[3] = 4; result = sample.set(src, 0); - assert.compareArray(sample, [42, 43, 3, 4], 'The value of sample is expected to be [42, 43, 3, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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); @@ -92,8 +92,8 @@ testWithTypedArrayConstructors(function(TA) { sample[2] = 3; sample[3] = 4; result = sample.set(src, 1); - assert.compareArray(sample, [1, 42, 43, 4], 'The value of sample is expected to be [1, 42, 43, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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); @@ -102,6 +102,6 @@ testWithTypedArrayConstructors(function(TA) { sample[2] = 3; sample[3] = 4; result = sample.set(src, 2); - assert.compareArray(sample, [1, 2, 42, 43], 'The value of sample is expected to be [1, 2, 42, 43]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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/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 22d57299d6..04ddb52371 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 @@ -33,16 +33,16 @@ testWithTypedArrayConstructors(function(TA) { sample = new TA([1, 2, 3, 4]); result = sample.set(src, 0); - assert.compareArray(sample, [42, 43, 3, 4], 'The value of sample is expected to be [42, 43, 3, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [42, 43, 3, 4]), "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], 'The value of sample is expected to be [1, 42, 43, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1, 42, 43, 4]), "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], 'The value of sample is expected to be [1, 2, 42, 43]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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-sab.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type-sab.js index 2695362599..cae8f7e5b3 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type-sab.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type-sab.js @@ -22,18 +22,18 @@ testWithTypedArrayConstructors(function(TA) { sample = new TA([1, 2, 3, 4]); result = sample.set(src, 1); - assert.compareArray(sample, [1, 42, 43, 4], 'The value of sample is expected to be [1, 42, 43, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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], 'The value of sample is expected to be [42, 43, 3, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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], 'The value of sample is expected to be [1, 2, 42, 43]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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]); @@ -45,8 +45,8 @@ testWithTypedArrayConstructors(function(TA) { sample[2] = 3; sample[3] = 4; result = sample.set(src, 1); - assert.compareArray(sample, [1, 42, 43, 4], 'The value of sample is expected to be [1, 42, 43, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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); @@ -55,8 +55,8 @@ testWithTypedArrayConstructors(function(TA) { sample[2] = 3; sample[3] = 4; result = sample.set(src, 0); - assert.compareArray(sample, [42, 43, 3, 4], 'The value of sample is expected to be [42, 43, 3, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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); @@ -65,8 +65,8 @@ testWithTypedArrayConstructors(function(TA) { sample[2] = 3; sample[3] = 4; result = sample.set(src, 2); - assert.compareArray(sample, [1, 2, 42, 43], 'The value of sample is expected to be [1, 2, 42, 43]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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); @@ -82,8 +82,8 @@ testWithTypedArrayConstructors(function(TA) { sample[2] = 3; sample[3] = 4; result = sample.set(src, 1); - assert.compareArray(sample, [1, 42, 43, 4], 'The value of sample is expected to be [1, 42, 43, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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); @@ -92,8 +92,8 @@ testWithTypedArrayConstructors(function(TA) { sample[2] = 3; sample[3] = 4; result = sample.set(src, 0); - assert.compareArray(sample, [42, 43, 3, 4], 'The value of sample is expected to be [42, 43, 3, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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); @@ -102,6 +102,6 @@ testWithTypedArrayConstructors(function(TA) { sample[2] = 3; sample[3] = 4; result = sample.set(src, 2); - assert.compareArray(sample, [1, 2, 42, 43], 'The value of sample is expected to be [1, 2, 42, 43]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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/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 fe079f472e..b915747855 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 @@ -35,16 +35,16 @@ testWithTypedArrayConstructors(function(TA) { sample = new TA([1, 2, 3, 4]); result = sample.set(src, 1); - assert.compareArray(sample, [1, 42, 43, 4], 'The value of sample is expected to be [1, 42, 43, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1, 42, 43, 4]), "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], 'The value of sample is expected to be [42, 43, 3, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [42, 43, 3, 4]), "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], 'The value of sample is expected to be [1, 2, 42, 43]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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-other-type.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-other-type.js index a46f52c574..45d648c1a2 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 @@ -54,6 +54,6 @@ testWithTypedArrayConstructors(function(TA) { var result = sample.set(src, 1); - assert.compareArray(sample, expected[TA.name], 'The value of sample is expected to equal the value of expected[TA.name]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, expected[TA.name]), sample); + assert.sameValue(result, undefined, "returns undefined"); }); diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type-resized.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type-resized.js index 9593d2b030..3bd4bf6259 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type-resized.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type-resized.js @@ -12,7 +12,7 @@ features: [TypedArray, resizable-arraybuffer] assert.sameValue( typeof ArrayBuffer.prototype.resize, 'function', - 'The value of `typeof ArrayBuffer.prototype.resize` is expected to be "function"' + 'implements ArrayBuffer.prototype.resize' ); testWithTypedArrayConstructors(function(TA) { @@ -33,7 +33,7 @@ testWithTypedArrayConstructors(function(TA) { } catch (_) {} target.set(source); - assert.compareArray(target, expected, 'The value of target is expected to equal the value of expected'); + assert(compareArray(target, expected), 'following grow'); try { ab.resize(BPE * 3); @@ -41,5 +41,5 @@ testWithTypedArrayConstructors(function(TA) { } catch (_) {} target.set(source); - assert.compareArray(target, expected, 'The value of target is expected to equal the value of expected'); + assert(compareArray(target, expected), 'following shrink'); }); diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type-sab.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type-sab.js index ae1c10e691..e3c3eabc25 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type-sab.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type-sab.js @@ -24,8 +24,8 @@ testWithTypedArrayConstructors(function(TA) { sample[3] = 4; src = new TA(sample.buffer, 0, 2); result = sample.set(src, 0); - assert.compareArray(sample, [1, 2, 3, 4], 'The value of sample is expected to be [1, 2, 3, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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); @@ -35,8 +35,8 @@ testWithTypedArrayConstructors(function(TA) { sample[3] = 4; src = new TA(sample.buffer, 0, 2); result = sample.set(src, 1); - assert.compareArray(sample, [1, 1, 2, 4], 'The value of sample is expected to be [1, 1, 2, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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); @@ -46,6 +46,6 @@ testWithTypedArrayConstructors(function(TA) { sample[3] = 4; src = new TA(sample.buffer, 0, 2); result = sample.set(src, 2); - assert.compareArray(sample, [1, 2, 1, 2], 'The value of sample is expected to be [1, 2, 1, 2]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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/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 d1491e4a5f..02d15ddee9 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 @@ -36,18 +36,18 @@ testWithTypedArrayConstructors(function(TA) { sample = new TA([1, 2, 3, 4]); src = new TA(sample.buffer, 0, 2); result = sample.set(src, 0); - assert.compareArray(sample, [1, 2, 3, 4], 'The value of sample is expected to be [1, 2, 3, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1, 2, 3, 4]), "offset: 0, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); sample = new TA([1, 2, 3, 4]); src = new TA(sample.buffer, 0, 2); result = sample.set(src, 1); - assert.compareArray(sample, [1, 1, 2, 4], 'The value of sample is expected to be [1, 1, 2, 4]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + assert(compareArray(sample, [1, 1, 2, 4]), "offset: 1, result: " + sample); + assert.sameValue(result, undefined, "returns undefined"); sample = new TA([1, 2, 3, 4]); src = new TA(sample.buffer, 0, 2); result = sample.set(src, 2); - assert.compareArray(sample, [1, 2, 1, 2], 'The value of sample is expected to be [1, 2, 1, 2]'); - assert.sameValue(result, undefined, 'The value of result is expected to equal undefined'); + 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/slice/BigInt/infinity.js b/test/built-ins/TypedArray/prototype/slice/BigInt/infinity.js index c006bd49f0..adad1dc0fa 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/infinity.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/infinity.js @@ -6,21 +6,24 @@ description: Infinity values on start and end includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([40n, 41n, 42n, 43n]); - assert.compareArray( - sample.slice(-Infinity), - [40n, 41n, 42n, 43n], - 'sample.slice(-Infinity) must return [40n, 41n, 42n, 43n]' + assert( + compareArray(sample.slice(-Infinity), [40n, 41n, 42n, 43n]), + "start == -Infinity" ); - - assert.compareArray(sample.slice(Infinity), [], 'sample.slice(Infinity) must return []'); - assert.compareArray(sample.slice(0, -Infinity), [], 'sample.slice(0, -Infinity) must return []'); - - assert.compareArray( - sample.slice(0, Infinity), - [40n, 41n, 42n, 43n], - 'sample.slice(0, Infinity) must return [40n, 41n, 42n, 43n]' + assert( + compareArray(sample.slice(Infinity), []), + "start == Infinity" + ); + assert( + compareArray(sample.slice(0, -Infinity), []), + "end == -Infinity" + ); + assert( + 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 4a9ec35f08..12245c6aae 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/minus-zero.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/minus-zero.js @@ -8,10 +8,24 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([40n, 41n, 42n, 43n]); - assert.compareArray(sample.slice(-0), [40n, 41n, 42n, 43n], 'sample.slice(-0) must return [40n, 41n, 42n, 43n]'); - assert.compareArray(sample.slice(-0, 4), [40n, 41n, 42n, 43n], 'sample.slice(-0, 4) must return [40n, 41n, 42n, 43n]'); - assert.compareArray(sample.slice(0, -0), [], 'sample.slice(0, -0) must return []'); - assert.compareArray(sample.slice(-0, -0), [], 'sample.slice(-0, -0) must return []'); + + assert( + compareArray(sample.slice(-0), [40n, 41n, 42n, 43n]), + "start == -0" + ); + assert( + compareArray(sample.slice(-0, 4), [40n, 41n, 42n, 43n]), + "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/results-with-different-length.js b/test/built-ins/TypedArray/prototype/slice/BigInt/results-with-different-length.js index 8820cd75b0..1db41d6012 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 @@ -6,39 +6,48 @@ 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([40n, 41n, 42n, 43n]); function testRes(result, expected, msg) { - assert.compareArray(result, expected, 'The value of result is expected to equal the value of expected'); + assert(compareArray(result, expected), msg + ", result: [" + result + "]"); } - 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), [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), [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), [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), [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), [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), [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), [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), [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(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), [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), [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), [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), [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), [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), [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), [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), [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/set-values-from-different-ctor-type.js b/test/built-ins/TypedArray/prototype/slice/BigInt/set-values-from-different-ctor-type.js index f77ab7ed6c..53ee40eba0 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 @@ -29,21 +29,19 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, Symbol.species, TypedArray] ---*/ + var arr = [42n, 43n, 44n]; testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA(arr); var other = TA === BigInt64Array ? BigUint64Array : BigInt64Array; + sample.constructor = {}; sample.constructor[Symbol.species] = other; + var result = sample.slice(); - assert.compareArray(result, arr, 'The value of result is expected to equal the value of arr'); - assert.notSameValue( - result.buffer, - sample.buffer, - 'The value of result.buffer is expected to not equal the value of `sample.buffer`' - ); - - assert.sameValue(result.constructor, other, 'The value of result.constructor is expected to equal the value of other'); + 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/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 c27a2a5583..bfd0fff4f3 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 @@ -35,17 +35,19 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, Symbol.species, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([40n]); var other = new BigInt64Array([1n, 0n, 1n]); var result; - sample.constructor = {}; + sample.constructor = {}; sample.constructor[Symbol.species] = function() { return other; }; result = sample.slice(0, 0); - assert.sameValue(result, other, 'The value of result is expected to equal the value of other'); - assert.compareArray(result, [1n, 0n, 1n], 'The value of result is expected to be [1n, 0n, 1n]'); + + assert.sameValue(result, other, "returned another typedarray"); + assert(compareArray(result, [1n, 0n, 1n]), "the returned object is preserved"); }); 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 3131cdc422..5965ce367a 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 @@ -35,18 +35,20 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, Symbol.species, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([40n, 41n, 42n]); var calls = 0; var result; - sample.constructor = {}; + sample.constructor = {}; sample.constructor[Symbol.species] = function(count) { calls++; return new TA(count); }; result = sample.slice(1); - assert.sameValue(calls, 1, 'The value of calls is expected to be 1'); - assert.compareArray(result, [41n, 42n], 'The value of result is expected to be [41n, 42n]'); + + assert.sameValue(calls, 1, "ctor called once"); + 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 96dd7ee33a..b43e92dc12 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-end.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-end.js @@ -13,6 +13,7 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + var obj = { valueOf: function() { return 2; @@ -21,28 +22,27 @@ var obj = { testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([40n, 41n, 42n, 43n]); - assert.compareArray(sample.slice(0, false), [], 'sample.slice(0, false) must return []'); - assert.compareArray(sample.slice(0, true), [40n], 'sample.slice(0, true) must return [40n]'); - assert.compareArray(sample.slice(0, NaN), [], 'sample.slice(0, NaN) must return []'); - assert.compareArray(sample.slice(0, null), [], 'sample.slice(0, null) must return []'); - assert.compareArray( - sample.slice(0, undefined), - [40n, 41n, 42n, 43n], - 'sample.slice(0, undefined) must return [40n, 41n, 42n, 43n]' - ); + assert(compareArray(sample.slice(0, false), []), "false"); + assert(compareArray(sample.slice(0, true), [40n]), "true"); - assert.compareArray(sample.slice(0, 0.6), [], 'sample.slice(0, 0.6) must return []'); - assert.compareArray(sample.slice(0, 1.1), [40n], 'sample.slice(0, 1.1) must return [40n]'); - assert.compareArray(sample.slice(0, 1.5), [40n], 'sample.slice(0, 1.5) must return [40n]'); - assert.compareArray(sample.slice(0, -0.6), [], 'sample.slice(0, -0.6) must return []'); - assert.compareArray(sample.slice(0, -1.1), [40n, 41n, 42n], 'sample.slice(0, -1.1) must return [40n, 41n, 42n]'); - assert.compareArray(sample.slice(0, -1.5), [40n, 41n, 42n], 'sample.slice(0, -1.5) must return [40n, 41n, 42n]'); - assert.compareArray(sample.slice(0, '3'), [40n, 41n, 42n], 'sample.slice(0, "3") must return [40n, 41n, 42n]'); + assert(compareArray(sample.slice(0, NaN), []), "NaN"); + assert(compareArray(sample.slice(0, null), []), "null"); + assert(compareArray(sample.slice(0, undefined), [40n, 41n, 42n, 43n]), "undefined"); - assert.compareArray( - sample.slice(0, obj), - [40n, 41n], - 'sample.slice(0, {valueOf: function() {return 2;}}) must return [40n, 41n]' + assert(compareArray(sample.slice(0, 0.6), []), "0.6"); + 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), [40n, 41n, 42n]), "-1.1"); + assert(compareArray(sample.slice(0, -1.5), [40n, 41n, 42n]), "-1.5"); + + assert(compareArray(sample.slice(0, "3"), [40n, 41n, 42n]), "string"); + assert( + compareArray( + sample.slice(0, obj), + [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 edc79ea96d..3b5bb606c9 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-start.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-start.js @@ -12,6 +12,7 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + var obj = { valueOf: function() { return 2; @@ -20,28 +21,28 @@ var obj = { testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([40n, 41n, 42n, 43n]); - assert.compareArray(sample.slice(false), [40n, 41n, 42n, 43n], 'sample.slice(false) must return [40n, 41n, 42n, 43n]'); - assert.compareArray(sample.slice(true), [41n, 42n, 43n], 'sample.slice(true) must return [41n, 42n, 43n]'); - assert.compareArray(sample.slice(NaN), [40n, 41n, 42n, 43n], 'sample.slice(NaN) must return [40n, 41n, 42n, 43n]'); - assert.compareArray(sample.slice(null), [40n, 41n, 42n, 43n], 'sample.slice(null) must return [40n, 41n, 42n, 43n]'); - assert.compareArray( - sample.slice(undefined), - [40n, 41n, 42n, 43n], - 'sample.slice(undefined) must return [40n, 41n, 42n, 43n]' - ); + assert(compareArray(sample.slice(false), [40n, 41n, 42n, 43n]), "false"); + assert(compareArray(sample.slice(true), [41n, 42n, 43n]), "true"); - assert.compareArray(sample.slice(1.1), [41n, 42n, 43n], 'sample.slice(1.1) must return [41n, 42n, 43n]'); - assert.compareArray(sample.slice(1.5), [41n, 42n, 43n], 'sample.slice(1.5) must return [41n, 42n, 43n]'); - assert.compareArray(sample.slice(0.6), [40n, 41n, 42n, 43n], 'sample.slice(0.6) must return [40n, 41n, 42n, 43n]'); - assert.compareArray(sample.slice(-1.5), [43n], 'sample.slice(-1.5) must return [43n]'); - assert.compareArray(sample.slice(-1.1), [43n], 'sample.slice(-1.1) must return [43n]'); - assert.compareArray(sample.slice(-0.6), [40n, 41n, 42n, 43n], 'sample.slice(-0.6) must return [40n, 41n, 42n, 43n]'); - assert.compareArray(sample.slice('3'), [43n], 'sample.slice("3") must return [43n]'); + 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(obj), - [42n, 43n], - 'sample.slice({valueOf: function() {return 2;}}) must return [42n, 43n]' + 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), [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"), [43n]), "string"); + assert( + compareArray( + sample.slice(obj), + [42n, 43n] + ), + "object" ); }); diff --git a/test/built-ins/TypedArray/prototype/slice/bit-precision.js b/test/built-ins/TypedArray/prototype/slice/bit-precision.js index a78c76c064..fb3074b0bf 100644 --- a/test/built-ins/TypedArray/prototype/slice/bit-precision.js +++ b/test/built-ins/TypedArray/prototype/slice/bit-precision.js @@ -33,7 +33,7 @@ function body(FloatArray) { subjectBytes = new Uint8Array(subject.buffer); slicedBytes = new Uint8Array(sliced.buffer); - assert.compareArray(subjectBytes, slicedBytes, 'The value of subjectBytes is expected to equal the value of slicedBytes'); + assert(compareArray(subjectBytes, slicedBytes)); } testWithTypedArrayConstructors(body, [Float32Array, Float64Array]); diff --git a/test/built-ins/TypedArray/prototype/slice/infinity.js b/test/built-ins/TypedArray/prototype/slice/infinity.js index 2cbe2b2bb4..a93cd713a7 100644 --- a/test/built-ins/TypedArray/prototype/slice/infinity.js +++ b/test/built-ins/TypedArray/prototype/slice/infinity.js @@ -10,20 +10,20 @@ features: [TypedArray] testWithTypedArrayConstructors(function(TA) { var sample = new TA([40, 41, 42, 43]); - assert.compareArray( - sample.slice(-Infinity), [40, 41, 42, 43], - 'sample.slice(-Infinity) must return [40, 41, 42, 43]' + assert( + compareArray(sample.slice(-Infinity), [40, 41, 42, 43]), + "start == -Infinity" ); - assert.compareArray( - sample.slice(Infinity), [], - 'sample.slice(Infinity) must return []' + assert( + compareArray(sample.slice(Infinity), []), + "start == Infinity" ); - assert.compareArray( - sample.slice(0, -Infinity), [], - 'sample.slice(0, -Infinity) must return []' + assert( + compareArray(sample.slice(0, -Infinity), []), + "end == -Infinity" ); - assert.compareArray( - sample.slice(0, Infinity), [40, 41, 42, 43], - 'sample.slice(0, Infinity) must return [40, 41, 42, 43]' + assert( + 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 ad176edd1c..c597dadec9 100644 --- a/test/built-ins/TypedArray/prototype/slice/minus-zero.js +++ b/test/built-ins/TypedArray/prototype/slice/minus-zero.js @@ -12,20 +12,20 @@ features: [TypedArray] testWithTypedArrayConstructors(function(TA) { var sample = new TA([40, 41, 42, 43]); - assert.compareArray( - sample.slice(-0), [40, 41, 42, 43], - 'sample.slice(-0) must return [40, 41, 42, 43]' + assert( + compareArray(sample.slice(-0), [40, 41, 42, 43]), + "start == -0" ); - assert.compareArray( - sample.slice(-0, 4), [40, 41, 42, 43], - 'sample.slice(-0, 4) must return [40, 41, 42, 43]' + assert( + compareArray(sample.slice(-0, 4), [40, 41, 42, 43]), + "start == -0, end == length" ); - assert.compareArray( - sample.slice(0, -0), [], - 'sample.slice(0, -0) must return []' + assert( + compareArray(sample.slice(0, -0), []), + "start == 0, end == -0" ); - assert.compareArray( - sample.slice(-0, -0), [], - 'sample.slice(-0, -0) must return []' + assert( + compareArray(sample.slice(-0, -0), []), + "start == -0, end == -0" ); }); 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 590b54cb87..34a4ad11b3 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 @@ -11,7 +11,7 @@ testWithTypedArrayConstructors(function(TA) { var sample = new TA([40, 41, 42, 43]); function testRes(result, expected, msg) { - assert.compareArray(result, expected, 'The value of result is expected to equal the value of expected'); + assert(compareArray(result, expected), msg + ", result: [" + result + "]"); } testRes(sample.slice(1), [41, 42, 43], "begin == 1"); 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 241105d13d..cb19d311d2 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 @@ -41,7 +41,7 @@ testWithTypedArrayConstructors(function(TA) { var result = sample.slice(); - assert.compareArray(result, arr, 'The value of result is expected to equal the value of arr'); - assert.notSameValue(result.buffer, sample.buffer, 'The value of result.buffer is expected to not equal the value of `sample.buffer`'); - assert.sameValue(result.constructor, other, 'The value of result.constructor is expected to equal the value of other'); + 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-species-custom-ctor-returns-another-instance.js b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor-returns-another-instance.js index 8783a4450c..7bb19f5df4 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 @@ -48,6 +48,6 @@ testWithTypedArrayConstructors(function(TA) { result = sample.slice(0, 0); - assert.sameValue(result, other, 'The value of result is expected to equal the value of other'); - assert.compareArray(result, [1, 0, 1], 'The value of result is expected to be [1, 0, 1]'); + 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/speciesctor-get-species-custom-ctor.js b/test/built-ins/TypedArray/prototype/slice/speciesctor-get-species-custom-ctor.js index 29baffabd9..0477a0fd43 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 @@ -49,6 +49,6 @@ testWithTypedArrayConstructors(function(TA) { result = sample.slice(1); - assert.sameValue(calls, 1, 'The value of calls is expected to be 1'); - assert.compareArray(result, [41, 42], 'The value of result is expected to be [41, 42]'); + assert.sameValue(calls, 1, "ctor called once"); + 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 146e14df18..2a9be94068 100644 --- a/test/built-ins/TypedArray/prototype/slice/tointeger-end.js +++ b/test/built-ins/TypedArray/prototype/slice/tointeger-end.js @@ -23,20 +23,26 @@ var obj = { testWithTypedArrayConstructors(function(TA) { var sample = new TA([40, 41, 42, 43]); - assert.compareArray(sample.slice(0, false), [], 'sample.slice(0, false) must return []'); - assert.compareArray(sample.slice(0, true), [40], 'sample.slice(0, true) must return [40]'); + assert(compareArray(sample.slice(0, false), []), "false"); + assert(compareArray(sample.slice(0, true), [40]), "true"); - assert.compareArray(sample.slice(0, NaN), [], 'sample.slice(0, NaN) must return []'); - assert.compareArray(sample.slice(0, null), [], 'sample.slice(0, null) must return []'); - assert.compareArray(sample.slice(0, undefined), [40, 41, 42, 43], 'sample.slice(0, undefined) must return [40, 41, 42, 43]'); + 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, 0.6), [], 'sample.slice(0, 0.6) must return []'); - assert.compareArray(sample.slice(0, 1.1), [40], 'sample.slice(0, 1.1) must return [40]'); - assert.compareArray(sample.slice(0, 1.5), [40], 'sample.slice(0, 1.5) must return [40]'); - assert.compareArray(sample.slice(0, -0.6), [], 'sample.slice(0, -0.6) must return []'); - assert.compareArray(sample.slice(0, -1.1), [40, 41, 42], 'sample.slice(0, -1.1) must return [40, 41, 42]'); - assert.compareArray(sample.slice(0, -1.5), [40, 41, 42], 'sample.slice(0, -1.5) must return [40, 41, 42]'); + 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, -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, "3"), [40, 41, 42], 'sample.slice(0, 3) must return [40, 41, 42]'); - assert.compareArray(sample.slice(0, obj), [40, 41], 'sample.slice(0, {valueOf: function() {return 2;}}) must return [40, 41]'); + assert(compareArray(sample.slice(0, "3"), [40, 41, 42]), "string"); + assert( + compareArray( + sample.slice(0, obj), + [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 a65ba1d531..f67ee090c0 100644 --- a/test/built-ins/TypedArray/prototype/slice/tointeger-start.js +++ b/test/built-ins/TypedArray/prototype/slice/tointeger-start.js @@ -22,21 +22,27 @@ var obj = { testWithTypedArrayConstructors(function(TA) { var sample = new TA([40, 41, 42, 43]); - assert.compareArray(sample.slice(false), [40, 41, 42, 43], 'sample.slice(false) must return [40, 41, 42, 43]'); - assert.compareArray(sample.slice(true), [41, 42, 43], 'sample.slice(true) must return [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(NaN), [40, 41, 42, 43], 'sample.slice(NaN) must return [40, 41, 42, 43]'); - assert.compareArray(sample.slice(null), [40, 41, 42, 43], 'sample.slice(null) must return [40, 41, 42, 43]'); - assert.compareArray(sample.slice(undefined), [40, 41, 42, 43], 'sample.slice(undefined) must return [40, 41, 42, 43]'); + 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), [41, 42, 43], 'sample.slice(1.1) must return [41, 42, 43]'); - assert.compareArray(sample.slice(1.5), [41, 42, 43], 'sample.slice(1.5) must return [41, 42, 43]'); - assert.compareArray(sample.slice(0.6), [40, 41, 42, 43], 'sample.slice(0.6) must return [40, 41, 42, 43]'); + 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), [43], 'sample.slice(-1.5) must return [43]'); - assert.compareArray(sample.slice(-1.1), [43], 'sample.slice(-1.1) must return [43]'); - assert.compareArray(sample.slice(-0.6), [40, 41, 42, 43], 'sample.slice(-0.6) must return [40, 41, 42, 43]'); + 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"), [43], 'sample.slice("3") must return [43]'); - assert.compareArray(sample.slice(obj), [42, 43], 'sample.slice({valueOf: function() {return 2;}}) must return [42, 43]'); + assert(compareArray(sample.slice("3"), [43]), "string"); + assert( + compareArray( + sample.slice(obj), + [42, 43] + ), + "object" + ); }); 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 5eb0c8edb2..8a3d5a7f8b 100644 --- a/test/built-ins/TypedArray/prototype/sort/BigInt/arraylength-internal.js +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/arraylength-internal.js @@ -11,8 +11,8 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ -var getCalls = 0; +var getCalls = 0; var desc = { get: function getLen() { getCalls++; @@ -20,14 +20,20 @@ var desc = { } }; -Object.defineProperty(TypedArray.prototype, 'length', desc); +Object.defineProperty(TypedArray.prototype, "length", desc); testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([42n, 42n, 42n]); getCalls = 0; - Object.defineProperty(TA.prototype, 'length', desc); - Object.defineProperty(sample, 'length', desc); + + Object.defineProperty(TA.prototype, "length", desc); + Object.defineProperty(sample, "length", desc); + var result = sample.sort(); - assert.sameValue(getCalls, 0, 'The value of getCalls is expected to be 0'); - assert.compareArray(result, sample, 'The value of result is expected to equal the value of sample'); + + 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/sortcompare-with-no-tostring.js b/test/built-ins/TypedArray/prototype/sort/BigInt/sortcompare-with-no-tostring.js index abe1d3ffa1..f588b36bcc 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 @@ -17,15 +17,15 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ -var toStringCalled = false; +var toStringCalled = false; BigInt.prototype.toString = function() { toStringCalled = true; -}; +} testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([20n, 100n, 3n]); var result = sample.sort(); - assert.sameValue(toStringCalled, false, 'The value of toStringCalled is expected to be false'); - assert.compareArray(result, [3n, 20n, 100n], 'The value of result is expected to be [3n, 20n, 100n]'); + assert.sameValue(toStringCalled, false, "BigInt.prototype.toString will not be called"); + 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 eab089edec..79b7e54691 100644 --- a/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js @@ -13,25 +13,19 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample; - sample = new TA([4n, 3n, 2n, 1n]).sort(); - assert.compareArray(sample, [1n, 2n, 3n, 4n], 'The value of sample is expected to be [1n, 2n, 3n, 4n]'); - sample = new TA([3n, 4n, 1n, 2n]).sort(); - assert.compareArray(sample, [1n, 2n, 3n, 4n], 'The value of sample is expected to be [1n, 2n, 3n, 4n]'); - sample = new TA([3n, 4n, 3n, 1n, 0n, 1n, 2n]).sort(); - assert.compareArray( - sample, - [0n, 1n, 1n, 2n, 3n, 3n, 4n], - 'The value of sample is expected to be [0n, 1n, 1n, 2n, 3n, 3n, 4n]' - ); + sample = new TA([4n, 3n, 2n, 1n]).sort(); + assert(compareArray(sample, [1n, 2n, 3n, 4n]), "descending values"); + + sample = new TA([3n, 4n, 1n, 2n]).sort(); + assert(compareArray(sample, [1n, 2n, 3n, 4n]), "mixed numbers"); + + sample = new TA([3n, 4n, 3n, 1n, 0n, 1n, 2n]).sort(); + assert(compareArray(sample, [0n, 1n, 1n, 2n, 3n, 3n, 4n]), "repeating numbers"); }); var sample = new BigInt64Array([-4n, 3n, 4n, -3n, 2n, -2n, 1n, 0n]).sort(); - -assert.compareArray( - sample, - [-4n, -3n, -2n, 0n, 1n, 2n, 3n, 4n], - 'The value of sample is expected to be [-4n, -3n, -2n, 0n, 1n, 2n, 3n, 4n]' -); +assert(compareArray(sample, [-4n, -3n, -2n, 0n, 1n, 2n, 3n, 4n]), "negative values"); diff --git a/test/built-ins/TypedArray/prototype/sort/arraylength-internal.js b/test/built-ins/TypedArray/prototype/sort/arraylength-internal.js index 25b9f44f04..543c4eaa6f 100644 --- a/test/built-ins/TypedArray/prototype/sort/arraylength-internal.js +++ b/test/built-ins/TypedArray/prototype/sort/arraylength-internal.js @@ -31,6 +31,9 @@ testWithTypedArrayConstructors(function(TA) { var result = sample.sort(); - assert.sameValue(getCalls, 0, 'The value of getCalls is expected to be 0'); - assert.compareArray(result, sample, 'The value of result is expected to equal the value of sample'); + 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/sortcompare-with-no-tostring.js b/test/built-ins/TypedArray/prototype/sort/sortcompare-with-no-tostring.js index cb8445cd0a..591c9087b0 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 @@ -26,6 +26,6 @@ Number.prototype.toString = function() { testWithTypedArrayConstructors(function(TA) { var sample = new TA([20, 100, 3]); var result = sample.sort(); - assert.sameValue(toStringCalled, false, 'The value of toStringCalled is expected to be false'); - assert.compareArray(result, [3, 20, 100], 'The value of result is expected to be [3, 20, 100]'); + assert.sameValue(toStringCalled, false, "Number.prototype.toString will not be called"); + assert(compareArray(result, [3, 20, 100]), "Default sorting by value"); }); diff --git a/test/built-ins/TypedArray/prototype/sort/sorted-values.js b/test/built-ins/TypedArray/prototype/sort/sorted-values.js index 12d67a7e87..5693c6d577 100644 --- a/test/built-ins/TypedArray/prototype/sort/sorted-values.js +++ b/test/built-ins/TypedArray/prototype/sort/sorted-values.js @@ -18,40 +18,40 @@ testWithTypedArrayConstructors(function(TA) { var sample; sample = new TA([4, 3, 2, 1]).sort(); - assert.compareArray(sample, [1, 2, 3, 4], 'The value of sample is expected to be [1, 2, 3, 4]'); + assert(compareArray(sample, [1, 2, 3, 4]), "descending values"); sample = new TA([3, 4, 1, 2]).sort(); - assert.compareArray(sample, [1, 2, 3, 4], 'The value of sample is expected to be [1, 2, 3, 4]'); + assert(compareArray(sample, [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], 'The value of sample is expected to be [0, 1, 1, 2, 3, 3, 4]'); + assert(compareArray(sample, [0, 1, 1, 2, 3, 3, 4]), "repeating numbers"); }); testWithTypedArrayConstructors(function(TA) { var sample = new TA([1, 0, -0, 2]).sort(); - assert.compareArray(sample, [-0, 0, 1, 2], 'The value of sample is expected to be [-0, 0, 1, 2]'); + assert(compareArray(sample, [-0, 0, 1, 2]), "0s"); }, floatArrayConstructors); testWithTypedArrayConstructors(function(TA) { var sample = new TA([1, 0, -0, 2]).sort(); - assert.compareArray(sample, [0, 0, 1, 2], 'The value of sample is expected to be [0, 0, 1, 2]'); + assert(compareArray(sample, [0, 0, 1, 2]), "0s"); }, intArrayConstructors); testWithTypedArrayConstructors(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], 'The value of sample is expected to be [-4, -3, -2, 0, 1, 2, 3, 4]'); + assert(compareArray(sample, [-4, -3, -2, 0, 1, 2, 3, 4]), "negative values"); }, [Float64Array, Float32Array, Int8Array, Int16Array, Int32Array]); testWithTypedArrayConstructors(function(TA) { var sample; sample = new TA([0.5, 0, 1.5, 1]).sort(); - assert.compareArray(sample, [0, 0.5, 1, 1.5], 'The value of sample is expected to be [0, 0.5, 1, 1.5]'); + 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], 'The value of sample is expected to be [-1.5, -1, -0.5, 0, 0.5, 1, 1.5]'); + assert(compareArray(sample, [-1.5, -1, -0.5, 0, 0.5, 1, 1.5]), "non integers + negatives"); sample = new TA([3, 4, Infinity, -Infinity, 1, 2]).sort(); - assert.compareArray(sample, [-Infinity, 1, 2, 3, 4, Infinity], 'The value of sample is expected to be [-Infinity, 1, 2, 3, 4, Infinity]'); + assert(compareArray(sample, [-Infinity, 1, 2, 3, 4, Infinity]), "infinities"); }, [Float64Array, Float32Array]); diff --git a/test/built-ins/TypedArray/prototype/sort/stability.js b/test/built-ins/TypedArray/prototype/sort/stability.js index 8e930f925a..3bdd6fc6ed 100644 --- a/test/built-ins/TypedArray/prototype/sort/stability.js +++ b/test/built-ins/TypedArray/prototype/sort/stability.js @@ -17,17 +17,16 @@ testWithTypedArrayConstructors((TA) => { const array = Array.from({ length: 128 }, (_, i) => i); const typedArray1 = new TA(array); - assert.compareArray( + assert(compareArray( typedArray1.sort(compare), - array, - 'typedArray1.sort((a, b) => (a / 4 | 0) - (b / 4 | 0)) returns array' - ); + array + ), 'pre-sorted'); // Reverse `array` in-place so it becomes `[127, 126, …, 1, 0]`. array.reverse(); const typedArray2 = new TA(array); - assert.compareArray( + assert(compareArray( typedArray2.sort(compare), [ 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, @@ -41,7 +40,6 @@ testWithTypedArrayConstructors((TA) => { 99, 98, 97, 96, 103, 102, 101, 100, 107, 106, 105, 104, 111, 110, 109, 108, 115, 114, 113, 112, 119, 118, 117, 116, 123, 122, 121, 120, 127, 126, 125, 124, - ], - 'typedArray2.sort((a, b) => (a / 4 | 0) - (b / 4 | 0)) must return [\n 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8,\n 15, 14, 13, 12, 19, 18, 17, 16, 23, 22, 21, 20,\n 27, 26, 25, 24, 31, 30, 29, 28, 35, 34, 33, 32,\n 39, 38, 37, 36, 43, 42, 41, 40, 47, 46, 45, 44,\n 51, 50, 49, 48, 55, 54, 53, 52, 59, 58, 57, 56,\n 63, 62, 61, 60, 67, 66, 65, 64, 71, 70, 69, 68,\n 75, 74, 73, 72, 79, 78, 77, 76, 83, 82, 81, 80,\n 87, 86, 85, 84, 91, 90, 89, 88, 95, 94, 93, 92,\n 99, 98, 97, 96, 103, 102, 101, 100, 107, 106, 105, 104,\n 111, 110, 109, 108, 115, 114, 113, 112, 119, 118, 117, 116,\n 123, 122, 121, 120, 127, 126, 125, 124,\n]' - ); + ] + ), 'not presorted'); }); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/infinity.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/infinity.js index e24a388519..fc6786978f 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/infinity.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/infinity.js @@ -8,21 +8,24 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([40n, 41n, 42n, 43n]); - assert.compareArray( - sample.subarray(-Infinity), - [40n, 41n, 42n, 43n], - 'sample.subarray(-Infinity) must return [40n, 41n, 42n, 43n]' + assert( + compareArray(sample.subarray(-Infinity), [40n, 41n, 42n, 43n]), + "begin == -Infinity" ); - - assert.compareArray(sample.subarray(Infinity), [], 'sample.subarray(Infinity) must return []'); - assert.compareArray(sample.subarray(0, -Infinity), [], 'sample.subarray(0, -Infinity) must return []'); - - assert.compareArray( - sample.subarray(0, Infinity), - [40n, 41n, 42n, 43n], - 'sample.subarray(0, Infinity) must return [40n, 41n, 42n, 43n]' + assert( + compareArray(sample.subarray(Infinity), []), + "being == Infinity" + ); + assert( + compareArray(sample.subarray(0, -Infinity), []), + "end == -Infinity" + ); + assert( + 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 c1d0d08a84..b71e445c7f 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/minus-zero.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/minus-zero.js @@ -8,16 +8,24 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([40n, 41n, 42n, 43n]); - assert.compareArray(sample.subarray(-0), [40n, 41n, 42n, 43n], 'sample.subarray(-0) must return [40n, 41n, 42n, 43n]'); - assert.compareArray( - sample.subarray(-0, 4), - [40n, 41n, 42n, 43n], - 'sample.subarray(-0, 4) must return [40n, 41n, 42n, 43n]' + assert( + compareArray(sample.subarray(-0), [40n, 41n, 42n, 43n]), + "begin == -0" + ); + assert( + compareArray(sample.subarray(-0, 4), [40n, 41n, 42n, 43n]), + "being == -0, end == length" + ); + assert( + compareArray(sample.subarray(0, -0), []), + "being == 0, end == -0" + ); + assert( + compareArray(sample.subarray(-0, -0), []), + "being == -0, end == -0" ); - - assert.compareArray(sample.subarray(0, -0), [], 'sample.subarray(0, -0) must return []'); - assert.compareArray(sample.subarray(-0, -0), [], 'sample.subarray(-0, -0) must return []'); }); 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 c9a156ec4e..0d0362394a 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 @@ -11,6 +11,7 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([40n, 41n, 42n, 43n]); var result = sample.subarray(1); @@ -18,15 +19,13 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue( Object.getPrototypeOf(result), Object.getPrototypeOf(sample), - 'Object.getPrototypeOf(sample.subarray(1)) must return the same value returned by Object.getPrototypeOf(sample)' + "prototype" ); + assert.sameValue(result.constructor, sample.constructor, "constructor"); + assert(result instanceof TA, "instanceof"); - assert.sameValue( - result.constructor, - sample.constructor, - 'The value of result.constructor is expected to equal the value of sample.constructor' + assert( + compareArray(sample, [40n, 41n, 42n, 43n]), + "original sample remains the same" ); - - assert(result instanceof TA, 'The result of evaluating (result instanceof TA) is expected to be true'); - assert.compareArray(sample, [40n, 41n, 42n, 43n], 'The value of sample is expected to be [40n, 41n, 42n, 43n]'); }); 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 843ad38558..ee1198833f 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 @@ -11,21 +11,25 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([40n, 41n, 42n, 43n]); var buffer = sample.buffer; var result = sample.subarray(1); - assert.notSameValue(result, sample, 'The value of result is expected to not equal the value of `sample`'); - assert.sameValue( - result.buffer, - sample.buffer, - 'The value of result.buffer is expected to equal the value of sample.buffer' + 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] = 100n; + assert( + compareArray(result, [100n, 42n, 43n]), + "changes on the original sample values affect the new instance" ); - assert.sameValue(sample.buffer, buffer, 'The value of sample.buffer is expected to equal the value of buffer'); - sample[1] = 100n; - assert.compareArray(result, [100n, 42n, 43n], 'The value of result is expected to be [100n, 42n, 43n]'); result[1] = 111n; - assert.compareArray(sample, [40n, 100n, 111n, 43n], 'The value of sample is expected to be [40n, 100n, 111n, 43n]'); + assert( + 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 2e0e750dfa..ff07874698 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 @@ -11,39 +11,48 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([40n, 41n, 42n, 43n]); function testRes(result, expected, msg) { - assert.compareArray(result, expected, 'The value of result is expected to equal the value of expected'); + assert(compareArray(result, expected), msg + ", result: [" + result + "]"); } - 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), [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), [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), [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), [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), [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), [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), [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), [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(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), [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), [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), [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), [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), [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), [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), [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), [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/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 ddafb33122..0aa28e822a 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 @@ -34,17 +34,19 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, Symbol.species, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([40n]); var other = new BigInt64Array([1n, 0n, 1n]); var result; - sample.constructor = {}; + sample.constructor = {}; sample.constructor[Symbol.species] = function() { return other; }; result = sample.subarray(0, 0); - assert.sameValue(result, other, 'The value of result is expected to equal the value of other'); - assert.compareArray(result, [1n, 0n, 1n], 'The value of result is expected to be [1n, 0n, 1n]'); + + assert.sameValue(result, other, "returned another typedarray"); + assert(compareArray(result, [1n, 0n, 1n]), "the returned object is preserved"); }); 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 288af9a5e6..01b0dbd9b4 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 @@ -34,18 +34,20 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, Symbol.species, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([40n, 41n, 42n]); var calls = 0; var result; - sample.constructor = {}; + 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, 'The value of calls is expected to be 1'); - assert.compareArray(result, [41n, 42n], 'The value of result is expected to be [41n, 42n]'); + + assert.sameValue(calls, 1, "ctor called once"); + 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 02ec829b95..3d9ff3c0f1 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-begin.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-begin.js @@ -12,6 +12,7 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + var obj = { valueOf: function() { return 2; @@ -21,44 +22,27 @@ var obj = { testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([40n, 41n, 42n, 43n]); - assert.compareArray( - sample.subarray(false), - [40n, 41n, 42n, 43n], - 'sample.subarray(false) must return [40n, 41n, 42n, 43n]' - ); + assert(compareArray(sample.subarray(false), [40n, 41n, 42n, 43n]), "false"); + assert(compareArray(sample.subarray(true), [41n, 42n, 43n]), "true"); - assert.compareArray(sample.subarray(true), [41n, 42n, 43n], 'sample.subarray(true) must return [41n, 42n, 43n]'); - assert.compareArray(sample.subarray(NaN), [40n, 41n, 42n, 43n], 'sample.subarray(NaN) must return [40n, 41n, 42n, 43n]'); + 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(null), - [40n, 41n, 42n, 43n], - 'sample.subarray(null) must return [40n, 41n, 42n, 43n]' - ); + 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(undefined), - [40n, 41n, 42n, 43n], - 'sample.subarray(undefined) must return [40n, 41n, 42n, 43n]' - ); + 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(1.1), [41n, 42n, 43n], 'sample.subarray(1.1) must return [41n, 42n, 43n]'); - assert.compareArray(sample.subarray(1.5), [41n, 42n, 43n], 'sample.subarray(1.5) must return [41n, 42n, 43n]'); - assert.compareArray(sample.subarray(0.6), [40n, 41n, 42n, 43n], 'sample.subarray(0.6) must return [40n, 41n, 42n, 43n]'); - assert.compareArray(sample.subarray(-1.5), [43n], 'sample.subarray(-1.5) must return [43n]'); - assert.compareArray(sample.subarray(-1.1), [43n], 'sample.subarray(-1.1) must return [43n]'); - - assert.compareArray( - sample.subarray(-0.6), - [40n, 41n, 42n, 43n], - 'sample.subarray(-0.6) must return [40n, 41n, 42n, 43n]' - ); - - assert.compareArray(sample.subarray('3'), [43n], 'sample.subarray("3") must return [43n]'); - - assert.compareArray( - sample.subarray(obj), - [42n, 43n], - 'sample.subarray({valueOf: function() {return 2;}}) must return [42n, 43n]' + assert(compareArray(sample.subarray("3"), [43n]), "string"); + assert( + compareArray( + sample.subarray(obj), + [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 f1deb8cf17..8885220a3f 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-end.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-end.js @@ -13,6 +13,7 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ + var obj = { valueOf: function() { return 2; @@ -21,28 +22,27 @@ var obj = { testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([40n, 41n, 42n, 43n]); - assert.compareArray(sample.subarray(0, false), [], 'sample.subarray(0, false) must return []'); - assert.compareArray(sample.subarray(0, true), [40n], 'sample.subarray(0, true) must return [40n]'); - assert.compareArray(sample.subarray(0, NaN), [], 'sample.subarray(0, NaN) must return []'); - assert.compareArray(sample.subarray(0, null), [], 'sample.subarray(0, null) must return []'); - assert.compareArray( - sample.subarray(0, undefined), - [40n, 41n, 42n, 43n], - 'sample.subarray(0, undefined) must return [40n, 41n, 42n, 43n]' - ); + assert(compareArray(sample.subarray(0, false), []), "false"); + assert(compareArray(sample.subarray(0, true), [40n]), "true"); - assert.compareArray(sample.subarray(0, 0.6), [], 'sample.subarray(0, 0.6) must return []'); - assert.compareArray(sample.subarray(0, 1.1), [40n], 'sample.subarray(0, 1.1) must return [40n]'); - assert.compareArray(sample.subarray(0, 1.5), [40n], 'sample.subarray(0, 1.5) must return [40n]'); - assert.compareArray(sample.subarray(0, -0.6), [], 'sample.subarray(0, -0.6) must return []'); - assert.compareArray(sample.subarray(0, -1.1), [40n, 41n, 42n], 'sample.subarray(0, -1.1) must return [40n, 41n, 42n]'); - assert.compareArray(sample.subarray(0, -1.5), [40n, 41n, 42n], 'sample.subarray(0, -1.5) must return [40n, 41n, 42n]'); - assert.compareArray(sample.subarray(0, '3'), [40n, 41n, 42n], 'sample.subarray(0, "3") must return [40n, 41n, 42n]'); + assert(compareArray(sample.subarray(0, NaN), []), "NaN"); + assert(compareArray(sample.subarray(0, null), []), "null"); + assert(compareArray(sample.subarray(0, undefined), [40n, 41n, 42n, 43n]), "undefined"); - assert.compareArray( - sample.subarray(0, obj), - [40n, 41n], - 'sample.subarray(0, {valueOf: function() {return 2;}}) must return [40n, 41n]' + assert(compareArray(sample.subarray(0, 0.6), []), "0.6"); + 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), [40n, 41n, 42n]), "-1.1"); + assert(compareArray(sample.subarray(0, -1.5), [40n, 41n, 42n]), "-1.5"); + + assert(compareArray(sample.subarray(0, "3"), [40n, 41n, 42n]), "string"); + assert( + compareArray( + sample.subarray(0, obj), + [40n, 41n] + ), + "object" ); }); diff --git a/test/built-ins/TypedArray/prototype/subarray/infinity.js b/test/built-ins/TypedArray/prototype/subarray/infinity.js index 6c4a2d9b10..8a27464925 100644 --- a/test/built-ins/TypedArray/prototype/subarray/infinity.js +++ b/test/built-ins/TypedArray/prototype/subarray/infinity.js @@ -12,20 +12,20 @@ features: [TypedArray] testWithTypedArrayConstructors(function(TA) { var sample = new TA([40, 41, 42, 43]); - assert.compareArray( - sample.subarray(-Infinity), [40, 41, 42, 43], - 'sample.subarray(-Infinity) must return [40, 41, 42, 43]' + assert( + compareArray(sample.subarray(-Infinity), [40, 41, 42, 43]), + "begin == -Infinity" ); - assert.compareArray( - sample.subarray(Infinity), [], - 'sample.subarray(Infinity) must return []' + assert( + compareArray(sample.subarray(Infinity), []), + "being == Infinity" ); - assert.compareArray( - sample.subarray(0, -Infinity), [], - 'sample.subarray(0, -Infinity) must return []' + assert( + compareArray(sample.subarray(0, -Infinity), []), + "end == -Infinity" ); - assert.compareArray( - sample.subarray(0, Infinity), [40, 41, 42, 43], - 'sample.subarray(0, Infinity) must return [40, 41, 42, 43]' + assert( + 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 b70f27cc6f..de714ad469 100644 --- a/test/built-ins/TypedArray/prototype/subarray/minus-zero.js +++ b/test/built-ins/TypedArray/prototype/subarray/minus-zero.js @@ -12,20 +12,20 @@ features: [TypedArray] testWithTypedArrayConstructors(function(TA) { var sample = new TA([40, 41, 42, 43]); - assert.compareArray( - sample.subarray(-0), [40, 41, 42, 43], - 'sample.subarray(-0) must return [40, 41, 42, 43]' + assert( + compareArray(sample.subarray(-0), [40, 41, 42, 43]), + "begin == -0" ); - assert.compareArray( - sample.subarray(-0, 4), [40, 41, 42, 43], - 'sample.subarray(-0, 4) must return [40, 41, 42, 43]' + assert( + compareArray(sample.subarray(-0, 4), [40, 41, 42, 43]), + "being == -0, end == length" ); - assert.compareArray( - sample.subarray(0, -0), [], - 'sample.subarray(0, -0) must return []' + assert( + compareArray(sample.subarray(0, -0), []), + "being == 0, end == -0" ); - assert.compareArray( - sample.subarray(-0, -0), [], - 'sample.subarray(-0, -0) must return []' + assert( + compareArray(sample.subarray(-0, -0), []), + "being == -0, end == -0" ); }); 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 eafb28555f..a507518bb7 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 @@ -19,13 +19,13 @@ testWithTypedArrayConstructors(function(TA) { assert.sameValue( Object.getPrototypeOf(result), Object.getPrototypeOf(sample), - 'Object.getPrototypeOf(sample.subarray(1)) must return the same value returned by Object.getPrototypeOf(sample)' + "prototype" ); - assert.sameValue(result.constructor, sample.constructor, 'The value of result.constructor is expected to equal the value of sample.constructor'); - assert(result instanceof TA, 'The result of evaluating (result instanceof TA) is expected to be true'); + assert.sameValue(result.constructor, sample.constructor, "constructor"); + assert(result instanceof TA, "instanceof"); - assert.compareArray( - sample, [40, 41, 42, 43], - 'The value of sample is expected to be [40, 41, 42, 43]' + assert( + 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 c42880d895..ff3925eb63 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 @@ -17,19 +17,19 @@ testWithTypedArrayConstructors(function(TA) { var buffer = sample.buffer; var result = sample.subarray(1); - assert.notSameValue(result, sample, 'The value of result is expected to not equal the value of `sample`'); - assert.sameValue(result.buffer, sample.buffer, 'The value of result.buffer is expected to equal the value of sample.buffer'); - assert.sameValue(sample.buffer, buffer, 'The value of sample.buffer is expected to equal the value of buffer'); + 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] = 100; - assert.compareArray( - result, [100, 42, 43], - 'The value of result is expected to be [100, 42, 43]' + assert( + compareArray(result, [100, 42, 43]), + "changes on the original sample values affect the new instance" ); result[1] = 111; - assert.compareArray( - sample, [40, 100, 111, 43], - 'The value of sample is expected to be [40, 100, 111, 43]' + assert( + 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 26c1a4b318..c206e2462b 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 @@ -16,7 +16,7 @@ testWithTypedArrayConstructors(function(TA) { var sample = new TA([40, 41, 42, 43]); function testRes(result, expected, msg) { - assert.compareArray(result, expected, 'The value of result is expected to equal the value of expected'); + assert(compareArray(result, expected), msg + ", result: [" + result + "]"); } testRes(sample.subarray(1), [41, 42, 43], "begin == 1"); 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 69100186ee..3ed6ba00a8 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 @@ -47,6 +47,6 @@ testWithTypedArrayConstructors(function(TA) { result = sample.subarray(0, 0); - assert.sameValue(result, other, 'The value of result is expected to equal the value of other'); - assert.compareArray(result, [1, 0, 1], 'The value of result is expected to be [1, 0, 1]'); + 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/speciesctor-get-species-custom-ctor.js b/test/built-ins/TypedArray/prototype/subarray/speciesctor-get-species-custom-ctor.js index 8b4c8aa528..5dbc2cc361 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 @@ -48,6 +48,6 @@ testWithTypedArrayConstructors(function(TA) { result = sample.subarray(1); - assert.sameValue(calls, 1, 'The value of calls is expected to be 1'); - assert.compareArray(result, [41, 42], 'The value of result is expected to be [41, 42]'); + assert.sameValue(calls, 1, "ctor called once"); + 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 27a9e96e76..abf503cb8f 100644 --- a/test/built-ins/TypedArray/prototype/subarray/tointeger-begin.js +++ b/test/built-ins/TypedArray/prototype/subarray/tointeger-begin.js @@ -22,21 +22,27 @@ var obj = { testWithTypedArrayConstructors(function(TA) { var sample = new TA([40, 41, 42, 43]); - assert.compareArray(sample.subarray(false), [40, 41, 42, 43], 'sample.subarray(false) must return [40, 41, 42, 43]'); - assert.compareArray(sample.subarray(true), [41, 42, 43], 'sample.subarray(true) must return [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(NaN), [40, 41, 42, 43], 'sample.subarray(NaN) must return [40, 41, 42, 43]'); - assert.compareArray(sample.subarray(null), [40, 41, 42, 43], 'sample.subarray(null) must return [40, 41, 42, 43]'); - assert.compareArray(sample.subarray(undefined), [40, 41, 42, 43], 'sample.subarray(undefined) must return [40, 41, 42, 43]'); + 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), [41, 42, 43], 'sample.subarray(1.1) must return [41, 42, 43]'); - assert.compareArray(sample.subarray(1.5), [41, 42, 43], 'sample.subarray(1.5) must return [41, 42, 43]'); - assert.compareArray(sample.subarray(0.6), [40, 41, 42, 43], 'sample.subarray(0.6) must return [40, 41, 42, 43]'); + 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), [43], 'sample.subarray(-1.5) must return [43]'); - assert.compareArray(sample.subarray(-1.1), [43], 'sample.subarray(-1.1) must return [43]'); - assert.compareArray(sample.subarray(-0.6), [40, 41, 42, 43], 'sample.subarray(-0.6) must return [40, 41, 42, 43]'); + 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"), [43], 'sample.subarray("3") must return [43]'); - assert.compareArray(sample.subarray(obj), [42, 43], 'sample.subarray({valueOf: function() {return 2;}}) must return [42, 43]'); + assert(compareArray(sample.subarray("3"), [43]), "string"); + assert( + compareArray( + sample.subarray(obj), + [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 12dad543e1..4797bf5b22 100644 --- a/test/built-ins/TypedArray/prototype/subarray/tointeger-end.js +++ b/test/built-ins/TypedArray/prototype/subarray/tointeger-end.js @@ -23,20 +23,26 @@ var obj = { testWithTypedArrayConstructors(function(TA) { var sample = new TA([40, 41, 42, 43]); - assert.compareArray(sample.subarray(0, false), [], 'sample.subarray(0, false) must return []'); - assert.compareArray(sample.subarray(0, true), [40], 'sample.subarray(0, true) must return [40]'); + assert(compareArray(sample.subarray(0, false), []), "false"); + assert(compareArray(sample.subarray(0, true), [40]), "true"); - assert.compareArray(sample.subarray(0, NaN), [], 'sample.subarray(0, NaN) must return []'); - assert.compareArray(sample.subarray(0, null), [], 'sample.subarray(0, null) must return []'); - assert.compareArray(sample.subarray(0, undefined), [40, 41, 42, 43], 'sample.subarray(0, undefined) must return [40, 41, 42, 43]'); + 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, 0.6), [], 'sample.subarray(0, 0.6) must return []'); - assert.compareArray(sample.subarray(0, 1.1), [40], 'sample.subarray(0, 1.1) must return [40]'); - assert.compareArray(sample.subarray(0, 1.5), [40], 'sample.subarray(0, 1.5) must return [40]'); - assert.compareArray(sample.subarray(0, -0.6), [], 'sample.subarray(0, -0.6) must return []'); - assert.compareArray(sample.subarray(0, -1.1), [40, 41, 42], 'sample.subarray(0, -1.1) must return [40, 41, 42]'); - assert.compareArray(sample.subarray(0, -1.5), [40, 41, 42], 'sample.subarray(0, -1.5) must return [40, 41, 42]'); + 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, -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, "3"), [40, 41, 42], 'sample.subarray(0, 3) must return [40, 41, 42]'); - assert.compareArray(sample.subarray(0, obj), [40, 41], 'sample.subarray(0, {valueOf: function() {return 2;}}) must return [40, 41]'); + assert(compareArray(sample.subarray(0, "3"), [40, 41, 42]), "string"); + assert( + compareArray( + sample.subarray(0, obj), + [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 index 3191f75ccc..82cd346b91 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 @@ -30,19 +30,23 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ -var separator = ['', ''].toLocaleString(); + +var separator = ["", ""].toLocaleString(); var calls; BigInt.prototype.toLocaleString = function() { calls.push(this); - return 'hacks' + calls.length; + return "hacks" + calls.length; }; -var expected = ['hacks1', 'hacks2'].join(separator); +var expected = ["hacks1", "hacks2"].join(separator); testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([42n, 0n]); calls = []; - assert.sameValue(sample.toLocaleString(), expected, 'sample.toLocaleString() returns expected'); - assert.compareArray(new TA(calls), sample, 'new TA(calls) is expected to equal the value of sample'); + assert.sameValue(sample.toLocaleString(), expected, "returns expected value"); + assert( + compareArray(new TA(calls), sample), + "toLocaleString called for each item" + ); }); 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 6cb25fc9ab..980670c721 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 @@ -45,9 +45,9 @@ var expected = ["hacks1", "hacks2"].join(separator); testWithTypedArrayConstructors(function(TA) { var sample = new TA(arr); calls = []; - assert.sameValue(sample.toLocaleString(), expected, 'sample.toLocaleString() returns expected'); - assert.compareArray( - new TA(calls), sample, - 'new TA(calls) is expected to equal the value of sample' + assert.sameValue(sample.toLocaleString(), expected, "returns expected value"); + assert( + compareArray(new TA(calls), sample), + "toLocaleString called for each item" ); }); diff --git a/test/built-ins/TypedArrayConstructors/ctors/object-arg/conversion-operation-consistent-nan.js b/test/built-ins/TypedArrayConstructors/ctors/object-arg/conversion-operation-consistent-nan.js index 8391ffc800..d440071946 100644 --- a/test/built-ins/TypedArrayConstructors/ctors/object-arg/conversion-operation-consistent-nan.js +++ b/test/built-ins/TypedArrayConstructors/ctors/object-arg/conversion-operation-consistent-nan.js @@ -64,7 +64,7 @@ function body(FloatArray) { var firstBytes = new Uint8Array(first.buffer); var secondBytes = new Uint8Array(second.buffer); - assert.compareArray(firstBytes, secondBytes, 'The value of firstBytes is expected to equal the value of secondBytes'); + assert(compareArray(firstBytes, secondBytes)); } testWithTypedArrayConstructors(body, [Float32Array, Float64Array]); diff --git a/test/built-ins/TypedArrayConstructors/ctors/typedarray-arg/out-of-bounds-when-species-retrieved-different-type.js b/test/built-ins/TypedArrayConstructors/ctors/typedarray-arg/out-of-bounds-when-species-retrieved-different-type.js index 1d3db05086..0aba12fc80 100644 --- a/test/built-ins/TypedArrayConstructors/ctors/typedarray-arg/out-of-bounds-when-species-retrieved-different-type.js +++ b/test/built-ins/TypedArrayConstructors/ctors/typedarray-arg/out-of-bounds-when-species-retrieved-different-type.js @@ -14,11 +14,7 @@ features: [TypedArray, Symbol.species, resizable-arraybuffer] // behavior will be identical to the case where `ArrayBuffer.prototype.resize` // has not been implemented. The following assertion prevents this test from // passing in runtimes which have not implemented the method. -assert.sameValue( - typeof ArrayBuffer.prototype.resize, - 'function', - 'The value of `typeof ArrayBuffer.prototype.resize` is expected to be "function"' -); +assert.sameValue(typeof ArrayBuffer.prototype.resize, 'function'); testWithTypedArrayConstructors(function(TA) { var BPE = TA.BYTES_PER_ELEMENT; @@ -50,7 +46,7 @@ testWithTypedArrayConstructors(function(TA) { } catch (_) {} }; - assert.compareArray(new TargetCtor(source), expected, 'new TargetCtor(source) is expected to equal the value of expected'); + assert(compareArray(new TargetCtor(source), expected), 'following grow'); onGetSpecies = function() { try { @@ -59,7 +55,7 @@ testWithTypedArrayConstructors(function(TA) { } catch (_) {} }; - assert.compareArray(new TargetCtor(source), expected, 'new TargetCtor(source) is expected to equal the value of expected'); + assert(compareArray(new TargetCtor(source), expected), 'following shrink (within bounds)'); onGetSpecies = function() { try { @@ -68,7 +64,7 @@ testWithTypedArrayConstructors(function(TA) { } catch (_) {} }; - assert.compareArray(new TargetCtor(source), expected, 'new TargetCtor(source) is expected to equal the value of expected'); + assert(compareArray(new TargetCtor(source), expected), 'following shrink (on boundary)'); // `assert.throws` cannot be used in this case because the expected error // is derived only after the constructor is invoked. @@ -89,9 +85,5 @@ testWithTypedArrayConstructors(function(TA) { actualError = caught; } - assert.sameValue( - actualError.constructor, - expectedError, - 'The value of actualError.constructor is expected to equal the value of expectedError' - ); + assert.sameValue(actualError.constructor, expectedError); }); diff --git a/test/built-ins/TypedArrayConstructors/ctors/typedarray-arg/out-of-bounds-when-species-retrieved-same-type.js b/test/built-ins/TypedArrayConstructors/ctors/typedarray-arg/out-of-bounds-when-species-retrieved-same-type.js index 1837d791b9..c633ba0696 100644 --- a/test/built-ins/TypedArrayConstructors/ctors/typedarray-arg/out-of-bounds-when-species-retrieved-same-type.js +++ b/test/built-ins/TypedArrayConstructors/ctors/typedarray-arg/out-of-bounds-when-species-retrieved-same-type.js @@ -14,11 +14,7 @@ features: [TypedArray, Symbol.species, resizable-arraybuffer] // behavior will be identical to the case where `ArrayBuffer.prototype.resize` // has not been implemented. The following assertion prevents this test from // passing in runtimes which have not implemented the method. -assert.sameValue( - typeof ArrayBuffer.prototype.resize, - 'function', - 'The value of `typeof ArrayBuffer.prototype.resize` is expected to be "function"' -); +assert.sameValue(typeof ArrayBuffer.prototype.resize, 'function'); testWithTypedArrayConstructors(function(TA) { var BPE = TA.BYTES_PER_ELEMENT; @@ -49,12 +45,8 @@ testWithTypedArrayConstructors(function(TA) { } catch (_) {} }; - assert.sameValue( - (new TA(source)).join(','), - expected.join(','), - '(new TA(source)).join(",") must return the same value returned by expected.join(",")' - ); - assert.compareArray(new TA(source), expected, 'new TA(source) is expected to equal the value of expected'); + assert.sameValue((new TA(source)).join(','), expected.join(',')); + assert(compareArray(new TA(source), expected), 'following grow'); onGetSpecies = function() { try { @@ -63,7 +55,7 @@ testWithTypedArrayConstructors(function(TA) { } catch (_) {} }; - assert.compareArray(new TA(source), expected, 'new TA(source) is expected to equal the value of expected'); + assert(compareArray(new TA(source), expected), 'following shrink (within bounds)'); onGetSpecies = function() { try { @@ -72,7 +64,7 @@ testWithTypedArrayConstructors(function(TA) { } catch (_) {} }; - assert.compareArray(new TA(source), expected, 'new TA(source) is expected to equal the value of expected'); + assert(compareArray(new TA(source), expected), 'following shrink (on boundary)'); // `assert.throws` cannot be used in this case because the expected error // is derived only after the constructor is invoked. @@ -93,9 +85,5 @@ testWithTypedArrayConstructors(function(TA) { actualError = caught; } - assert.sameValue( - actualError.constructor, - expectedError, - 'The value of actualError.constructor is expected to equal the value of expectedError' - ); + assert.sameValue(actualError.constructor, expectedError); }); diff --git a/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-and-symbol-keys-.js b/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-and-symbol-keys-.js index 89d886a1b3..6f64fa646a 100644 --- a/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-and-symbol-keys-.js +++ b/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-and-symbol-keys-.js @@ -1,5 +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. + /*--- esid: sec-integer-indexed-exotic-objects-ownpropertykeys description: > @@ -15,8 +16,10 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, Reflect, Symbol, TypedArray] ---*/ -var s1 = Symbol('1'); -var s2 = Symbol('2'); + +var s1 = Symbol("1"); +var s2 = Symbol("2"); + TypedArray.prototype[3] = 42; TypedArray.prototype.bar = 42; @@ -27,11 +30,9 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample1.test262 = 42; sample1.ecma262 = 42; var result1 = Reflect.ownKeys(sample1); - - assert.compareArray( - result1, - ['0', '1', '2', 'test262', 'ecma262', s1, s2], - 'The value of result1 is expected to be ["0", "1", "2", "test262", "ecma262", s1, s2]' + assert( + compareArray(result1, ["0", "1", "2", "test262", "ecma262", s1, s2]), + "result1" ); var sample2 = new TA(4).subarray(2); @@ -40,10 +41,8 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample2.test262 = 42; sample2.ecma262 = 42; var result2 = Reflect.ownKeys(sample2); - - assert.compareArray( - result2, - ['0', '1', 'test262', 'ecma262', s1, s2], - 'The value of result2 is expected to be ["0", "1", "test262", "ecma262", s1, s2]' + assert( + compareArray(result2, ["0", "1", "test262", "ecma262", s1, s2]), + "result2" ); }); diff --git a/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-keys.js b/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-keys.js index 22fb839ec5..8de17148be 100644 --- a/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-keys.js +++ b/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-keys.js @@ -1,5 +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. + /*--- esid: sec-integer-indexed-exotic-objects-ownpropertykeys description: > @@ -15,6 +16,7 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, Reflect, TypedArray] ---*/ + TypedArray.prototype[3] = 42; TypedArray.prototype.bar = 42; @@ -23,21 +25,17 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample1.test262 = 42; sample1.ecma262 = 42; var result1 = Reflect.ownKeys(sample1); - - assert.compareArray( - result1, - ['0', '1', '2', 'test262', 'ecma262'], - 'The value of result1 is expected to be ["0", "1", "2", "test262", "ecma262"]' + 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'], - 'The value of result2 is expected to be ["0", "1", "test262", "ecma262"]' + assert( + compareArray(result2, ["0", "1", "test262", "ecma262"]), + "result2" ); }); diff --git a/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes.js b/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes.js index 4633b930c9..88f6f3b8fb 100644 --- a/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes.js +++ b/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes.js @@ -1,5 +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. + /*--- esid: sec-integer-indexed-exotic-objects-ownpropertykeys description: > @@ -15,17 +16,21 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, Reflect, TypedArray] ---*/ + testWithBigIntTypedArrayConstructors(function(TA) { var sample1 = new TA([42n, 42n, 42n]); var result1 = Reflect.ownKeys(sample1); - assert.compareArray(result1, ['0', '1', '2'], 'The value of result1 is expected to be ["0", "1", "2"]'); + assert(compareArray(result1, ["0", "1", "2"]), "result1"); + var sample2 = new TA(4); var result2 = Reflect.ownKeys(sample2); - assert.compareArray(result2, ['0', '1', '2', '3'], 'The value of result2 is expected to be ["0", "1", "2", "3"]'); + 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'], 'The value of result3 is expected to be ["0", "1"]'); + assert(compareArray(result3, ["0", "1"]), "result3"); + var sample4 = new TA(); var result4 = Reflect.ownKeys(sample4); - assert.compareArray(result4, [], 'The value of result4 is expected to be []'); + assert(compareArray(result4, []), "result4"); }); diff --git a/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/not-enumerable-keys.js b/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/not-enumerable-keys.js index 2e640e757c..d50d2d20f9 100644 --- a/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/not-enumerable-keys.js +++ b/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/not-enumerable-keys.js @@ -31,5 +31,5 @@ testWithBigIntTypedArrayConstructors(function(TA) { enumerable: false }); var result = Reflect.ownKeys(sample); - assert.compareArray(result, ["test262", s], 'The value of result is expected to be ["test262", s]'); + assert(compareArray(result, ["test262", s])); }); diff --git a/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/integer-indexes-and-string-and-symbol-keys-.js b/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/integer-indexes-and-string-and-symbol-keys-.js index a7174168bd..9060bee4d7 100644 --- a/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/integer-indexes-and-string-and-symbol-keys-.js +++ b/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/integer-indexes-and-string-and-symbol-keys-.js @@ -30,9 +30,9 @@ testWithTypedArrayConstructors(function(TA) { sample1.test262 = 42; sample1.ecma262 = 42; var result1 = Reflect.ownKeys(sample1); - assert.compareArray( - result1, ["0", "1", "2", "test262", "ecma262", s1, s2], - 'The value of result1 is expected to be ["0", "1", "2", "test262", "ecma262", s1, s2]' + assert( + compareArray(result1, ["0", "1", "2", "test262", "ecma262", s1, s2]), + "result1" ); var sample2 = new TA(4).subarray(2); @@ -41,8 +41,8 @@ testWithTypedArrayConstructors(function(TA) { sample2.test262 = 42; sample2.ecma262 = 42; var result2 = Reflect.ownKeys(sample2); - assert.compareArray( - result2, ["0", "1", "test262", "ecma262", s1, s2], - 'The value of result2 is expected to be ["0", "1", "test262", "ecma262", s1, s2]' + assert( + compareArray(result2, ["0", "1", "test262", "ecma262", s1, s2]), + "result2" ); }); diff --git a/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/integer-indexes-and-string-keys.js b/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/integer-indexes-and-string-keys.js index 35435d2ae6..b227ef6f22 100644 --- a/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/integer-indexes-and-string-keys.js +++ b/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/integer-indexes-and-string-keys.js @@ -25,17 +25,17 @@ testWithTypedArrayConstructors(function(TA) { sample1.test262 = 42; sample1.ecma262 = 42; var result1 = Reflect.ownKeys(sample1); - assert.compareArray( - result1, ["0", "1", "2", "test262", "ecma262"], - 'The value of result1 is expected to be ["0", "1", "2", "test262", "ecma262"]' + 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"], - 'The value of result2 is expected to be ["0", "1", "test262", "ecma262"]' + assert( + compareArray(result2, ["0", "1", "test262", "ecma262"]), + "result2" ); }); diff --git a/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/integer-indexes.js b/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/integer-indexes.js index b0b27e8d91..00e57de342 100644 --- a/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/integer-indexes.js +++ b/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/integer-indexes.js @@ -20,17 +20,17 @@ features: [Reflect, TypedArray] testWithTypedArrayConstructors(function(TA) { var sample1 = new TA([42, 42, 42]); var result1 = Reflect.ownKeys(sample1); - assert.compareArray(result1, ["0", "1", "2"], 'The value of result1 is expected to be ["0", "1", "2"]'); + assert(compareArray(result1, ["0", "1", "2"]), "result1"); var sample2 = new TA(4); var result2 = Reflect.ownKeys(sample2); - assert.compareArray(result2, ["0", "1", "2", "3"], 'The value of result2 is expected to be ["0", "1", "2", "3"]'); + 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"], 'The value of result3 is expected to be ["0", "1"]'); + assert(compareArray(result3, ["0", "1"]), "result3"); var sample4 = new TA(); var result4 = Reflect.ownKeys(sample4); - assert.compareArray(result4, [], 'The value of result4 is expected to be []'); + assert(compareArray(result4, []), "result4"); }); diff --git a/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/not-enumerable-keys.js b/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/not-enumerable-keys.js index 7a47cfcb83..ad030c21ee 100644 --- a/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/not-enumerable-keys.js +++ b/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/not-enumerable-keys.js @@ -31,5 +31,5 @@ testWithTypedArrayConstructors(function(TA) { enumerable: false }); var result = Reflect.ownKeys(sample); - assert.compareArray(result, ["test262", s], 'The value of result is expected to be ["test262", s]'); + assert(compareArray(result, ["test262", s])); }); diff --git a/test/harness/compare-array-samevalue.js b/test/harness/compare-array-samevalue.js index bbd97046b5..826840e219 100644 --- a/test/harness/compare-array-samevalue.js +++ b/test/harness/compare-array-samevalue.js @@ -7,7 +7,5 @@ description: > includes: [compareArray.js] ---*/ -assert.compareArray([NaN], [NaN], '[NaN] is expected to be [NaN]'); -assert.throws(Test262Error, () => { - assert.compareArray([0], [-0], '[0] is expected to be [-0]'); -}, 'assert.compareArray([0], [-0]) throws a Test262Error exception'); +assert(compareArray([NaN], [NaN])); +assert(!compareArray([0], [-0])); diff --git a/test/intl402/Intl/getCanonicalLocales/duplicates.js b/test/intl402/Intl/getCanonicalLocales/duplicates.js index 18cc833ba5..cff587ca3c 100644 --- a/test/intl402/Intl/getCanonicalLocales/duplicates.js +++ b/test/intl402/Intl/getCanonicalLocales/duplicates.js @@ -11,8 +11,9 @@ info: | includes: [compareArray.js] ---*/ -assert.compareArray(Intl.getCanonicalLocales( - ['ab-cd', 'ff', 'de-rt', 'ab-Cd']), ['ab-CD', 'ff', 'de-RT'], 'Intl.getCanonicalLocales(["ab-cd", "ff", "de-rt", "ab-Cd"]) must return ["ab-CD", "ff", "de-RT"]'); +assert(compareArray( + Intl.getCanonicalLocales( + ['ab-cd', 'ff', 'de-rt', 'ab-Cd']), ['ab-CD', 'ff', 'de-RT'])); var locales = Intl.getCanonicalLocales(['en-US', 'en-US']); -assert.compareArray(locales, ['en-US'], 'The value of locales is expected to be ["en-US"]'); +assert(compareArray(locales, ['en-US']), 'en-US'); diff --git a/test/intl402/Intl/getCanonicalLocales/locales-is-not-a-string.js b/test/intl402/Intl/getCanonicalLocales/locales-is-not-a-string.js index 3fcc9302a9..ee96616d7f 100644 --- a/test/intl402/Intl/getCanonicalLocales/locales-is-not-a-string.js +++ b/test/intl402/Intl/getCanonicalLocales/locales-is-not-a-string.js @@ -15,7 +15,7 @@ features: [Symbol] var gCL = Intl.getCanonicalLocales; function assertArray(l, r) { - assert.compareArray(l, r, 'The value of l is expected to equal the value of r'); + assert(compareArray(l, r), r); } assertArray(gCL(), []); diff --git a/test/intl402/Intl/getCanonicalLocales/main.js b/test/intl402/Intl/getCanonicalLocales/main.js index 5ac0a2163b..ae088b38a2 100644 --- a/test/intl402/Intl/getCanonicalLocales/main.js +++ b/test/intl402/Intl/getCanonicalLocales/main.js @@ -14,7 +14,7 @@ includes: [compareArray.js] var gCL = Intl.getCanonicalLocales; function assertArray(l, r) { - assert.compareArray(l, r, 'The value of l is expected to equal the value of r'); + assert(compareArray(l, r), r); } assertArray(gCL(), []); diff --git a/test/intl402/Intl/getCanonicalLocales/overriden-arg-length.js b/test/intl402/Intl/getCanonicalLocales/overriden-arg-length.js index e0a066641c..49321736a0 100644 --- a/test/intl402/Intl/getCanonicalLocales/overriden-arg-length.js +++ b/test/intl402/Intl/getCanonicalLocales/overriden-arg-length.js @@ -21,7 +21,7 @@ Object.defineProperty(locales, "length", { assert.throws(Test262Error, function() { Intl.getCanonicalLocales(locales); -}, 'Intl.getCanonicalLocales(locales) throws a Test262Error exception'); +}, "should throw if locales.length throws"); var locales = { '0': 'en-US', @@ -32,8 +32,8 @@ Object.defineProperty(locales, "length", { get: function() { return "1" } }); -assert.compareArray(Intl.getCanonicalLocales(locales), ['en-US'], - 'Intl.getCanonicalLocales({"0": "en-US", "1": "pt-BR",}) must return ["en-US"]'); +assert(compareArray(Intl.getCanonicalLocales(locales), ['en-US']), + "should return one element if locales.length is '1'"); var locales = { '0': 'en-US', @@ -44,8 +44,8 @@ Object.defineProperty(locales, "length", { get: function() { return 1.3 } }); -assert.compareArray(Intl.getCanonicalLocales(locales), ['en-US'], - 'Intl.getCanonicalLocales({"0": "en-US", "1": "pt-BR",}) must return ["en-US"]'); +assert(compareArray(Intl.getCanonicalLocales(locales), ['en-US']), + "should return one element if locales.length is 1.3"); var locales = { '0': 'en-US', @@ -58,7 +58,7 @@ Object.defineProperty(locales, "length", { assert.throws(TypeError, function() { Intl.getCanonicalLocales(locales); -}, 'Intl.getCanonicalLocales(locales) throws a TypeError exception'); +}, "should throw if locales.length is a Symbol"); var locales = { '0': 'en-US', @@ -69,8 +69,8 @@ Object.defineProperty(locales, "length", { get: function() { return -Infinity } }); -assert.compareArray(Intl.getCanonicalLocales(locales), [], - 'Intl.getCanonicalLocales({"0": "en-US", "1": "pt-BR",}) must return []'); +assert(compareArray(Intl.getCanonicalLocales(locales), []), + "should return empty array if locales.length is -Infinity"); var locales = { length: -Math.pow(2, 32) + 1 @@ -80,10 +80,10 @@ Object.defineProperty(locales, "0", { get: function() { throw new Error("must not be gotten!"); } }) -assert.compareArray(Intl.getCanonicalLocales(locales), [], - 'Intl.getCanonicalLocales({length: -Math.pow(2, 32) + 1}) must return []'); +assert(compareArray(Intl.getCanonicalLocales(locales), []), + "should return empty array if locales.length is a negative value"); var count = 0; var locs = { get length() { if (count++ > 0) throw 42; return 0; } }; var locales = Intl.getCanonicalLocales(locs); // shouldn't throw 42 -assert.sameValue(locales.length, 0, 'The value of locales.length is expected to be 0'); +assert.sameValue(locales.length, 0); diff --git a/test/intl402/Intl/getCanonicalLocales/overriden-push.js b/test/intl402/Intl/getCanonicalLocales/overriden-push.js index 1b5b5aa28d..142f123c53 100644 --- a/test/intl402/Intl/getCanonicalLocales/overriden-push.js +++ b/test/intl402/Intl/getCanonicalLocales/overriden-push.js @@ -16,4 +16,4 @@ Array.prototype.push = function() { throw 42; }; // must not throw 42, might if push is used var arr = Intl.getCanonicalLocales(["en-US"]); -assert.compareArray(arr, ["en-US"], 'The value of arr is expected to be ["en-US"]'); +assert(compareArray(arr, ["en-US"])); diff --git a/test/intl402/Intl/getCanonicalLocales/to-string.js b/test/intl402/Intl/getCanonicalLocales/to-string.js index e3473d8c6a..3d18a6dff0 100644 --- a/test/intl402/Intl/getCanonicalLocales/to-string.js +++ b/test/intl402/Intl/getCanonicalLocales/to-string.js @@ -17,8 +17,4 @@ var locales = { length: 2 }; -assert.compareArray( - Intl.getCanonicalLocales(locales), - [ "en-US", "pt-BR" ], - 'Intl.getCanonicalLocales("{"0": {toString: function() {locales[1] = "pt-BR"; return "en-US";}}, length: 2}) must return [ "en-US", "pt-BR" ]' -); +assert(compareArray(Intl.getCanonicalLocales(locales), [ "en-US", "pt-BR" ])); diff --git a/test/intl402/Intl/getCanonicalLocales/weird-cases.js b/test/intl402/Intl/getCanonicalLocales/weird-cases.js index fba778ea71..32fa44f679 100644 --- a/test/intl402/Intl/getCanonicalLocales/weird-cases.js +++ b/test/intl402/Intl/getCanonicalLocales/weird-cases.js @@ -20,5 +20,5 @@ var weirdCases = ]; weirdCases.forEach(function (weird) { - assert.compareArray(Intl.getCanonicalLocales(weird), [weird], 'Intl.getCanonicalLocales(weird) must return [weird]'); + assert(compareArray(Intl.getCanonicalLocales(weird), [weird])); }); diff --git a/test/intl402/ListFormat/prototype/formatToParts/iterable-undefined.js b/test/intl402/ListFormat/prototype/formatToParts/iterable-undefined.js index d246928f84..c1d6ac91c0 100644 --- a/test/intl402/ListFormat/prototype/formatToParts/iterable-undefined.js +++ b/test/intl402/ListFormat/prototype/formatToParts/iterable-undefined.js @@ -16,8 +16,4 @@ includes: [compareArray.js] let lf = new Intl.ListFormat(); -assert.compareArray( - lf.formatToParts(undefined), - [], - 'lf.formatToParts(undefined) must return []' -); +assert(compareArray([], lf.formatToParts(undefined))); diff --git a/test/language/computed-property-names/basics/number.js b/test/language/computed-property-names/basics/number.js index f53f9e17b8..823d669f8b 100644 --- a/test/language/computed-property-names/basics/number.js +++ b/test/language/computed-property-names/basics/number.js @@ -17,11 +17,11 @@ var object = { c: 'C', [ID(2)]: 'D', }; -assert.sameValue(object.a, 'A', 'The value of object.a is expected to be "A"'); -assert.sameValue(object[1], 'B', 'The value of object[1] is expected to be "B"'); -assert.sameValue(object.c, 'C', 'The value of object.c is expected to be "C"'); -assert.sameValue(object[2], 'D', 'The value of object[2] is expected to be "D"'); -assert.compareArray( - Object.getOwnPropertyNames(object), ['1', '2', 'a', 'c'], - 'Object.getOwnPropertyNames({a: "A", [1]: "B", c: "C", [ID(2)]: "D",}) must return ["1", "2", "a", "c"]' +assert.sameValue(object.a, 'A', "The value of `object.a` is `'A'`. Defined in `object` as `a: 'A'`"); +assert.sameValue(object[1], 'B', "The value of `object[1]` is `'B'`. Defined in `object` as `[1]: 'B'`"); +assert.sameValue(object.c, 'C', "The value of `object.c` is `'C'`. Defined in `object` as `c: 'C'`"); +assert.sameValue(object[2], 'D', "The value of `object[2]` is `'D'`. Defined in `object` as `[ID(2)]: 'D'`"); +assert( + compareArray(Object.getOwnPropertyNames(object), ['1', '2', 'a', 'c']), + "`compareArray(Object.getOwnPropertyNames(object), ['1', '2', 'a', 'c'])` returns `true`" ); diff --git a/test/language/computed-property-names/basics/string.js b/test/language/computed-property-names/basics/string.js index f7f66c62ce..039b4d4697 100644 --- a/test/language/computed-property-names/basics/string.js +++ b/test/language/computed-property-names/basics/string.js @@ -16,11 +16,11 @@ var object = { c: 'C', [ID('d')]: 'D', }; -assert.sameValue(object.a, 'A', 'The value of object.a is expected to be "A"'); -assert.sameValue(object.b, 'B', 'The value of object.b is expected to be "B"'); -assert.sameValue(object.c, 'C', 'The value of object.c is expected to be "C"'); -assert.sameValue(object.d, 'D', 'The value of object.d is expected to be "D"'); -assert.compareArray( - Object.getOwnPropertyNames(object), ['a', 'b', 'c', 'd'], - 'Object.getOwnPropertyNames({a: "A", ["b"]: "B", c: "C", [ID("d")]: "D",}) must return ["a", "b", "c", "d"]' +assert.sameValue(object.a, 'A', "The value of `object.a` is `'A'`. Defined in `object` as `a: 'A'`"); +assert.sameValue(object.b, 'B', "The value of `object.b` is `'B'`. Defined in `object` as `['b']: 'B'`"); +assert.sameValue(object.c, 'C', "The value of `object.c` is `'C'`. Defined in `object` as `c: 'C'`"); +assert.sameValue(object.d, 'D', "The value of `object.d` is `'D'`. Defined in `object` as `[ID('d')]: 'D'`"); +assert( + compareArray(Object.getOwnPropertyNames(object), ['a', 'b', 'c', 'd']), + "`compareArray(Object.getOwnPropertyNames(object), ['a', 'b', 'c', 'd'])` returns `true`" ); diff --git a/test/language/computed-property-names/basics/symbol.js b/test/language/computed-property-names/basics/symbol.js index b497e317eb..9408401002 100644 --- a/test/language/computed-property-names/basics/symbol.js +++ b/test/language/computed-property-names/basics/symbol.js @@ -20,15 +20,15 @@ var object = { c: 'C', [ID(sym2)]: 'D', }; -assert.sameValue(object.a, 'A', 'The value of object.a is expected to be "A"'); -assert.sameValue(object[sym1], 'B', 'The value of object[sym1] is expected to be "B"'); -assert.sameValue(object.c, 'C', 'The value of object.c is expected to be "C"'); -assert.sameValue(object[sym2], 'D', 'The value of object[sym2] is expected to be "D"'); -assert.compareArray( - Object.getOwnPropertyNames(object), ['a', 'c'], - 'Object.getOwnPropertyNames({a: "A", [sym1]: "B", c: "C", [ID(sym2)]: "D",}) must return ["a", "c"]' +assert.sameValue(object.a, 'A', "The value of `object.a` is `'A'`. Defined in `object` as `a: 'A'`"); +assert.sameValue(object[sym1], 'B', "The value of `object[sym1]` is `'B'`. Defined in `object` as `[sym1]: 'B'`"); +assert.sameValue(object.c, 'C', "The value of `object.c` is `'C'`. Defined in `object` as `c: 'C'`"); +assert.sameValue(object[sym2], 'D', "The value of `object[sym2]` is `'D'`. Defined in `object` as `[ID(sym2)]: 'D'`"); +assert( + compareArray(Object.getOwnPropertyNames(object), ['a', 'c']), + "`compareArray(Object.getOwnPropertyNames(object), ['a', 'c'])` returns `true`" ); -assert.compareArray( - Object.getOwnPropertySymbols(object), [sym1, sym2], - 'Object.getOwnPropertySymbols({a: "A", [sym1]: "B", c: "C", [ID(sym2)]: "D",}) must return [sym1, sym2]' +assert( + compareArray(Object.getOwnPropertySymbols(object), [sym1, sym2]), + "`compareArray(Object.getOwnPropertySymbols(object), [sym1, sym2])` returns `true`" ); diff --git a/test/language/computed-property-names/class/method/generator.js b/test/language/computed-property-names/class/method/generator.js index dea4f72616..94d9054cd4 100644 --- a/test/language/computed-property-names/class/method/generator.js +++ b/test/language/computed-property-names/class/method/generator.js @@ -15,9 +15,9 @@ class C { assert.sameValue( Object.keys(C.prototype).length, 0, - 'The value of Object.keys(C.prototype).length is expected to be 0' + "The value of `Object.keys(C.prototype).length` is `0`" ); -assert.compareArray( - Object.getOwnPropertyNames(C.prototype), ['constructor', 'a'], - 'Object.getOwnPropertyNames(C.prototype) must return ["constructor", "a"]' +assert( + compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a']), + "`compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a'])` returns `true`" ); diff --git a/test/language/computed-property-names/class/method/number.js b/test/language/computed-property-names/class/method/number.js index b47579162b..b8b005995b 100644 --- a/test/language/computed-property-names/class/method/number.js +++ b/test/language/computed-property-names/class/method/number.js @@ -17,14 +17,14 @@ class C { c() { return 'C'; } [ID(2)]() { return 'D'; } } -assert.sameValue(new C().a(), 'A', 'new C().a() must return "A"'); -assert.sameValue(new C()[1](), 'B', 'new C()[1]() must return "B"'); -assert.sameValue(new C().c(), 'C', 'new C().c() must return "C"'); -assert.sameValue(new C()[2](), 'D', 'new C()[2]() must return "D"'); +assert.sameValue(new C().a(), 'A', "`new C().a()` returns `'A'`, from `a() { return 'A'; }`"); +assert.sameValue(new C()[1](), 'B', "`new C()[1]()` returns `'B'`, from `[1]() { return 'B'; }`"); +assert.sameValue(new C().c(), 'C', "`new C().c()` returns `'C'`, from `c() { return 'C'; }`"); +assert.sameValue(new C()[2](), 'D', "`new C()[2]()` returns `'D'`, from `[ID(2)]() { return 'D'; }`"); -assert.sameValue(Object.keys(C.prototype).length, 0, 'The value of Object.keys(C.prototype).length is expected to be 0'); +assert.sameValue(Object.keys(C.prototype).length, 0, "No enum keys from C.prototype"); -assert.compareArray( - Object.getOwnPropertyNames(C.prototype), ['1', '2', 'constructor', 'a', 'c'], - 'Object.getOwnPropertyNames(C.prototype) must return ["1", "2", "constructor", "a", "c"]' +assert( + compareArray(Object.getOwnPropertyNames(C.prototype), ['1', '2', 'constructor', 'a', 'c']), + "`compareArray(Object.getOwnPropertyNames(C.prototype), ['1', '2', 'constructor', 'a', 'c'])` returns `true`" ); diff --git a/test/language/computed-property-names/class/method/string.js b/test/language/computed-property-names/class/method/string.js index cb509bd794..f35f2341d1 100644 --- a/test/language/computed-property-names/class/method/string.js +++ b/test/language/computed-property-names/class/method/string.js @@ -17,11 +17,12 @@ class C { c() { return 'C'; } [ID('d')]() { return 'D'; } } -assert.sameValue(new C().a(), 'A', 'new C().a() must return "A"'); -assert.sameValue(new C().b(), 'B', 'new C().b() must return "B"'); -assert.sameValue(new C().c(), 'C', 'new C().c() must return "C"'); -assert.sameValue(new C().d(), 'D', 'new C().d() must return "D"'); -assert.sameValue(Object.keys(C.prototype).length, 0, 'The value of Object.keys(C.prototype).length is expected to be 0'); -assert.compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a', 'b', 'c', 'd'], - 'Object.getOwnPropertyNames(C.prototype) must return ["constructor", "a", "b", "c", "d"]' +assert.sameValue(new C().a(), 'A', "`new C().a()` returns `'A'`. Defined as `a() { return 'A'}`"); +assert.sameValue(new C().b(), 'B', "`new C().b()` returns `'B'`. Defined as `['b']() { return 'B'; }`"); +assert.sameValue(new C().c(), 'C', "`new C().c()` returns `'C'`. Defined as `c() { return 'C'; }`"); +assert.sameValue(new C().d(), 'D', "`new C().d()` returns `'D'`. Defined as `[ID('d')]() { return 'D'; }`"); +assert.sameValue(Object.keys(C.prototype).length, 0, "No enum keys from C.prototype"); +assert( + compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a', 'b', 'c', 'd']), + "`compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a', 'b', 'c', 'd'])` returns `true`" ); diff --git a/test/language/computed-property-names/class/method/symbol.js b/test/language/computed-property-names/class/method/symbol.js index f1f431a048..9dd9870b11 100644 --- a/test/language/computed-property-names/class/method/symbol.js +++ b/test/language/computed-property-names/class/method/symbol.js @@ -20,16 +20,16 @@ class C { c() { return 'C'; } [ID(sym2)]() { return 'D'; } } -assert.sameValue(new C().a(), 'A', 'new C().a() must return "A"'); -assert.sameValue(new C()[sym1](), 'B', 'new C()[sym1]() must return "B"'); -assert.sameValue(new C().c(), 'C', 'new C().c() must return "C"'); -assert.sameValue(new C()[sym2](), 'D', 'new C()[sym2]() must return "D"'); -assert.sameValue(Object.keys(C.prototype).length, 0, 'The value of Object.keys(C.prototype).length is expected to be 0'); -assert.compareArray( - Object.getOwnPropertyNames(C.prototype), ['constructor', 'a', 'c'], - 'Object.getOwnPropertyNames(C.prototype) must return ["constructor", "a", "c"]' +assert.sameValue(new C().a(), 'A', "`new C().a()` returns `'A'`. Defined as `a() { return 'A'; }`"); +assert.sameValue(new C()[sym1](), 'B', "`new C()[sym1]()` returns `'B'`. Defined as `[sym1]() { return 'B'; }`"); +assert.sameValue(new C().c(), 'C', "`new C().c()` returns `'C'`. Defined as `c() { return 'C'; }`"); +assert.sameValue(new C()[sym2](), 'D', "`new C()[sym2]()` returns `'D'`. Defined as `[ID(sym2)]() { return 'D'; }`"); +assert.sameValue(Object.keys(C.prototype).length, 0, "No enum keys from C.prototype"); +assert( + compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a', 'c']), + "`compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a', 'c'])` returns `true`" ); -assert.compareArray( - Object.getOwnPropertySymbols(C.prototype), [sym1, sym2], - 'Object.getOwnPropertySymbols(C.prototype) must return [sym1, sym2]' +assert( + compareArray(Object.getOwnPropertySymbols(C.prototype), [sym1, sym2]), + "`compareArray(Object.getOwnPropertySymbols(C.prototype), [sym1, sym2])` returns `true`" ); diff --git a/test/language/computed-property-names/object/method/generator.js b/test/language/computed-property-names/object/method/generator.js index b1df1eb93b..dcf29a544a 100644 --- a/test/language/computed-property-names/object/method/generator.js +++ b/test/language/computed-property-names/object/method/generator.js @@ -12,6 +12,7 @@ var object = { yield 2; } }; -assert.compareArray(Object.keys(object), ['a'], - 'Object.keys({*["a"]() {yield 1; yield 2;}}) must return ["a"]' +assert( + compareArray(Object.keys(object), ['a']), + "`compareArray(Object.keys(object), ['a'])` returns `true`" ); diff --git a/test/language/computed-property-names/object/method/number.js b/test/language/computed-property-names/object/method/number.js index 8283408f50..65196664c7 100644 --- a/test/language/computed-property-names/object/method/number.js +++ b/test/language/computed-property-names/object/method/number.js @@ -17,10 +17,11 @@ var object = { c() { return 'C'; }, [ID(2)]() { return 'D'; }, }; -assert.sameValue(object.a(), 'A', 'object.a() must return "A"'); -assert.sameValue(object[1](), 'B', 'object[1]() must return "B"'); -assert.sameValue(object.c(), 'C', 'object.c() must return "C"'); -assert.sameValue(object[2](), 'D', 'object[2]() must return "D"'); -assert.compareArray(Object.getOwnPropertyNames(object), ['1', '2', 'a', 'c'], - 'Object.getOwnPropertyNames("{a() {return "A";}, [1]() {return "B";}, c() {return "C";}, [ID(2)]() {return "D";},}) must return ["1", "2", "a", "c"]' +assert.sameValue(object.a(), 'A', "`object.a()` returns `'A'`. Defined as `a() { return 'A'; }`"); +assert.sameValue(object[1](), 'B', "`object[1]()` returns `'B'`. Defined as `[1]() { return 'B'; }`"); +assert.sameValue(object.c(), 'C', "`object.c()` returns `'C'`. Defined as `c() { return 'C'; }`"); +assert.sameValue(object[2](), 'D', "`object[2]()` returns `'D'`. Defined as `[ID(2)]() { return 'D'; }`"); +assert( + compareArray(Object.getOwnPropertyNames(object), ['1', '2', 'a', 'c']), + "`compareArray(Object.getOwnPropertyNames(object), ['1', '2', 'a', 'c'])` returns `true`" ); diff --git a/test/language/computed-property-names/object/method/string.js b/test/language/computed-property-names/object/method/string.js index e906aab465..bbf18e67fb 100644 --- a/test/language/computed-property-names/object/method/string.js +++ b/test/language/computed-property-names/object/method/string.js @@ -17,10 +17,11 @@ var object = { c() { return 'C'; }, [ID('d')]() { return 'D'; }, }; -assert.sameValue(object.a(), 'A', 'object.a() must return "A"'); -assert.sameValue(object.b(), 'B', 'object.b() must return "B"'); -assert.sameValue(object.c(), 'C', 'object.c() must return "C"'); -assert.sameValue(object.d(), 'D', 'object.d() must return "D"'); -assert.compareArray(Object.getOwnPropertyNames(object), ['a', 'b', 'c', 'd'], - 'Object.getOwnPropertyNames("{a() {return "A"}, ["b"]() {return "B";}, c() {return "C";}, [ID("d")]() {return "D";},}) must return ["a", "b", "c", "d"]' +assert.sameValue(object.a(), 'A', "`object.a()` returns `'A'`. Defined as `a() { return 'A'}`"); +assert.sameValue(object.b(), 'B', "`object.b()` returns `'B'`. Defined as `['b']() { return 'B'; }`"); +assert.sameValue(object.c(), 'C', "`object.c()` returns `'C'`. Defined as `c() { return 'C'; }`"); +assert.sameValue(object.d(), 'D', "`object.d()` returns `'D'`. Defined as `[ID('d')]() { return 'D'; }`"); +assert( + compareArray(Object.getOwnPropertyNames(object), ['a', 'b', 'c', 'd']), + "`compareArray(Object.getOwnPropertyNames(object), ['a', 'b', 'c', 'd'])` returns `true`" ); diff --git a/test/language/computed-property-names/object/method/symbol.js b/test/language/computed-property-names/object/method/symbol.js index 18a903b6a2..5bd07c468e 100644 --- a/test/language/computed-property-names/object/method/symbol.js +++ b/test/language/computed-property-names/object/method/symbol.js @@ -20,15 +20,15 @@ var object = { c() { return 'C'; }, [ID(sym2)]() { return 'D'; }, }; -assert.sameValue(object.a(), 'A', 'object.a() must return "A"'); -assert.sameValue(object[sym1](), 'B', 'object[sym1]() must return "B"'); -assert.sameValue(object.c(), 'C', 'object.c() must return "C"'); -assert.sameValue(object[sym2](), 'D', 'object[sym2]() must return "D"'); -assert.compareArray( - Object.getOwnPropertyNames(object), ['a', 'c'], - 'Object.getOwnPropertyNames("{a() {return "A";}, [sym1]() {return "B";}, c() {return "C";}, [ID(sym2)]() {return "D";},}) must return ["a", "c"]' +assert.sameValue(object.a(), 'A', "`object.a()` returns `'A'`. Defined as `a() { return 'A'; }`"); +assert.sameValue(object[sym1](), 'B', "`object[sym1]()` returns `'B'`. Defined as `[sym1]() { return 'B'; }`"); +assert.sameValue(object.c(), 'C', "`object.c()` returns `'C'`. Defined as `c() { return 'C'; }`"); +assert.sameValue(object[sym2](), 'D', "`object[sym2]()` returns `'D'`. Defined as `[ID(sym2)]() { return 'D'; }`"); +assert( + compareArray(Object.getOwnPropertyNames(object), ['a', 'c']), + "`compareArray(Object.getOwnPropertyNames(object), ['a', 'c'])` returns `true`" ); -assert.compareArray( - Object.getOwnPropertySymbols(object), [sym1, sym2], - 'Object.getOwnPropertySymbols("{a() {return "A";}, [sym1]() {return "B";}, c() {return "C";}, [ID(sym2)]() {return "D";},}) must return [sym1, sym2]' +assert( + compareArray(Object.getOwnPropertySymbols(object), [sym1, sym2]), + "`compareArray(Object.getOwnPropertySymbols(object), [sym1, sym2])` returns `true`" ); diff --git a/test/language/computed-property-names/to-name-side-effects/class.js b/test/language/computed-property-names/to-name-side-effects/class.js index 0f15588844..8e03dd938d 100644 --- a/test/language/computed-property-names/to-name-side-effects/class.js +++ b/test/language/computed-property-names/to-name-side-effects/class.js @@ -30,16 +30,16 @@ class C { [key2]() { return 'D'; } } -assert.compareArray(key1ToString, [0], 'The value of key1ToString is expected to be [0]'); -assert.compareArray(key2ToString, [1], 'The value of key2ToString is expected to be [1]'); +assert.compareArray(key1ToString, [0], "order set for key1"); +assert.compareArray(key2ToString, [1], "order set for key2"); -assert.sameValue(counter, 2, 'The value of counter is expected to be 2'); -assert.sameValue(new C().a(), 'A', 'new C().a() must return "A"'); -assert.sameValue(new C().b(), 'B', 'new C().b() must return "B"'); -assert.sameValue(new C().c(), 'C', 'new C().c() must return "C"'); -assert.sameValue(new C().d(), 'D', 'new C().d() must return "D"'); -assert.sameValue(Object.keys(C.prototype).length, 0, 'The value of Object.keys(C.prototype).length is expected to be 0'); -assert.compareArray( - Object.getOwnPropertyNames(C.prototype), ['constructor', 'a', 'b', 'c', 'd'], - 'Object.getOwnPropertyNames(C.prototype) must return ["constructor", "a", "b", "c", "d"]' +assert.sameValue(counter, 2, "The value of `counter` is `2`"); +assert.sameValue(new C().a(), 'A', "`new C().a()` returns `'A'`. Defined as `a() { return 'A'; }`"); +assert.sameValue(new C().b(), 'B', "`new C().b()` returns `'B'`. Defined as `[key1]() { return 'B'; }`"); +assert.sameValue(new C().c(), 'C', "`new C().c()` returns `'C'`. Defined as `c() { return 'C'; }`"); +assert.sameValue(new C().d(), 'D', "`new C().d()` returns `'D'`. Defined as `[key2]() { return 'D'; }`"); +assert.sameValue(Object.keys(C.prototype).length, 0, "No enum keys from C.prototype"); +assert( + compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a', 'b', 'c', 'd']), + "`compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a', 'b', 'c', 'd'])` returns `true`" ); diff --git a/test/language/computed-property-names/to-name-side-effects/numbers-class.js b/test/language/computed-property-names/to-name-side-effects/numbers-class.js index 57e30833c4..b92310babc 100644 --- a/test/language/computed-property-names/to-name-side-effects/numbers-class.js +++ b/test/language/computed-property-names/to-name-side-effects/numbers-class.js @@ -33,16 +33,16 @@ class C { [key2]() { return 'D'; } } -assert.compareArray(key1vof, [0], 'The value of key1vof is expected to be [0]'); -assert.compareArray(key2vof, [1], 'The value of key2vof is expected to be [1]'); +assert.compareArray(key1vof, [0], "order set for key1"); +assert.compareArray(key2vof, [1], "order set for key2"); -assert.sameValue(counter, 2, 'The value of counter is expected to be 2'); -assert.sameValue(new C().a(), 'A', 'new C().a() must return "A"'); -assert.sameValue(new C()[1](), 'B', 'new C()[1]() must return "B"'); -assert.sameValue(new C().c(), 'C', 'new C().c() must return "C"'); -assert.sameValue(new C()[2](), 'D', 'new C()[2]() must return "D"'); -assert.sameValue(Object.keys(C.prototype).length, 0, 'The value of Object.keys(C.prototype).length is expected to be 0'); -assert.compareArray( - Object.getOwnPropertyNames(C.prototype), ['1', '2', 'constructor', 'a', 'c'], - 'Object.getOwnPropertyNames(C.prototype) must return ["1", "2", "constructor", "a", "c"]' +assert.sameValue(counter, 2, "The value of `counter` is `2`"); +assert.sameValue(new C().a(), 'A', "`new C().a()` returns `'A'`. Defined as `a() { return 'A'; }`"); +assert.sameValue(new C()[1](), 'B', "`new C()[1]()` returns `'B'`. Defined as `[key1]() { return 'B'; }`"); +assert.sameValue(new C().c(), 'C', "`new C().c()` returns `'C'`. Defined as `c() { return 'C'; }`"); +assert.sameValue(new C()[2](), 'D', "`new C()[2]()` returns `'D'`. Defined as `[key2]() { return 'D'; }`"); +assert.sameValue(Object.keys(C.prototype).length, 0, "No enum keys from C.prototype"); +assert( + compareArray(Object.getOwnPropertyNames(C.prototype), ['1', '2', 'constructor', 'a', 'c']), + "`compareArray(Object.getOwnPropertyNames(C.prototype), ['1', '2', 'constructor', 'a', 'c'])` returns `true`" ); diff --git a/test/language/computed-property-names/to-name-side-effects/numbers-object.js b/test/language/computed-property-names/to-name-side-effects/numbers-object.js index b93a255080..edf3855c75 100644 --- a/test/language/computed-property-names/to-name-side-effects/numbers-object.js +++ b/test/language/computed-property-names/to-name-side-effects/numbers-object.js @@ -9,14 +9,14 @@ includes: [compareArray.js] var counter = 0; var key1 = { valueOf: function() { - assert.sameValue(counter++, 0, 'The result of counter++ is expected to be 0'); + assert.sameValue(counter++, 0, "The result of `counter++` is `0`"); return 1; }, toString: null }; var key2 = { valueOf: function() { - assert.sameValue(counter++, 1, 'The result of counter++ is expected to be 1'); + assert.sameValue(counter++, 1, "The result of `counter++` is `1`"); return 2; }, toString: null @@ -28,12 +28,12 @@ var object = { c: 'C', [key2]: 'D', }; -assert.sameValue(counter, 2, 'The value of counter is expected to be 2'); -assert.sameValue(object.a, 'A', 'The value of object.a is expected to be "A"'); -assert.sameValue(object[1], 'B', 'The value of object[1] is expected to be "B"'); -assert.sameValue(object.c, 'C', 'The value of object.c is expected to be "C"'); -assert.sameValue(object[2], 'D', 'The value of object[2] is expected to be "D"'); -assert.compareArray( - Object.getOwnPropertyNames(object), ['1', '2', 'a', 'c'], - 'Object.getOwnPropertyNames({a: "A", [key1]: "B", c: "C", [key2]: "D",}) must return ["1", "2", "a", "c"]' +assert.sameValue(counter, 2, "The value of `counter` is `2`"); +assert.sameValue(object.a, 'A', "The value of `object.a` is `'A'`. Defined as `a: 'A'`"); +assert.sameValue(object[1], 'B', "The value of `object[1]` is `'B'`. Defined as `[key1]: 'B'`"); +assert.sameValue(object.c, 'C', "The value of `object.c` is `'C'`. Defined as `c: 'C'`"); +assert.sameValue(object[2], 'D', "The value of `object[2]` is `'D'`. Defined as `[key2]: 'D'`"); +assert( + compareArray(Object.getOwnPropertyNames(object), ['1', '2', 'a', 'c']), + "`compareArray(Object.getOwnPropertyNames(object), ['1', '2', 'a', 'c'])` returns `true`" ); diff --git a/test/language/computed-property-names/to-name-side-effects/object.js b/test/language/computed-property-names/to-name-side-effects/object.js index cc97b69dcc..a0a3e64a11 100644 --- a/test/language/computed-property-names/to-name-side-effects/object.js +++ b/test/language/computed-property-names/to-name-side-effects/object.js @@ -9,13 +9,13 @@ includes: [compareArray.js] var counter = 0; var key1 = { toString: function() { - assert.sameValue(counter++, 0, 'The result of counter++ is expected to be 0'); + assert.sameValue(counter++, 0, "The result of `counter++` is `0`"); return 'b'; } }; var key2 = { toString: function() { - assert.sameValue(counter++, 1, 'The result of counter++ is expected to be 1'); + assert.sameValue(counter++, 1, "The result of `counter++` is `1`"); return 'd'; } }; @@ -25,12 +25,12 @@ var object = { c() { return 'C'; }, [key2]() { return 'D'; }, }; -assert.sameValue(counter, 2, 'The value of counter is expected to be 2'); -assert.sameValue(object.a(), 'A', 'object.a() must return "A"'); -assert.sameValue(object.b(), 'B', 'object.b() must return "B"'); -assert.sameValue(object.c(), 'C', 'object.c() must return "C"'); -assert.sameValue(object.d(), 'D', 'object.d() must return "D"'); -assert.compareArray( - Object.getOwnPropertyNames(object), ['a', 'b', 'c', 'd'], - 'Object.getOwnPropertyNames("{a() {return "A";}, [key1]() {return "B";}, c() {return "C";}, [key2]() {return "D";},}) must return ["a", "b", "c", "d"]' +assert.sameValue(counter, 2, "The value of `counter` is `2`"); +assert.sameValue(object.a(), 'A', "`object.a()` returns `'A'`. Defined as `a() { return 'A'; }`"); +assert.sameValue(object.b(), 'B', "`object.b()` returns `'B'`. Defined as `[key1]() { return 'B'; }`"); +assert.sameValue(object.c(), 'C', "`object.c()` returns `'C'`. Defined as `c() { return 'C'; }`"); +assert.sameValue(object.d(), 'D', "`object.d()` returns `'D'`. Defined as `[key2]() { return 'D'; }`"); +assert( + compareArray(Object.getOwnPropertyNames(object), ['a', 'b', 'c', 'd']), + "`compareArray(Object.getOwnPropertyNames(object), ['a', 'b', 'c', 'd'])` returns `true`" ); diff --git a/test/language/expressions/array/spread-obj-spread-order.js b/test/language/expressions/array/spread-obj-spread-order.js index a06c7abc64..080baa18fc 100644 --- a/test/language/expressions/array/spread-obj-spread-order.js +++ b/test/language/expressions/array/spread-obj-spread-order.js @@ -42,7 +42,7 @@ Object.defineProperty(o, Symbol('foo'), { get: () => { calls.push("Symbol(foo)") var callCount = 0; (function(obj) { - assert.compareArray(calls, [1, 'z', 'a', "Symbol(foo)"]); + assert(compareArray(calls, [1, 'z', 'a', "Symbol(foo)"])); assert.sameValue(Object.keys(obj).length, 3); callCount += 1; }.apply(null, [{...o}])); diff --git a/test/language/expressions/assignment/dstr/obj-rest-order.js b/test/language/expressions/assignment/dstr/obj-rest-order.js index df8a6ec6ab..bf5a148e49 100644 --- a/test/language/expressions/assignment/dstr/obj-rest-order.js +++ b/test/language/expressions/assignment/dstr/obj-rest-order.js @@ -27,7 +27,7 @@ var vals = o; result = {...rest} = vals; -assert.compareArray(calls, [1, 'z', 'a', "Symbol(foo)"]); +assert(compareArray(calls, [1, 'z', 'a', "Symbol(foo)"])); assert.sameValue(Object.keys(rest).length, 3); assert.sameValue(result, vals); diff --git a/test/language/expressions/async-generator/named-yield-spread-arr-multiple.js b/test/language/expressions/async-generator/named-yield-spread-arr-multiple.js index 11e10dbb86..56c3a3cdf7 100644 --- a/test/language/expressions/async-generator/named-yield-spread-arr-multiple.js +++ b/test/language/expressions/async-generator/named-yield-spread-arr-multiple.js @@ -41,7 +41,7 @@ item.then(({ done, value }) => { item = iter.next(value); item.then(({ done, value }) => { - assert.compareArray(value, arr); + assert(compareArray(value, arr)); assert.sameValue(done, false); }).then($DONE, $DONE); }).catch($DONE); diff --git a/test/language/expressions/async-generator/yield-spread-arr-multiple.js b/test/language/expressions/async-generator/yield-spread-arr-multiple.js index fd4fa26270..fff1129daf 100644 --- a/test/language/expressions/async-generator/yield-spread-arr-multiple.js +++ b/test/language/expressions/async-generator/yield-spread-arr-multiple.js @@ -41,7 +41,7 @@ item.then(({ done, value }) => { item = iter.next(value); item.then(({ done, value }) => { - assert.compareArray(value, arr); + assert(compareArray(value, arr)); assert.sameValue(done, false); }).then($DONE, $DONE); }).catch($DONE); diff --git a/test/language/expressions/call/spread-obj-spread-order.js b/test/language/expressions/call/spread-obj-spread-order.js index 6935edf58a..3e384fff32 100644 --- a/test/language/expressions/call/spread-obj-spread-order.js +++ b/test/language/expressions/call/spread-obj-spread-order.js @@ -40,7 +40,7 @@ Object.defineProperty(o, Symbol('foo'), { get: () => { calls.push("Symbol(foo)") var callCount = 0; (function(obj) { - assert.compareArray(calls, [1, 'z', 'a', "Symbol(foo)"]); + assert(compareArray(calls, [1, 'z', 'a', "Symbol(foo)"])); assert.sameValue(Object.keys(obj).length, 3); callCount += 1; }({...o})); diff --git a/test/language/expressions/class/async-gen-method-static/yield-spread-arr-multiple.js b/test/language/expressions/class/async-gen-method-static/yield-spread-arr-multiple.js index 24b91300b0..fc3d81a4ea 100644 --- a/test/language/expressions/class/async-gen-method-static/yield-spread-arr-multiple.js +++ b/test/language/expressions/class/async-gen-method-static/yield-spread-arr-multiple.js @@ -48,7 +48,7 @@ item.then(({ done, value }) => { item = iter.next(value); item.then(({ done, value }) => { - assert.compareArray(value, arr); + assert(compareArray(value, arr)); assert.sameValue(done, false); }).then($DONE, $DONE); }).catch($DONE); diff --git a/test/language/expressions/class/async-gen-method/yield-spread-arr-multiple.js b/test/language/expressions/class/async-gen-method/yield-spread-arr-multiple.js index bd64e1ed4a..a05af12200 100644 --- a/test/language/expressions/class/async-gen-method/yield-spread-arr-multiple.js +++ b/test/language/expressions/class/async-gen-method/yield-spread-arr-multiple.js @@ -48,7 +48,7 @@ item.then(({ done, value }) => { item = iter.next(value); item.then(({ done, value }) => { - assert.compareArray(value, arr); + assert(compareArray(value, arr)); assert.sameValue(done, false); }).then($DONE, $DONE); }).catch($DONE); diff --git a/test/language/expressions/class/elements/async-gen-private-method-static/yield-spread-arr-multiple.js b/test/language/expressions/class/elements/async-gen-private-method-static/yield-spread-arr-multiple.js index 10701c2996..ca2490c4c7 100644 --- a/test/language/expressions/class/elements/async-gen-private-method-static/yield-spread-arr-multiple.js +++ b/test/language/expressions/class/elements/async-gen-private-method-static/yield-spread-arr-multiple.js @@ -53,7 +53,7 @@ item.then(({ done, value }) => { item = iter.next(value); item.then(({ done, value }) => { - assert.compareArray(value, arr); + assert(compareArray(value, arr)); assert.sameValue(done, false); }).then($DONE, $DONE); }).catch($DONE); diff --git a/test/language/expressions/class/elements/async-gen-private-method/yield-spread-arr-multiple.js b/test/language/expressions/class/elements/async-gen-private-method/yield-spread-arr-multiple.js index 4b4797839d..3ddff189c4 100644 --- a/test/language/expressions/class/elements/async-gen-private-method/yield-spread-arr-multiple.js +++ b/test/language/expressions/class/elements/async-gen-private-method/yield-spread-arr-multiple.js @@ -56,7 +56,7 @@ item.then(({ done, value }) => { item = iter.next(value); item.then(({ done, value }) => { - assert.compareArray(value, arr); + assert(compareArray(value, arr)); assert.sameValue(done, false); }).then($DONE, $DONE); }).catch($DONE); diff --git a/test/language/expressions/class/elements/gen-private-method-static/yield-spread-arr-multiple.js b/test/language/expressions/class/elements/gen-private-method-static/yield-spread-arr-multiple.js index 91dd516f50..22d1d6ce7a 100644 --- a/test/language/expressions/class/elements/gen-private-method-static/yield-spread-arr-multiple.js +++ b/test/language/expressions/class/elements/gen-private-method-static/yield-spread-arr-multiple.js @@ -49,7 +49,7 @@ iter.next(false); item = iter.next(['a', 'b', 'c']); item = iter.next(item.value); -assert.compareArray(item.value, arr); +assert(compareArray(item.value, arr)); assert.sameValue(item.done, false); assert.sameValue(callCount, 1); diff --git a/test/language/expressions/class/elements/gen-private-method/yield-spread-arr-multiple.js b/test/language/expressions/class/elements/gen-private-method/yield-spread-arr-multiple.js index 40f919db04..51dbe6425c 100644 --- a/test/language/expressions/class/elements/gen-private-method/yield-spread-arr-multiple.js +++ b/test/language/expressions/class/elements/gen-private-method/yield-spread-arr-multiple.js @@ -52,7 +52,7 @@ iter.next(false); item = iter.next(['a', 'b', 'c']); item = iter.next(item.value); -assert.compareArray(item.value, arr); +assert(compareArray(item.value, arr)); assert.sameValue(item.done, false); assert.sameValue(callCount, 1); diff --git a/test/language/expressions/class/elements/redeclaration-symbol.js b/test/language/expressions/class/elements/redeclaration-symbol.js index 5268fe2774..48c7949f9e 100644 --- a/test/language/expressions/class/elements/redeclaration-symbol.js +++ b/test/language/expressions/class/elements/redeclaration-symbol.js @@ -52,4 +52,4 @@ verifyProperty(c, y, { configurable: true }); -assert.compareArray(x, ["a", "b", "c"]); +assert(compareArray(x, ["a", "b", "c"])); diff --git a/test/language/expressions/class/elements/redeclaration.js b/test/language/expressions/class/elements/redeclaration.js index 131ed05b40..5e78204678 100644 --- a/test/language/expressions/class/elements/redeclaration.js +++ b/test/language/expressions/class/elements/redeclaration.js @@ -52,4 +52,4 @@ verifyProperty(c, "y", { configurable: true }); -assert.compareArray(x, ["a", "b", "c", "d"]); +assert(compareArray(x, ["a", "b", "c", "d"])); diff --git a/test/language/expressions/class/gen-method-static/yield-spread-arr-multiple.js b/test/language/expressions/class/gen-method-static/yield-spread-arr-multiple.js index e0fea8c63a..305a03657f 100644 --- a/test/language/expressions/class/gen-method-static/yield-spread-arr-multiple.js +++ b/test/language/expressions/class/gen-method-static/yield-spread-arr-multiple.js @@ -44,7 +44,7 @@ iter.next(false); item = iter.next(['a', 'b', 'c']); item = iter.next(item.value); -assert.compareArray(item.value, arr); +assert(compareArray(item.value, arr)); assert.sameValue(item.done, false); assert.sameValue(callCount, 1); diff --git a/test/language/expressions/class/gen-method/yield-spread-arr-multiple.js b/test/language/expressions/class/gen-method/yield-spread-arr-multiple.js index 0ccb87a616..ef993275aa 100644 --- a/test/language/expressions/class/gen-method/yield-spread-arr-multiple.js +++ b/test/language/expressions/class/gen-method/yield-spread-arr-multiple.js @@ -44,7 +44,7 @@ iter.next(false); item = iter.next(['a', 'b', 'c']); item = iter.next(item.value); -assert.compareArray(item.value, arr); +assert(compareArray(item.value, arr)); assert.sameValue(item.done, false); assert.sameValue(callCount, 1); diff --git a/test/language/expressions/generators/named-yield-spread-arr-multiple.js b/test/language/expressions/generators/named-yield-spread-arr-multiple.js index c34cd63ae9..2dbbe051a2 100644 --- a/test/language/expressions/generators/named-yield-spread-arr-multiple.js +++ b/test/language/expressions/generators/named-yield-spread-arr-multiple.js @@ -36,7 +36,7 @@ iter.next(false); item = iter.next(['a', 'b', 'c']); item = iter.next(item.value); -assert.compareArray(item.value, arr); +assert(compareArray(item.value, arr)); assert.sameValue(item.done, false); assert.sameValue(callCount, 1); diff --git a/test/language/expressions/generators/yield-spread-arr-multiple.js b/test/language/expressions/generators/yield-spread-arr-multiple.js index 81f4479326..c0b000c87b 100644 --- a/test/language/expressions/generators/yield-spread-arr-multiple.js +++ b/test/language/expressions/generators/yield-spread-arr-multiple.js @@ -36,7 +36,7 @@ iter.next(false); item = iter.next(['a', 'b', 'c']); item = iter.next(item.value); -assert.compareArray(item.value, arr); +assert(compareArray(item.value, arr)); assert.sameValue(item.done, false); assert.sameValue(callCount, 1); diff --git a/test/language/expressions/new/spread-obj-spread-order.js b/test/language/expressions/new/spread-obj-spread-order.js index 6c050bd2a0..4ec1e1ed3a 100644 --- a/test/language/expressions/new/spread-obj-spread-order.js +++ b/test/language/expressions/new/spread-obj-spread-order.js @@ -39,7 +39,7 @@ Object.defineProperty(o, Symbol('foo'), { get: () => { calls.push("Symbol(foo)") var callCount = 0; new function(obj) { - assert.compareArray(calls, [1, 'z', 'a', "Symbol(foo)"]); + assert(compareArray(calls, [1, 'z', 'a', "Symbol(foo)"])); assert.sameValue(Object.keys(obj).length, 3); callCount += 1; }({...o}); diff --git a/test/language/expressions/object/method-definition/async-gen-yield-spread-arr-multiple.js b/test/language/expressions/object/method-definition/async-gen-yield-spread-arr-multiple.js index 7e669e71ef..984ce0c113 100644 --- a/test/language/expressions/object/method-definition/async-gen-yield-spread-arr-multiple.js +++ b/test/language/expressions/object/method-definition/async-gen-yield-spread-arr-multiple.js @@ -41,7 +41,7 @@ item.then(({ done, value }) => { item = iter.next(value); item.then(({ done, value }) => { - assert.compareArray(value, arr); + assert(compareArray(value, arr)); assert.sameValue(done, false); }).then($DONE, $DONE); }).catch($DONE); diff --git a/test/language/expressions/object/method-definition/gen-yield-spread-arr-multiple.js b/test/language/expressions/object/method-definition/gen-yield-spread-arr-multiple.js index fe86bf3141..ccff04c90c 100644 --- a/test/language/expressions/object/method-definition/gen-yield-spread-arr-multiple.js +++ b/test/language/expressions/object/method-definition/gen-yield-spread-arr-multiple.js @@ -38,7 +38,7 @@ iter.next(false); item = iter.next(['a', 'b', 'c']); item = iter.next(item.value); -assert.compareArray(item.value, arr); +assert(compareArray(item.value, arr)); assert.sameValue(item.done, false); assert.sameValue(callCount, 1); diff --git a/test/language/expressions/super/call-spread-obj-spread-order.js b/test/language/expressions/super/call-spread-obj-spread-order.js index 77241c898f..50fbf388e2 100644 --- a/test/language/expressions/super/call-spread-obj-spread-order.js +++ b/test/language/expressions/super/call-spread-obj-spread-order.js @@ -38,7 +38,7 @@ var callCount = 0; class Test262ParentClass { constructor(obj) { - assert.compareArray(calls, [1, 'z', 'a', "Symbol(foo)"]); + assert(compareArray(calls, [1, 'z', 'a', "Symbol(foo)"])); assert.sameValue(Object.keys(obj).length, 3); callCount += 1; } diff --git a/test/language/module-code/namespace/internals/define-own-property.js b/test/language/module-code/namespace/internals/define-own-property.js index 471e625dfe..0d61cbdd08 100644 --- a/test/language/module-code/namespace/internals/define-own-property.js +++ b/test/language/module-code/namespace/internals/define-own-property.js @@ -25,11 +25,11 @@ for (const key of ['local2', 0, sym, Symbol.iterator]) { assert.sameValue( Reflect.defineProperty(ns, key, {}), false, - 'Reflect.defineProperty(ns, , {}) must return false' + 'Reflect.defineProperty: ' + key.toString() ); assert.throws(TypeError, function() { Object.defineProperty(ns, key, {}); - }, 'Object.defineProperty(ns, key, {}) throws a TypeError exception'); + }, 'Object.defineProperty: ' + key.toString()); } @@ -39,12 +39,12 @@ for (const key of ([...exported, Symbol.toStringTag])) { assert.sameValue( Reflect.defineProperty(ns, key, {}), true, - 'Reflect.defineProperty(ns, , {}) must return true' + 'Reflect.defineProperty: ' + key.toString() ); assert.sameValue( Object.defineProperty(ns, key, {}), ns, - 'Object.defineProperty(ns, , {}) returns ns' + 'Object.defineProperty: ' + key.toString() ); } @@ -53,13 +53,13 @@ assert.sameValue( Reflect.defineProperty(ns, 'indirect', {writable: true, enumerable: true, configurable: false}), true, - 'Reflect.defineProperty(ns, "indirect", {writable: true, enumerable: true, configurable: false}) must return true' + 'Reflect.defineProperty: indirect' ); assert.sameValue( Object.defineProperty(ns, 'indirect', {writable: true, enumerable: true, configurable: false}), ns, - 'Object.defineProperty(ns, "indirect", {writable: true, enumerable: true, configurable: false}) returns ns' + 'Object.defineProperty: indirect' ); assert.sameValue( @@ -67,14 +67,14 @@ assert.sameValue( {value: "Module", writable: false, enumerable: false, configurable: false}), true, - 'Reflect.defineProperty( ns, Symbol.toStringTag, {value: "Module", writable: false, enumerable: false, configurable: false} ) must return true' + 'Reflect.defineProperty: Symbol.toStringTag' ); assert.sameValue( Object.defineProperty(ns, Symbol.toStringTag, {value: "Module", writable: false, enumerable: false, configurable: false}), ns, - 'Object.defineProperty( ns, Symbol.toStringTag, {value: "Module", writable: false, enumerable: false, configurable: false} ) returns ns' + 'Object.defineProperty: Symbol.toStringTag' ); @@ -84,33 +84,54 @@ for (const key of ([...exported, Symbol.toStringTag])) { assert.sameValue( Reflect.defineProperty(ns, key, {value: 123}), false, - 'Reflect.defineProperty(ns, , {value: 123}) must return false' + 'Reflect.defineProperty: ' + key.toString() ); assert.throws(TypeError, function() { Object.defineProperty(ns, key, {value: 123}); - }, 'Object.defineProperty(ns, key, {value: 123}) throws a TypeError exception'); + }, 'Object.defineProperty: ' + key.toString()); } assert.sameValue( Reflect.defineProperty(ns, 'indirect', {writable: true, enumerable: true, configurable: true}), false, - 'Reflect.defineProperty(ns, "indirect", {writable: true, enumerable: true, configurable: true}) must return false' + 'Reflect.defineProperty: indirect' ); assert.throws(TypeError, function() { Object.defineProperty(ns, 'indirect', {writable: true, enumerable: true, configurable: true}); -}, 'Object.defineProperty(ns, "indirect", {writable: true, enumerable: true, configurable: true}) throws a TypeError exception'); +}, 'Object.defineProperty: indirect'); assert.sameValue( Reflect.defineProperty(ns, Symbol.toStringTag, {value: "module", writable: false, enumerable: false, configurable: false}), false, - 'Reflect.defineProperty( ns, Symbol.toStringTag, {value: "module", writable: false, enumerable: false, configurable: false} ) must return false' + 'Reflect.defineProperty: Symbol.toStringTag' ); assert.throws(TypeError, function() { Object.defineProperty(ns, Symbol.toStringTag, {value: "module", writable: false, enumerable: false, configurable: false}); -}, 'Object.defineProperty(ns, Symbol.toStringTag, {value: "module", writable: false, enumerable: false, configurable: false}) throws a TypeError exception'); +}, 'Object.defineProperty: Symbol.toStringTag'); + + +// Indirect change requested through Object.freeze + +// Try freezing more times than there are exported properties +for (let i = 1; i < exported.length + 2; i++) { + assert.throws( + TypeError, + function () { + Object.freeze(ns); + }, + "Object.freeze: " + String(i) + ); +} + +for (const key of exported) { + const desc = Object.getOwnPropertyDescriptor(ns, key); + assert.sameValue(desc.writable, true, String(key) + " writable"); +} + +assert(!Object.isFrozen(ns), "namespace object not frozen"); diff --git a/test/language/rest-parameters/arrow-function.js b/test/language/rest-parameters/arrow-function.js index e0bd1c8aa3..b7c922e33e 100644 --- a/test/language/rest-parameters/arrow-function.js +++ b/test/language/rest-parameters/arrow-function.js @@ -8,26 +8,10 @@ includes: [compareArray.js] ---*/ var fn = (a, b, ...c) => c; -assert.compareArray(fn(), [], 'fn() must return []'); -assert.compareArray(fn(1, 2), [], 'fn(1, 2) must return []'); -assert.compareArray(fn(1, 2, 3), [3], 'fn(1, 2, 3) must return [3]'); -assert.compareArray( - fn(1, 2, 3, 4), - [3, 4], - 'fn(1, 2, 3, 4) must return [3, 4]' -); -assert.compareArray( - fn(1, 2, 3, 4, 5), - [3, 4, 5], - 'fn(1, 2, 3, 4, 5) must return [3, 4, 5]' -); -assert.compareArray( - ((...args) => args)(), - [], - '((...args) => args)() must return []' -); -assert.compareArray( - ((...args) => args)(1,2,3), - [1,2,3], - '((...args) => args)(1, 2, 3) must return [1,2,3]' -); +assert(compareArray(fn(), []), "`compareArray(fn(), [])` returns `true`"); +assert(compareArray(fn(1, 2), []), "`compareArray(fn(1, 2), [])` returns `true`"); +assert(compareArray(fn(1, 2, 3), [3]),"`compareArray(fn(1, 2, 3), [3])` returns `true`"); +assert(compareArray(fn(1, 2, 3, 4), [3, 4]),"`compareArray(fn(1, 2, 3, 4), [3, 4])` returns `true`"); +assert(compareArray(fn(1, 2, 3, 4, 5), [3, 4, 5]),"`compareArray(fn(1, 2, 3, 4, 5), [3, 4, 5])` returns `true`"); +assert(compareArray(((...args) => args)(), []),"`compareArray(((...args) => args)(), [])` returns `true`"); +assert(compareArray(((...args) => args)(1,2,3), [1,2,3]),"`compareArray(((...args) => args)(1,2,3), [1,2,3])` returns `true`"); diff --git a/test/language/rest-parameters/no-alias-arguments.js b/test/language/rest-parameters/no-alias-arguments.js index 99ab432d8f..e35165f0ad 100644 --- a/test/language/rest-parameters/no-alias-arguments.js +++ b/test/language/rest-parameters/no-alias-arguments.js @@ -8,8 +8,8 @@ includes: [compareArray.js] ---*/ function f(a, ...rest) { arguments[0] = 1; - assert.sameValue(a, 3, 'The value of a is expected to be 3'); + assert.sameValue(a, 3, "The value of `a` is `3`"); arguments[1] = 2; - assert.compareArray(rest, [4, 5], 'The value of rest is expected to be [4, 5]'); + assert(compareArray(rest, [4, 5]), "`compareArray(rest, [4, 5])` returns `true`"); } f(3, 4, 5); diff --git a/test/language/rest-parameters/with-new-target.js b/test/language/rest-parameters/with-new-target.js index 773d69738c..209f904f06 100644 --- a/test/language/rest-parameters/with-new-target.js +++ b/test/language/rest-parameters/with-new-target.js @@ -11,14 +11,14 @@ class Base { assert.sameValue( arguments.length, a.length, - 'The value of arguments.length is expected to equal the value of a.length' + "The value of `arguments.length` is `a.length`" ); this.base = a; var args = []; for (var i = 0; i < arguments.length; ++i) { args.push(arguments[i]); } - assert.compareArray(args, a, 'The value of args is expected to equal the value of a'); + assert(compareArray(args, a), "`compareArray(args, a)` returns `true`"); } } class Child extends Base { @@ -27,27 +27,27 @@ class Child extends Base { assert.sameValue( arguments.length, b.length, - 'The value of arguments.length is expected to equal the value of b.length' + "The value of `arguments.length` is `b.length`" ); this.child = b; var args = []; for (var i = 0; i < arguments.length; ++i) { args.push(arguments[i]); } - assert.compareArray(args, b, 'The value of args is expected to equal the value of b'); + assert(compareArray(args, b), "`compareArray(args, b)` returns `true`"); } } var c = new Child(1, 2, 3); -assert.sameValue(c.child.length, 3, 'The value of c.child.length is expected to be 3'); -assert.sameValue(c.base.length, 3, 'The value of c.base.length is expected to be 3'); +assert.sameValue(c.child.length, 3, "The value of `c.child.length` is `3`"); +assert.sameValue(c.base.length, 3, "The value of `c.base.length` is `3`"); -assert.compareArray( - c.child, [1, 2, 3], - 'The value of c.child is expected to be [1, 2, 3]' +assert( + compareArray(c.child, [1, 2, 3]), + "`compareArray(c.child, [1, 2, 3])` returns `true`" ); -assert.compareArray( - c.base, [1, 2, 3], - 'The value of c.base is expected to be [1, 2, 3]' +assert( + compareArray(c.base, [1, 2, 3]), + "`compareArray(c.base, [1, 2, 3])` returns `true`" ); diff --git a/test/language/statements/async-generator/yield-spread-arr-multiple.js b/test/language/statements/async-generator/yield-spread-arr-multiple.js index 747969f873..f8a500feb8 100644 --- a/test/language/statements/async-generator/yield-spread-arr-multiple.js +++ b/test/language/statements/async-generator/yield-spread-arr-multiple.js @@ -41,7 +41,7 @@ item.then(({ done, value }) => { item = iter.next(value); item.then(({ done, value }) => { - assert.compareArray(value, arr); + assert(compareArray(value, arr)); assert.sameValue(done, false); }).then($DONE, $DONE); }).catch($DONE); diff --git a/test/language/statements/class/async-gen-method-static/yield-spread-arr-multiple.js b/test/language/statements/class/async-gen-method-static/yield-spread-arr-multiple.js index 3bdc400747..4226899aff 100644 --- a/test/language/statements/class/async-gen-method-static/yield-spread-arr-multiple.js +++ b/test/language/statements/class/async-gen-method-static/yield-spread-arr-multiple.js @@ -48,7 +48,7 @@ item.then(({ done, value }) => { item = iter.next(value); item.then(({ done, value }) => { - assert.compareArray(value, arr); + assert(compareArray(value, arr)); assert.sameValue(done, false); }).then($DONE, $DONE); }).catch($DONE); diff --git a/test/language/statements/class/async-gen-method/yield-spread-arr-multiple.js b/test/language/statements/class/async-gen-method/yield-spread-arr-multiple.js index 8a05c73c9a..2ae6c7bba6 100644 --- a/test/language/statements/class/async-gen-method/yield-spread-arr-multiple.js +++ b/test/language/statements/class/async-gen-method/yield-spread-arr-multiple.js @@ -48,7 +48,7 @@ item.then(({ done, value }) => { item = iter.next(value); item.then(({ done, value }) => { - assert.compareArray(value, arr); + assert(compareArray(value, arr)); assert.sameValue(done, false); }).then($DONE, $DONE); }).catch($DONE); diff --git a/test/language/statements/class/definition/fn-length-static-precedence-order.js b/test/language/statements/class/definition/fn-length-static-precedence-order.js index 3ff681d84e..6aa57673a2 100644 --- a/test/language/statements/class/definition/fn-length-static-precedence-order.js +++ b/test/language/statements/class/definition/fn-length-static-precedence-order.js @@ -33,11 +33,7 @@ class A { } } -assert.compareArray( - Object.getOwnPropertyNames(A), - ['length', 'name', 'prototype', 'method'], - 'Object.getOwnPropertyNames(A) must return ["length", "name", "prototype", "method"]' -) +assert(compareArray(Object.getOwnPropertyNames(A), ['length', 'name', 'prototype', 'method'])) var attr = 'length'; class B { @@ -49,11 +45,7 @@ class B { } } -assert.compareArray( - Object.getOwnPropertyNames(B), - ['length', 'name', 'prototype'], - 'Object.getOwnPropertyNames(B) must return ["length", "name", "prototype"]' -) +assert(compareArray(Object.getOwnPropertyNames(B), ['length', 'name', 'prototype'])) class C { static get length() { @@ -61,11 +53,7 @@ class C { } } -assert.compareArray( - Object.getOwnPropertyNames(C), - ['length', 'name', 'prototype'], - 'Object.getOwnPropertyNames(C) must return ["length", "name", "prototype"]' -) +assert(compareArray(Object.getOwnPropertyNames(C), ['length', 'name', 'prototype'])) class D { static set length(_) { @@ -73,11 +61,7 @@ class D { } } -assert.compareArray( - Object.getOwnPropertyNames(D), - ['length', 'name', 'prototype'], - 'Object.getOwnPropertyNames(D) must return ["length", "name", "prototype"]' -) +assert(compareArray(Object.getOwnPropertyNames(D), ['length', 'name', 'prototype'])) class E { static *length() { @@ -85,8 +69,4 @@ class E { } } -assert.compareArray( - Object.getOwnPropertyNames(E), - ['length', 'name', 'prototype'], - 'Object.getOwnPropertyNames(E) must return ["length", "name", "prototype"]' -) +assert(compareArray(Object.getOwnPropertyNames(E), ['length', 'name', 'prototype'])) diff --git a/test/language/statements/class/definition/fn-name-static-precedence-order.js b/test/language/statements/class/definition/fn-name-static-precedence-order.js index 902d0fbd0c..4612767b6e 100644 --- a/test/language/statements/class/definition/fn-name-static-precedence-order.js +++ b/test/language/statements/class/definition/fn-name-static-precedence-order.js @@ -30,11 +30,7 @@ class A { } } -assert.compareArray( - Object.getOwnPropertyNames(A), - ['length', 'name', 'prototype', 'method'], - 'Object.getOwnPropertyNames(A) must return ["length", "name", "prototype", "method"]' -); +assert(compareArray(Object.getOwnPropertyNames(A), ['length', 'name', 'prototype', 'method'])) var attr = 'name'; class B { @@ -46,11 +42,7 @@ class B { } } -assert.compareArray( - Object.getOwnPropertyNames(B), - ['length', 'name', 'prototype'], - 'Object.getOwnPropertyNames(B) must return ["length", "name", "prototype"]' -); +assert(compareArray(Object.getOwnPropertyNames(B), ['length', 'name', 'prototype'])) class C { static get name() { @@ -58,11 +50,7 @@ class C { } } -assert.compareArray( - Object.getOwnPropertyNames(C), - ['length', 'name', 'prototype'], - 'Object.getOwnPropertyNames(C) must return ["length", "name", "prototype"]' -); +assert(compareArray(Object.getOwnPropertyNames(C), ['length', 'name', 'prototype'])) class D { static set name(_) { @@ -70,11 +58,7 @@ class D { } } -assert.compareArray( - Object.getOwnPropertyNames(D), - ['length', 'name', 'prototype'], - 'Object.getOwnPropertyNames(D) must return ["length", "name", "prototype"]' -); +assert(compareArray(Object.getOwnPropertyNames(D), ['length', 'name', 'prototype'])) class E { static *name() { @@ -82,8 +66,4 @@ class E { } } -assert.compareArray( - Object.getOwnPropertyNames(E), - ['length', 'name', 'prototype'], - 'Object.getOwnPropertyNames(E) must return ["length", "name", "prototype"]' -); +assert(compareArray(Object.getOwnPropertyNames(E), ['length', 'name', 'prototype'])) diff --git a/test/language/statements/class/elements/async-gen-private-method-static/yield-spread-arr-multiple.js b/test/language/statements/class/elements/async-gen-private-method-static/yield-spread-arr-multiple.js index cf8185e09b..9afb0c202c 100644 --- a/test/language/statements/class/elements/async-gen-private-method-static/yield-spread-arr-multiple.js +++ b/test/language/statements/class/elements/async-gen-private-method-static/yield-spread-arr-multiple.js @@ -53,7 +53,7 @@ item.then(({ done, value }) => { item = iter.next(value); item.then(({ done, value }) => { - assert.compareArray(value, arr); + assert(compareArray(value, arr)); assert.sameValue(done, false); }).then($DONE, $DONE); }).catch($DONE); diff --git a/test/language/statements/class/elements/async-gen-private-method/yield-spread-arr-multiple.js b/test/language/statements/class/elements/async-gen-private-method/yield-spread-arr-multiple.js index 6430030664..45644af5da 100644 --- a/test/language/statements/class/elements/async-gen-private-method/yield-spread-arr-multiple.js +++ b/test/language/statements/class/elements/async-gen-private-method/yield-spread-arr-multiple.js @@ -56,7 +56,7 @@ item.then(({ done, value }) => { item = iter.next(value); item.then(({ done, value }) => { - assert.compareArray(value, arr); + assert(compareArray(value, arr)); assert.sameValue(done, false); }).then($DONE, $DONE); }).catch($DONE); diff --git a/test/language/statements/class/elements/gen-private-method-static/yield-spread-arr-multiple.js b/test/language/statements/class/elements/gen-private-method-static/yield-spread-arr-multiple.js index 9a097b5ba3..c8f989297d 100644 --- a/test/language/statements/class/elements/gen-private-method-static/yield-spread-arr-multiple.js +++ b/test/language/statements/class/elements/gen-private-method-static/yield-spread-arr-multiple.js @@ -49,7 +49,7 @@ iter.next(false); item = iter.next(['a', 'b', 'c']); item = iter.next(item.value); -assert.compareArray(item.value, arr); +assert(compareArray(item.value, arr)); assert.sameValue(item.done, false); assert.sameValue(callCount, 1); diff --git a/test/language/statements/class/elements/gen-private-method/yield-spread-arr-multiple.js b/test/language/statements/class/elements/gen-private-method/yield-spread-arr-multiple.js index 9e49a38c0c..1725a9b35c 100644 --- a/test/language/statements/class/elements/gen-private-method/yield-spread-arr-multiple.js +++ b/test/language/statements/class/elements/gen-private-method/yield-spread-arr-multiple.js @@ -52,7 +52,7 @@ iter.next(false); item = iter.next(['a', 'b', 'c']); item = iter.next(item.value); -assert.compareArray(item.value, arr); +assert(compareArray(item.value, arr)); assert.sameValue(item.done, false); assert.sameValue(callCount, 1); diff --git a/test/language/statements/class/elements/redeclaration-symbol.js b/test/language/statements/class/elements/redeclaration-symbol.js index 6726e9b49c..b410a423a7 100644 --- a/test/language/statements/class/elements/redeclaration-symbol.js +++ b/test/language/statements/class/elements/redeclaration-symbol.js @@ -52,4 +52,4 @@ verifyProperty(c, y, { configurable: true }); -assert.compareArray(x, ["a", "b", "c"]); +assert(compareArray(x, ["a", "b", "c"])); diff --git a/test/language/statements/class/elements/redeclaration.js b/test/language/statements/class/elements/redeclaration.js index c3fc519c3d..f3452b86bf 100644 --- a/test/language/statements/class/elements/redeclaration.js +++ b/test/language/statements/class/elements/redeclaration.js @@ -52,4 +52,4 @@ verifyProperty(c, "y", { configurable: true }); -assert.compareArray(x, ["a", "b", "c", "d"]); +assert(compareArray(x, ["a", "b", "c", "d"])); diff --git a/test/language/statements/class/gen-method-static/yield-spread-arr-multiple.js b/test/language/statements/class/gen-method-static/yield-spread-arr-multiple.js index 1e028ece7f..458f5fac59 100644 --- a/test/language/statements/class/gen-method-static/yield-spread-arr-multiple.js +++ b/test/language/statements/class/gen-method-static/yield-spread-arr-multiple.js @@ -44,7 +44,7 @@ iter.next(false); item = iter.next(['a', 'b', 'c']); item = iter.next(item.value); -assert.compareArray(item.value, arr); +assert(compareArray(item.value, arr)); assert.sameValue(item.done, false); assert.sameValue(callCount, 1); diff --git a/test/language/statements/class/gen-method/yield-spread-arr-multiple.js b/test/language/statements/class/gen-method/yield-spread-arr-multiple.js index 866167e81f..0c33747403 100644 --- a/test/language/statements/class/gen-method/yield-spread-arr-multiple.js +++ b/test/language/statements/class/gen-method/yield-spread-arr-multiple.js @@ -44,7 +44,7 @@ iter.next(false); item = iter.next(['a', 'b', 'c']); item = iter.next(item.value); -assert.compareArray(item.value, arr); +assert(compareArray(item.value, arr)); assert.sameValue(item.done, false); assert.sameValue(callCount, 1); diff --git a/test/language/statements/class/static-init-arguments-functions.js b/test/language/statements/class/static-init-arguments-functions.js index 152d6f535b..19aefb2234 100644 --- a/test/language/statements/class/static-init-arguments-functions.js +++ b/test/language/statements/class/static-init-arguments-functions.js @@ -32,9 +32,9 @@ class C { } } -assert.compareArray(['function'], fn, 'body'); -assert.compareArray(['function'], fnParam, 'parameter'); -assert.compareArray(['generator function'], gen, 'body'); -assert.compareArray(['generator function'], genParam, 'parameter'); -assert.compareArray(['async function'], asyncFn, 'body'); -assert.compareArray(['async function'], asyncFnParam, 'parameter'); +assert(compareArray(['function'], fn), 'body'); +assert(compareArray(['function'], fnParam), 'parameter'); +assert(compareArray(['generator function'], gen), 'body'); +assert(compareArray(['generator function'], genParam), 'parameter'); +assert(compareArray(['async function'], asyncFn), 'body'); +assert(compareArray(['async function'], asyncFnParam), 'parameter'); diff --git a/test/language/statements/class/static-init-arguments-methods.js b/test/language/statements/class/static-init-arguments-methods.js index 1ef423dc39..66862156d9 100644 --- a/test/language/statements/class/static-init-arguments-methods.js +++ b/test/language/statements/class/static-init-arguments-methods.js @@ -47,12 +47,12 @@ instance.accessor = 'setter'; instance.gen('generator method').next(); instance.async('async method'); -assert.compareArray(['method'], method, 'body'); -assert.compareArray(['method'], methodParam, 'parameter'); -assert.compareArray([], getter, 'body'); -assert.compareArray(['setter'], setter, 'body'); -assert.compareArray(['setter'], setterParam, 'parameter'); -assert.compareArray(['generator method'], genMethod, 'body'); -assert.compareArray(['generator method'], genMethodParam, 'parameter'); -assert.compareArray(['async method'], asyncMethod, 'body'); -assert.compareArray(['async method'], asyncMethodParam, 'parameter'); +assert(compareArray(['method'], method), 'body'); +assert(compareArray(['method'], methodParam), 'parameter'); +assert(compareArray([], getter), 'body'); +assert(compareArray(['setter'], setter), 'body'); +assert(compareArray(['setter'], setterParam), 'parameter'); +assert(compareArray(['generator method'], genMethod), 'body'); +assert(compareArray(['generator method'], genMethodParam), 'parameter'); +assert(compareArray(['async method'], asyncMethod), 'body'); +assert(compareArray(['async method'], asyncMethodParam), 'parameter'); diff --git a/test/language/statements/class/subclass/builtin-objects/Array/contructor-calls-super-multiple-arguments.js b/test/language/statements/class/subclass/builtin-objects/Array/contructor-calls-super-multiple-arguments.js index e75441054e..fe92330aa2 100644 --- a/test/language/statements/class/subclass/builtin-objects/Array/contructor-calls-super-multiple-arguments.js +++ b/test/language/statements/class/subclass/builtin-objects/Array/contructor-calls-super-multiple-arguments.js @@ -23,4 +23,4 @@ class Sub extends Array { var sub = new Sub(42, 'foo'); -assert.compareArray(sub, [42, 'foo'], 'The value of sub is expected to be [42, "foo"]'); +assert(compareArray(sub, [42, 'foo'])); diff --git a/test/language/statements/class/subclass/builtin-objects/Array/regular-subclassing.js b/test/language/statements/class/subclass/builtin-objects/Array/regular-subclassing.js index 2bb8ac1c2a..ec0b752798 100644 --- a/test/language/statements/class/subclass/builtin-objects/Array/regular-subclassing.js +++ b/test/language/statements/class/subclass/builtin-objects/Array/regular-subclassing.js @@ -15,19 +15,19 @@ class Sub extends Array {} var a1 = new Sub(42, 'foo'); -assert.sameValue(a1.length, 2, 'The value of a1.length is expected to be 2'); -assert.sameValue(a1[0], 42, 'The value of a1[0] is expected to be 42'); -assert.sameValue(a1[1], 'foo', 'The value of a1[1] is expected to be "foo"'); +assert.sameValue(a1.length, 2); +assert.sameValue(a1[0], 42); +assert.sameValue(a1[1], 'foo'); a1.push(true); -assert.sameValue(a1.length, 3, 'The value of a1.length is expected to be 3'); -assert.sameValue(a1[0], 42, 'The value of a1[0] is expected to be 42'); -assert.sameValue(a1[1], 'foo', 'The value of a1[1] is expected to be "foo"'); -assert.sameValue(a1[2], true, 'The value of a1[2] is expected to be true'); +assert.sameValue(a1.length, 3, 'Array#push updates the length property'); +assert.sameValue(a1[0], 42); +assert.sameValue(a1[1], 'foo'); +assert.sameValue(a1[2], true, 'Adds new item'); var a2 = new Sub(7); -assert.sameValue(a2.length, 7, 'The value of a2.length is expected to be 7'); +assert.sameValue(a2.length, 7); var a3 = new Sub(); -assert.compareArray(a3, [], 'The value of a3 is expected to be []'); -assert.sameValue(a3.length, 0, 'The value of a3.length is expected to be 0'); +assert(compareArray(a3, [])); +assert.sameValue(a3.length, 0); diff --git a/test/language/statements/for-of/dstr/obj-rest-order.js b/test/language/statements/for-of/dstr/obj-rest-order.js index 95b40b6b53..1d178917b5 100644 --- a/test/language/statements/for-of/dstr/obj-rest-order.js +++ b/test/language/statements/for-of/dstr/obj-rest-order.js @@ -34,7 +34,7 @@ Object.defineProperty(o, Symbol('foo'), { get: () => { calls.push("Symbol(foo)") var counter = 0; for ({...rest} of [o]) { - assert.compareArray(calls, [1, 'z', 'a', "Symbol(foo)"]); + assert(compareArray(calls, [1, 'z', 'a', "Symbol(foo)"])); assert.sameValue(Object.keys(rest).length, 3); counter += 1; } diff --git a/test/language/statements/generators/yield-spread-arr-multiple.js b/test/language/statements/generators/yield-spread-arr-multiple.js index cec0f0b6aa..da28d3876c 100644 --- a/test/language/statements/generators/yield-spread-arr-multiple.js +++ b/test/language/statements/generators/yield-spread-arr-multiple.js @@ -36,7 +36,7 @@ iter.next(false); item = iter.next(['a', 'b', 'c']); item = iter.next(item.value); -assert.compareArray(item.value, arr); +assert(compareArray(item.value, arr)); assert.sameValue(item.done, false); assert.sameValue(callCount, 1);