Bug 12961

Summary: shouldBe() should support NaN
Product: WebKit Reporter: Alexey Proskuryakov <ap>
Component: Tools / TestsAssignee: Alexey Proskuryakov <ap>
Status: RESOLVED FIXED    
Severity: Normal CC: zimmermann
Priority: P2    
Version: 523.x (Safari 3)   
Hardware: Mac   
OS: OS X 10.4   
Bug Depends on:    
Bug Blocks: 12953    
Attachments:
Description Flags
proposed patch darin: review+

Alexey Proskuryakov
Reported 2007-03-04 00:33:36 PST
Currently, JS shouldBe() tests don't work with NaN results, because NaN != NaN. Patch forthcoming.
Attachments
proposed patch (1.18 KB, patch)
2007-03-04 00:35 PST, Alexey Proskuryakov
darin: review+
Alexey Proskuryakov
Comment 1 2007-03-04 00:35:51 PST
Created attachment 13468 [details] proposed patch
Nikolas Zimmermann
Comment 2 2007-03-04 03:53:54 PST
Looks fine, though what is the "===" operator? (you didn't add it - just wondering though...) - else if (_av === _bv) + else if (_av === _bv || (typeof(_av) == "number" && typeof(_bv) == "number" && isNaN(_av) && isNaN(_bv))) Niko
David Kilzer (:ddkilzer)
Comment 3 2007-03-04 07:05:44 PST
(In reply to comment #2) > Looks fine, though what is the "===" operator? (you didn't add it - just > wondering though...) It's the identity (strict equality) operator. There is also a "not identity" operator: !== http://www.webreference.com/js/tips/991205.html
Darin Adler
Comment 4 2007-03-04 21:56:00 PST
Comment on attachment 13468 [details] proposed patch r=me
Alexey Proskuryakov
Comment 5 2007-03-04 22:31:54 PST
Committed revision 19959.
Note You need to log in before you can comment on or make changes to this bug.