Repository navigation
Expand file tree
/
Copy pathXCProjectTests.m
More file actions
146 lines (103 loc) · 3.58 KB
/
Copy pathXCProjectTests.m
File metadata and controls
146 lines (103 loc) · 3.58 KB
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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
////////////////////////////////////////////////////////////////////////////////
//
// JASPER BLUES
// Copyright 2012 Jasper Blues
// All Rights Reserved.
//
// NOTICE: Jasper Blues permits you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
#import <XCTest/XCTest.h>
#import "XCProject.h"
#import "XCSourceFile.h"
#import "XCTarget.h"
#import "XCGroup.h"
@interface XCProjectTests : XCTestCase
@end
@implementation XCProjectTests
{
__block XCProject* project;
}
/* ====================================================================================================================================== */
- (void)setUp
{
project = [[XCProject alloc] initWithFilePath:@"/tmp"];
}
/* ====================================================================================================================================== */
#pragma mark - Listing files
- (void)test_able_to_list_all_the_header_files_in_a_project
{
NSArray* headerFiles = [project headerFiles];
NSLog(@"Headers: %@", headerFiles);
XCTAssertTrue([headerFiles count] == 18);
for (XCSourceFile* file in headerFiles)
{
NSLog(@"File: %@", [file description]);
}
}
- (void)test_able_to_list_all_the_obj_c_files_in_a_project
{
NSArray* objcFiles = [project objectiveCFiles];
NSLog(@"Implementation Files: %@", objcFiles);
XCTAssertTrue([objcFiles count] == 21);
}
- (void)test_able_to_list_all_the_obj_cPlusPlus_files_in_a_project
{
NSArray* objcPlusPlusFiles = [project objectiveCPlusPlusFiles];
NSLog(@"Implementation Files: %@", objcPlusPlusFiles);
//TODO: Put an obj-c++ file in the test project.
XCTAssertTrue([objcPlusPlusFiles count] == 0);
}
- (void)test_be_able_to_list_all_the_xib_files_in_a_project
{
NSArray* xibFiles = [project xibFiles];
NSLog(@"Xib Files: %@", xibFiles);
XCTAssertTrue([xibFiles count] == 2);
}
/* ====================================================================================================================================== */
#pragma mark - Groups
- (void)test_able_to_list_all_of_the_groups_in_a_project
{
NSArray* groups = [project groups];
for (XCGroup* group in groups)
{
NSLog(@"Name: %@, full path: %@", [group displayName], [group pathRelativeToProjectRoot]);
for (id <XcodeGroupMember> member in [group members])
{
NSLog(@"\t%@", [member displayName]);
}
}
XCTAssertNotNil(groups);
XCTAssertFalse([groups count] == 0);
}
- (void)test_provides_access_to_the_root_top_level_group
{
XCGroup* rootGroup = [project rootGroup];
NSLog(@"Here the group: %@", rootGroup);
XCTAssertFalse([rootGroup.members count] == 0);
}
- (void)test_provides_a_way_to_locate_a_group_from_its_path_to_the_root_group
{
XCGroup* group = [project groupWithPathFromRoot:@"Source/Main/Assembly"];
XCTAssertNotNil(group);
NSLog(@"Group: %@", group);
}
/* ====================================================================================================================================== */
#pragma mark - Targets
- (void)test_able_to_list_the_targets_in_an_xcode_project
{
NSArray* targets = [project targets];
for (XCTarget* target in [project targets])
{
NSLog(@"%@", target);
}
XCTAssertNotNil(targets);
XCTAssertFalse([targets count] == 0);
for (XCTarget* target in targets)
{
NSArray* members = [target members];
NSLog(@"Members: %@", members);
}
}
@end