aboutsummaryrefslogtreecommitdiff
path: root/Foundation/GTMObjC2RuntimeTest.m
diff options
context:
space:
mode:
Diffstat (limited to 'Foundation/GTMObjC2RuntimeTest.m')
-rw-r--r--Foundation/GTMObjC2RuntimeTest.m23
1 files changed, 15 insertions, 8 deletions
diff --git a/Foundation/GTMObjC2RuntimeTest.m b/Foundation/GTMObjC2RuntimeTest.m
index d0ce4f7..7344a0f 100644
--- a/Foundation/GTMObjC2RuntimeTest.m
+++ b/Foundation/GTMObjC2RuntimeTest.m
@@ -78,6 +78,20 @@ AT_REQUIRED
@end
@implementation GTMObjC2NotificationWatcher
+- (id)init {
+ if ((self = [super init])) {
+ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
+ // We release ourselves when we are notified.
+ [self retain];
+ [nc addObserver:self
+ selector:@selector(startedTest:)
+ name:SenTestSuiteDidStartNotification
+ object:nil];
+
+ }
+ return self;
+}
+
- (void)startedTest:(NSNotification *)notification {
// Logs if we are testing on Tiger or Leopard runtime.
NSString *testName = [(SenTest*)[[notification object] test] name];
@@ -101,14 +115,7 @@ AT_REQUIRED
+ (void)initialize {
// This allows us to track which runtime we are actually testing.
- NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
-
- // Watcher is released when it is notified.
- GTMObjC2NotificationWatcher *watcher = [[GTMObjC2NotificationWatcher alloc] init];
- [nc addObserver:watcher
- selector:@selector(startedTest:)
- name:SenTestSuiteDidStartNotification
- object:nil];
+ [[[GTMObjC2NotificationWatcher alloc] init] autorelease];
}
- (void)setUp {