mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 17:47:49 +00:00
Rename rp vars to rest.
This commit is contained in:
24
test/test.js
24
test/test.js
@@ -17178,15 +17178,15 @@
|
|||||||
QUnit.test('should apply a rest parameter to `func`', function(assert) {
|
QUnit.test('should apply a rest parameter to `func`', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
var rp = _.rest(fn);
|
var rest = _.rest(fn);
|
||||||
assert.deepEqual(rp(1, 2, 3, 4), [1, 2, [3, 4]]);
|
assert.deepEqual(rest(1, 2, 3, 4), [1, 2, [3, 4]]);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should work with `start`', function(assert) {
|
QUnit.test('should work with `start`', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
var rp = _.rest(fn, 1);
|
var rest = _.rest(fn, 1);
|
||||||
assert.deepEqual(rp(1, 2, 3, 4), [1, [2, 3, 4]]);
|
assert.deepEqual(rest(1, 2, 3, 4), [1, [2, 3, 4]]);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should treat `start` as `0` for negative or `NaN` values', function(assert) {
|
QUnit.test('should treat `start` as `0` for negative or `NaN` values', function(assert) {
|
||||||
@@ -17196,8 +17196,8 @@
|
|||||||
expected = lodashStable.map(values, lodashStable.constant([[1, 2, 3, 4]]));
|
expected = lodashStable.map(values, lodashStable.constant([[1, 2, 3, 4]]));
|
||||||
|
|
||||||
var actual = lodashStable.map(values, function(value) {
|
var actual = lodashStable.map(values, function(value) {
|
||||||
var rp = _.rest(fn, value);
|
var rest = _.rest(fn, value);
|
||||||
return rp(1, 2, 3, 4);
|
return rest(1, 2, 3, 4);
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.deepEqual(actual, expected);
|
assert.deepEqual(actual, expected);
|
||||||
@@ -17206,25 +17206,25 @@
|
|||||||
QUnit.test('should coerce `start` to an integer', function(assert) {
|
QUnit.test('should coerce `start` to an integer', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
var rp = _.rest(fn, 1.6);
|
var rest = _.rest(fn, 1.6);
|
||||||
assert.deepEqual(rp(1, 2, 3), [1, [2, 3]]);
|
assert.deepEqual(rest(1, 2, 3), [1, [2, 3]]);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should use an empty array when `start` is not reached', function(assert) {
|
QUnit.test('should use an empty array when `start` is not reached', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
var rp = _.rest(fn);
|
var rest = _.rest(fn);
|
||||||
assert.deepEqual(rp(1), [1, undefined, []]);
|
assert.deepEqual(rest(1), [1, undefined, []]);
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should work on functions with more than three parameters', function(assert) {
|
QUnit.test('should work on functions with more than three parameters', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
var rp = _.rest(function(a, b, c, d) {
|
var rest = _.rest(function(a, b, c, d) {
|
||||||
return slice.call(arguments);
|
return slice.call(arguments);
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.deepEqual(rp(1, 2, 3, 4, 5), [1, 2, 3, [4, 5]]);
|
assert.deepEqual(rest(1, 2, 3, 4, 5), [1, 2, 3, [4, 5]]);
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user