mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 03:17:49 +00:00
Increase code coverage.
This commit is contained in:
30
test/test.js
30
test/test.js
@@ -11147,25 +11147,29 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('`_.' + methodName + '` should support arrays larger than `MAX_ARRAY_LENGTH / 2`', 12, function() {
|
test('`_.' + methodName + '` should support arrays larger than `MAX_ARRAY_LENGTH / 2`', 12, function() {
|
||||||
_.each([Math.ceil(MAX_ARRAY_LENGTH / 2), MAX_ARRAY_LENGTH], function(length, index) {
|
_.each([Math.ceil(MAX_ARRAY_LENGTH / 2), MAX_ARRAY_LENGTH], function(length) {
|
||||||
var array = [],
|
var array = [],
|
||||||
values = [MAX_ARRAY_LENGTH, NaN, undefined];
|
values = [MAX_ARRAY_LENGTH, NaN, undefined];
|
||||||
|
|
||||||
array.length = length;
|
array.length = length;
|
||||||
|
|
||||||
// Avoid false fails in older Firefox.
|
_.each(values, function(value) {
|
||||||
if (array.length == length) {
|
var steps = 0,
|
||||||
_.each(values, function(value) {
|
actual = func(array, value, function(value) { steps++; return value; });
|
||||||
var steps = 0,
|
|
||||||
actual = func(array, value, function() { steps++; });
|
|
||||||
|
|
||||||
strictEqual(steps, isSortedIndex ? 33 : (32 + index));
|
var expected = (isSortedIndex ? !_.isNaN(value) : _.isFinite(value))
|
||||||
strictEqual(actual, isSortedIndex ? 0 : Math.min(length, MAX_ARRAY_INDEX));
|
? 0
|
||||||
});
|
: Math.min(length, MAX_ARRAY_INDEX)
|
||||||
}
|
|
||||||
else {
|
// Avoid false fails in older Firefox.
|
||||||
skipTest(6);
|
if (array.length == length) {
|
||||||
}
|
ok(steps == 32 || steps == 33);
|
||||||
|
strictEqual(actual, expected);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
skipTest(2);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user