Skip to content

Commit

Permalink
Merge pull request jashkenas#2357 from captbaritone/test-cleanups-rest
Browse files Browse the repository at this point in the history
Clean up assertions for _.rest()
  • Loading branch information
jridgewell committed Nov 24, 2015
2 parents bce947f + e38a9de commit feb4cb3
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions test/arrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@

test('rest', function(assert) {
var numbers = [1, 2, 3, 4];
assert.deepEqual(_.rest(numbers), [2, 3, 4], 'working rest()');
assert.deepEqual(_.rest(numbers, 0), [1, 2, 3, 4], 'working rest(0)');
assert.deepEqual(_.rest(numbers, 2), [3, 4], 'rest can take an index');
assert.deepEqual(_.rest(numbers), [2, 3, 4], 'fetches all but the first element');
assert.deepEqual(_.rest(numbers, 0), [1, 2, 3, 4], 'returns the whole array when n is 0');
assert.deepEqual(_.rest(numbers, 2), [3, 4], 'returns all but the first n elements');
var result = (function(){ return _(arguments).rest(); }(1, 2, 3, 4));
assert.deepEqual(result, [2, 3, 4], 'works on arguments object');
assert.deepEqual(result, [2, 3, 4], 'works on an arguments object');
result = _.map([[1, 2, 3], [1, 2, 3]], _.rest);
assert.deepEqual(_.flatten(result), [2, 3, 2, 3], 'works well with _.map');
result = (function(){ return _(arguments).rest(); }(1, 2, 3, 4));
assert.deepEqual(result, [2, 3, 4], 'works on arguments object');
});

test('tail', function(assert) {
Expand Down

0 comments on commit feb4cb3

Please sign in to comment.