Skip to content
Browse files

add test to exercise correct handling of both a class and its supercl…

…ass getting a swizzled dealloc
  • Loading branch information...
1 parent d464913 commit 1f414de5dd2fd54fad6928a09794431ffa13f30f Michael Ash committed Jun 17, 2012
Showing with 28 additions and 0 deletions.
  1. +28 −0 Tests.m
View
28 Tests.m
@@ -59,6 +59,19 @@ @implementation TestKeyPaths
@end
/******************************************************************************/
+@interface DeallocTesterSuperclass : NSObject
+@end
+@implementation DeallocTesterSuperclass
+- (void)dealloc { [super dealloc]; }
+@end
+
+@interface DeallocTesterSubclass : DeallocTesterSuperclass
+@end
+@implementation DeallocTesterSubclass
+- (void)dealloc { [super dealloc]; }
+@end
+
+/******************************************************************************/
@interface MAKVONotificationCenter_Tests ()
@end
@@ -544,4 +557,19 @@ - (void)testSelfObservation
}
}
+- (void)testMultipleDeallocSwizzleInHierarchy
+{
+ NSMutableArray *observations = [NSMutableArray array];
+ @autoreleasepool {
+ TestObject *object = [[[TestObject alloc] init] autorelease];
+ DeallocTesterSuperclass *observer1 = [[[DeallocTesterSuperclass alloc] init] autorelease];
+ DeallocTesterSubclass *observer2 = [[[DeallocTesterSubclass alloc] init] autorelease];
+
+ [observations addObject: [object addObserver:observer1 keyPath:@"self" options:0
+ block:^(MAKVONotification *notification) {}]];
+ [observations addObject: [object addObserver:observer2 keyPath:@"self" options:0
+ block:^(MAKVONotification *notification) {}]];
+ }
+}
+
@end

0 comments on commit 1f414de

Please sign in to comment.
Something went wrong with that request. Please try again.