mirror of
https://github.com/tc39/test262.git
synced 2025-07-30 01:14:56 +02:00
Transform compareArray -> assert.compareArray: test/built-ins/Array/**/*.js (#3238)
This commit is contained in:
parent
4ce285da7a
commit
fc975b171d
@ -16,22 +16,13 @@ function concatTypedArray(type, elems, modulo) {
|
|||||||
ta_by_len[i] = items[i] = modulo === false ? i : elems % modulo;
|
ta_by_len[i] = items[i] = modulo === false ? i : elems % modulo;
|
||||||
}
|
}
|
||||||
var ta = new type(items);
|
var ta = new type(items);
|
||||||
assert(
|
assert.compareArray([].concat(ta, ta), [ta, ta]);
|
||||||
compareArray([].concat(ta, ta), [ta, ta]),
|
|
||||||
'compareArray([].concat(ta, ta), [ta, ta]) must return true'
|
|
||||||
);
|
|
||||||
ta[Symbol.isConcatSpreadable] = true;
|
ta[Symbol.isConcatSpreadable] = true;
|
||||||
assert.compareArray([].concat(ta), items, '[].concat(new type(items)) returns items');
|
assert.compareArray([].concat(ta), items);
|
||||||
|
|
||||||
assert(
|
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]),
|
|
||||||
'compareArray([].concat(ta_by_len, ta_by_len), [ta_by_len, ta_by_len]) must return true'
|
|
||||||
);
|
|
||||||
ta_by_len[Symbol.isConcatSpreadable] = true;
|
ta_by_len[Symbol.isConcatSpreadable] = true;
|
||||||
assert(
|
assert.compareArray([].concat(ta_by_len), items);
|
||||||
compareArray([].concat(ta_by_len), items),
|
|
||||||
'compareArray([].concat(ta_by_len), items) must return true'
|
|
||||||
);
|
|
||||||
|
|
||||||
// TypedArray with fake `length`.
|
// TypedArray with fake `length`.
|
||||||
ta = new type(1);
|
ta = new type(1);
|
||||||
@ -43,7 +34,7 @@ function concatTypedArray(type, elems, modulo) {
|
|||||||
value: 4000
|
value: 4000
|
||||||
});
|
});
|
||||||
ta[Symbol.isConcatSpreadable] = true;
|
ta[Symbol.isConcatSpreadable] = true;
|
||||||
assert.compareArray([].concat(ta), expected, '[].concat(new type(1)) returns expected');
|
assert.compareArray([].concat(ta), expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
var max = [Math.pow(2, 8), Math.pow(2, 16), Math.pow(2, 32), false, false];
|
var max = [Math.pow(2, 8), Math.pow(2, 16), Math.pow(2, 32), false, false];
|
||||||
|
@ -16,22 +16,13 @@ function concatTypedArray(type, elems, modulo) {
|
|||||||
ta_by_len[i] = items[i] = modulo === false ? i : elems % modulo;
|
ta_by_len[i] = items[i] = modulo === false ? i : elems % modulo;
|
||||||
}
|
}
|
||||||
var ta = new type(items);
|
var ta = new type(items);
|
||||||
assert(
|
assert.compareArray([].concat(ta, ta), [ta, ta]);
|
||||||
compareArray([].concat(ta, ta), [ta, ta]),
|
|
||||||
'compareArray([].concat(ta, ta), [ta, ta]) must return true'
|
|
||||||
);
|
|
||||||
ta[Symbol.isConcatSpreadable] = true;
|
ta[Symbol.isConcatSpreadable] = true;
|
||||||
assert.compareArray([].concat(ta), items, '[].concat(new type(items)) returns items');
|
assert.compareArray([].concat(ta), items);
|
||||||
|
|
||||||
assert(
|
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]),
|
|
||||||
'compareArray([].concat(ta_by_len, ta_by_len), [ta_by_len, ta_by_len]) must return true'
|
|
||||||
);
|
|
||||||
ta_by_len[Symbol.isConcatSpreadable] = true;
|
ta_by_len[Symbol.isConcatSpreadable] = true;
|
||||||
assert(
|
assert.compareArray([].concat(ta_by_len), items);
|
||||||
compareArray([].concat(ta_by_len), items),
|
|
||||||
'compareArray([].concat(ta_by_len), items) must return true'
|
|
||||||
);
|
|
||||||
|
|
||||||
// TypedArray with fake `length`.
|
// TypedArray with fake `length`.
|
||||||
ta = new type(1);
|
ta = new type(1);
|
||||||
@ -43,7 +34,7 @@ function concatTypedArray(type, elems, modulo) {
|
|||||||
value: 4000
|
value: 4000
|
||||||
});
|
});
|
||||||
ta[Symbol.isConcatSpreadable] = true;
|
ta[Symbol.isConcatSpreadable] = true;
|
||||||
assert.compareArray([].concat(ta), expected, '[].concat(new type(1)) returns expected');
|
assert.compareArray([].concat(ta), expected);
|
||||||
}
|
}
|
||||||
var max = [Math.pow(2, 8), Math.pow(2, 16), Math.pow(2, 32), false, false];
|
var max = [Math.pow(2, 8), Math.pow(2, 16), Math.pow(2, 32), false, false];
|
||||||
[
|
[
|
||||||
|
@ -31,18 +31,22 @@ info: |
|
|||||||
includes: [compareArray.js]
|
includes: [compareArray.js]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert(compareArray(
|
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),
|
||||||
), 'compareArray( ["a", "b", "c", "d", "e", "f"].copyWithin(0, 0), ["a", "b", "c", "d", "e", "f"] ) must return true');
|
['a', 'b', 'c', 'd', 'e', 'f']
|
||||||
|
);
|
||||||
|
|
||||||
assert(compareArray(
|
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),
|
||||||
), 'compareArray( ["a", "b", "c", "d", "e", "f"].copyWithin(0, 2), ["c", "d", "e", "f", "e", "f"] ) must return true');
|
['c', 'd', 'e', 'f', 'e', 'f']
|
||||||
|
);
|
||||||
|
|
||||||
assert(compareArray(
|
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),
|
||||||
), 'compareArray( ["a", "b", "c", "d", "e", "f"].copyWithin(3, 0), ["a", "b", "c", "a", "b", "c"] ) must return true');
|
['a', 'b', 'c', 'a', 'b', 'c']
|
||||||
|
);
|
||||||
|
|
||||||
assert(compareArray(
|
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),
|
||||||
), 'compareArray( [0, 1, 2, 3, 4, 5].copyWithin(1, 4), [0, 4, 5, 3, 4, 5] ) must return true');
|
[0, 4, 5, 3, 4, 5]
|
||||||
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user