forked from appsquickly/XcodeEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXCTargetTests.m
More file actions
85 lines (63 loc) · 2.61 KB
/
XCTargetTests.m
File metadata and controls
85 lines (63 loc) · 2.61 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
////////////////////////////////////////////////////////////////////////////////
//
// 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 "XCTarget.h"
#import "XCProjectBuildConfig.h"
#import "XCTestResourceUtils.h"
@interface XCTargetTests : XCTestCase
@end
@implementation XCTargetTests
{
XCProject* _project;
}
- (void)setUp
{
_project = [[XCProject alloc] initWithFilePath:XCSample1XcodeProjectPath()];
NSLog(@"Targets: %@", [_project targets]);
}
- (void)test_allows_setting_name_and_product_name_target_properties
{
XCTarget* target = [_project targetWithName:@"expanzCore"];
[target setName:@"foobar"];
[target setProductName:@"foobar"];
[_project save];
}
//-------------------------------------------------------------------------------------------
#pragma mark - Build configuration. . .
- (void)test_allows_setting_build_configurations
{
XCProject* project = [[XCProject alloc] initWithFilePath:XCBox2dSampleProjectPath()];
XCTarget* target = [project targetWithName:@"HelloBoxy"];
XCProjectBuildConfig * configuration = [target configurationWithName:@"Debug"];
NSLog(@"Here's the configuration: %@", configuration);
id ldFlags = [configuration valueForKey:@"OTHER_LDFLAGS"];
NSLog(@"ldflags: %@, %@", ldFlags, [ldFlags class]);
[configuration addOrReplaceSetting:@"-lz -lxml2" forKey:@"OTHER_LDFLAGS"];
[configuration addOrReplaceSetting:@[@"foo", @"bar"] forKey:@"HEADER_SEARCH_PATHS"];
configuration = [target configurationWithName:@"Release"];
NSLog(@"Here's the configuration: %@", configuration);
ldFlags = [configuration valueForKey:@"OTHER_LDFLAGS"];
NSLog(@"ldflags: %@, %@", ldFlags, [ldFlags class]);
[configuration addOrReplaceSetting:@"-lz -lxml2" forKey:@"OTHER_LDFLAGS"];
[configuration addOrReplaceSetting:@[@"foo", @"bar"] forKey:@"HEADER_SEARCH_PATHS"];
[project save];
}
//-------------------------------------------------------------------------------------------
#pragma mark - Duplication
- (void)test_allows_duplicating_a_target
{
XCProject* project = [[XCProject alloc] initWithFilePath:XCBox2dSampleProjectPath()];
XCTarget* target = [project targetWithName:@"HelloBoxy"];
XCTarget* duplicated = [target duplicateWithTargetName:@"DuplicatedTarget" productName:@"NewProduct"];
[project save];
}
@end