mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Ensure length hit of for lazy eval is checked on initial lazy call. [closes #997]
This commit is contained in:
62
test/test.js
62
test/test.js
@@ -3986,11 +3986,17 @@
|
||||
}
|
||||
});
|
||||
|
||||
test('should provide the correct `predicate` arguments in a lazy chain sequence', 4, function() {
|
||||
test('should provide the correct `predicate` arguments in a lazy chain sequence', 5, function() {
|
||||
if (!isNpm) {
|
||||
var args,
|
||||
expected = [16, 3, [1, 4, 9 ,16]];
|
||||
|
||||
_(array).dropRightWhile(function(value, index, array) {
|
||||
args = slice.call(arguments);
|
||||
}).value();
|
||||
|
||||
deepEqual(args, [4, 3, array]);
|
||||
|
||||
_(array).map(square).dropRightWhile(function(value, index, array) {
|
||||
args = slice.call(arguments);
|
||||
}).value();
|
||||
@@ -4016,7 +4022,7 @@
|
||||
deepEqual(args, expected);
|
||||
}
|
||||
else {
|
||||
skipTest(4);
|
||||
skipTest(5);
|
||||
}
|
||||
});
|
||||
}());
|
||||
@@ -4102,11 +4108,17 @@
|
||||
}
|
||||
});
|
||||
|
||||
test('should provide the correct `predicate` arguments in a lazy chain sequence', 4, function() {
|
||||
test('should provide the correct `predicate` arguments in a lazy chain sequence', 5, function() {
|
||||
if (!isNpm) {
|
||||
var args,
|
||||
expected = [1, 0, [1, 4, 9, 16]];
|
||||
|
||||
_(array).dropWhile(function(value, index, array) {
|
||||
args = slice.call(arguments);
|
||||
}).value();
|
||||
|
||||
deepEqual(args, [1, 0, array]);
|
||||
|
||||
_(array).map(square).dropWhile(function(value, index, array) {
|
||||
args = slice.call(arguments);
|
||||
}).value();
|
||||
@@ -4132,7 +4144,7 @@
|
||||
deepEqual(args, expected);
|
||||
}
|
||||
else {
|
||||
skipTest(4);
|
||||
skipTest(5);
|
||||
}
|
||||
});
|
||||
}());
|
||||
@@ -4936,11 +4948,17 @@
|
||||
}
|
||||
});
|
||||
|
||||
test('should provide the correct `predicate` arguments in a lazy chain sequence', 4, function() {
|
||||
test('should provide the correct `predicate` arguments in a lazy chain sequence', 5, function() {
|
||||
if (!isNpm) {
|
||||
var args,
|
||||
expected = [16, 3, [1, 4, 9 , 16]];
|
||||
|
||||
_(array).takeRightWhile(function(value, index, array) {
|
||||
args = slice.call(arguments)
|
||||
}).value();
|
||||
|
||||
deepEqual(args, [4, 3, array]);
|
||||
|
||||
_(array).map(square).takeRightWhile(function(value, index, array) {
|
||||
args = slice.call(arguments)
|
||||
}).value();
|
||||
@@ -4966,7 +4984,7 @@
|
||||
deepEqual(args, expected);
|
||||
}
|
||||
else {
|
||||
skipTest(4);
|
||||
skipTest(5);
|
||||
}
|
||||
});
|
||||
}());
|
||||
@@ -5051,11 +5069,17 @@
|
||||
}
|
||||
});
|
||||
|
||||
test('should provide the correct `predicate` arguments in a lazy chain sequence', 4, function() {
|
||||
test('should provide the correct `predicate` arguments in a lazy chain sequence', 5, function() {
|
||||
if (!isNpm) {
|
||||
var args,
|
||||
expected = [1, 0, [1, 4, 9, 16]];
|
||||
|
||||
_(array).takeWhile(function(value, index, array) {
|
||||
args = slice.call(arguments);
|
||||
}).value();
|
||||
|
||||
deepEqual(args, [1, 0, array]);
|
||||
|
||||
_(array).map(square).takeWhile(function(value, index, array) {
|
||||
args = slice.call(arguments);
|
||||
}).value();
|
||||
@@ -5081,7 +5105,7 @@
|
||||
deepEqual(args, expected);
|
||||
}
|
||||
else {
|
||||
skipTest(4);
|
||||
skipTest(5);
|
||||
}
|
||||
});
|
||||
}());
|
||||
@@ -9223,11 +9247,18 @@
|
||||
}
|
||||
});
|
||||
|
||||
test('should provide the correct `predicate` arguments in a lazy chain sequence', 4, function() {
|
||||
test('should provide the correct `predicate` arguments in a lazy chain sequence', 5, function() {
|
||||
if (!isNpm) {
|
||||
var args,
|
||||
expected = [1, 0, [1, 4, 9]];
|
||||
|
||||
_(array).map(function(value, index, array) {
|
||||
args || (args = slice.call(arguments));
|
||||
}).value();
|
||||
|
||||
deepEqual(args, [1, 0, array]);
|
||||
|
||||
args = null;
|
||||
_(array).map(square).map(function(value, index, array) {
|
||||
args || (args = slice.call(arguments));
|
||||
}).value();
|
||||
@@ -9256,7 +9287,7 @@
|
||||
deepEqual(args, expected);
|
||||
}
|
||||
else {
|
||||
skipTest(4);
|
||||
skipTest(5);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -12210,11 +12241,18 @@
|
||||
}
|
||||
});
|
||||
|
||||
test('`_.' + methodName + '` should provide the correct `predicate` arguments in a lazy chain sequence', 4, function() {
|
||||
test('`_.' + methodName + '` should provide the correct `predicate` arguments in a lazy chain sequence', 5, function() {
|
||||
if (!isNpm) {
|
||||
var args,
|
||||
expected = [1, 0, [1, 4, 9, 16]];
|
||||
|
||||
_(array)[methodName](function(value, index, array) {
|
||||
args || (args = slice.call(arguments));
|
||||
}).value();
|
||||
|
||||
deepEqual(args, [1, 0, array]);
|
||||
|
||||
args = null;
|
||||
_(array).map(square)[methodName](function(value, index, array) {
|
||||
args || (args = slice.call(arguments));
|
||||
}).value();
|
||||
@@ -12243,7 +12281,7 @@
|
||||
deepEqual(args, expected);
|
||||
}
|
||||
else {
|
||||
skipTest(4);
|
||||
skipTest(5);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user