mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 08:57:49 +00:00
lodash: Ensure max and min do not error when computing the result of massive arrays. [cederberg, jddalton, jeeyoungk]
Former-commit-id: af982790c3bb62777523f972a95b7115fb645180
This commit is contained in:
21
test/test.js
21
test/test.js
@@ -176,6 +176,27 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
_.each(['max', 'min'], function(methodName) {
|
||||
QUnit.module('lodash.' + methodName);
|
||||
|
||||
test('does not error when computing the ' + methodName + ' value of massive arrays', function() {
|
||||
var actual,
|
||||
array = [],
|
||||
i = -1;
|
||||
|
||||
while (++i <= 1e6) {
|
||||
array[i] = i;
|
||||
}
|
||||
try {
|
||||
actual = _[methodName](array);
|
||||
} catch(e) { }
|
||||
|
||||
equal(actual, methodName == 'max' ? 1e6 : 0);
|
||||
});
|
||||
});
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash.partial');
|
||||
|
||||
(function() {
|
||||
|
||||
Reference in New Issue
Block a user