fix bad fixings from Remove N

This commit is contained in:
Leo Balter 2018-02-15 17:51:52 -05:00
parent 77096157d1
commit 857f1d429b
5 changed files with 28 additions and 28 deletions

View File

@ -33,72 +33,72 @@ features: [TypedArray]
testWithTypedArrayConstructors(function(TA) {
assert(
compareArray(new TA([0, 0])).fill(1, undefined), [1, 1],
compareArray(new TA([0, 0]).fill(1, undefined), [1, 1]),
'`undefined` start coerced to 0'
);
assert(
compareArray(new TA([0, 0])).fill(1, 0, undefined), [1, 1],
compareArray(new TA([0, 0]).fill(1, 0, undefined), [1, 1]),
'If end is undefined, let relativeEnd be len'
);
assert(
compareArray(new TA([0, 0])).fill(1, null), [1, 1],
compareArray(new TA([0, 0]).fill(1, null), [1, 1]),
'`null` start coerced to 0'
);
assert(
compareArray(new TA([0, 0])).fill(1, 0, null), [0, 0],
compareArray(new TA([0, 0]).fill(1, 0, null), [0, 0]),
'`null` end coerced to 0'
);
assert(
compareArray(new TA([0, 0])).fill(1, true), [0, 1],
compareArray(new TA([0, 0]).fill(1, true), [0, 1]),
'`true` start coerced to 1'
);
assert(
compareArray(new TA([0, 0])).fill(1, 0, true), [1, 0],
compareArray(new TA([0, 0]).fill(1, 0, true), [1, 0]),
'`true` end coerced to 1'
);
assert(
compareArray(new TA([0, 0])).fill(1, false), [1, 1],
compareArray(new TA([0, 0]).fill(1, false), [1, 1]),
'`false` start coerced to 0'
);
assert(
compareArray(new TA([0, 0])).fill(1, 0, false), [0, 0],
compareArray(new TA([0, 0]).fill(1, 0, false), [0, 0]),
'`false` end coerced to 0'
);
assert(
compareArray(new TA([0, 0])).fill(1, NaN), [1, 1],
compareArray(new TA([0, 0]).fill(1, NaN), [1, 1]),
'`NaN` start coerced to 0'
);
assert(
compareArray(new TA([0, 0])).fill(1, 0, NaN), [0, 0],
compareArray(new TA([0, 0]).fill(1, 0, NaN), [0, 0]),
'`NaN` end coerced to 0'
);
assert(
compareArray(new TA([0, 0])).fill(1, '1'), [0, 1],
compareArray(new TA([0, 0]).fill(1, '1'), [0, 1]),
'string start coerced'
);
assert(
compareArray(new TA([0, 0])).fill(1, 0, '1'), [1, 0],
compareArray(new TA([0, 0]).fill(1, 0, '1'), [1, 0]),
'string end coerced'
);
assert(
compareArray(new TA([0, 0])).fill(1, 1.5), [0, 1],
compareArray(new TA([0, 0]).fill(1, 1.5), [0, 1]),
'start as a float number coerced'
);
assert(
compareArray(new TA([0, 0])).fill(1, 0, 1.5), [1, 0],
compareArray(new TA([0, 0]).fill(1, 0, 1.5), [1, 0]),
'end as a float number coerced'
);
});

View File

@ -34,9 +34,9 @@ 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]));
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]));
});

View File

@ -32,22 +32,22 @@ features: [TypedArray]
testWithTypedArrayConstructors(function(TA) {
assert(
compareArray(new TA([0, 0, 0])).fill(8, 0, 1), [8, 0, 0],
compareArray(new TA([0, 0, 0]).fill(8, 0, 1), [8, 0, 0]),
"Fill elements from custom end position"
);
assert(
compareArray(new TA([0, 0, 0])).fill(8, 0, -1), [8, 8, 0],
compareArray(new TA([0, 0, 0]).fill(8, 0, -1), [8, 8, 0]),
"negative end sets final position to max((length + relativeEnd), 0)"
);
assert(
compareArray(new TA([0, 0, 0])).fill(8, 0, 5), [8, 8, 8],
compareArray(new TA([0, 0, 0]).fill(8, 0, 5), [8, 8, 8]),
"end position is never higher than of length"
);
assert(
compareArray(new TA([0, 0, 0])).fill(8, 0, -4), [0, 0, 0],
compareArray(new TA([0, 0, 0]).fill(8, 0, -4), [0, 0, 0]),
"end position is 0 when (len + relativeEnd) < 0"
);
});

View File

@ -30,22 +30,22 @@ features: [TypedArray]
testWithTypedArrayConstructors(function(TA) {
assert(
compareArray(new TA([0, 0, 0])).fill(8, 1), [0, 8, 8],
compareArray(new TA([0, 0, 0]).fill(8, 1), [0, 8, 8]),
"Fill elements from custom start position"
);
assert(
compareArray(new TA([0, 0, 0])).fill(8, 4), [0, 0, 0],
compareArray(new TA([0, 0, 0]).fill(8, 4), [0, 0, 0]),
"start position is never higher than length"
);
assert(
compareArray(new TA([0, 0, 0])).fill(8, -1), [0, 0, 8],
compareArray(new TA([0, 0, 0]).fill(8, -1), [0, 0, 8]),
"start < 0 sets initial position to max((len + relativeStart), 0)"
);
assert(
compareArray(new TA([0, 0, 0])).fill(8, -5), [8, 8, 8],
compareArray(new TA([0, 0, 0]).fill(8, -5), [8, 8, 8]),
"start position is 0 when (len + relativeStart) < 0"
);
});

View File

@ -38,7 +38,7 @@ testWithTypedArrayConstructors(function(TA) {
);
assert(
compareArray(new TA([0, 0, 0])).fill(8), [8, 8, 8],
compareArray(new TA([0, 0, 0]).fill(8), [8, 8, 8]),
"Default start and end indexes are 0 and this.length"
);
});