Revert removing falsey guards.

Former-commit-id: b5eeb5d4a0896eb030f20e7e91e54bf101535abc
This commit is contained in:
John-David Dalton
2012-10-03 09:08:51 -07:00
parent 4017443b1e
commit 01b84c79f0
2 changed files with 83 additions and 26 deletions

View File

@@ -1702,6 +1702,43 @@
QUnit.module('lodash methods');
(function() {
test('should allow falsey arguments', function() {
var funcs = _.without.apply(_, [_.functions(_)].concat([
'_',
'_iteratorTemplate',
'_shimKeys',
'after',
'bind',
'bindAll',
'compose',
'debounce',
'defer',
'delay',
'functions',
'memoize',
'once',
'partial',
'tap',
'throttle',
'wrap'
]));
_.each(funcs, function(methodName) {
var func = _[methodName],
pass = true;
_.each(falsey, function(value, index) {
try {
index ? func(value) : func();
} catch(e) {
pass = false;
}
});
ok(pass, '_.' + methodName + ' allows falsey arguments');
});
});
test('should handle `null` `thisArg` arguments', function() {
var thisArg,
array = ['a'],