Opened 12 years ago

Closed 11 years ago

#5200 closed defect (fixed)

[patch]doh.assertEquals() fails to differentiate objects

Reported by: Adam Peller Owned by: alex
Priority: high Milestone: 1.1
Component: General Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description

doh.assertEqual({}, {a:1})

true

doh.assertEqual(new Date(2000,0,1), new Date(2007, 11, 31))

true

Attachments (2)

patch5200.diff (549 bytes) - added by wolfram 11 years ago.
this fixes at least doh.assertEqual({}, {a:1})
patch5200.2.diff (791 bytes) - added by wolfram 11 years ago.
now the patch also handles the mentioned date comparison

Download all attachments as: .zip

Change History (12)

comment:1 Changed 11 years ago by Adam Peller

(In [11901]) Updated test to explicitly check for failures with Boolean coercion - Refs #5200. Invalid month/day names on parse now return null. Thanks, Doug. Fixes #4864

Changed 11 years ago by wolfram

Attachment: patch5200.diff added

this fixes at least doh.assertEqual({}, {a:1})

comment:2 Changed 11 years ago by wolfram

i dont know how to compare the new Date() objects properly :-(

Changed 11 years ago by wolfram

Attachment: patch5200.2.diff added

now the patch also handles the mentioned date comparison

comment:3 Changed 11 years ago by wolfram

Resolution: fixed
Status: newclosed

fixed, ready for commitingI guess.

comment:4 Changed 11 years ago by wolfram

Resolution: fixed
Status: closedreopened

comment:5 Changed 11 years ago by Adam Peller

Summary: doh.assertEquals() fails to differentiate objects[patch]doh.assertEquals() fails to differentiate objects

comment:6 Changed 11 years ago by alex

Resolution: fixed
Status: reopenedclosed

(In [12485]) merging Wolfram's patch for object equivelance. Fixes #5200. !strict

comment:7 Changed 11 years ago by Adam Peller

Resolution: fixed
Status: closedreopened

how about simply casting dates to numbers or calling getTime() on both operands?

comment:8 Changed 11 years ago by alex

fine, but no reason to re-open?

comment:9 Changed 11 years ago by bill

I assume the problem with the checked in patch is that it returns false even when two dates objects are equal. It only returns true when you pass in the same object twice, right?

comment:10 Changed 11 years ago by Adam Peller

Resolution: fixed
Status: reopenedclosed

(In [12490]) compare Dates using getTime(). Fixes #5200 !strict

Note: See TracTickets for help on using tickets.