60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
return [self superTest];
}
@end
@implementation TestsAppDelegate (RuntimeTests)
- (void)runtimeTests
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
RuntimeTest *rt = [[[RuntimeTest alloc] init] autorelease];
OFString *t, *foo;
EXPECT_EXCEPTION(@"Calling a non-existent method via super",
OFNotImplementedException, [rt superTest])
TEST(@"Calling a method via a super with self == nil",
[rt nilSuperTest] == nil)
t = [OFMutableString stringWithString: @"foo"];
foo = @"foo";
[rt setFoo: t];
TEST(@"copy, nonatomic properties", [rt.foo isEqual: foo] &&
rt.foo != foo && rt.foo.retainCount == 1)
rt.bar = t;
TEST(@"retain, atomic properties", rt.bar == t && t.retainCount == 3)
[pool drain];
}
@end
|
|
|
|
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
return [self superTest];
}
@end
@implementation TestsAppDelegate (RuntimeTests)
- (void)runtimeTests
{
void *pool = objc_autoreleasePoolPush();
RuntimeTest *rt = [[[RuntimeTest alloc] init] autorelease];
OFString *t, *foo;
EXPECT_EXCEPTION(@"Calling a non-existent method via super",
OFNotImplementedException, [rt superTest])
TEST(@"Calling a method via a super with self == nil",
[rt nilSuperTest] == nil)
t = [OFMutableString stringWithString: @"foo"];
foo = @"foo";
[rt setFoo: t];
TEST(@"copy, nonatomic properties", [rt.foo isEqual: foo] &&
rt.foo != foo && rt.foo.retainCount == 1)
rt.bar = t;
TEST(@"retain, atomic properties", rt.bar == t && t.retainCount == 3)
objc_autoreleasePoolPop(pool);
}
@end
|