/
XCUnitApplicationTestsWithXCTest.m
31 lines (25 loc) · 1.29 KB
/
XCUnitApplicationTestsWithXCTest.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#import <XCTest/XCTest.h>
#import "OCUnitAppAppDelegate.h" // should NOT be included in OCUnitAppTests target
@interface ExampleApplicationTestsWithXCTest : XCTestCase
@end
@implementation ExampleApplicationTestsWithXCTest
- (void)testApplicationTestsRun {
UILabel *label = [[[UILabel alloc] init] autorelease];
XCTAssertEqual([label class], [UILabel class], @"expected an instance of UILabel to be UILabel kind");
}
- (void)testHasAccessToClassesDefinedInApp {
// For that to work app target must have 'Strip Debug Symbols During Copy' set to NO.
XCTAssertEqual([OCUnitAppAppDelegate class], [OCUnitAppAppDelegate class], @"expected OCUnitAppAppDelegate class to equal itself");
}
- (void)testMainBundleIsTheAppBundle {
XCTAssertTrue([[NSBundle mainBundle].bundlePath hasSuffix:@".app"], @"expected main NSBundle path to have 'app' extension");
}
- (void)testCanLoadNibFilesFromApp {
NSArray *views = [[NSBundle mainBundle] loadNibNamed:@"DummyView" owner:nil options:nil];
XCTAssertEqual([[views lastObject] class], [UIView class], @"expected last view of DummyView nib to be UIView kind");
}
- (void)testRunningCedarExamples {
XCTestSuite *defaultSuite = [XCTestSuite defaultTestSuite];
XCTAssert([[defaultSuite valueForKeyPath:@"tests.name"] containsObject:@"Cedar"]);
}
@end