mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Ensure _.ary treats negative n values as 0.
This commit is contained in:
10
test/test.js
10
test/test.js
@@ -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']);
|
||||
|
||||
Reference in New Issue
Block a user