Skip to content

Commit

Permalink
Merge pull request #484 from phatblat/ben/ios-test-target
Browse files Browse the repository at this point in the history
iOS Test target
  • Loading branch information
joshaber committed Sep 2, 2015
2 parents 4447e70 + c9da387 commit 0dc6c60
Show file tree
Hide file tree
Showing 10 changed files with 436 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@
[submodule "Carthage/Checkouts/xcconfigs"]
path = Carthage/Checkouts/xcconfigs
url = https://github.com/jspahrsummers/xcconfigs.git
[submodule "Carthage/Checkouts/ZipArchive"]
path = Carthage/Checkouts/ZipArchive
url = https://github.com/ZipArchive/ZipArchive.git
1 change: 1 addition & 0 deletions Cartfile.private
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
github "jspahrsummers/xcconfigs" >= 0.7.1
github "Quick/Quick" ~> 0.3
github "Quick/Nimble" ~> 0.4
github "ZipArchive/ZipArchive" ~> 0.3
1 change: 1 addition & 0 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
github "Quick/Nimble" "v0.4.2"
github "Quick/Quick" "v0.3.1"
github "ZipArchive/ZipArchive" "v0.3.2"
github "jspahrsummers/xcconfigs" "0.7.2"
1 change: 1 addition & 0 deletions Carthage/Checkouts/ZipArchive
Submodule ZipArchive added at 60312c
411 changes: 398 additions & 13 deletions ObjectiveGitFramework.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D01B6EDC19F82E2000D411BC"
BlueprintIdentifier = "F879D8351B4B7F7C002D5C07"
BuildableName = "ObjectiveGit-iOSTests.xctest"
BlueprintName = "ObjectiveGit-iOSTests"
ReferencedContainer = "container:ObjectiveGitFramework.xcodeproj">
Expand Down
3 changes: 3 additions & 0 deletions ObjectiveGitFramework.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ObjectiveGitTests/ObjectiveGitTests-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.libgit2.${PRODUCT_NAME:rfc1034identifier}</string>
<string>org.libgit2.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
Expand Down
25 changes: 25 additions & 0 deletions ObjectiveGitTests/QuickSpec+GTFixtures.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#import "QuickSpec+GTFixtures.h"
#import <objc/runtime.h>

#if TARGET_OS_IPHONE
#import "SSZipArchive.h"
#endif

static const NSInteger FixturesErrorUnzipFailed = 666;

static NSString * const FixturesErrorDomain = @"com.objectivegit.Fixtures";
Expand Down Expand Up @@ -95,6 +99,24 @@ - (NSString *)pathForFixtureRepositoryNamed:(NSString *)repositoryName {
}

- (BOOL)unzipFile:(NSString *)member fromArchiveAtPath:(NSString *)zipPath intoDirectory:(NSString *)destinationPath error:(NSError **)error {

#if TARGET_OS_IPHONE
// iOS: unzip in-process using SSZipArchive
//
// system() and NSTask() are not available when running tests in the iOS simulator

BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:destinationPath overwrite:YES password:nil error:error];

if (!success) {
NSLog(@"Unzip failed");
return NO;
}

return YES;

#else
// OS X: shell out to unzip using NSTask

NSTask *task = [[NSTask alloc] init];
task.launchPath = @"/usr/bin/unzip";
task.arguments = @[ @"-qq", @"-d", destinationPath, zipPath, [member stringByAppendingString:@"*"] ];
Expand All @@ -108,6 +130,9 @@ - (BOOL)unzipFile:(NSString *)member fromArchiveAtPath:(NSString *)zipPath intoD
}

return success;

#endif

}

#pragma mark API
Expand Down
4 changes: 2 additions & 2 deletions script/cibuild
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ build_scheme ()
if [ "$awkstatus" -eq "1" ]
then
# SDK not found, try for iphonesimulator.
sdkflag="-sdk iphonesimulator"
sdkflag='-sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 5"'

# Determine whether the unit tests will run with iphonesimulator
run_xctool $sdkflag -scheme "$scheme" run-tests | parse_build
run_xctool "$sdkflag" -scheme "$scheme" run-tests | parse_build

awkstatus=$?

Expand Down

0 comments on commit 0dc6c60

Please sign in to comment.