Overview
Comment: | RuntimeTests: Add tests for super lookup |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
5fb89d6804018bf2d8be5ece62d8ce91 |
User & Date: | js on 2016-05-21 21:47:24 |
Other Links: | manifest | tags |
Context
2016-05-21
| ||
21:53 | configure: Remove check for GCC bug objc/27438 check-in: 3f704f13c4 user: js tags: trunk | |
21:47 | RuntimeTests: Add tests for super lookup check-in: 5fb89d6804 user: js tags: trunk | |
21:31 | Rename PropertiesTests to RuntimeTests check-in: f2deed0464 user: js tags: trunk | |
Changes
Modified tests/RuntimeTests.m from [e815229773] to [bfc7ba7db5].
︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | */ #include "config.h" #import "OFString.h" #import "OFAutoreleasePool.h" #import "TestsAppDelegate.h" static OFString *module = @"Runtime"; @interface RuntimeTest: OFObject { OFString *_foo, *_bar; } @property (copy, nonatomic) OFString *foo; @property (retain) OFString *bar; @end @implementation RuntimeTest @synthesize foo = _foo; @synthesize bar = _bar; - (void)dealloc { [_foo release]; [_bar release]; [super dealloc]; } @end @implementation TestsAppDelegate (RuntimeTests) - (void)runtimeTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; RuntimeTest *rt = [[[RuntimeTest alloc] init] autorelease]; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 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 90 91 92 93 94 | */ #include "config.h" #import "OFString.h" #import "OFAutoreleasePool.h" #import "OFNotImplementedException.h" #import "TestsAppDelegate.h" static OFString *module = @"Runtime"; @interface OFObject (SuperTest) - (id)superTest; @end @interface RuntimeTest: OFObject { OFString *_foo, *_bar; } @property (copy, nonatomic) OFString *foo; @property (retain) OFString *bar; - (id)nilSuperTest; @end @implementation RuntimeTest @synthesize foo = _foo; @synthesize bar = _bar; - (void)dealloc { [_foo release]; [_bar release]; [super dealloc]; } - (id)superTest { return [super superTest]; } - (id)nilSuperTest { self = nil; 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-existant 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 setBar: t]; TEST(@"retain, atomic properties", [rt bar] == t && [t retainCount] == 3) [pool drain]; } @end |