Add number object tests to number coercion methods.

This commit is contained in:
John-David Dalton
2016-03-24 00:10:51 -07:00
parent 1670800df3
commit 577226bbd0

View File

@@ -22081,17 +22081,21 @@
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 result = func(value); var others = lodashStable.map(values, index ? Object : identity);
return [result, 1 / result];
});
assert.deepEqual(actual, expected); var actual = lodashStable.map(others, function(value) {
var result = func(value);
return [result, 1 / result];
});
assert.deepEqual(actual, expected);
});
}); });
}); });