NaN is never equal to NaN. Fixed in underscore.js and underscore-min.js, updated tests in test/objects.js

This commit is contained in:
Ryan W Tenney
2010-06-12 17:10:48 -04:00
parent 79f65b440a
commit 0e8ca3cb97
3 changed files with 5 additions and 3 deletions

View File

@@ -54,7 +54,9 @@ $(document).ready(function() {
ok(_.isEqual(moe, clone), 'deep equality is true');
ok(_(moe).isEqual(clone), 'OO-style deep equality works');
ok(!_.isEqual(5, NaN), '5 is not equal to NaN');
ok(_.isEqual(NaN, NaN), 'NaN is equal to NaN');
ok(NaN != NaN, 'NaN is not equal to NaN (native equality)');
ok(NaN !== NaN, 'NaN is not equal to NaN (native identity)');
ok(!_.isEqual(NaN, NaN), 'NaN is not equal to NaN');
ok(_.isEqual(new Date(100), new Date(100)), 'identical dates are equal');
ok(_.isEqual((/hello/ig), (/hello/ig)), 'identical regexes are equal');
ok(!_.isEqual(null, [1]), 'a falsy is never equal to a truthy');