Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
281 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>BNDL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// | ||
// Created by Cédric Luthi on 06/04/16. | ||
// Copyright © 2016 Cédric Luthi. All rights reserved. | ||
// | ||
|
||
#import <XCTest/XCTest.h> | ||
|
||
@interface Tests : XCTestCase | ||
|
||
@property NSArray *xcodeURLs; | ||
|
||
@end | ||
|
||
@implementation Tests | ||
|
||
- (void) run:(NSArray *)arguments expectedResult:(NSString *)expectedResult | ||
{ | ||
NSString *builtProductsDir = NSProcessInfo.processInfo.environment[@"BUILT_PRODUCTS_DIR"]; | ||
NSString *projectDir = NSProcessInfo.processInfo.environment[@"PROJECT_DIR"]; | ||
for (NSURL *xcodeURL in self.xcodeURLs) | ||
{ | ||
NSTask *xcproj = [NSTask new]; | ||
xcproj.launchPath = [builtProductsDir stringByAppendingPathComponent:@"xcproj"]; | ||
xcproj.arguments = arguments; | ||
xcproj.environment = @{ @"XCPROJ_XCODE_APP_PATH": xcodeURL.path }; | ||
xcproj.currentDirectoryPath = [projectDir stringByAppendingPathComponent:@"Sandbox"];; | ||
xcproj.standardOutput = [NSPipe new]; | ||
printf("%s\n", [NSString stringWithFormat:@"env XCPROJ_XCODE_APP_PATH=%@ %@ %@", xcproj.environment[@"XCPROJ_XCODE_APP_PATH"], xcproj.launchPath, [xcproj.arguments componentsJoinedByString:@" "]].UTF8String); | ||
[xcproj launch]; | ||
[xcproj waitUntilExit]; | ||
|
||
NSData *outputData = [[xcproj.standardOutput fileHandleForReading] readDataToEndOfFile]; | ||
NSString *result = [[[NSString alloc] initWithData:outputData encoding:NSUTF8StringEncoding] stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]]; | ||
printf("%s\n", result.UTF8String); | ||
|
||
XCTAssertEqual(xcproj.terminationStatus, 0); | ||
XCTAssertEqualObjects(result, expectedResult); | ||
} | ||
} | ||
|
||
- (void) setUp | ||
{ | ||
self.xcodeURLs = CFBridgingRelease(LSCopyApplicationURLsForBundleIdentifier(CFSTR("com.apple.dt.Xcode"), NULL)); | ||
XCTAssertTrue(self.xcodeURLs.count > 0); | ||
} | ||
|
||
- (void) testReadBuildSetting | ||
{ | ||
[self run:@[ @"--target", @"Sandbox", @"read-build-setting", @"COPY_PHASE_STRIP"] expectedResult:@"YES"]; | ||
[self run:@[ @"--target", @"Sandbox", @"--configuration", @"Debug", @"read-build-setting", @"COPY_PHASE_STRIP"] expectedResult:@"NO"]; | ||
[self run:@[ @"--target", @"Sandbox", @"--configuration", @"Release", @"read-build-setting", @"COPY_PHASE_STRIP"] expectedResult:@"YES"]; | ||
[self run:@[ @"read-build-setting", @"COPY_PHASE_STRIP"] expectedResult:@"YES"]; | ||
[self run:@[ @"--configuration", @"Debug", @"read-build-setting", @"COPY_PHASE_STRIP"] expectedResult:@"YES"]; | ||
[self run:@[ @"--configuration", @"Release", @"read-build-setting", @"COPY_PHASE_STRIP"] expectedResult:@"YES"]; | ||
|
||
[self run:@[ @"--target", @"Sandbox", @"read-build-setting", @"CURRENT_PROJECT_VERSION"] expectedResult:@"1.2.3"]; | ||
[self run:@[ @"read-build-setting", @"CURRENT_PROJECT_VERSION"] expectedResult:@"1.2.3"]; | ||
} | ||
|
||
@end |
Oops, something went wrong.