From fcc079a5f2d67b30eee02d744be093b446b44aec Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Tue, 30 Apr 2013 18:20:34 +0200 Subject: [PATCH] Extend expect.js's eql to handle NaNs --- test/expect-0.2.0-ol3/expect.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/expect-0.2.0-ol3/expect.js b/test/expect-0.2.0-ol3/expect.js index fef29752f4..749264a725 100644 --- a/test/expect-0.2.0-ol3/expect.js +++ b/test/expect-0.2.0-ol3/expect.js @@ -929,7 +929,11 @@ // 7.3. Other pairs that do not both pass typeof value == "object", // equivalence is determined by ==. } else if (typeof actual != 'object' && typeof expected != 'object') { - return actual == expected; + if (isNaN(actual) && isNaN(expected)) { + return true; + } else { + return actual == expected; + } // 7.4. For all other Object pairs, including Array objects, equivalence is // determined by having the same number of owned properties (as verified