mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 18:37:50 +00:00
Add number object tests to number coercion methods.
This commit is contained in:
@@ -22081,12 +22081,15 @@
|
|||||||
var func = _[methodName];
|
var func = _[methodName];
|
||||||
|
|
||||||
QUnit.test('`_.' + methodName + '` should preserve sign of `0`', function(assert) {
|
QUnit.test('`_.' + methodName + '` should preserve sign of `0`', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(2);
|
||||||
|
|
||||||
var values = [0, '0', -0, '-0'],
|
var values = [0, '0', -0, '-0'],
|
||||||
expected = [[0, Infinity], [0, Infinity], [-0, -Infinity], [-0, -Infinity]];
|
expected = [[0, Infinity], [0, Infinity], [-0, -Infinity], [-0, -Infinity]];
|
||||||
|
|
||||||
var actual = lodashStable.map(values, function(value) {
|
lodashStable.times(2, function(index) {
|
||||||
|
var others = lodashStable.map(values, index ? Object : identity);
|
||||||
|
|
||||||
|
var actual = lodashStable.map(others, function(value) {
|
||||||
var result = func(value);
|
var result = func(value);
|
||||||
return [result, 1 / result];
|
return [result, 1 / result];
|
||||||
});
|
});
|
||||||
@@ -22094,6 +22097,7 @@
|
|||||||
assert.deepEqual(actual, expected);
|
assert.deepEqual(actual, expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
lodashStable.each(['toInteger', 'toLength', 'toNumber', 'toSafeInteger'], function(methodName) {
|
lodashStable.each(['toInteger', 'toLength', 'toNumber', 'toSafeInteger'], function(methodName) {
|
||||||
var func = _[methodName],
|
var func = _[methodName],
|
||||||
|
|||||||
Reference in New Issue
Block a user