Fixed: CPDates compared equal to nil and CPNull.

This commit is contained in:
Alexander Ljungberg authored and Ross Boucher committed 2010-02-09 10:59:59 -08:00
1 parent 94ce055bc2
commit f89c2e0ba9
2 files changed
+9 -1

No files matched your search

+1 -1
View File
@@ -153,7 +153,7 @@ var CPDateReferenceDate = new Date(Date.UTC(2001,1,1,0,0,0,0));
- (BOOL)isEqualToDate:(CPDate)anotherDate
{
return !(self < anotherDate || self > anotherDate);
return self === anotherDate || (anotherDate !== nil && anotherDate.isa && [anotherDate isKindOfClass:CPDate] && !(self < anotherDate || self > anotherDate));
}
- (CPComparisonResult)compare:(CPDate)anotherDate
+8
View File
@@ -25,6 +25,14 @@
[self assert:middle equals:[middle laterDate:past] message:"laterDate incorrect"];
}
- (void)testEquals
{
var now = [CPDate date];
[self assert:now equals:now];
[self assertFalse:[now isEqual:[CPNull null]]];
[self assertFalse:[now isEqual:nil]];
}
- (void)testInitWithString
{
var tests = [