Ensure _.ary treats negative n values as 0.

This commit is contained in:
jdalton
2015-01-25 12:12:41 -08:00
parent ed61d0c591
commit 47a5b227cc
2 changed files with 11 additions and 1 deletions

View File

@@ -896,6 +896,16 @@
deepEqual(capped('a', 'b', 'c', 'd'), ['a', 'b', 'c']);
});
test('should treat a negative `n` as `0`', 1, function() {
var capped = _.ary(fn, -1);
try {
var actual = capped('a');
} catch(e) {}
deepEqual(actual, []);
});
test('should work when provided less than the capped numer of arguments', 1, function() {
var capped = _.ary(fn, 3);
deepEqual(capped('a'), ['a']);