Fix failing tests.

This commit is contained in:
John-David Dalton
2014-06-11 12:23:42 -07:00
parent 1f07f9d127
commit 6ab04866ec
2 changed files with 8 additions and 5 deletions

View File

@@ -1791,6 +1791,10 @@
// to `1` or `0` treating invalid dates coerced to `NaN` as not equal
return +value == +other;
case errorClass:
// check properties instead of coercing to strings to support IE < 8
return value.name === other.name && value.message === other.message;
case numberClass:
// treat `NaN` vs. `NaN` as equal
return (value != +value)
@@ -1798,12 +1802,10 @@
// but treat `-0` vs. `+0` as not equal
: (value == 0 ? (1 / value == 1 / other) : value == +other);
case errorClass:
case regexpClass:
case stringClass:
// coerce errors (http://es5.github.io/#x15.11.4.4)
// and regexes (http://es5.github.io/#x15.10.6.4) to strings
// treat string primitives and their corresponding object instances as equal
// coerce regexes to strings (http://es5.github.io/#x15.10.6.4)
// treat string primitives and object instances as equal
return value == String(other);
}
if (!support.argsClass) {

View File

@@ -1272,6 +1272,7 @@
_.forOwn(objects, function(object, key) {
test('`_.' + methodName + '` should clone ' + key, 2, function() {
var actual = func(object);
ok(_.isEqual(actual, object));
if (_.isObject(object)) {
@@ -1294,7 +1295,7 @@
error = new Ctor('text'),
actual = func(error);
deepEqual(actual, error);
ok(_.isEqual(actual, error));
notStrictEqual(actual, error);
});
});