Ensure _.xor returns an empty array when comparing the same array. [closes #2776]

This commit is contained in:
John-David Dalton
2016-10-31 09:56:55 -07:00
parent 46d1f53ee9
commit 0fcf43b02b
2 changed files with 10 additions and 1 deletions

View File

@@ -4414,7 +4414,7 @@
while (++othIndex < length) { while (++othIndex < length) {
var othArray = arrays[othIndex]; var othArray = arrays[othIndex];
if (othArray !== array) { if (othIndex != index) {
result[index] = baseDifference(result[index] || array, othArray, iteratee, comparator); result[index] = baseDifference(result[index] || array, othArray, iteratee, comparator);
} }
} }

View File

@@ -25279,6 +25279,15 @@
assert.deepEqual(actual, []); assert.deepEqual(actual, []);
}); });
QUnit.test('`_.' + methodName + '` should return an empty array when comparing the same array', function(assert) {
assert.expect(1);
var array = [1],
actual = func(array, array, array);
assert.deepEqual(actual, []);
});
QUnit.test('`_.' + methodName + '` should return an array of unique values', function(assert) { QUnit.test('`_.' + methodName + '` should return an array of unique values', function(assert) {
assert.expect(2); assert.expect(2);