mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 10:07:48 +00:00
Add spare array test for _.pull.
Former-commit-id: 38d677a4f2693db0591a6b43fe5a66a7dae39883
This commit is contained in:
23
test/test.js
23
test/test.js
@@ -2801,7 +2801,28 @@
|
|||||||
|
|
||||||
deepEqual(array, [2]);
|
deepEqual(array, [2]);
|
||||||
ok(actual === array);
|
ok(actual === array);
|
||||||
})
|
});
|
||||||
|
|
||||||
|
test('should preserve holes in arrays', function() {
|
||||||
|
var array = [1, 2, 3, 4];
|
||||||
|
delete array[1];
|
||||||
|
delete array[3];
|
||||||
|
|
||||||
|
_.pull(array, 1);
|
||||||
|
equal(0 in array, false);
|
||||||
|
equal(2 in array, false);
|
||||||
|
|
||||||
|
_.pull(array, undefined);
|
||||||
|
deepEqual(array, [3]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should treat holes as `undefined`', function() {
|
||||||
|
var array = [1, 2, 3];
|
||||||
|
delete array[1];
|
||||||
|
|
||||||
|
_.pull(array, undefined);
|
||||||
|
deepEqual(array, [1, 3]);
|
||||||
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|||||||
Reference in New Issue
Block a user