Add _.parseInt test for its bizarro form.

This commit is contained in:
John-David Dalton
2014-11-27 01:37:12 -08:00
parent 8b43b2b69d
commit 3256c9b3f5

View File

@@ -677,7 +677,7 @@
} }
}); });
test('should avoid overwritten native methods', 13, function() { test('should avoid overwritten native methods', 14, function() {
function Foo() {} function Foo() {}
function message(lodashMethod, nativeMethod) { function message(lodashMethod, nativeMethod) {
@@ -743,6 +743,13 @@
} }
deepEqual(actual, [[otherObject], [object], [object]], message('_.difference`, `_.intersection`, and `_.uniq', 'Set')); deepEqual(actual, [[otherObject], [object], [object]], message('_.difference`, `_.intersection`, and `_.uniq', 'Set'));
try {
actual = _.map(['6', '08', '10'], lodashBizarro.parseInt);
} catch(e) {
actual = null;
}
deepEqual(actual, [6, 8, 10], '`_.parseInt` should work in its bizarro form');
if (ArrayBuffer) { if (ArrayBuffer) {
try { try {
var buffer = new ArrayBuffer(10); var buffer = new ArrayBuffer(10);
@@ -772,7 +779,7 @@
} }
} }
else { else {
skipTest(13); skipTest(14);
} }
}); });
}()); }());
@@ -8802,8 +8809,8 @@
}); });
test('should work as an iteratee for `_.map`', 2, function() { test('should work as an iteratee for `_.map`', 2, function() {
var actual = _.map(['1', '10', '08'], _.parseInt); var actual = _.map(['6', '08', '10'], _.parseInt);
deepEqual(actual, [1, 10, 8]); deepEqual(actual, [6, 8, 10]);
actual = _.map('123', _.parseInt); actual = _.map('123', _.parseInt);
deepEqual(actual, [1, 2, 3]); deepEqual(actual, [1, 2, 3]);