Increase code coverage.

This commit is contained in:
John-David Dalton
2014-12-15 12:11:27 -08:00
parent 74cdaa9fcb
commit 1b8ca164c9

View File

@@ -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);
}
});
}); });
}); });
}); });