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 361a990748..474643907c 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,21 +16,18 @@ 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]), - 'compareArray([].concat(ta, ta), [ta, ta]) must return true' + assert.compareArray([].concat(ta, ta), [ta, ta], + '[].concat(new type(items), new type(items)) must return [ta, ta]' ); 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]), - 'compareArray([].concat(ta_by_len, ta_by_len), [ta_by_len, ta_by_len]) must return true' + 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]' ); ta_by_len[Symbol.isConcatSpreadable] = true; - assert( - compareArray([].concat(ta_by_len), items), - 'compareArray([].concat(ta_by_len), items) must return true' + assert.compareArray([].concat(ta_by_len), items, + '[].concat(new type(elems)) returns items' ); // 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 4c8763a9d9..61fd5ff389 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]), - 'compareArray([].concat(ta, ta), [ta, ta]) must return true' + assert.compareArray( + [].concat(ta, ta), [ta, ta], + '[].concat(new type(items), new type(items)) must return [ta, ta]' ); 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]), - 'compareArray([].concat(ta_by_len, ta_by_len), [ta_by_len, ta_by_len]) must return true' + 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]' ); ta_by_len[Symbol.isConcatSpreadable] = true; - assert( - compareArray([].concat(ta_by_len), items), - 'compareArray([].concat(ta_by_len), items) must return true' + assert.compareArray( + [].concat(ta_by_len), items, + '[].concat(new type(elems)) returns items' ); // 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 cf8f60912f..e39f637cf8 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,18 +31,22 @@ info: | includes: [compareArray.js] ---*/ -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, 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, 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(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(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( + ['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( - [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'); +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]' +); diff --git a/test/built-ins/Map/iterable-calls-set.js b/test/built-ins/Map/iterable-calls-set.js index 3b512eb4b1..acdc33f1db 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, "`Map.prototype.set` called twice."); +assert.sameValue(counter, 2, 'The value of counter is expected to be 2'); -assert(compareArray(results[0], iterable[0])); -assert(compareArray(results[1], iterable[1])); -assert.sameValue(_this[0], map); -assert.sameValue(_this[1], map); +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'); 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 ad7799a2a3..1bf648ab0d 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,7 +12,6 @@ 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, expected), 'compareArray(actual, expected) !== true'); +assert.compareArray(actual, ["0", "1", "2", "5", "length"], 'The value of actual is expected to be ["0", "1", "2", "5", "length"]'); 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 bb7f61ce94..6f75ee9a44 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,7 +10,6 @@ includes: [compareArray.js] ---*/ var arr = [0, 1, 2]; -var expected = ["0", "1", "2", "length"]; var actual = Object.getOwnPropertyNames(arr); -assert(compareArray(actual, expected), 'compareArray(actual, expected) !== true'); +assert.compareArray(actual, ["0", "1", "2", "length"], 'The value of actual is expected to be ["0", "1", "2", "length"]'); 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 ac9096e50c..b908426941 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,6 +36,5 @@ Object.defineProperty(obj, "d", { }); var actual = Object.getOwnPropertyNames(obj); -var expected = ["a", "b", "c", "d"]; -assert(compareArray(actual, expected), 'compareArray(actual, expected) !== true'); +assert.compareArray(actual, ["a", "b", "c", "d"], 'The value of actual is expected to be ["a", "b", "c", "d"]'); 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 a6fc274cde..4c4596444e 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); + assert.sameValue(sequence.length, 3, 'The value of sequence.length is expected to be 3'); return checkSequence(sequence, 'Expected to be called first.'); }), Promise.race([a, b]).catch(() => { sequence.push(5); - assert.sameValue(sequence.length, 5); + assert.sameValue(sequence.length, 5, 'The value of sequence.length is expected to be 5'); return checkSequence(sequence, 'Expected to be called third.'); }), b.catch(() => { sequence.push(4); - assert.sameValue(sequence.length, 4); + assert.sameValue(sequence.length, 4, 'The value of sequence.length is expected to be 4'); return checkSequence(sequence, 'Expected to be called second.'); }) ]).then(result => { - compareArray(result, [true, true, true]); - assert.sameValue(sequence.length, 5); + 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'); 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 d2d67d42e8..df0b66802b 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); + assert.sameValue(sequence.length, 3, 'The value of sequence.length is expected to be 3'); return checkSequence(sequence, 'Expected to be called first.'); }), Promise.race([a, b]).then(() => { sequence.push(5); - assert.sameValue(sequence.length, 5); + assert.sameValue(sequence.length, 5, 'The value of sequence.length is expected to be 5'); return checkSequence(sequence, 'Expected to be called third.'); }), b.then(() => { sequence.push(4); - assert.sameValue(sequence.length, 4); + assert.sameValue(sequence.length, 4, 'The value of sequence.length is expected to be 4'); return checkSequence(sequence, 'Expected to be called second.'); }) ]).then(result => { - compareArray(result, [true, true, true]); - assert.sameValue(sequence.length, 5); + 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'); 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 2696525469..5be8b4ce97 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"])); +assert.compareArray(forInResults, ["0", "1", "2"], 'The value of forInResults is expected to be ["0", "1", "2"]'); var forOfResults = []; for (x of p) { forOfResults.push(x); } -assert(compareArray(forOfResults, [1, 2, 3])); +assert.compareArray(forOfResults, [1, 2, 3], 'The value of forOfResults is expected to be [1, 2, 3]'); var itor = p[Symbol.iterator](); var next = itor.next(); -assert.sameValue(next.value, 1); -assert.sameValue(next.done, false); +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'); next = itor.next(); -assert.sameValue(next.value, 2); -assert.sameValue(next.done, false); +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'); next = itor.next(); -assert.sameValue(next.value, 3); -assert.sameValue(next.done, false); +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'); next = itor.next(); -assert.sameValue(next.value, undefined); -assert.sameValue(next.done, true); +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'); 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 4e010227bc..fd2d4bf67e 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'] - ) +assert.compareArray( + Object.getOwnPropertyNames(result), + ['get', 'set', 'enumerable', 'configurable'], + 'Object.getOwnPropertyNames(Reflect.getOwnPropertyDescriptor(o1, "p")) must return ["get", "set", "enumerable", "configurable"]' ); -assert.sameValue(result.enumerable, false); -assert.sameValue(result.configurable, true); -assert.sameValue(result.get, fn); -assert.sameValue(result.set, undefined); +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'); 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 64fac9416d..1c00914c1c 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'] - ) +assert.compareArray( + Object.getOwnPropertyNames(result), + ['value', 'writable', 'enumerable', 'configurable'], + 'Object.getOwnPropertyNames(Reflect.getOwnPropertyDescriptor(o1, "p")) must return ["value", "writable", "enumerable", "configurable"]' ); -assert.sameValue(result.value, 'foo'); -assert.sameValue(result.enumerable, true); -assert.sameValue(result.configurable, true); -assert.sameValue(result.writable, true); +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'); diff --git a/test/built-ins/Reflect/getOwnPropertyDescriptor/symbol-property.js b/test/built-ins/Reflect/getOwnPropertyDescriptor/symbol-property.js index 5b9deb8bc6..5f99f47b38 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'] - ) +assert.compareArray( + Object.getOwnPropertyNames(result), + ['value', 'writable', 'enumerable', 'configurable'], + 'Object.getOwnPropertyNames(Reflect.getOwnPropertyDescriptor(o, s)) must return ["value", "writable", "enumerable", "configurable"]' ); -assert.sameValue(result.value, 42); -assert.sameValue(result.enumerable, true); -assert.sameValue(result.configurable, true); -assert.sameValue(result.writable, true); +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'); 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 2d97d8bbcb..5273bae654 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,7 +23,4 @@ var o = Object.create(proto); o.p1 = 42; o.p2 = 43; o.p3 = 44; -assert( - compareArray(Reflect.ownKeys(o), ['p1', 'p2', 'p3']), - 'return object own keys' -); +assert.compareArray(Reflect.ownKeys(o), ['p1', 'p2', 'p3'], 'Reflect.ownKeys(Object.create(proto)) must return ["p1", "p2", "p3"]'); diff --git a/test/built-ins/Reflect/ownKeys/return-empty-array.js b/test/built-ins/Reflect/ownKeys/return-empty-array.js index 9f30b8240b..306cc39904 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({}), [])); +assert.compareArray(Reflect.ownKeys({}), [], 'Reflect.ownKeys({}) must return []'); var o = { d: 42 }; delete o.d; -assert(compareArray(Reflect.ownKeys(o), [])); +assert.compareArray(Reflect.ownKeys(o), [], 'Reflect.ownKeys({d: 42}) must return []'); 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 115a9a15d2..7948740916 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']), - 'return non enumerable `length` from empty array' +assert.compareArray( + Reflect.ownKeys([]), ['length'], + 'Reflect.ownKeys([]) must return ["length"]' ); -assert( - compareArray(Reflect.ownKeys([, , 2]), ['2', 'length']), - 'return array keys' +assert.compareArray( + Reflect.ownKeys([, , 2]), ['2', 'length'], + 'Reflect.ownKeys([, , 2]) must return ["2", "length"]' ); var o = {}; @@ -35,4 +35,4 @@ Object.defineProperty(o, 'p2', { enumerable: false }); -assert(compareArray(Reflect.ownKeys(o), ['p1', 'p2'])); +assert.compareArray(Reflect.ownKeys(o), ['p1', 'p2'], 'Reflect.ownKeys({}) must return ["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 9d7aa66f2e..e128962568 100644 --- a/test/built-ins/RegExp/named-groups/groups-properties.js +++ b/test/built-ins/RegExp/named-groups/groups-properties.js @@ -15,16 +15,15 @@ info: | ---*/ // Properties created on result.groups in textual order. -assert(compareArray(["fst", "snd"], - Object.getOwnPropertyNames( - /(?.)|(?.)/u.exec("abcd").groups))); +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)'); // 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); +assert.sameValue(counter, 0, 'The value of counter is expected to be 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 e3926bc97e..4b9061ff72 100644 --- a/test/built-ins/RegExp/named-groups/lookbehind.js +++ b/test/built-ins/RegExp/named-groups/lookbehind.js @@ -9,38 +9,125 @@ includes: [compareArray.js] ---*/ // Unicode mode -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", "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", ""], "abcdef".match(/((?<=\w{3}))f/u))); -assert(compareArray(["f", ""], "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), + '["f", ""] must return the same value returned by "abcdef".match(/(?(?<=w{3}))f/u)' +); -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/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|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(/(?(?(?\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", "c"], + "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", ""], "abcdef".match(/((?<=\w{3}))f/))); -assert(compareArray(["f", ""], "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/), + '["f", ""] must return the same value returned by "abcdef".match(/(?(?<=w{3}))f/)' +); -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", 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|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(/(?(?(?.)|(?.))/u.exec("abcd").groups))); +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)'); 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 7904c75e43..3dc6cdd737 100644 --- a/test/built-ins/RegExp/named-groups/non-unicode-match.js +++ b/test/built-ins/RegExp/named-groups/non-unicode-match.js @@ -8,36 +8,135 @@ features: [regexp-named-groups] includes: [compareArray.js] ---*/ -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)/))); +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"]' +); let {a, b, c} = /(?.)(?.)(?.)\k\k\k/.exec("abccba").groups; -assert.sameValue(a, "a"); -assert.sameValue(b, "b"); -assert.sameValue(c, "c"); +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(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(/(?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", "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/))); +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", ">"]' +); 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 33d62a3f0a..e10488218b 100644 --- a/test/built-ins/RegExp/named-groups/non-unicode-references.js +++ b/test/built-ins/RegExp/named-groups/non-unicode-references.js @@ -9,26 +9,78 @@ includes: [compareArray.js] ---*/ // Named references. -assert(compareArray(["bab", "b"], "bab".match(/(?.).\k/))); -assert.sameValue(null, "baa".match(/(?.).\k/)); +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' +); // Reference inside group. -assert(compareArray(["bab", "b"], "bab".match(/(?\k\w)../))); -assert.sameValue("b", "bab".match(/(?\k\w)../).groups.a); +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"' +); // Reference before group. -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/))); +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"]' +); let {a, b} = "bab".match(/(?b)\k(?a)\k/).groups; -assert.sameValue(a, "a"); -assert.sameValue(b, "b"); +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(compareArray(["bab", "b"], "bab".match(/\k(?b)\w\k/))); -assert(compareArray(["bab", "b", "a"], "bab".match(/(?b)\k(?a)\k/))); +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"]' +); // Reference properties. -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); +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' +); diff --git a/test/built-ins/RegExp/named-groups/unicode-match.js b/test/built-ins/RegExp/named-groups/unicode-match.js index a8e1059bdb..030f97599e 100644 --- a/test/built-ins/RegExp/named-groups/unicode-match.js +++ b/test/built-ins/RegExp/named-groups/unicode-match.js @@ -8,41 +8,149 @@ features: [regexp-named-groups] includes: [compareArray.js] ---*/ -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))); +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"]' +); let {a, b, c} = /(?.)(?.)(?.)\k\k\k/u.exec("abccba").groups; -assert.sameValue(a, "a"); -assert.sameValue(b, "b"); -assert.sameValue(c, "c"); +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(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(/(?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", "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))); +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", ">"]' +); // Nested groups. -assert(compareArray(["bab", "bab", "ab", "b"], "bab".match(/(?.(?.(?.)))/u))); -assert(compareArray({a: "bab", b: "ab", c: "b"}, - "bab".match(/(?.(?.(?.)))/u).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"'); +} diff --git a/test/built-ins/RegExp/named-groups/unicode-references.js b/test/built-ins/RegExp/named-groups/unicode-references.js index 1f95a2f40c..a11097d9ef 100644 --- a/test/built-ins/RegExp/named-groups/unicode-references.js +++ b/test/built-ins/RegExp/named-groups/unicode-references.js @@ -22,26 +22,79 @@ includes: [compareArray.js] ---*/ // Named references. -assert(compareArray(["bab", "b"], "bab".match(/(?.).\k/u))); -assert.sameValue(null, "baa".match(/(?.).\k/u)); +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' +); // Reference inside group. -assert(compareArray(["bab", "b"], "bab".match(/(?\k\w)../u))); -assert.sameValue("b", "bab".match(/(?\k\w)../u).groups.a); +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"' +); // Reference before group. -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"); -assert.sameValue(b, "b"); +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/))); -assert(compareArray(["bab", "b", "a"], "bab".match(/(?b)\k(?a)\k/))); +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.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"]' +); // Reference properties. -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); +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' +); 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 03c7314d7d..14c855c2b9 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)), - 'compareArray(cal.fields(fields), Array.from(fields)) must return true' +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)' ); 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 6060fab6e4..921c450c4a 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,53 +25,40 @@ 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] - ), - 'null value coerced to 0' + 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, NaN), - [0n, 1n, 2n, 3n] - ), - 'NaN 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, false), - [0n, 1n, 2n, 3n] - ), - 'false 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, true), - [0n, 0n, 2n, 3n] - ), - 'true value coerced to 1' + 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, '-2'), - [0n, 0n, 1n, 3n] - ), - 'string "-2" value coerced to integer -2' + 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.5), - [0n, 0n, 1n, 3n] - ), - 'float -2.5 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]' ); }); 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 6cd12a381a..5534c9e8ae 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,69 +24,52 @@ 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] - ), - 'undefined value coerced to 0' + 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, false), - [0n, 0n, 1n, 2n] - ), - 'false 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, NaN), - [0n, 0n, 1n, 2n] - ), - 'NaN 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, null), - [0n, 0n, 1n, 2n] - ), - 'null 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(0, true), - [1n, 2n, 3n, 3n] - ), - 'true value coerced to 1' + 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, '1'), - [1n, 2n, 3n, 3n] - ), - 'string "1" 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(1, 0.5), - [0n, 0n, 1n, 2n] - ), - '0.5 float value coerced to integer 0' + 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(0, 1.5), - [1n, 2n, 3n, 3n] - ), - '1.5 float value coerced to integer 1' + 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]' ); }); 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 92d409a46e..ddf1bd7a62 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,69 +24,52 @@ 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] - ), - 'undefined value coerced to 0' + 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(false, 1), - [1n, 2n, 3n, 3n] - ), - 'false 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(NaN, 1), - [1n, 2n, 3n, 3n] - ), - 'NaN 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(null, 1), - [1n, 2n, 3n, 3n] - ), - 'null 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(true, 0), - [0n, 0n, 1n, 2n] - ), - 'true value coerced to 1' + 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('1', 0), - [0n, 0n, 1n, 2n] - ), - 'string "1" 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(0.5, 1), - [1n, 2n, 3n, 3n] - ), - '0.5 float value coerced to integer 0' + 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(1.5, 0), - [0n, 0n, 1n, 2n] - ), - '1.5 float value coerced to integer 1' + 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]' ); }); 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 78a8c9c9a6..228883a586 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js @@ -27,69 +27,52 @@ 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] - ), - '[0, 1, 2, 3].copyWithin(0, 1, -1) -> [1, 2, 2, 3]' + 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, 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(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(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, 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]).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]).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, 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, 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]).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]).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, 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(-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(-5, -2, -1), - [3n, 1n, 2n, 3n, 4n] - ), - '[0, 1, 2, 3, 4].copyWithin(-5, -2, -1) -> [3, 1, 2, 3, 4]' + 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]' ); }); 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 ae13098243..169d93e9ce 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,85 +27,64 @@ 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] - ), - '[0, 1, 2, 3].copyWithin(0, 1, -10) -> [0, 1, 2, 3]' + 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([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([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([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([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([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([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([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([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([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([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([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([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([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([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([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([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([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]' + 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]' ); }); 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 06ec98f34d..e4ed620ba0 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,69 +25,52 @@ 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] - ), - '[0, 1, 2, 3]).copyWithin(0, -10) -> [0, 1, 2, 3]' + 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([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([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([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([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([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([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([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([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([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([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([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([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([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]' + 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]' ); }); 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 91e2b0e5b8..5bc8770c2e 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,37 +25,28 @@ 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] - ), - '[0, 1, 2, 3].copyWithin(-10, 0) -> [0, 1, 2, 3]' + 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([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([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([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([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([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]' + 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]' ); }); 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 36d5f22263..5018c30a15 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js @@ -25,53 +25,40 @@ 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] - ), - '[0, 1, 2, 3].copyWithin(0, -1) -> [3, 1, 2, 3]' + 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, 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(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(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, 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]).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]).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, 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(-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(-5, -2), - [3n, 4n, 2n, 3n, 4n] - ), - '[0, 1, 2, 3, 4].copyWithin(-5, -2) -> [3, 4, 2, 3, 4]' + 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]' ); }); 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 ec6adaedb3..f1a4028684 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js @@ -25,29 +25,22 @@ 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] - ), - '[0, 1, 2, 3].copyWithin(-1, 0) -> [0, 1, 2, 0]' + 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, 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, 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]).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]).copyWithin(-1, 2), + [0n, 1n, 2n, 2n], + 'new TA([0n, 1n, 2n, 3n]).copyWithin(-1, 2) must return [0n, 1n, 2n, 2n]' ); }); 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 16d68d51b7..d461fd8443 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,37 +18,28 @@ 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] - ), - '[0, 1, 2, 3].copyWithin(0, 1, 6) -> [1, 2, 3, 3]' + 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([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([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([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([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([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]' + 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]' ); }); 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 fcb6034914..54aed61e9d 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,57 +18,46 @@ 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] - ) + 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([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([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([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(0, 6), - [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], + 'new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(0, 6) must return [0n, 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([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([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(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(10, 10), - [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([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]' + 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]' ); }); 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 27385c45ec..1920123508 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,33 +18,28 @@ 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] - ) + 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, 2), - [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], + '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(3, 0), - [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], + 'new TA([1n, 2n, 3n, 4n, 5n, 6n]).copyWithin(3, 0) must return [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] - ) + 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]' ); }); 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 befa6e7523..58415caf12 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,28 +20,22 @@ features: [BigInt, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { - 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, 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, 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, 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, 1, 2), - [1n, 1n, 2n, 3n] - ), - '[0, 1, 2, 3].copyWithin(0, 1, 2) -> [1, 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]' ); /* @@ -55,19 +49,15 @@ 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] - ), - '[0, 1, 2, 3].copyWithin(1, 0, 2) -> [0, 0, 1, 3]' + 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, 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]' + 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]' ); }); 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 360d3125f4..687d75eb7c 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js @@ -25,21 +25,16 @@ 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] - ), - '[0, 1, 2, 3].copyWithin(0, 1, undefined) -> [1, 2, 3]' + 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), - [1n, 2n, 3n, 3n] - ), - '[0, 1, 2, 3].copyWithin(0, 1) -> [1, 2, 3, 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]' ); }); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/bit-precision.js b/test/built-ins/TypedArray/prototype/copyWithin/bit-precision.js index 399cda2dcd..a1955ba1ef 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/bit-precision.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/bit-precision.js @@ -38,7 +38,11 @@ function body(FloatArray) { length ); - assert(compareArray(originalBytes, copiedBytes)); + assert.compareArray( + originalBytes, + copiedBytes, + 'The value of originalBytes is expected to equal the value of 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 225f52cea7..b9defb5ba3 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-end.js @@ -27,51 +27,45 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - 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, 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, NaN), - [0, 1, 2, 3] - ), - 'NaN 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, false), - [0, 1, 2, 3] - ), - 'false 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, true), - [0, 0, 2, 3] - ), - 'true value coerced to 1' + 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, '-2'), - [0, 0, 1, 3] - ), - 'string "-2" value coerced to integer -2' + 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.5), - [0, 0, 1, 3] - ), - 'float -2.5 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]' ); }); 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 45aa223aa6..f95fde26b2 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-start.js @@ -26,67 +26,51 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - 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, 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, false), - [0, 0, 1, 2] - ), - 'false 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, NaN), - [0, 0, 1, 2] - ), - 'NaN 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, null), - [0, 0, 1, 2] - ), - 'null 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(0, true), - [1, 2, 3, 3] - ), - 'true value coerced to 1' + 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, '1'), - [1, 2, 3, 3] - ), - 'string "1" 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(1, 0.5), - [0, 0, 1, 2] - ), - '0.5 float value coerced to integer 0' + 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(0, 1.5), - [1, 2, 3, 3] - ), - '1.5 float value coerced to integer 1' + 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]' ); }); 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 58813a6e65..fd625fc020 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/coerced-values-target.js @@ -26,75 +26,57 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - 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(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(false, 1), - [1, 2, 3, 3] - ), - 'false 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(NaN, 1), - [1, 2, 3, 3] - ), - 'NaN 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(null, 1), - [1, 2, 3, 3] - ), - 'null 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(true, 0), - [0, 0, 1, 2] - ), - 'true value coerced to 1' + 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('1', 0), - [0, 0, 1, 2] - ), - 'string "1" 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(0.5, 1), - [1, 2, 3, 3] - ), - '0.5 float value coerced to integer 0' + 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(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.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), - [1, 2, 3, 3] - ), - 'object value coerced to integer 0' + 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]' ); }); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js index cc97dacf1c..7ccb76535e 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-end.js @@ -29,67 +29,51 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - 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]).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, 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(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(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, 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]).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]).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, 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, 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]).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]).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, 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(-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(-5, -2, -1), - [3, 1, 2, 3, 4] - ), - '[0, 1, 2, 3, 4].copyWithin(-5, -2, -1) -> [3, 1, 2, 3, 4]' + 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]' ); }); 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 6f77a75cd2..e1dc854ac6 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,83 +29,63 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - 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([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([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([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([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([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([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([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([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([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([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([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([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([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([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([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([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([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([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]' + 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]' ); }); 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 456f3ed44f..9bc486724e 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,67 +27,51 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - 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([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([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([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([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([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([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([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([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([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([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([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([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([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([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]' + 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]' ); }); 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 2ec06c368f..4f0a77678b 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,35 +27,27 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - 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([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([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([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([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([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([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]' + 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]' ); }); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js index 4035db6c24..7b7817d927 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-start.js @@ -27,51 +27,39 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - 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]).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, 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(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(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, 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]).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]).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, 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(-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(-5, -2), - [3, 4, 2, 3, 4] - ), - '[0, 1, 2, 3, 4].copyWithin(-5, -2) -> [3, 4, 2, 3, 4]' + 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]' ); }); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js b/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js index f6cde1f61e..9c0cf9df59 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/negative-target.js @@ -27,27 +27,21 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - 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]).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, 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, 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]).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]).copyWithin(-1, 2), + [0, 1, 2, 2], + 'new TA([0, 1, 2, 3]).copyWithin(-1, 2) must return [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 f37b8a02bb..ae9a32fa98 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,35 +20,27 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - 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([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([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([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([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([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([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]' + 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]' ); }); 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 3862d7b7d2..dcde6b9dc7 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,55 +20,45 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - assert( - compareArray( - new TA([0, 1, 2, 3, 4, 5]).copyWithin(6, 0), - [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], + 'new TA([0, 1, 2, 3, 4, 5]).copyWithin(6, 0) must return [0, 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([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([0, 1, 2, 3, 4, 5]).copyWithin(0, 6), - [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([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([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([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(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(10, 10), - [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([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]' + 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]' ); }); 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 0cfd34c5ec..49131fa38f 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,31 +20,27 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - 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, 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, 2), - [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], + '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(3, 0), - [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], + 'new TA([1, 2, 3, 4, 5, 6]).copyWithin(3, 0) must return [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] - ) + 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]' ); }); 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 5ce98d35e7..55aec783e4 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,28 +20,22 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - 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, 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, 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, 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, 1, 2), - [1, 1, 2, 3] - ), - '[0, 1, 2, 3].copyWithin(0, 1, 2) -> [1, 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]' ); /* @@ -55,19 +49,15 @@ 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] - ), - '[0, 1, 2, 3].copyWithin(1, 0, 2) -> [0, 0, 1, 3]' + 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, 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]' + 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]' ); }); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js b/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js index 6728788061..0755eb9462 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/undefined-end.js @@ -27,19 +27,15 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - 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, 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), - [1, 2, 3, 3] - ), - '[0, 1, 2, 3].copyWithin(0, 1) -> [1, 2, 3, 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]' ); }); 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 b5e3a5f024..81bd790e3b 100644 --- a/test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js +++ b/test/built-ins/TypedArray/prototype/entries/BigInt/return-itor.js @@ -11,24 +11,19 @@ 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])); - assert.sameValue(next.done, false); - + 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'); next = itor.next(); - assert(compareArray(next.value, [1, 42n])); - assert.sameValue(next.done, false); - + 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'); next = itor.next(); - assert(compareArray(next.value, [2, 64n])); - assert.sameValue(next.done, false); - + 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'); next = itor.next(); - assert.sameValue(next.value, undefined); - assert.sameValue(next.done, true); + 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'); }); diff --git a/test/built-ins/TypedArray/prototype/entries/return-itor.js b/test/built-ins/TypedArray/prototype/entries/return-itor.js index a3da9e9f94..09b22d002d 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])); - assert.sameValue(next.done, false); + 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'); next = itor.next(); - assert(compareArray(next.value, [1, 42])); - assert.sameValue(next.done, false); + 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'); next = itor.next(); - assert(compareArray(next.value, [2, 64])); - assert.sameValue(next.done, false); + 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'); next = itor.next(); - assert.sameValue(next.value, undefined); - assert.sameValue(next.done, true); + 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'); }); 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 5467a89cd3..e03a01d408 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/coerced-indexes.js @@ -30,75 +30,64 @@ info: | includes: [compareArray.js, testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ - testWithBigIntTypedArrayConstructors(function(TA) { - assert( - compareArray(new TA([0n, 0n]).fill(1n, undefined), [1n, 1n]), - '`undefined` start coerced to 0' + assert.compareArray( + new TA([0n, 0n]).fill(1n, undefined), + [1n, 1n], + 'new TA([0n, 0n]).fill(1n, 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, 0, undefined), + [1n, 1n], + 'new TA([0n, 0n]).fill(1n, 0, undefined) must return [1n, 1n]' ); - assert( - compareArray(new TA([0n, 0n]).fill(1n, null), [1n, 1n]), - '`null` start coerced to 0' + 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, 0, null), [0n, 0n]), - '`null` end 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, true), [0n, 1n]), - '`true` start coerced to 1' + 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, 0, true), [1n, 0n]), - '`true` end 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, false), [1n, 1n]), - '`false` start coerced to 0' + 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, 0, false), [0n, 0n]), - '`false` end 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, 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' + 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]' ); }); 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 a981ab00bd..7bfb6bd38c 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,11 +32,34 @@ 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])); - 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])); + 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]' + ); }); 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 a4cac9ffb4..dd9e3b1f7e 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,25 +29,28 @@ 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]), - "Fill elements from custom end position" + 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, 8n, 0n]), - "negative end sets final position to max((length + relativeEnd), 0)" + 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, 5), [8n, 8n, 8n]), - "end position is never higher than of length" + 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, -4), [0n, 0n, 0n]), - "end position is 0 when (len + relativeEnd) < 0" + 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]' ); }); 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 790d1a5f26..36aeaff659 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,25 +27,28 @@ 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]), - "Fill elements from custom start position" + 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, 4), [0n, 0n, 0n]), - "start position is never higher than length" + 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, -1), [0n, 0n, 8n]), - "start < 0 sets initial position to max((len + relativeStart), 0)" + 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, -5), [8n, 8n, 8n]), - "start position is 0 when (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]' ); }); 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 ec390d28bb..e795071974 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values.js @@ -27,18 +27,12 @@ info: | includes: [compareArray.js, testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ - testWithBigIntTypedArrayConstructors(function(TA) { - assert( - compareArray( - new TA().fill(8n), - [] - ), - "does not fill an empty instance" - ); + assert.compareArray(new TA().fill(8n), [], 'new TA().fill(8n) must return []'); - assert( - compareArray(new TA([0n, 0n, 0n]).fill(8n), [8n, 8n, 8n]), - "Default start and end indexes are 0 and this.length" + assert.compareArray( + new TA([0n, 0n, 0n]).fill(8n), + [8n, 8n, 8n], + 'new TA([0n, 0n, 0n]).fill(8n) must return [8n, 8n, 8n]' ); }); diff --git a/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js b/test/built-ins/TypedArray/prototype/fill/coerced-indexes.js index 2d512bae5c..4efb3725b8 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]), - '`undefined` start coerced to 0' + 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, 0, undefined), [1, 1]), - 'If end is undefined, let relativeEnd be len' + 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, null), [1, 1]), - '`null` start coerced to 0' + 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, 0, null), [0, 0]), - '`null` end 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, true), [0, 1]), - '`true` start coerced to 1' + 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, 0, true), [1, 0]), - '`true` end 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, false), [1, 1]), - '`false` start coerced to 0' + 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, 0, false), [0, 0]), - '`false` end 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, NaN), [1, 1]), - '`NaN` start 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, 0, NaN), [0, 0]), - '`NaN` end 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, '1'), [0, 1]), - 'string start coerced' + 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, 0, '1'), [1, 0]), - 'string end 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, 1.5), [0, 1]), - 'start as a float number 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, 0, 1.5), [1, 0]), - 'end 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]' ); }); 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 2a332b54f4..26a486865f 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js @@ -34,9 +34,25 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - assert(compareArray(new TA([0, 0, 0]).fill(8, 1, 2), [0, 8, 0])); - assert(compareArray(new TA([0, 0, 0, 0, 0]).fill(8, -3, 4), [0, 0, 8, 8, 0])); - assert(compareArray(new TA([0, 0, 0, 0, 0]).fill(8, -2, -1), [0, 0, 0, 8, 0])); - assert(compareArray(new TA([0, 0, 0, 0, 0]).fill(8, -1, -3), [0, 0, 0, 0, 0])); - assert(compareArray(new TA([0, 0, 0, 0, 0]).fill(8, 1, 3), [0, 8, 8, 0, 0])); + assert.compareArray(new TA([0, 0, 0]).fill(8, 1, 2), [0, 8, 0], '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]' + ); }); 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 4926fdb57a..9b23bb0c83 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]), - "Fill elements from custom end position" + 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, 8, 0]), - "negative end sets final position to max((length + relativeEnd), 0)" + 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, 5), [8, 8, 8]), - "end position is never higher than of length" + 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, -4), [0, 0, 0]), - "end position is 0 when (len + relativeEnd) < 0" + 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]' ); }); 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 cb89c951fd..834bc6896e 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]), - "Fill elements from custom start position" + 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, 4), [0, 0, 0]), - "start position is never higher than length" + 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, -1), [0, 0, 8]), - "start < 0 sets initial position to max((len + relativeStart), 0)" + 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, -5), [8, 8, 8]), - "start position is 0 when (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]' ); }); diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values.js b/test/built-ins/TypedArray/prototype/fill/fill-values.js index 7d0faa44f3..6223b4acb6 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values.js @@ -29,16 +29,13 @@ features: [TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - assert( - compareArray( - new TA().fill(8), - [] - ), - "does not fill an empty instance" + assert.compareArray( + new TA().fill(8), [], + 'new TA().fill(8) must return []' ); - assert( - compareArray(new TA([0, 0, 0]).fill(8), [8, 8, 8]), - "Default start and end indexes are 0 and this.length" + assert.compareArray( + new TA([0, 0, 0]).fill(8), [8, 8, 8], + 'new TA([0, 0, 0]).fill(8) must return [8, 8, 8]' ); }); 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 b539ca2eca..b881a51938 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,10 +15,7 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, Symbol, TypedArray] ---*/ - testWithBigIntTypedArrayConstructors(function(TA) { - var sample = new TA([40n, 41n, 42n]); - [ true, 1, @@ -32,7 +29,9 @@ testWithBigIntTypedArrayConstructors(function(TA) { 0.1, -0.1 ].forEach(function(val) { - var result = sample.filter(function() { return val; }); - assert(compareArray(result, sample), 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'); }); }); 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 fe301ac8f6..b8282b1677 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,7 +48,6 @@ testWithBigIntTypedArrayConstructors(function(TA) { }; result = sample.filter(function() {}); - - assert.sameValue(result, other, "returned another typedarray"); - assert(compareArray(result, [1n, 0n, 1n]), "the returned object is preserved"); + 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]'); }); 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 4e4da9bee0..175a7b3b7c 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,22 +35,23 @@ 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[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, "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"); + 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]'); }); 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 49c65cacf9..b5c065f531 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,16 +15,17 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ - testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([41n, 1n, 42n, 7n]); - var result; + var result = sample.filter(function() { + return true; + }); - result = sample.filter(function() { return true; }); - assert(compareArray(result, [41n, 1n, 42n, 7n]), "values are set #1"); + assert.compareArray(result, [41n, 1n, 42n, 7n], 'The value of result is expected to be [41n, 1n, 42n, 7n]'); result = sample.filter(function(v) { return v > 40n; }); - assert(compareArray(result, [41n, 42n]), "values are set #2"); + + assert.compareArray(result, [41n, 42n], 'The value of result is expected to be [41n, 42n]'); }); 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 f46bf483da..66578b5333 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), val); + assert.compareArray(result, sample, 'The value of result is expected to equal the value of sample'); }); }); 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 79547878b1..c58f6171ba 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, "returned another typedarray"); - assert(compareArray(result, [1, 0, 1]), "the returned object is preserved"); + 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]'); }); 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 28e12b1352..7c6df7ed9e 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, "ctor called once"); - assert.sameValue(result, other, "return is instance of custom constructor"); - assert(compareArray(result, [40, 41, 42]), "values are set on the new obj"); + assert.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]'); }); 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 c9f16b8df1..cd9b1dadbc 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]), "values are set #1"); + assert.compareArray(result, [41, 1, 42, 7], 'The value of result is expected to be [41, 1, 42, 7]'); result = sample.filter(function(v) { return v > 40; }); - assert(compareArray(result, [41, 42]), "values are set #2"); + assert.compareArray(result, [41, 42], 'The value of result is expected to be [41, 42]'); }); 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 86be70f059..14fc33bcba 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,51 +28,57 @@ 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.find(function(val, i) { sample[i] = arr[i]; - - assert.sameValue(val, 0n, "value is not mapped to instance"); + assert.sameValue(val, 0n, 'The value of val is expected to be 0n'); }); - 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, "find() returns previous found value"); + + assert.sameValue(result, 1n, 'The value of result is expected to be 1n'); }); 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 0b8baa4ba4..786328e82b 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, "value is not mapped to instance"); + assert.sameValue(val, 0, 'The value of val is expected to be 0'); }); - 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) { @@ -49,7 +49,7 @@ testWithTypedArrayConstructors(function(TA) { } return val === 7; }); - assert.sameValue(result, 7, "value found"); + assert.sameValue(result, 7, 'The value of result is expected to be 7'); sample = new TA(arr); result = sample.find(function(val, i) { @@ -58,7 +58,7 @@ testWithTypedArrayConstructors(function(TA) { } return val === 3; }); - 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) { @@ -67,12 +67,12 @@ testWithTypedArrayConstructors(function(TA) { } return val === 7; }); - 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] = 7; return true; }); - assert.sameValue(result, 1, "find() returns previous found value"); + assert.sameValue(result, 1, 'The value of result is expected to be 1'); }); 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 2fa7603237..3f142f3d1c 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,44 +24,49 @@ 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.findIndex(function(val, i) { sample[i] = arr[i]; - - assert.sameValue(val, 0n, "value is not mapped to instance"); + assert.sameValue(val, 0n, 'The value of val is expected to be 0n'); }); - 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, "value not found - changed after call"); + + assert.sameValue(result, -1, 'The value of result is expected to be -1'); }); 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 2843859a09..7acbc4dd41 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, "value is not mapped to instance"); + assert.sameValue(val, 0, 'The value of val is expected to be 0'); }); - 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) { @@ -45,7 +45,7 @@ testWithTypedArrayConstructors(function(TA) { } return val === 7; }); - 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) { @@ -54,7 +54,7 @@ testWithTypedArrayConstructors(function(TA) { } return val === 30; }); - 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) { @@ -63,5 +63,5 @@ testWithTypedArrayConstructors(function(TA) { } return val === 7; }); - assert.sameValue(result, -1, "value not found - changed after call"); + assert.sameValue(result, -1, 'The value of result is expected to be -1'); }); 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 9c4496c762..dee2a7683e 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,50 +17,69 @@ 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.findLast(function(val, i) { sample[i] = arr[i]; - - assert.sameValue(val, 0n, "value is not mapped to instance"); + assert.sameValue(val, 0n, 'The value of val is expected to be 0n'); }); - 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, "findLast() returns previous found value"); + + assert.sameValue(result, 3n, 'The value of result is expected to be 3n'); }); 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 7fc08ab8c6..72aaa3f559 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,6 +17,18 @@ 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; @@ -26,9 +38,9 @@ testWithTypedArrayConstructors(function(TA) { sample.findLast(function(val, i) { sample[i] = arr[i]; - assert.sameValue(val, 0, "value is not mapped to instance"); + assert.sameValue(val, 0, 'The value of val is expected to be 0'); }); - 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) { @@ -37,7 +49,7 @@ testWithTypedArrayConstructors(function(TA) { } return val === 7; }); - assert.sameValue(result, 7, "value found"); + assert.sameValue(result, 7, 'The value of result is expected to be 7'); sample = new TA(arr); result = sample.findLast(function(val, i) { @@ -46,7 +58,7 @@ testWithTypedArrayConstructors(function(TA) { } return val === 1; }); - 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) { @@ -55,12 +67,12 @@ testWithTypedArrayConstructors(function(TA) { } return val === 7; }); - 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] = 7; return true; }); - assert.sameValue(result, 3, "findLast() returns previous found value"); + assert.sameValue(result, 3, 'The value of result is expected to be 3'); }); 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 6fe27a8b5b..88a55407e6 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,43 +16,61 @@ 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.findLastIndex(function(val, i) { sample[i] = arr[i]; - - assert.sameValue(val, 0n, "value is not mapped to instance"); + assert.sameValue(val, 0n, 'The value of val is expected to be 0n'); }); - 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, "value not found - changed after call"); + + assert.sameValue(result, -1, 'The value of result is expected to be -1'); }); 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 5449cc1ba0..249b04c911 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,6 +16,18 @@ 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; @@ -25,9 +37,9 @@ testWithTypedArrayConstructors(function(TA) { sample.findLastIndex(function(val, i) { sample[i] = arr[i]; - assert.sameValue(val, 0, "value is not mapped to instance"); + assert.sameValue(val, 0, 'The value of val is expected to be 0'); }); - 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) { @@ -36,7 +48,7 @@ testWithTypedArrayConstructors(function(TA) { } return val === 7; }); - 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) { @@ -45,7 +57,7 @@ testWithTypedArrayConstructors(function(TA) { } return val === 10; }); - 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) { @@ -54,5 +66,5 @@ testWithTypedArrayConstructors(function(TA) { } return val === 7; }); - assert.sameValue(result, -1, "value not found - changed after call"); + assert.sameValue(result, -1, 'The value of result is expected to be -1'); }); 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 ed43f6485a..4e40d34ee7 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,20 +35,21 @@ 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[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, "returned another typedarray"); - assert(compareArray(result, [47n, 0n, 1n]), "values are set on returned typedarray"); + 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]'); }); 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 45b6cb8faf..c766b764da 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,22 +35,23 @@ 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[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, "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"); + 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]'); }); 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 44fab4529e..27aa967262 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)); + assert.compareArray(sampleBytes, resultBytes, 'The value of sampleBytes is expected to equal the value of 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 a13585f015..0b980ebe32 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, "returned another typedarray"); - assert(compareArray(result, [47, 0, 1]), "values are set on returned typedarray"); + 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]'); }); 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 d6ec477494..6ca4379f83 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, "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"); + 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]'); }); diff --git a/test/built-ins/TypedArray/prototype/reverse/BigInt/reverts.js b/test/built-ins/TypedArray/prototype/reverse/BigInt/reverts.js index 92aa0eb3e9..b814a3afc3 100644 --- a/test/built-ins/TypedArray/prototype/reverse/BigInt/reverts.js +++ b/test/built-ins/TypedArray/prototype/reverse/BigInt/reverts.js @@ -18,40 +18,25 @@ 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]) - ); - - assert( - compareArray(other, [1n, 2n, 43n, 42n, 7n]) - ); - + 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]'); 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]) - ); - - assert( - compareArray(sample, [42n, 0n, 1n, 17n]) - ); + 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]'); }); diff --git a/test/built-ins/TypedArray/prototype/reverse/reverts.js b/test/built-ins/TypedArray/prototype/reverse/reverts.js index 5bec740e5b..46fdee39fd 100644 --- a/test/built-ins/TypedArray/prototype/reverse/reverts.js +++ b/test/built-ins/TypedArray/prototype/reverse/reverts.js @@ -32,13 +32,8 @@ testWithTypedArrayConstructors(function(TA) { other[4] = 7; sample.reverse(); - assert( - compareArray(sample, [1, 2, 43, 42]) - ); - - assert( - compareArray(other, [1, 2, 43, 42, 7]) - ); + 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]'); sample[0] = 7; sample[1] = 17; @@ -47,11 +42,6 @@ testWithTypedArrayConstructors(function(TA) { other[4] = 42; other.reverse(); - assert( - compareArray(other, [42, 0, 1, 17, 7]) - ); - - assert( - compareArray(sample, [42, 0, 1, 17]) - ); + 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]'); }); 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 e5d5046348..0c2b44ccf3 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,79 +17,72 @@ 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 empty string"); - + sample.set([42n], ''); + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); - sample.set([42n], "0"); - assert(compareArray(sample, [42n, 2n]), "'0'"); - + sample.set([42n], '0'); + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); sample.set([42n], false); - assert(compareArray(sample, [42n, 2n]), "false"); - + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); sample.set([42n], 0.1); - assert(compareArray(sample, [42n, 2n]), "0.1"); - + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); sample.set([42n], 0.9); - assert(compareArray(sample, [42n, 2n]), "0.9"); - + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); sample.set([42n], -0.5); - assert(compareArray(sample, [42n, 2n]), "-0.5"); - + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); sample.set([42n], 1.1); - assert(compareArray(sample, [1n, 42n]), "1.1"); - + assert.compareArray(sample, [1n, 42n], 'The value of sample is expected to be [1n, 42n]'); sample = new TA([1n, 2n]); sample.set([42n], NaN); - assert(compareArray(sample, [42n, 2n]), "NaN"); - + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); sample.set([42n], null); - assert(compareArray(sample, [42n, 2n]), "null"); - + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); sample.set([42n], undefined); - assert(compareArray(sample, [42n, 2n]), "undefined"); - + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); sample.set([42n], {}); - assert(compareArray(sample, [42n, 2n]), "{}"); - + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); sample.set([42n], []); - assert(compareArray(sample, [42n, 2n]), "[]"); - + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); sample.set([42n], [0]); - assert(compareArray(sample, [42n, 2n]), "[0]"); - + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); sample.set([42n], true); - assert(compareArray(sample, [1n, 42n]), "true"); - + assert.compareArray(sample, [1n, 42n], 'The value of sample is expected to be [1n, 42n]'); sample = new TA([1n, 2n]); - sample.set([42n], "1"); - assert(compareArray(sample, [1n, 42n]), "'1'"); - + sample.set([42n], '1'); + assert.compareArray(sample, [1n, 42n], 'The value of sample is expected to be [1n, 42n]'); sample = new TA([1n, 2n]); sample.set([42n], [1]); - assert(compareArray(sample, [1n, 42n]), "[1]"); - + assert.compareArray(sample, [1n, 42n], 'The value of sample is expected to be [1n, 42n]'); 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]), "toString"); + + sample.set([42n], { + toString: function() { + return 1; + } + }); + + assert.compareArray(sample, [1n, 42n], 'The value of sample is expected to be [1n, 42n]'); }); 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 237c946458..b3f725e4ca 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,28 +21,25 @@ 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]), - "values are set until exception" - ); + assert.compareArray(sample, [42n, 43n, 3n, 4n], 'The value of sample is expected to be [42n, 43n, 3n, 4n]'); }); 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 683d318f0c..943d705a8d 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,24 +21,20 @@ 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]), - "values are set until exception" - ); + assert.compareArray(sample, [42n, 43n, 3n, 4n], 'The value of sample is expected to be [42n, 43n, 3n, 4n]'); }); 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 7195d3f7d2..3c5fffd21e 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,28 +21,26 @@ 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]), - "values are set until exception" - ); + assert.compareArray(sample, [42n, 43n, 3n, 4n], 'The value of sample is expected to be [42n, 43n, 3n, 4n]'); }); 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 3eb5722efc..632f1ece95 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,13 +21,14 @@ 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); @@ -54,19 +55,16 @@ 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(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" + 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"]' ); }); 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 1e3a226f8d..c0ba0cf7dc 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,43 +21,38 @@ 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; + var sample, result; sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 0); - assert(compareArray(sample, [42n, 43n, 3n, 4n]), "offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 1); - assert(compareArray(sample, [1n, 42n, 43n, 4n]), "offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 2); - assert(compareArray(sample, [1n, 2n, 42n, 43n]), "offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(srcObj, 0); - assert(compareArray(sample, [7n, 17n, 3n, 4n]), "offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(srcObj, 1); - assert(compareArray(sample, [1n, 7n, 17n, 4n]), "offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(srcObj, 2); - assert(compareArray(sample, [1n, 2n, 7n, 17n]), "offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); }); 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 d3d5c1aa4a..523c3c4a26 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,29 +21,22 @@ 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), - "sample: [" + sample + "], expected: [" + expected + "]" - ); + assert.compareArray(sample, expected, 'The value of sample is expected to equal the value of 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 d6156af975..ea0dee6849 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,6 +31,7 @@ testWithBigIntTypedArrayConstructors(function(TA) { '3': 7n, '4': 7n }; + Object.defineProperty(obj, 0, { get: function() { obj[1] = 43n; @@ -42,6 +43,5 @@ testWithBigIntTypedArrayConstructors(function(TA) { }); sample.set(obj); - - assert(compareArray(sample, [42n, 43n, 44n, 45n, 46n])); + assert.compareArray(sample, [42n, 43n, 44n, 45n, 46n], 'The value of sample is expected to be [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 3b191aa4e8..21748baf01 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,80 +14,73 @@ 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 empty string"); - + sample.set(src, ''); + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); - sample.set(src, "0"); - assert(compareArray(sample, [42n, 2n]), "'0'"); - + sample.set(src, '0'); + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); sample.set(src, false); - assert(compareArray(sample, [42n, 2n]), "false"); - + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); sample.set(src, 0.1); - assert(compareArray(sample, [42n, 2n]), "0.1"); - + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); sample.set(src, 0.9); - assert(compareArray(sample, [42n, 2n]), "0.9"); - + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); sample.set(src, -0.5); - assert(compareArray(sample, [42n, 2n]), "-0.5"); - + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); sample.set(src, 1.1); - assert(compareArray(sample, [1n, 42n]), "1.1"); - + assert.compareArray(sample, [1n, 42n], 'The value of sample is expected to be [1n, 42n]'); sample = new TA([1n, 2n]); sample.set(src, NaN); - assert(compareArray(sample, [42n, 2n]), "NaN"); - + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); sample.set(src, null); - assert(compareArray(sample, [42n, 2n]), "null"); - + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); sample.set(src, undefined); - assert(compareArray(sample, [42n, 2n]), "undefined"); - + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); sample.set(src, {}); - assert(compareArray(sample, [42n, 2n]), "{}"); - + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); sample.set(src, []); - assert(compareArray(sample, [42n, 2n]), "[]"); - + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); sample.set(src, [0]); - assert(compareArray(sample, [42n, 2n]), "[0]"); - + assert.compareArray(sample, [42n, 2n], 'The value of sample is expected to be [42n, 2n]'); sample = new TA([1n, 2n]); sample.set(src, true); - assert(compareArray(sample, [1n, 42n]), "true"); - + assert.compareArray(sample, [1n, 42n], 'The value of sample is expected to be [1n, 42n]'); sample = new TA([1n, 2n]); - sample.set(src, "1"); - assert(compareArray(sample, [1n, 42n]), "'1'"); - + sample.set(src, '1'); + assert.compareArray(sample, [1n, 42n], 'The value of sample is expected to be [1n, 42n]'); sample = new TA([1n, 2n]); sample.set(src, [1]); - assert(compareArray(sample, [1n, 42n]), "[1]"); - + assert.compareArray(sample, [1n, 42n], 'The value of sample is expected to be [1n, 42n]'); 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]), "toString"); + + sample.set(src, { + toString: function() { + return 1; + } + }); + + assert.compareArray(sample, [1n, 42n], 'The value of sample is expected to be [1n, 42n]'); }); 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 3145bc8075..cc454a6d0f 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,7 +1,6 @@ // 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: > @@ -10,7 +9,6 @@ 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; @@ -18,24 +16,19 @@ 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]), "src is SAB-backed, offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 1); - assert(compareArray(sample, [1n, 42n, 43n, 4n]), "src is SAB-backed, offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 2); - assert(compareArray(sample, [1n, 2n, 42n, 43n]), "src is SAB-backed, offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); src = new BigInt64Array([42n, 43n]); - sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab); sample[0] = 1n; @@ -43,9 +36,8 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 0); - assert(compareArray(sample, [42n, 43n, 3n, 4n]), "sample is SAB-backed, offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab); sample[0] = 1n; @@ -53,9 +45,8 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 1); - assert(compareArray(sample, [1n, 42n, 43n, 4n]), "sample is SAB-backed, offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab); sample[0] = 1n; @@ -63,14 +54,12 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 2); - assert(compareArray(sample, [1n, 2n, 42n, 43n]), "sample is SAB-backed, offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); 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); @@ -79,9 +68,8 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 0); - assert(compareArray(sample, [42n, 43n, 3n, 4n]), "src and sample are SAB-backed, offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab2); sample[0] = 1n; @@ -89,9 +77,8 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 1); - assert(compareArray(sample, [1n, 42n, 43n, 4n]), "src and sample are SAB-backed, offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab2); sample[0] = 1n; @@ -99,6 +86,6 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 2); - assert(compareArray(sample, [1n, 2n, 42n, 43n]), "src and sample are SAB-backed, offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); }); 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 4456c5dccc..0ced5b5ef7 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,24 +25,20 @@ 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]), "offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 1); - assert(compareArray(sample, [1n, 42n, 43n, 4n]), "offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 2); - assert(compareArray(sample, [1n, 2n, 42n, 43n]), "offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); }); 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 f179ba052c..22935d7cfc 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,32 +9,25 @@ 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]), "src is SAB-backed, offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 0); - assert(compareArray(sample, [42n, 43n, 3n, 4n]), "src is SAB-backed, offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 2); - assert(compareArray(sample, [1n, 2n, 42n, 43n]), "src is SAB-backed, offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); src = new TA([42n, 43n]); - sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab); sample[0] = 1n; @@ -42,9 +35,8 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 1); - assert(compareArray(sample, [1n, 42n, 43n, 4n]), "sample is SAB-backed, offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab); sample[0] = 1n; @@ -52,9 +44,8 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 0); - assert(compareArray(sample, [42n, 43n, 3n, 4n]), "sample is SAB-backed, offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab); sample[0] = 1n; @@ -62,15 +53,12 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 2); - assert(compareArray(sample, [1n, 2n, 42n, 43n]), "sample is SAB-backed, offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - - + 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'); 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); @@ -79,9 +67,8 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 1); - assert(compareArray(sample, [1n, 42n, 43n, 4n]), "src and sample are SAB-backed, offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab2); sample[0] = 1n; @@ -89,9 +76,8 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 0); - assert(compareArray(sample, [42n, 43n, 3n, 4n]), "src and sample are SAB-backed, offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); sab2 = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab2); sample[0] = 1n; @@ -99,6 +85,6 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample[2] = 3n; sample[3] = 4n; result = sample.set(src, 2); - assert(compareArray(sample, [1n, 2n, 42n, 43n]), "src and sample are SAB-backed, offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); }); 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 d806b6a6c3..22f6e9411a 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,23 +28,19 @@ 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]), "offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 0); - assert(compareArray(sample, [42n, 43n, 3n, 4n]), "offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); sample = new TA([1n, 2n, 3n, 4n]); result = sample.set(src, 2); - assert(compareArray(sample, [1n, 2n, 42n, 43n]), "offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); }); 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 7ffaf60153..48c46be0c7 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,16 +12,18 @@ features: [BigInt, TypedArray, resizable-arraybuffer] assert.sameValue( typeof ArrayBuffer.prototype.resize, 'function', - 'implements ArrayBuffer.prototype.resize' + 'The value of `typeof ArrayBuffer.prototype.resize` is expected to be "function"' ); 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; @@ -29,17 +31,15 @@ testWithBigIntTypedArrayConstructors(function(TA) { try { ab.resize(BPE * 5); - expected = [10n, 20n, 30n, 40n, 0n]; } catch (_) {} target.set(source); - assert(compareArray(target, expected), 'following grow'); + assert.compareArray(target, [10n, 20n, 30n, 40n, 0n], 'The value of target is expected to be [10n, 20n, 30n, 40n, 0n]'); try { ab.resize(BPE * 3); - expected = [10n, 20n, 30n]; } catch (_) {} target.set(source); - assert(compareArray(target, expected), 'following shrink'); + assert.compareArray(target, [10n, 20n, 30n], 'The value of target is expected to be [10n, 20n, 30n]'); }); 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 7e60fba139..45c0bdcc03 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,7 +1,6 @@ // 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: > @@ -10,10 +9,8 @@ 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; @@ -22,9 +19,8 @@ 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]), "offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab); sample[0] = 1n; @@ -33,9 +29,8 @@ 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]), "offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); sab = new SharedArrayBuffer(4 * TA.BYTES_PER_ELEMENT); sample = new TA(sab); sample[0] = 1n; @@ -44,6 +39,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]), "offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); }); 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 ab1454760b..5b684cdad5 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,25 +29,21 @@ 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]), "offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); 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]), "offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); - + 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'); 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]), "offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); }); 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 a5ab527732..f202440605 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 empty string"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set([42], "0"); - assert(compareArray(sample, [42, 2]), "'0'"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set([42], false); - assert(compareArray(sample, [42, 2]), "false"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set([42], 0.1); - assert(compareArray(sample, [42, 2]), "0.1"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set([42], 0.9); - assert(compareArray(sample, [42, 2]), "0.9"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set([42], -0.5); - assert(compareArray(sample, [42, 2]), "-0.5"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set([42], 1.1); - assert(compareArray(sample, [1, 42]), "1.1"); + assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); sample = new TA([1, 2]); sample.set([42], NaN); - assert(compareArray(sample, [42, 2]), "NaN"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set([42], null); - assert(compareArray(sample, [42, 2]), "null"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set([42], undefined); - assert(compareArray(sample, [42, 2]), "undefined"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set([42], {}); - assert(compareArray(sample, [42, 2]), "{}"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set([42], []); - assert(compareArray(sample, [42, 2]), "[]"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set([42], [0]); - assert(compareArray(sample, [42, 2]), "[0]"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set([42], true); - assert(compareArray(sample, [1, 42]), "true"); + assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); sample = new TA([1, 2]); sample.set([42], "1"); - assert(compareArray(sample, [1, 42]), "'1'"); + assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); sample = new TA([1, 2]); sample.set([42], [1]); - assert(compareArray(sample, [1, 42]), "[1]"); + assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); sample = new TA([1, 2]); sample.set([42], { valueOf: function() {return 1;} }); - assert(compareArray(sample, [1, 42]), "valueOf"); + assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); sample = new TA([1, 2]); sample.set([42], { toString: function() {return 1;} }); - assert(compareArray(sample, [1, 42]), "toString"); + assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); }); 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 afe0800303..1e823fa667 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]), - "values are set until exception" + assert.compareArray( + sample, [42, 43, 3, 4], + 'The value of sample is expected to be [42, 43, 3, 4]' ); }); 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 2afc27a6fa..fd7c00690e 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]), - "values are set until exception" + assert.compareArray( + sample, [42, 43, 3, 4], + 'The value of sample is expected to be [42, 43, 3, 4]' ); }); 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 438001533b..917f111b14 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]), - "values are set until exception" + assert.compareArray( + sample, [42, 43, 3, 4], + 'The value of sample is expected to be [42, 43, 3, 4]' ); }); 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 9c1603a30d..d239aae1d2 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]), - "values are set for src length" + assert.compareArray( + sample, [0, 42, 43, 44, 0], + 'The value of sample is expected to be [0, 42, 43, 44, 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" + 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"]' ); }); 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 6e53dbc94e..f699ea5788 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]), "offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); sample = new TA([1, 2, 3, 4]); result = sample.set(src, 1); - assert(compareArray(sample, [1, 42, 43, 4]), "offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); sample = new TA([1, 2, 3, 4]); result = sample.set(src, 2); - assert(compareArray(sample, [1, 2, 42, 43]), "offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); sample = new TA([1, 2, 3, 4]); result = sample.set(srcObj, 0); - assert(compareArray(sample, [7, 17, 3, 4]), "offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); sample = new TA([1, 2, 3, 4]); result = sample.set(srcObj, 1); - assert(compareArray(sample, [1, 7, 17, 4]), "offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); sample = new TA([1, 2, 3, 4]); result = sample.set(srcObj, 2); - assert(compareArray(sample, [1, 2, 7, 17]), "offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); }); 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 02cfa8b659..4c1c6e2213 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,8 +42,7 @@ testWithTypedArrayConstructors(function(TA) { sample.set(arr); - assert( - compareArray(sample, expected), - "sample: [" + sample + "], expected: [" + expected + "]" + assert.compareArray(sample, expected, + 'The value of sample is expected to equal the value of 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 a3750490f1..7216e1dca4 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])); + assert.compareArray(sample, [42, 43, 44, 45, 46], 'The value of sample is expected to be [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 e0a9b814d4..d6889d6b56 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)) + assert.compareArray(sourceBytes, targetBytes, 'The value of sourceBytes is expected to equal the value of 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 7f63cb9960..2219eb601d 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 empty string"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set(src, "0"); - assert(compareArray(sample, [42, 2]), "'0'"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set(src, false); - assert(compareArray(sample, [42, 2]), "false"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set(src, 0.1); - assert(compareArray(sample, [42, 2]), "0.1"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set(src, 0.9); - assert(compareArray(sample, [42, 2]), "0.9"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set(src, -0.5); - assert(compareArray(sample, [42, 2]), "-0.5"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set(src, 1.1); - assert(compareArray(sample, [1, 42]), "1.1"); + assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); sample = new TA([1, 2]); sample.set(src, NaN); - assert(compareArray(sample, [42, 2]), "NaN"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set(src, null); - assert(compareArray(sample, [42, 2]), "null"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set(src, undefined); - assert(compareArray(sample, [42, 2]), "undefined"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set(src, {}); - assert(compareArray(sample, [42, 2]), "{}"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set(src, []); - assert(compareArray(sample, [42, 2]), "[]"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set(src, [0]); - assert(compareArray(sample, [42, 2]), "[0]"); + assert.compareArray(sample, [42, 2], 'The value of sample is expected to be [42, 2]'); sample = new TA([1, 2]); sample.set(src, true); - assert(compareArray(sample, [1, 42]), "true"); + assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); sample = new TA([1, 2]); sample.set(src, "1"); - assert(compareArray(sample, [1, 42]), "'1'"); + assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); sample = new TA([1, 2]); sample.set(src, [1]); - assert(compareArray(sample, [1, 42]), "[1]"); + assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); sample = new TA([1, 2]); sample.set(src, { valueOf: function() {return 1;} }); - assert(compareArray(sample, [1, 42]), "valueOf"); + assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); sample = new TA([1, 2]); sample.set(src, { toString: function() {return 1;} }); - assert(compareArray(sample, [1, 42]), "toString"); + assert.compareArray(sample, [1, 42], 'The value of sample is expected to be [1, 42]'); }); 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 1b1a963887..d8e477c4ef 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]), "src is SAB-backed, offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); sample = new TA([1, 2, 3, 4]); result = sample.set(src, 1); - assert(compareArray(sample, [1, 42, 43, 4]), "src is SAB-backed, offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); sample = new TA([1, 2, 3, 4]); result = sample.set(src, 2); - assert(compareArray(sample, [1, 2, 42, 43]), "src is SAB-backed, offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); 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]), "sample is SAB-backed, offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); 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]), "sample is SAB-backed, offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); 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]), "sample is SAB-backed, offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); 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]), "src and sample are SAB-backed, offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); 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]), "src and sample are SAB-backed, offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); 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]), "src and sample are SAB-backed, offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); }, 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 04ddb52371..22d57299d6 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]), "offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); sample = new TA([1, 2, 3, 4]); result = sample.set(src, 1); - assert(compareArray(sample, [1, 42, 43, 4]), "offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); sample = new TA([1, 2, 3, 4]); result = sample.set(src, 2); - assert(compareArray(sample, [1, 2, 42, 43]), "offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); }); 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 cae8f7e5b3..2695362599 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]), "src is SAB-backed, offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); sample = new TA([1, 2, 3, 4]); result = sample.set(src, 0); - assert(compareArray(sample, [42, 43, 3, 4]), "src is SAB-backed, offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); sample = new TA([1, 2, 3, 4]); result = sample.set(src, 2); - assert(compareArray(sample, [1, 2, 42, 43]), "src is SAB-backed, offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); 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]), "sample is SAB-backed, offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); 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]), "sample is SAB-backed, offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); 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]), "sample is SAB-backed, offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); 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]), "src and sample are SAB-backed, offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); 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]), "src and sample are SAB-backed, offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); 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]), "src and sample are SAB-backed, offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); }, 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 b915747855..fe079f472e 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]), "offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); sample = new TA([1, 2, 3, 4]); result = sample.set(src, 0); - assert(compareArray(sample, [42, 43, 3, 4]), "offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); sample = new TA([1, 2, 3, 4]); result = sample.set(src, 2); - assert(compareArray(sample, [1, 2, 42, 43]), "offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); }); 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 45d648c1a2..a46f52c574 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]), sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); }); 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 3bd4bf6259..9593d2b030 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', - 'implements ArrayBuffer.prototype.resize' + 'The value of `typeof ArrayBuffer.prototype.resize` is expected to be "function"' ); testWithTypedArrayConstructors(function(TA) { @@ -33,7 +33,7 @@ testWithTypedArrayConstructors(function(TA) { } catch (_) {} target.set(source); - assert(compareArray(target, expected), 'following grow'); + assert.compareArray(target, expected, 'The value of target is expected to equal the value of expected'); try { ab.resize(BPE * 3); @@ -41,5 +41,5 @@ testWithTypedArrayConstructors(function(TA) { } catch (_) {} target.set(source); - assert(compareArray(target, expected), 'following shrink'); + assert.compareArray(target, expected, 'The value of target is expected to equal the value of expected'); }); 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 e3c3eabc25..ae1c10e691 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]), "offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); 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]), "offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); 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]), "offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); }, 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 02d15ddee9..d1491e4a5f 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]), "offset: 0, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); 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]), "offset: 1, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); 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]), "offset: 2, result: " + sample); - assert.sameValue(result, undefined, "returns undefined"); + 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'); }); diff --git a/test/built-ins/TypedArray/prototype/slice/BigInt/infinity.js b/test/built-ins/TypedArray/prototype/slice/BigInt/infinity.js index adad1dc0fa..c006bd49f0 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/infinity.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/infinity.js @@ -6,24 +6,21 @@ 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]), - "start == -Infinity" + assert.compareArray( + sample.slice(-Infinity), + [40n, 41n, 42n, 43n], + 'sample.slice(-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" + + 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]' ); }); 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 12245c6aae..4a9ec35f08 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/minus-zero.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/minus-zero.js @@ -8,24 +8,10 @@ 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]), - "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" - ); + 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 []'); }); 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 1db41d6012..8820cd75b0 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,48 +6,39 @@ 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), msg + ", result: [" + result + "]"); + assert.compareArray(result, expected, 'The value of result is expected to equal the value of expected'); } - 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 53ee40eba0..f77ab7ed6c 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,19 +29,21 @@ 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(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"); + 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'); }); 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 bfd0fff4f3..c27a2a5583 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,19 +35,17 @@ 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[Symbol.species] = function() { return other; }; result = sample.slice(0, 0); - - assert.sameValue(result, other, "returned another typedarray"); - assert(compareArray(result, [1n, 0n, 1n]), "the returned object is preserved"); + 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]'); }); 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 5965ce367a..3131cdc422 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,20 +35,18 @@ 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[Symbol.species] = function(count) { calls++; return new TA(count); }; result = sample.slice(1); - - assert.sameValue(calls, 1, "ctor called once"); - assert(compareArray(result, [41n, 42n]), "expected object"); + 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]'); }); 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 b43e92dc12..96dd7ee33a 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-end.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-end.js @@ -13,7 +13,6 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ - var obj = { valueOf: function() { return 2; @@ -22,27 +21,28 @@ 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, false), []), "false"); - assert(compareArray(sample.slice(0, true), [40n]), "true"); + 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, 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, 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, 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" + assert.compareArray( + sample.slice(0, obj), + [40n, 41n], + 'sample.slice(0, {valueOf: function() {return 2;}}) must return [40n, 41n]' ); }); 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 3b5bb606c9..edc79ea96d 100644 --- a/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-start.js +++ b/test/built-ins/TypedArray/prototype/slice/BigInt/tointeger-start.js @@ -12,7 +12,6 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ - var obj = { valueOf: function() { return 2; @@ -21,28 +20,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(false), [40n, 41n, 42n, 43n]), "false"); - assert(compareArray(sample.slice(true), [41n, 42n, 43n]), "true"); + assert.compareArray( + sample.slice(undefined), + [40n, 41n, 42n, 43n], + 'sample.slice(undefined) must return [40n, 41n, 42n, 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(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(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" + assert.compareArray( + sample.slice(obj), + [42n, 43n], + 'sample.slice({valueOf: function() {return 2;}}) must return [42n, 43n]' ); }); diff --git a/test/built-ins/TypedArray/prototype/slice/bit-precision.js b/test/built-ins/TypedArray/prototype/slice/bit-precision.js index fb3074b0bf..a78c76c064 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)); + assert.compareArray(subjectBytes, slicedBytes, 'The value of subjectBytes is expected to equal the value of 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 a93cd713a7..2cbe2b2bb4 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]), - "start == -Infinity" + assert.compareArray( + sample.slice(-Infinity), [40, 41, 42, 43], + 'sample.slice(-Infinity) must return [40, 41, 42, 43]' ); - assert( - compareArray(sample.slice(Infinity), []), - "start == Infinity" + assert.compareArray( + sample.slice(Infinity), [], + 'sample.slice(Infinity) must return []' ); - assert( - compareArray(sample.slice(0, -Infinity), []), - "end == -Infinity" + assert.compareArray( + sample.slice(0, -Infinity), [], + 'sample.slice(0, -Infinity) must return []' ); - assert( - compareArray(sample.slice(0, Infinity), [40, 41, 42, 43]), - "end == Infinity" + assert.compareArray( + sample.slice(0, Infinity), [40, 41, 42, 43], + 'sample.slice(0, Infinity) must return [40, 41, 42, 43]' ); }); diff --git a/test/built-ins/TypedArray/prototype/slice/minus-zero.js b/test/built-ins/TypedArray/prototype/slice/minus-zero.js index c597dadec9..ad176edd1c 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]), - "start == -0" + assert.compareArray( + sample.slice(-0), [40, 41, 42, 43], + 'sample.slice(-0) 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, 4), [40, 41, 42, 43], + 'sample.slice(-0, 4) must return [40, 41, 42, 43]' ); - 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" + assert.compareArray( + sample.slice(-0, -0), [], + 'sample.slice(-0, -0) must return []' ); }); 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 34a4ad11b3..590b54cb87 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), msg + ", result: [" + result + "]"); + assert.compareArray(result, expected, 'The value of result is expected to equal the value of expected'); } 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 cb19d311d2..241105d13d 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), "values are set"); - assert.notSameValue(result.buffer, sample.buffer, "creates a new buffer"); - assert.sameValue(result.constructor, other, "used the custom ctor"); + 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'); }); 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 7bb19f5df4..8783a4450c 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, "returned another typedarray"); - assert(compareArray(result, [1, 0, 1]), "the returned object is preserved"); + 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]'); }); 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 0477a0fd43..29baffabd9 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, "ctor called once"); - assert(compareArray(result, [41, 42]), "expected object"); + 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]'); }); diff --git a/test/built-ins/TypedArray/prototype/slice/tointeger-end.js b/test/built-ins/TypedArray/prototype/slice/tointeger-end.js index 2a9be94068..146e14df18 100644 --- a/test/built-ins/TypedArray/prototype/slice/tointeger-end.js +++ b/test/built-ins/TypedArray/prototype/slice/tointeger-end.js @@ -23,26 +23,20 @@ var obj = { testWithTypedArrayConstructors(function(TA) { var sample = new TA([40, 41, 42, 43]); - assert(compareArray(sample.slice(0, false), []), "false"); - assert(compareArray(sample.slice(0, true), [40]), "true"); + 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, 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, 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, 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, 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, "3"), [40, 41, 42]), "string"); - assert( - compareArray( - sample.slice(0, obj), - [40, 41] - ), - "object" - ); + 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]'); }); diff --git a/test/built-ins/TypedArray/prototype/slice/tointeger-start.js b/test/built-ins/TypedArray/prototype/slice/tointeger-start.js index f67ee090c0..a65ba1d531 100644 --- a/test/built-ins/TypedArray/prototype/slice/tointeger-start.js +++ b/test/built-ins/TypedArray/prototype/slice/tointeger-start.js @@ -22,27 +22,21 @@ var obj = { testWithTypedArrayConstructors(function(TA) { var sample = new TA([40, 41, 42, 43]); - assert(compareArray(sample.slice(false), [40, 41, 42, 43]), "false"); - assert(compareArray(sample.slice(true), [41, 42, 43]), "true"); + assert.compareArray(sample.slice(false), [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(NaN), [40, 41, 42, 43]), "NaN"); - assert(compareArray(sample.slice(null), [40, 41, 42, 43]), "null"); - assert(compareArray(sample.slice(undefined), [40, 41, 42, 43]), "undefined"); + assert.compareArray(sample.slice(NaN), [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(1.1), [41, 42, 43]), "1.1"); - assert(compareArray(sample.slice(1.5), [41, 42, 43]), "1.5"); - assert(compareArray(sample.slice(0.6), [40, 41, 42, 43]), "0.6"); + assert.compareArray(sample.slice(1.1), [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.5), [43]), "-1.5"); - assert(compareArray(sample.slice(-1.1), [43]), "-1.1"); - assert(compareArray(sample.slice(-0.6), [40, 41, 42, 43]), "-0.6"); + assert.compareArray(sample.slice(-1.5), [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("3"), [43]), "string"); - assert( - compareArray( - sample.slice(obj), - [42, 43] - ), - "object" - ); + 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]'); }); 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 8a3d5a7f8b..5eb0c8edb2 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 desc = { get: function getLen() { getCalls++; @@ -20,20 +20,14 @@ 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, "ignores length properties"); - assert( - compareArray(result, sample), - "result is not affected by custom length" - ); + 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'); }); 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 f588b36bcc..abe1d3ffa1 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; + BigInt.prototype.toString = function() { toStringCalled = true; -} +}; testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([20n, 100n, 3n]); var result = sample.sort(); - assert.sameValue(toStringCalled, false, "BigInt.prototype.toString will not be called"); - assert(compareArray(result, [3n, 20n, 100n])); + 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]'); }); 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 79b7e54691..eab089edec 100644 --- a/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js +++ b/test/built-ins/TypedArray/prototype/sort/BigInt/sorted-values.js @@ -13,19 +13,25 @@ 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]), "descending values"); - + 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]), "mixed numbers"); - + 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]), "repeating numbers"); + + 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]' + ); }); var sample = new BigInt64Array([-4n, 3n, 4n, -3n, 2n, -2n, 1n, 0n]).sort(); -assert(compareArray(sample, [-4n, -3n, -2n, 0n, 1n, 2n, 3n, 4n]), "negative values"); + +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]' +); diff --git a/test/built-ins/TypedArray/prototype/sort/arraylength-internal.js b/test/built-ins/TypedArray/prototype/sort/arraylength-internal.js index 543c4eaa6f..25b9f44f04 100644 --- a/test/built-ins/TypedArray/prototype/sort/arraylength-internal.js +++ b/test/built-ins/TypedArray/prototype/sort/arraylength-internal.js @@ -31,9 +31,6 @@ testWithTypedArrayConstructors(function(TA) { var result = sample.sort(); - assert.sameValue(getCalls, 0, "ignores length properties"); - assert( - compareArray(result, sample), - "result is not affected by custom length" - ); + 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'); }); 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 591c9087b0..cb8445cd0a 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, "Number.prototype.toString will not be called"); - assert(compareArray(result, [3, 20, 100]), "Default sorting by value"); + 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]'); }); diff --git a/test/built-ins/TypedArray/prototype/sort/sorted-values.js b/test/built-ins/TypedArray/prototype/sort/sorted-values.js index 5693c6d577..12d67a7e87 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]), "descending values"); + assert.compareArray(sample, [1, 2, 3, 4], 'The value of sample is expected to be [1, 2, 3, 4]'); sample = new TA([3, 4, 1, 2]).sort(); - assert(compareArray(sample, [1, 2, 3, 4]), "mixed numbers"); + assert.compareArray(sample, [1, 2, 3, 4], 'The value of sample is expected to be [1, 2, 3, 4]'); sample = new TA([3, 4, 3, 1, 0, 1, 2]).sort(); - assert(compareArray(sample, [0, 1, 1, 2, 3, 3, 4]), "repeating numbers"); + 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]'); }); testWithTypedArrayConstructors(function(TA) { var sample = new TA([1, 0, -0, 2]).sort(); - assert(compareArray(sample, [-0, 0, 1, 2]), "0s"); + assert.compareArray(sample, [-0, 0, 1, 2], 'The value of sample is expected to be [-0, 0, 1, 2]'); }, floatArrayConstructors); testWithTypedArrayConstructors(function(TA) { var sample = new TA([1, 0, -0, 2]).sort(); - assert(compareArray(sample, [0, 0, 1, 2]), "0s"); + assert.compareArray(sample, [0, 0, 1, 2], 'The value of sample is expected to be [0, 0, 1, 2]'); }, 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]), "negative values"); + 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]'); }, [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]), "non integers"); + assert.compareArray(sample, [0, 0.5, 1, 1.5], 'The value of sample is expected to be [0, 0.5, 1, 1.5]'); sample = new TA([0.5, 0, 1.5, -0.5, -1, -1.5, 1]).sort(); - assert(compareArray(sample, [-1.5, -1, -0.5, 0, 0.5, 1, 1.5]), "non integers + negatives"); + 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]'); sample = new TA([3, 4, Infinity, -Infinity, 1, 2]).sort(); - assert(compareArray(sample, [-Infinity, 1, 2, 3, 4, Infinity]), "infinities"); + assert.compareArray(sample, [-Infinity, 1, 2, 3, 4, Infinity], 'The value of sample is expected to be [-Infinity, 1, 2, 3, 4, Infinity]'); }, [Float64Array, Float32Array]); diff --git a/test/built-ins/TypedArray/prototype/sort/stability.js b/test/built-ins/TypedArray/prototype/sort/stability.js index 3bdd6fc6ed..8e930f925a 100644 --- a/test/built-ins/TypedArray/prototype/sort/stability.js +++ b/test/built-ins/TypedArray/prototype/sort/stability.js @@ -17,16 +17,17 @@ testWithTypedArrayConstructors((TA) => { const array = Array.from({ length: 128 }, (_, i) => i); const typedArray1 = new TA(array); - assert(compareArray( + assert.compareArray( typedArray1.sort(compare), - array - ), 'pre-sorted'); + array, + 'typedArray1.sort((a, b) => (a / 4 | 0) - (b / 4 | 0)) returns array' + ); // 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, @@ -40,6 +41,7 @@ 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, - ] - ), 'not presorted'); + ], + '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]' + ); }); diff --git a/test/built-ins/TypedArray/prototype/subarray/BigInt/infinity.js b/test/built-ins/TypedArray/prototype/subarray/BigInt/infinity.js index fc6786978f..e24a388519 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/infinity.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/infinity.js @@ -8,24 +8,21 @@ 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]), - "begin == -Infinity" + assert.compareArray( + sample.subarray(-Infinity), + [40n, 41n, 42n, 43n], + 'sample.subarray(-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" + + 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]' ); }); 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 b71e445c7f..c1d0d08a84 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/minus-zero.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/minus-zero.js @@ -8,24 +8,16 @@ 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), [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, 4), + [40n, 41n, 42n, 43n], + 'sample.subarray(-0, 4) must return [40n, 41n, 42n, 43n]' ); + + 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 0d0362394a..c9a156ec4e 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,7 +11,6 @@ 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); @@ -19,13 +18,15 @@ testWithBigIntTypedArrayConstructors(function(TA) { assert.sameValue( Object.getPrototypeOf(result), Object.getPrototypeOf(sample), - "prototype" + 'Object.getPrototypeOf(sample.subarray(1)) must return the same value returned by Object.getPrototypeOf(sample)' ); - assert.sameValue(result.constructor, sample.constructor, "constructor"); - assert(result instanceof TA, "instanceof"); - assert( - compareArray(sample, [40n, 41n, 42n, 43n]), - "original sample remains the same" + 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.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 ee1198833f..843ad38558 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,25 +11,21 @@ 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.notSameValue(result, sample, "returns a new instance"); - assert.sameValue(result.buffer, sample.buffer, "shared buffer"); - assert.sameValue(sample.buffer, buffer, "original buffer is preserved"); + 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'); sample[1] = 100n; - assert( - compareArray(result, [100n, 42n, 43n]), - "changes on the original sample values affect the new instance" - ); - + 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]), - "changes on the new instance values affect the original sample" - ); + assert.compareArray(sample, [40n, 100n, 111n, 43n], 'The value of sample is expected to be [40n, 100n, 111n, 43n]'); }); 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 ff07874698..2e0e750dfa 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,48 +11,39 @@ 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), msg + ", result: [" + result + "]"); + assert.compareArray(result, expected, 'The value of result is expected to equal the value of expected'); } - 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 0aa28e822a..ddafb33122 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,19 +34,17 @@ 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[Symbol.species] = function() { return other; }; result = sample.subarray(0, 0); - - assert.sameValue(result, other, "returned another typedarray"); - assert(compareArray(result, [1n, 0n, 1n]), "the returned object is preserved"); + 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]'); }); 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 01b0dbd9b4..288af9a5e6 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,20 +34,18 @@ 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[Symbol.species] = function(buffer, offset, length) { calls++; return new TA(buffer, offset, length); }; result = sample.subarray(1); - - assert.sameValue(calls, 1, "ctor called once"); - assert(compareArray(result, [41n, 42n]), "expected subarray"); + 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]'); }); 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 3d9ff3c0f1..02ec829b95 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-begin.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-begin.js @@ -12,7 +12,6 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ - var obj = { valueOf: function() { return 2; @@ -22,27 +21,44 @@ var obj = { testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([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(false), + [40n, 41n, 42n, 43n], + 'sample.subarray(false) 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(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(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(null), + [40n, 41n, 42n, 43n], + 'sample.subarray(null) 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(undefined), + [40n, 41n, 42n, 43n], + 'sample.subarray(undefined) must return [40n, 41n, 42n, 43n]' + ); - assert(compareArray(sample.subarray("3"), [43n]), "string"); - assert( - compareArray( - sample.subarray(obj), - [42n, 43n] - ), - "object" + 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]' ); }); 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 8885220a3f..f1deb8cf17 100644 --- a/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-end.js +++ b/test/built-ins/TypedArray/prototype/subarray/BigInt/tointeger-end.js @@ -13,7 +13,6 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, TypedArray] ---*/ - var obj = { valueOf: function() { return 2; @@ -22,27 +21,28 @@ 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, false), []), "false"); - assert(compareArray(sample.subarray(0, true), [40n]), "true"); + 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, 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, 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, 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" + assert.compareArray( + sample.subarray(0, obj), + [40n, 41n], + 'sample.subarray(0, {valueOf: function() {return 2;}}) must return [40n, 41n]' ); }); diff --git a/test/built-ins/TypedArray/prototype/subarray/infinity.js b/test/built-ins/TypedArray/prototype/subarray/infinity.js index 8a27464925..6c4a2d9b10 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]), - "begin == -Infinity" + assert.compareArray( + sample.subarray(-Infinity), [40, 41, 42, 43], + 'sample.subarray(-Infinity) must return [40, 41, 42, 43]' ); - assert( - compareArray(sample.subarray(Infinity), []), - "being == Infinity" + assert.compareArray( + sample.subarray(Infinity), [], + 'sample.subarray(Infinity) must return []' ); - assert( - compareArray(sample.subarray(0, -Infinity), []), - "end == -Infinity" + assert.compareArray( + sample.subarray(0, -Infinity), [], + 'sample.subarray(0, -Infinity) must return []' ); - assert( - compareArray(sample.subarray(0, Infinity), [40, 41, 42, 43]), - "end == Infinity" + assert.compareArray( + sample.subarray(0, Infinity), [40, 41, 42, 43], + 'sample.subarray(0, Infinity) must return [40, 41, 42, 43]' ); }); diff --git a/test/built-ins/TypedArray/prototype/subarray/minus-zero.js b/test/built-ins/TypedArray/prototype/subarray/minus-zero.js index de714ad469..b70f27cc6f 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]), - "begin == -0" + assert.compareArray( + sample.subarray(-0), [40, 41, 42, 43], + 'sample.subarray(-0) 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, 4), [40, 41, 42, 43], + 'sample.subarray(-0, 4) must return [40, 41, 42, 43]' ); - 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" + assert.compareArray( + sample.subarray(-0, -0), [], + 'sample.subarray(-0, -0) must return []' ); }); 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 a507518bb7..eafb28555f 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), - "prototype" + 'Object.getPrototypeOf(sample.subarray(1)) must return the same value returned by Object.getPrototypeOf(sample)' ); - 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(result instanceof TA, 'The result of evaluating (result instanceof TA) is expected to be true'); - assert( - compareArray(sample, [40, 41, 42, 43]), - "original sample remains the same" + assert.compareArray( + sample, [40, 41, 42, 43], + 'The value of sample is expected to be [40, 41, 42, 43]' ); }); 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 ff3925eb63..c42880d895 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, "returns a new instance"); - assert.sameValue(result.buffer, sample.buffer, "shared buffer"); - assert.sameValue(sample.buffer, buffer, "original buffer is preserved"); + 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'); sample[1] = 100; - assert( - compareArray(result, [100, 42, 43]), - "changes on the original sample values affect the new instance" + assert.compareArray( + result, [100, 42, 43], + 'The value of result is expected to be [100, 42, 43]' ); result[1] = 111; - assert( - compareArray(sample, [40, 100, 111, 43]), - "changes on the new instance values affect the original sample" + assert.compareArray( + sample, [40, 100, 111, 43], + 'The value of sample is expected to be [40, 100, 111, 43]' ); }); 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 c206e2462b..26c1a4b318 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), msg + ", result: [" + result + "]"); + assert.compareArray(result, expected, 'The value of result is expected to equal the value of expected'); } 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 3ed6ba00a8..69100186ee 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, "returned another typedarray"); - assert(compareArray(result, [1, 0, 1]), "the returned object is preserved"); + 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]'); }); 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 5dbc2cc361..8b4c8aa528 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, "ctor called once"); - assert(compareArray(result, [41, 42]), "expected subarray"); + 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]'); }); diff --git a/test/built-ins/TypedArray/prototype/subarray/tointeger-begin.js b/test/built-ins/TypedArray/prototype/subarray/tointeger-begin.js index abf503cb8f..27a9e96e76 100644 --- a/test/built-ins/TypedArray/prototype/subarray/tointeger-begin.js +++ b/test/built-ins/TypedArray/prototype/subarray/tointeger-begin.js @@ -22,27 +22,21 @@ var obj = { testWithTypedArrayConstructors(function(TA) { var sample = new TA([40, 41, 42, 43]); - assert(compareArray(sample.subarray(false), [40, 41, 42, 43]), "false"); - assert(compareArray(sample.subarray(true), [41, 42, 43]), "true"); + assert.compareArray(sample.subarray(false), [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(NaN), [40, 41, 42, 43]), "NaN"); - assert(compareArray(sample.subarray(null), [40, 41, 42, 43]), "null"); - assert(compareArray(sample.subarray(undefined), [40, 41, 42, 43]), "undefined"); + assert.compareArray(sample.subarray(NaN), [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(1.1), [41, 42, 43]), "1.1"); - assert(compareArray(sample.subarray(1.5), [41, 42, 43]), "1.5"); - assert(compareArray(sample.subarray(0.6), [40, 41, 42, 43]), "0.6"); + assert.compareArray(sample.subarray(1.1), [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.5), [43]), "-1.5"); - assert(compareArray(sample.subarray(-1.1), [43]), "-1.1"); - assert(compareArray(sample.subarray(-0.6), [40, 41, 42, 43]), "-0.6"); + assert.compareArray(sample.subarray(-1.5), [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("3"), [43]), "string"); - assert( - compareArray( - sample.subarray(obj), - [42, 43] - ), - "object" - ); + 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]'); }); diff --git a/test/built-ins/TypedArray/prototype/subarray/tointeger-end.js b/test/built-ins/TypedArray/prototype/subarray/tointeger-end.js index 4797bf5b22..12dad543e1 100644 --- a/test/built-ins/TypedArray/prototype/subarray/tointeger-end.js +++ b/test/built-ins/TypedArray/prototype/subarray/tointeger-end.js @@ -23,26 +23,20 @@ var obj = { testWithTypedArrayConstructors(function(TA) { var sample = new TA([40, 41, 42, 43]); - assert(compareArray(sample.subarray(0, false), []), "false"); - assert(compareArray(sample.subarray(0, true), [40]), "true"); + 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, 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, 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, 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, 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, "3"), [40, 41, 42]), "string"); - assert( - compareArray( - sample.subarray(0, obj), - [40, 41] - ), - "object" - ); + 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]'); }); 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 82cd346b91..3191f75ccc 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,23 +30,19 @@ 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, "returns expected value"); - assert( - compareArray(new TA(calls), sample), - "toLocaleString called for each item" - ); + 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'); }); 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 980670c721..6cb25fc9ab 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, "returns expected value"); - assert( - compareArray(new TA(calls), sample), - "toLocaleString called for each item" + 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' ); }); 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 d440071946..8391ffc800 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)); + assert.compareArray(firstBytes, secondBytes, 'The value of firstBytes is expected to equal the value of 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 0aba12fc80..1d3db05086 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,7 +14,11 @@ 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'); +assert.sameValue( + typeof ArrayBuffer.prototype.resize, + 'function', + 'The value of `typeof ArrayBuffer.prototype.resize` is expected to be "function"' +); testWithTypedArrayConstructors(function(TA) { var BPE = TA.BYTES_PER_ELEMENT; @@ -46,7 +50,7 @@ testWithTypedArrayConstructors(function(TA) { } catch (_) {} }; - assert(compareArray(new TargetCtor(source), expected), 'following grow'); + assert.compareArray(new TargetCtor(source), expected, 'new TargetCtor(source) is expected to equal the value of expected'); onGetSpecies = function() { try { @@ -55,7 +59,7 @@ testWithTypedArrayConstructors(function(TA) { } catch (_) {} }; - assert(compareArray(new TargetCtor(source), expected), 'following shrink (within bounds)'); + assert.compareArray(new TargetCtor(source), expected, 'new TargetCtor(source) is expected to equal the value of expected'); onGetSpecies = function() { try { @@ -64,7 +68,7 @@ testWithTypedArrayConstructors(function(TA) { } catch (_) {} }; - assert(compareArray(new TargetCtor(source), expected), 'following shrink (on boundary)'); + assert.compareArray(new TargetCtor(source), expected, 'new TargetCtor(source) is expected to equal the value of expected'); // `assert.throws` cannot be used in this case because the expected error // is derived only after the constructor is invoked. @@ -85,5 +89,9 @@ testWithTypedArrayConstructors(function(TA) { actualError = caught; } - assert.sameValue(actualError.constructor, expectedError); + assert.sameValue( + actualError.constructor, + expectedError, + 'The value of actualError.constructor is expected to equal the value of 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 c633ba0696..1837d791b9 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,7 +14,11 @@ 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'); +assert.sameValue( + typeof ArrayBuffer.prototype.resize, + 'function', + 'The value of `typeof ArrayBuffer.prototype.resize` is expected to be "function"' +); testWithTypedArrayConstructors(function(TA) { var BPE = TA.BYTES_PER_ELEMENT; @@ -45,8 +49,12 @@ testWithTypedArrayConstructors(function(TA) { } catch (_) {} }; - assert.sameValue((new TA(source)).join(','), expected.join(',')); - assert(compareArray(new TA(source), expected), 'following grow'); + 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'); onGetSpecies = function() { try { @@ -55,7 +63,7 @@ testWithTypedArrayConstructors(function(TA) { } catch (_) {} }; - assert(compareArray(new TA(source), expected), 'following shrink (within bounds)'); + assert.compareArray(new TA(source), expected, 'new TA(source) is expected to equal the value of expected'); onGetSpecies = function() { try { @@ -64,7 +72,7 @@ testWithTypedArrayConstructors(function(TA) { } catch (_) {} }; - assert(compareArray(new TA(source), expected), 'following shrink (on boundary)'); + assert.compareArray(new TA(source), expected, 'new TA(source) is expected to equal the value of expected'); // `assert.throws` cannot be used in this case because the expected error // is derived only after the constructor is invoked. @@ -85,5 +93,9 @@ testWithTypedArrayConstructors(function(TA) { actualError = caught; } - assert.sameValue(actualError.constructor, expectedError); + assert.sameValue( + actualError.constructor, + expectedError, + 'The value of actualError.constructor is expected to equal the value of 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 6f64fa646a..89d886a1b3 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,6 +1,5 @@ // Copyright (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: > @@ -16,10 +15,8 @@ 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; @@ -30,9 +27,11 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample1.test262 = 42; sample1.ecma262 = 42; var result1 = Reflect.ownKeys(sample1); - assert( - compareArray(result1, ["0", "1", "2", "test262", "ecma262", s1, s2]), - "result1" + + 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]' ); var sample2 = new TA(4).subarray(2); @@ -41,8 +40,10 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample2.test262 = 42; sample2.ecma262 = 42; var result2 = Reflect.ownKeys(sample2); - assert( - compareArray(result2, ["0", "1", "test262", "ecma262", s1, s2]), - "result2" + + assert.compareArray( + result2, + ['0', '1', 'test262', 'ecma262', s1, s2], + 'The value of result2 is expected to be ["0", "1", "test262", "ecma262", s1, s2]' ); }); 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 8de17148be..22fb839ec5 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,6 +1,5 @@ // Copyright (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: > @@ -16,7 +15,6 @@ info: | includes: [testBigIntTypedArray.js, compareArray.js] features: [BigInt, Reflect, TypedArray] ---*/ - TypedArray.prototype[3] = 42; TypedArray.prototype.bar = 42; @@ -25,17 +23,21 @@ testWithBigIntTypedArrayConstructors(function(TA) { sample1.test262 = 42; sample1.ecma262 = 42; var result1 = Reflect.ownKeys(sample1); - assert( - compareArray(result1, ["0", "1", "2", "test262", "ecma262"]), - "result1" + + assert.compareArray( + result1, + ['0', '1', '2', 'test262', 'ecma262'], + 'The value of result1 is expected to be ["0", "1", "2", "test262", "ecma262"]' ); var sample2 = new TA(4).subarray(2); sample2.test262 = 42; sample2.ecma262 = 42; var result2 = Reflect.ownKeys(sample2); - assert( - compareArray(result2, ["0", "1", "test262", "ecma262"]), - "result2" + + assert.compareArray( + result2, + ['0', '1', 'test262', 'ecma262'], + 'The value of result2 is expected to be ["0", "1", "test262", "ecma262"]' ); }); 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 88f6f3b8fb..4633b930c9 100644 --- a/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes.js +++ b/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes.js @@ -1,6 +1,5 @@ // Copyright (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: > @@ -16,21 +15,17 @@ 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"]), "result1"); - + assert.compareArray(result1, ['0', '1', '2'], 'The value of result1 is expected to be ["0", "1", "2"]'); var sample2 = new TA(4); var result2 = Reflect.ownKeys(sample2); - assert(compareArray(result2, ["0", "1", "2", "3"]), "result2"); - + assert.compareArray(result2, ['0', '1', '2', '3'], 'The value of result2 is expected to be ["0", "1", "2", "3"]'); var sample3 = new TA(4).subarray(2); var result3 = Reflect.ownKeys(sample3); - assert(compareArray(result3, ["0", "1"]), "result3"); - + assert.compareArray(result3, ['0', '1'], 'The value of result3 is expected to be ["0", "1"]'); var sample4 = new TA(); var result4 = Reflect.ownKeys(sample4); - assert(compareArray(result4, []), "result4"); + assert.compareArray(result4, [], 'The value of result4 is expected to be []'); }); 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 d50d2d20f9..2e640e757c 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])); + assert.compareArray(result, ["test262", s], 'The value of result is expected to be ["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 9060bee4d7..a7174168bd 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]), - "result1" + 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]' ); 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]), - "result2" + assert.compareArray( + result2, ["0", "1", "test262", "ecma262", s1, s2], + 'The value of result2 is expected to be ["0", "1", "test262", "ecma262", s1, s2]' ); }); 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 b227ef6f22..35435d2ae6 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"]), - "result1" + assert.compareArray( + result1, ["0", "1", "2", "test262", "ecma262"], + 'The value of result1 is expected to be ["0", "1", "2", "test262", "ecma262"]' ); var sample2 = new TA(4).subarray(2); sample2.test262 = 42; sample2.ecma262 = 42; var result2 = Reflect.ownKeys(sample2); - assert( - compareArray(result2, ["0", "1", "test262", "ecma262"]), - "result2" + assert.compareArray( + result2, ["0", "1", "test262", "ecma262"], + 'The value of result2 is expected to be ["0", "1", "test262", "ecma262"]' ); }); diff --git a/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/integer-indexes.js b/test/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/integer-indexes.js index 00e57de342..b0b27e8d91 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"]), "result1"); + assert.compareArray(result1, ["0", "1", "2"], 'The value of result1 is expected to be ["0", "1", "2"]'); var sample2 = new TA(4); var result2 = Reflect.ownKeys(sample2); - assert(compareArray(result2, ["0", "1", "2", "3"]), "result2"); + assert.compareArray(result2, ["0", "1", "2", "3"], 'The value of result2 is expected to be ["0", "1", "2", "3"]'); var sample3 = new TA(4).subarray(2); var result3 = Reflect.ownKeys(sample3); - assert(compareArray(result3, ["0", "1"]), "result3"); + assert.compareArray(result3, ["0", "1"], 'The value of result3 is expected to be ["0", "1"]'); var sample4 = new TA(); var result4 = Reflect.ownKeys(sample4); - assert(compareArray(result4, []), "result4"); + assert.compareArray(result4, [], 'The value of result4 is expected to be []'); }); 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 ad030c21ee..7a47cfcb83 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])); + assert.compareArray(result, ["test262", s], 'The value of result is expected to be ["test262", s]'); }); diff --git a/test/harness/compare-array-samevalue.js b/test/harness/compare-array-samevalue.js index 826840e219..bbd97046b5 100644 --- a/test/harness/compare-array-samevalue.js +++ b/test/harness/compare-array-samevalue.js @@ -7,5 +7,7 @@ description: > includes: [compareArray.js] ---*/ -assert(compareArray([NaN], [NaN])); -assert(!compareArray([0], [-0])); +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'); diff --git a/test/intl402/Intl/getCanonicalLocales/duplicates.js b/test/intl402/Intl/getCanonicalLocales/duplicates.js index cff587ca3c..18cc833ba5 100644 --- a/test/intl402/Intl/getCanonicalLocales/duplicates.js +++ b/test/intl402/Intl/getCanonicalLocales/duplicates.js @@ -11,9 +11,8 @@ info: | includes: [compareArray.js] ---*/ -assert(compareArray( - Intl.getCanonicalLocales( - ['ab-cd', 'ff', 'de-rt', 'ab-Cd']), ['ab-CD', 'ff', 'de-RT'])); +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"]'); var locales = Intl.getCanonicalLocales(['en-US', 'en-US']); -assert(compareArray(locales, ['en-US']), 'en-US'); +assert.compareArray(locales, ['en-US'], 'The value of locales is expected to be ["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 ee96616d7f..3fcc9302a9 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), r); + assert.compareArray(l, r, 'The value of l is expected to equal the value of r'); } assertArray(gCL(), []); diff --git a/test/intl402/Intl/getCanonicalLocales/main.js b/test/intl402/Intl/getCanonicalLocales/main.js index ae088b38a2..5ac0a2163b 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), r); + assert.compareArray(l, r, 'The value of l is expected to equal the value of r'); } assertArray(gCL(), []); diff --git a/test/intl402/Intl/getCanonicalLocales/overriden-arg-length.js b/test/intl402/Intl/getCanonicalLocales/overriden-arg-length.js index 49321736a0..e0a066641c 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); -}, "should throw if locales.length throws"); +}, 'Intl.getCanonicalLocales(locales) throws a Test262Error exception'); var locales = { '0': 'en-US', @@ -32,8 +32,8 @@ Object.defineProperty(locales, "length", { get: function() { return "1" } }); -assert(compareArray(Intl.getCanonicalLocales(locales), ['en-US']), - "should return one element if locales.length is '1'"); +assert.compareArray(Intl.getCanonicalLocales(locales), ['en-US'], + 'Intl.getCanonicalLocales({"0": "en-US", "1": "pt-BR",}) must return ["en-US"]'); 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']), - "should return one element if locales.length is 1.3"); +assert.compareArray(Intl.getCanonicalLocales(locales), ['en-US'], + 'Intl.getCanonicalLocales({"0": "en-US", "1": "pt-BR",}) must return ["en-US"]'); var locales = { '0': 'en-US', @@ -58,7 +58,7 @@ Object.defineProperty(locales, "length", { assert.throws(TypeError, function() { Intl.getCanonicalLocales(locales); -}, "should throw if locales.length is a Symbol"); +}, 'Intl.getCanonicalLocales(locales) throws a TypeError exception'); var locales = { '0': 'en-US', @@ -69,8 +69,8 @@ Object.defineProperty(locales, "length", { get: function() { return -Infinity } }); -assert(compareArray(Intl.getCanonicalLocales(locales), []), - "should return empty array if locales.length is -Infinity"); +assert.compareArray(Intl.getCanonicalLocales(locales), [], + 'Intl.getCanonicalLocales({"0": "en-US", "1": "pt-BR",}) must return []'); 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), []), - "should return empty array if locales.length is a negative value"); +assert.compareArray(Intl.getCanonicalLocales(locales), [], + 'Intl.getCanonicalLocales({length: -Math.pow(2, 32) + 1}) must return []'); 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); +assert.sameValue(locales.length, 0, 'The value of locales.length is expected to be 0'); diff --git a/test/intl402/Intl/getCanonicalLocales/overriden-push.js b/test/intl402/Intl/getCanonicalLocales/overriden-push.js index 142f123c53..1b5b5aa28d 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"])); +assert.compareArray(arr, ["en-US"], 'The value of arr is expected to be ["en-US"]'); diff --git a/test/intl402/Intl/getCanonicalLocales/to-string.js b/test/intl402/Intl/getCanonicalLocales/to-string.js index 3d18a6dff0..e3473d8c6a 100644 --- a/test/intl402/Intl/getCanonicalLocales/to-string.js +++ b/test/intl402/Intl/getCanonicalLocales/to-string.js @@ -17,4 +17,8 @@ var locales = { length: 2 }; -assert(compareArray(Intl.getCanonicalLocales(locales), [ "en-US", "pt-BR" ])); +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" ]' +); diff --git a/test/intl402/Intl/getCanonicalLocales/weird-cases.js b/test/intl402/Intl/getCanonicalLocales/weird-cases.js index 32fa44f679..fba778ea71 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])); + assert.compareArray(Intl.getCanonicalLocales(weird), [weird], 'Intl.getCanonicalLocales(weird) must return [weird]'); }); diff --git a/test/intl402/ListFormat/prototype/formatToParts/iterable-undefined.js b/test/intl402/ListFormat/prototype/formatToParts/iterable-undefined.js index c1d6ac91c0..d246928f84 100644 --- a/test/intl402/ListFormat/prototype/formatToParts/iterable-undefined.js +++ b/test/intl402/ListFormat/prototype/formatToParts/iterable-undefined.js @@ -16,4 +16,8 @@ includes: [compareArray.js] let lf = new Intl.ListFormat(); -assert(compareArray([], lf.formatToParts(undefined))); +assert.compareArray( + lf.formatToParts(undefined), + [], + 'lf.formatToParts(undefined) must return []' +); diff --git a/test/language/computed-property-names/basics/number.js b/test/language/computed-property-names/basics/number.js index 823d669f8b..f53f9e17b8 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 `'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`" +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"]' ); diff --git a/test/language/computed-property-names/basics/string.js b/test/language/computed-property-names/basics/string.js index 039b4d4697..f7f66c62ce 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 `'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`" +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"]' ); diff --git a/test/language/computed-property-names/basics/symbol.js b/test/language/computed-property-names/basics/symbol.js index 9408401002..b497e317eb 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 `'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.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( - compareArray(Object.getOwnPropertySymbols(object), [sym1, sym2]), - "`compareArray(Object.getOwnPropertySymbols(object), [sym1, sym2])` returns `true`" +assert.compareArray( + Object.getOwnPropertySymbols(object), [sym1, sym2], + 'Object.getOwnPropertySymbols({a: "A", [sym1]: "B", c: "C", [ID(sym2)]: "D",}) must return [sym1, sym2]' ); diff --git a/test/language/computed-property-names/class/method/generator.js b/test/language/computed-property-names/class/method/generator.js index 94d9054cd4..dea4f72616 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 `0`" + 'The value of Object.keys(C.prototype).length is expected to be 0' ); -assert( - compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a']), - "`compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a'])` returns `true`" +assert.compareArray( + Object.getOwnPropertyNames(C.prototype), ['constructor', 'a'], + 'Object.getOwnPropertyNames(C.prototype) must return ["constructor", "a"]' ); diff --git a/test/language/computed-property-names/class/method/number.js b/test/language/computed-property-names/class/method/number.js index b8b005995b..b47579162b 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()` 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(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, "No enum keys from C.prototype"); +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']), - "`compareArray(Object.getOwnPropertyNames(C.prototype), ['1', '2', 'constructor', 'a', 'c'])` returns `true`" +assert.compareArray( + Object.getOwnPropertyNames(C.prototype), ['1', '2', 'constructor', 'a', 'c'], + 'Object.getOwnPropertyNames(C.prototype) must return ["1", "2", "constructor", "a", "c"]' ); diff --git a/test/language/computed-property-names/class/method/string.js b/test/language/computed-property-names/class/method/string.js index f35f2341d1..cb509bd794 100644 --- a/test/language/computed-property-names/class/method/string.js +++ b/test/language/computed-property-names/class/method/string.js @@ -17,12 +17,11 @@ class C { c() { return 'C'; } [ID('d')]() { return '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`" +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"]' ); diff --git a/test/language/computed-property-names/class/method/symbol.js b/test/language/computed-property-names/class/method/symbol.js index 9dd9870b11..f1f431a048 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()` 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.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( - compareArray(Object.getOwnPropertySymbols(C.prototype), [sym1, sym2]), - "`compareArray(Object.getOwnPropertySymbols(C.prototype), [sym1, sym2])` returns `true`" +assert.compareArray( + Object.getOwnPropertySymbols(C.prototype), [sym1, sym2], + 'Object.getOwnPropertySymbols(C.prototype) must return [sym1, sym2]' ); diff --git a/test/language/computed-property-names/object/method/generator.js b/test/language/computed-property-names/object/method/generator.js index dcf29a544a..b1df1eb93b 100644 --- a/test/language/computed-property-names/object/method/generator.js +++ b/test/language/computed-property-names/object/method/generator.js @@ -12,7 +12,6 @@ var object = { yield 2; } }; -assert( - compareArray(Object.keys(object), ['a']), - "`compareArray(Object.keys(object), ['a'])` returns `true`" +assert.compareArray(Object.keys(object), ['a'], + 'Object.keys({*["a"]() {yield 1; yield 2;}}) must return ["a"]' ); diff --git a/test/language/computed-property-names/object/method/number.js b/test/language/computed-property-names/object/method/number.js index 65196664c7..8283408f50 100644 --- a/test/language/computed-property-names/object/method/number.js +++ b/test/language/computed-property-names/object/method/number.js @@ -17,11 +17,10 @@ var object = { c() { return 'C'; }, [ID(2)]() { return 'D'; }, }; -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`" +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"]' ); diff --git a/test/language/computed-property-names/object/method/string.js b/test/language/computed-property-names/object/method/string.js index bbf18e67fb..e906aab465 100644 --- a/test/language/computed-property-names/object/method/string.js +++ b/test/language/computed-property-names/object/method/string.js @@ -17,11 +17,10 @@ var object = { c() { return 'C'; }, [ID('d')]() { return '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`" +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"]' ); diff --git a/test/language/computed-property-names/object/method/symbol.js b/test/language/computed-property-names/object/method/symbol.js index 5bd07c468e..18a903b6a2 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()` 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.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( - compareArray(Object.getOwnPropertySymbols(object), [sym1, sym2]), - "`compareArray(Object.getOwnPropertySymbols(object), [sym1, sym2])` 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]' ); 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 8e03dd938d..0f15588844 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], "order set for key1"); -assert.compareArray(key2ToString, [1], "order set for key2"); +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.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`" +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"]' ); 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 b92310babc..57e30833c4 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], "order set for key1"); -assert.compareArray(key2vof, [1], "order set for key2"); +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.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`" +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"]' ); 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 edf3855c75..b93a255080 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 `0`"); + assert.sameValue(counter++, 0, 'The result of counter++ is expected to be 0'); return 1; }, toString: null }; var key2 = { valueOf: function() { - assert.sameValue(counter++, 1, "The result of `counter++` is `1`"); + assert.sameValue(counter++, 1, 'The result of counter++ is expected to be 1'); return 2; }, toString: null @@ -28,12 +28,12 @@ var object = { c: 'C', [key2]: 'D', }; -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`" +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"]' ); 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 a0a3e64a11..cc97b69dcc 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 `0`"); + assert.sameValue(counter++, 0, 'The result of counter++ is expected to be 0'); return 'b'; } }; var key2 = { toString: function() { - assert.sameValue(counter++, 1, "The result of `counter++` is `1`"); + assert.sameValue(counter++, 1, 'The result of counter++ is expected to be 1'); return 'd'; } }; @@ -25,12 +25,12 @@ var object = { c() { return 'C'; }, [key2]() { return '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`" +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"]' ); diff --git a/test/language/expressions/array/spread-obj-spread-order.js b/test/language/expressions/array/spread-obj-spread-order.js index 080baa18fc..a06c7abc64 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 bf5a148e49..df8a6ec6ab 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 56c3a3cdf7..11e10dbb86 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 fff1129daf..fd4fa26270 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 3e384fff32..6935edf58a 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 fc3d81a4ea..24b91300b0 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 a05af12200..bd64e1ed4a 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 ca2490c4c7..10701c2996 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 3ddff189c4..4b4797839d 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 22d1d6ce7a..91dd516f50 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 51dbe6425c..40f919db04 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 48c7949f9e..5268fe2774 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 5e78204678..131ed05b40 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 305a03657f..e0fea8c63a 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 ef993275aa..0ccb87a616 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 2dbbe051a2..c34cd63ae9 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 c0b000c87b..81f4479326 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 4ec1e1ed3a..6c050bd2a0 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 984ce0c113..7e669e71ef 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 ccff04c90c..fe86bf3141 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 50fbf388e2..77241c898f 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 0d61cbdd08..471e625dfe 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: ' + key.toString() + 'Reflect.defineProperty(ns, , {}) must return false' ); assert.throws(TypeError, function() { Object.defineProperty(ns, key, {}); - }, 'Object.defineProperty: ' + key.toString()); + }, 'Object.defineProperty(ns, key, {}) throws a TypeError exception'); } @@ -39,12 +39,12 @@ for (const key of ([...exported, Symbol.toStringTag])) { assert.sameValue( Reflect.defineProperty(ns, key, {}), true, - 'Reflect.defineProperty: ' + key.toString() + 'Reflect.defineProperty(ns, , {}) must return true' ); assert.sameValue( Object.defineProperty(ns, key, {}), ns, - 'Object.defineProperty: ' + key.toString() + 'Object.defineProperty(ns, , {}) returns ns' ); } @@ -53,13 +53,13 @@ assert.sameValue( Reflect.defineProperty(ns, 'indirect', {writable: true, enumerable: true, configurable: false}), true, - 'Reflect.defineProperty: indirect' + 'Reflect.defineProperty(ns, "indirect", {writable: true, enumerable: true, configurable: false}) must return true' ); assert.sameValue( Object.defineProperty(ns, 'indirect', {writable: true, enumerable: true, configurable: false}), ns, - 'Object.defineProperty: indirect' + 'Object.defineProperty(ns, "indirect", {writable: true, enumerable: true, configurable: false}) returns ns' ); assert.sameValue( @@ -67,14 +67,14 @@ assert.sameValue( {value: "Module", writable: false, enumerable: false, configurable: false}), true, - 'Reflect.defineProperty: Symbol.toStringTag' + 'Reflect.defineProperty( ns, Symbol.toStringTag, {value: "Module", writable: false, enumerable: false, configurable: false} ) must return true' ); assert.sameValue( Object.defineProperty(ns, Symbol.toStringTag, {value: "Module", writable: false, enumerable: false, configurable: false}), ns, - 'Object.defineProperty: Symbol.toStringTag' + 'Object.defineProperty( ns, Symbol.toStringTag, {value: "Module", writable: false, enumerable: false, configurable: false} ) returns ns' ); @@ -84,54 +84,33 @@ for (const key of ([...exported, Symbol.toStringTag])) { assert.sameValue( Reflect.defineProperty(ns, key, {value: 123}), false, - 'Reflect.defineProperty: ' + key.toString() + 'Reflect.defineProperty(ns, , {value: 123}) must return false' ); assert.throws(TypeError, function() { Object.defineProperty(ns, key, {value: 123}); - }, 'Object.defineProperty: ' + key.toString()); + }, 'Object.defineProperty(ns, key, {value: 123}) throws a TypeError exception'); } assert.sameValue( Reflect.defineProperty(ns, 'indirect', {writable: true, enumerable: true, configurable: true}), false, - 'Reflect.defineProperty: indirect' + 'Reflect.defineProperty(ns, "indirect", {writable: true, enumerable: true, configurable: true}) must return false' ); assert.throws(TypeError, function() { Object.defineProperty(ns, 'indirect', {writable: true, enumerable: true, configurable: true}); -}, 'Object.defineProperty: indirect'); +}, 'Object.defineProperty(ns, "indirect", {writable: true, enumerable: true, configurable: true}) throws a TypeError exception'); assert.sameValue( Reflect.defineProperty(ns, Symbol.toStringTag, {value: "module", writable: false, enumerable: false, configurable: false}), false, - 'Reflect.defineProperty: Symbol.toStringTag' + 'Reflect.defineProperty( ns, Symbol.toStringTag, {value: "module", writable: false, enumerable: false, configurable: false} ) must return false' ); assert.throws(TypeError, function() { Object.defineProperty(ns, Symbol.toStringTag, {value: "module", writable: false, enumerable: false, configurable: false}); -}, '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"); +}, 'Object.defineProperty(ns, Symbol.toStringTag, {value: "module", writable: false, enumerable: false, configurable: false}) throws a TypeError exception'); diff --git a/test/language/rest-parameters/arrow-function.js b/test/language/rest-parameters/arrow-function.js index b7c922e33e..e0bd1c8aa3 100644 --- a/test/language/rest-parameters/arrow-function.js +++ b/test/language/rest-parameters/arrow-function.js @@ -8,10 +8,26 @@ includes: [compareArray.js] ---*/ var fn = (a, b, ...c) => c; -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`"); +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]' +); diff --git a/test/language/rest-parameters/no-alias-arguments.js b/test/language/rest-parameters/no-alias-arguments.js index e35165f0ad..99ab432d8f 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 `3`"); + assert.sameValue(a, 3, 'The value of a is expected to be 3'); arguments[1] = 2; - assert(compareArray(rest, [4, 5]), "`compareArray(rest, [4, 5])` returns `true`"); + assert.compareArray(rest, [4, 5], 'The value of rest is expected to be [4, 5]'); } 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 209f904f06..773d69738c 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 `a.length`" + 'The value of arguments.length is expected to equal the value of a.length' ); this.base = a; var args = []; for (var i = 0; i < arguments.length; ++i) { args.push(arguments[i]); } - assert(compareArray(args, a), "`compareArray(args, a)` returns `true`"); + assert.compareArray(args, a, 'The value of args is expected to equal the value of a'); } } class Child extends Base { @@ -27,27 +27,27 @@ class Child extends Base { assert.sameValue( arguments.length, b.length, - "The value of `arguments.length` is `b.length`" + 'The value of arguments.length is expected to equal the value of b.length' ); this.child = b; var args = []; for (var i = 0; i < arguments.length; ++i) { args.push(arguments[i]); } - assert(compareArray(args, b), "`compareArray(args, b)` returns `true`"); + assert.compareArray(args, b, 'The value of args is expected to equal the value of b'); } } var c = new Child(1, 2, 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.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( - compareArray(c.child, [1, 2, 3]), - "`compareArray(c.child, [1, 2, 3])` returns `true`" +assert.compareArray( + c.child, [1, 2, 3], + 'The value of c.child is expected to be [1, 2, 3]' ); -assert( - compareArray(c.base, [1, 2, 3]), - "`compareArray(c.base, [1, 2, 3])` returns `true`" +assert.compareArray( + c.base, [1, 2, 3], + 'The value of c.base is expected to be [1, 2, 3]' ); 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 f8a500feb8..747969f873 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 4226899aff..3bdc400747 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 2ae6c7bba6..8a05c73c9a 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 6aa57673a2..3ff681d84e 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,7 +33,11 @@ class A { } } -assert(compareArray(Object.getOwnPropertyNames(A), ['length', 'name', 'prototype', 'method'])) +assert.compareArray( + Object.getOwnPropertyNames(A), + ['length', 'name', 'prototype', 'method'], + 'Object.getOwnPropertyNames(A) must return ["length", "name", "prototype", "method"]' +) var attr = 'length'; class B { @@ -45,7 +49,11 @@ class B { } } -assert(compareArray(Object.getOwnPropertyNames(B), ['length', 'name', 'prototype'])) +assert.compareArray( + Object.getOwnPropertyNames(B), + ['length', 'name', 'prototype'], + 'Object.getOwnPropertyNames(B) must return ["length", "name", "prototype"]' +) class C { static get length() { @@ -53,7 +61,11 @@ class C { } } -assert(compareArray(Object.getOwnPropertyNames(C), ['length', 'name', 'prototype'])) +assert.compareArray( + Object.getOwnPropertyNames(C), + ['length', 'name', 'prototype'], + 'Object.getOwnPropertyNames(C) must return ["length", "name", "prototype"]' +) class D { static set length(_) { @@ -61,7 +73,11 @@ class D { } } -assert(compareArray(Object.getOwnPropertyNames(D), ['length', 'name', 'prototype'])) +assert.compareArray( + Object.getOwnPropertyNames(D), + ['length', 'name', 'prototype'], + 'Object.getOwnPropertyNames(D) must return ["length", "name", "prototype"]' +) class E { static *length() { @@ -69,4 +85,8 @@ class E { } } -assert(compareArray(Object.getOwnPropertyNames(E), ['length', 'name', 'prototype'])) +assert.compareArray( + Object.getOwnPropertyNames(E), + ['length', 'name', 'prototype'], + 'Object.getOwnPropertyNames(E) must return ["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 4612767b6e..902d0fbd0c 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,7 +30,11 @@ class A { } } -assert(compareArray(Object.getOwnPropertyNames(A), ['length', 'name', 'prototype', 'method'])) +assert.compareArray( + Object.getOwnPropertyNames(A), + ['length', 'name', 'prototype', 'method'], + 'Object.getOwnPropertyNames(A) must return ["length", "name", "prototype", "method"]' +); var attr = 'name'; class B { @@ -42,7 +46,11 @@ class B { } } -assert(compareArray(Object.getOwnPropertyNames(B), ['length', 'name', 'prototype'])) +assert.compareArray( + Object.getOwnPropertyNames(B), + ['length', 'name', 'prototype'], + 'Object.getOwnPropertyNames(B) must return ["length", "name", "prototype"]' +); class C { static get name() { @@ -50,7 +58,11 @@ class C { } } -assert(compareArray(Object.getOwnPropertyNames(C), ['length', 'name', 'prototype'])) +assert.compareArray( + Object.getOwnPropertyNames(C), + ['length', 'name', 'prototype'], + 'Object.getOwnPropertyNames(C) must return ["length", "name", "prototype"]' +); class D { static set name(_) { @@ -58,7 +70,11 @@ class D { } } -assert(compareArray(Object.getOwnPropertyNames(D), ['length', 'name', 'prototype'])) +assert.compareArray( + Object.getOwnPropertyNames(D), + ['length', 'name', 'prototype'], + 'Object.getOwnPropertyNames(D) must return ["length", "name", "prototype"]' +); class E { static *name() { @@ -66,4 +82,8 @@ class E { } } -assert(compareArray(Object.getOwnPropertyNames(E), ['length', 'name', 'prototype'])) +assert.compareArray( + Object.getOwnPropertyNames(E), + ['length', 'name', 'prototype'], + 'Object.getOwnPropertyNames(E) must return ["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 9afb0c202c..cf8185e09b 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 45644af5da..6430030664 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 c8f989297d..9a097b5ba3 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 1725a9b35c..9e49a38c0c 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 b410a423a7..6726e9b49c 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 f3452b86bf..c3fc519c3d 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 458f5fac59..1e028ece7f 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 0c33747403..866167e81f 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 19aefb2234..152d6f535b 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 66862156d9..1ef423dc39 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 fe92330aa2..e75441054e 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'])); +assert.compareArray(sub, [42, 'foo'], 'The value of sub is expected to be [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 ec0b752798..2bb8ac1c2a 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); -assert.sameValue(a1[0], 42); -assert.sameValue(a1[1], '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"'); a1.push(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'); +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'); var a2 = new Sub(7); -assert.sameValue(a2.length, 7); +assert.sameValue(a2.length, 7, 'The value of a2.length is expected to be 7'); var a3 = new Sub(); -assert(compareArray(a3, [])); -assert.sameValue(a3.length, 0); +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'); 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 1d178917b5..95b40b6b53 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 da28d3876c..cec0f0b6aa 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);