Add _.ary test case for multiple applied arys.

This commit is contained in:
John-David Dalton
2015-12-28 10:11:17 -06:00
parent e5730af949
commit 0f928233ce
2 changed files with 9 additions and 2 deletions

View File

@@ -5019,7 +5019,7 @@
* may be applied regardless of execution order. Methods like `_.ary` and `_.rearg`
* modify function arguments, making the order in which they are executed important,
* preventing the merging of metadata. However, we make an exception for a safe
* common case where curried functions have `_.ary` and or `_.rearg` applied.
* combined case where curried functions have `_.ary` and or `_.rearg` applied.
*
* @private
* @param {Array} data The destination metadata.
@@ -5030,7 +5030,7 @@
var bitmask = data[1],
srcBitmask = source[1],
newBitmask = bitmask | srcBitmask,
isCommon = newBitmask < ARY_FLAG;
isCommon = newBitmask < ARY_FLAG || newBitmask == ARY_FLAG;
var isCombo =
(srcBitmask == ARY_FLAG && (bitmask == CURRY_FLAG)) ||

View File

@@ -1054,6 +1054,13 @@
assert.deepEqual(capped('a'), ['a']);
});
QUnit.test('should use the existing `ary` if smaller', function(assert) {
assert.expect(1);
var capped = _.ary(_.ary(fn, 1), 2);
assert.deepEqual(capped('a', 'b', 'c'), ['a']);
});
QUnit.test('should work as an iteratee for methods like `_.map`', function(assert) {
assert.expect(1);