CPNull is equal to CPNull. Unit test included.

This commit is contained in:
Alexander Ljungberg
2010-08-04 16:43:04 -04:00
parent 8c13204afa
commit 4ea0d4d043
2 changed files with 15 additions and 0 deletions
+9
View File
@@ -44,6 +44,7 @@ var CPNullSharedNull = nil;
return [super alloc];
}*/
/*!
Returns the singleton instance of the CPNull
object. While CPNull and \c nil should
@@ -57,6 +58,14 @@ var CPNullSharedNull = nil;
return CPNullSharedNull;
}
- (BOOL)isEqual:(id)anObject
{
if (self === anObject)
return YES;
return [anObject isKindOfClass:[CPNull class]];
}
/*!
Returns CPNull null.
@param aCoder the coder from which to do nothing
+6
View File
@@ -4,6 +4,12 @@
@implementation CPNullTest : OJTestCase
- (void)testEquals
{
[self assert:[CPNull null] equals:[CPNull null] message:"CPNull null should equal itself."];
[self assert:[CPNull null] equals:[CPNull new] message:"CPNull null should equal another CPNull."];
}
- (void)testArchiving
{
[self assert:[CPKeyedUnarchiver unarchiveObjectWithData:[CPKeyedArchiver archivedDataWithRootObject:[CPNull null]]] equals:[CPNull null]];