Skip to content

Commit 0dc6c60

Browse files
committed
Merge pull request #484 from phatblat/ben/ios-test-target
iOS Test target
2 parents 4447e70 + c9da387 commit 0dc6c60

File tree

10 files changed

+436
-17
lines changed

10 files changed

+436
-17
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@
1616
[submodule "Carthage/Checkouts/xcconfigs"]
1717
path = Carthage/Checkouts/xcconfigs
1818
url = https://github.com/jspahrsummers/xcconfigs.git
19+
[submodule "Carthage/Checkouts/ZipArchive"]
20+
path = Carthage/Checkouts/ZipArchive
21+
url = https://github.com/ZipArchive/ZipArchive.git

Cartfile.private

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
github "jspahrsummers/xcconfigs" >= 0.7.1
22
github "Quick/Quick" ~> 0.3
33
github "Quick/Nimble" ~> 0.4
4+
github "ZipArchive/ZipArchive" ~> 0.3

Cartfile.resolved

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
github "Quick/Nimble" "v0.4.2"
22
github "Quick/Quick" "v0.3.1"
3+
github "ZipArchive/ZipArchive" "v0.3.2"
34
github "jspahrsummers/xcconfigs" "0.7.2"

Carthage/Checkouts/ZipArchive

Submodule ZipArchive added at 60312c1

ObjectiveGitFramework.xcodeproj/project.pbxproj

Lines changed: 398 additions & 13 deletions
Large diffs are not rendered by default.

ObjectiveGitFramework.xcodeproj/xcshareddata/xcschemes/ObjectiveGit iOS.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
skipped = "NO">
3333
<BuildableReference
3434
BuildableIdentifier = "primary"
35-
BlueprintIdentifier = "D01B6EDC19F82E2000D411BC"
35+
BlueprintIdentifier = "F879D8351B4B7F7C002D5C07"
3636
BuildableName = "ObjectiveGit-iOSTests.xctest"
3737
BlueprintName = "ObjectiveGit-iOSTests"
3838
ReferencedContainer = "container:ObjectiveGitFramework.xcodeproj">

ObjectiveGitFramework.xcworkspace/contents.xcworkspacedata

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ObjectiveGitTests/ObjectiveGitTests-Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<key>CFBundleExecutable</key>
88
<string>${EXECUTABLE_NAME}</string>
99
<key>CFBundleIdentifier</key>
10-
<string>com.libgit2.${PRODUCT_NAME:rfc1034identifier}</string>
10+
<string>org.libgit2.$(PRODUCT_NAME:rfc1034identifier)</string>
1111
<key>CFBundleInfoDictionaryVersion</key>
1212
<string>6.0</string>
1313
<key>CFBundlePackageType</key>

ObjectiveGitTests/QuickSpec+GTFixtures.m

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
#import "QuickSpec+GTFixtures.h"
1111
#import <objc/runtime.h>
1212

13+
#if TARGET_OS_IPHONE
14+
#import "SSZipArchive.h"
15+
#endif
16+
1317
static const NSInteger FixturesErrorUnzipFailed = 666;
1418

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

97101
- (BOOL)unzipFile:(NSString *)member fromArchiveAtPath:(NSString *)zipPath intoDirectory:(NSString *)destinationPath error:(NSError **)error {
102+
103+
#if TARGET_OS_IPHONE
104+
// iOS: unzip in-process using SSZipArchive
105+
//
106+
// system() and NSTask() are not available when running tests in the iOS simulator
107+
108+
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:destinationPath overwrite:YES password:nil error:error];
109+
110+
if (!success) {
111+
NSLog(@"Unzip failed");
112+
return NO;
113+
}
114+
115+
return YES;
116+
117+
#else
118+
// OS X: shell out to unzip using NSTask
119+
98120
NSTask *task = [[NSTask alloc] init];
99121
task.launchPath = @"/usr/bin/unzip";
100122
task.arguments = @[ @"-qq", @"-d", destinationPath, zipPath, [member stringByAppendingString:@"*"] ];
@@ -108,6 +130,9 @@ - (BOOL)unzipFile:(NSString *)member fromArchiveAtPath:(NSString *)zipPath intoD
108130
}
109131

110132
return success;
133+
134+
#endif
135+
111136
}
112137

113138
#pragma mark API

script/cibuild

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ build_scheme ()
123123
if [ "$awkstatus" -eq "1" ]
124124
then
125125
# SDK not found, try for iphonesimulator.
126-
sdkflag="-sdk iphonesimulator"
126+
sdkflag='-sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 5"'
127127

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

131131
awkstatus=$?
132132

0 commit comments

Comments
 (0)