Skip to content

Commit f413d4c

Browse files
committed
Updated to use XCTest.
1 parent a360f60 commit f413d4c

10 files changed

+398
-343
lines changed

KSFileUtilities.xcodeproj/project.pbxproj

+21-19
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
EE43C84C13898D7B008ABD16 /* KSWebLocationPasteboardUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KSWebLocationPasteboardUtilities.m; sourceTree = SOURCE_ROOT; };
7777
EE43C84D13898D7B008ABD16 /* KSWorkspaceUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KSWorkspaceUtilities.h; sourceTree = SOURCE_ROOT; };
7878
EE43C84E13898D7B008ABD16 /* KSWorkspaceUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KSWorkspaceUtilities.m; sourceTree = SOURCE_ROOT; };
79-
EE83867813897644005E0FFD /* TestKSFileUtilities.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TestKSFileUtilities.octest; sourceTree = BUILT_PRODUCTS_DIR; };
79+
EE83867813897644005E0FFD /* TestKSFileUtilities.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TestKSFileUtilities.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
8080
EE83867B13897644005E0FFD /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
8181
EE83867E13897644005E0FFD /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
8282
EE83867F13897644005E0FFD /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
@@ -162,7 +162,7 @@
162162
EE83867913897644005E0FFD /* Products */ = {
163163
isa = PBXGroup;
164164
children = (
165-
EE83867813897644005E0FFD /* TestKSFileUtilities.octest */,
165+
EE83867813897644005E0FFD /* TestKSFileUtilities.xctest */,
166166
);
167167
name = Products;
168168
sourceTree = "<group>";
@@ -230,16 +230,16 @@
230230
);
231231
name = TestKSFileUtilities;
232232
productName = TestKSFileUtilities;
233-
productReference = EE83867813897644005E0FFD /* TestKSFileUtilities.octest */;
234-
productType = "com.apple.product-type.bundle";
233+
productReference = EE83867813897644005E0FFD /* TestKSFileUtilities.xctest */;
234+
productType = "com.apple.product-type.bundle.unit-test";
235235
};
236236
/* End PBXNativeTarget section */
237237

238238
/* Begin PBXProject section */
239239
EE83866C13897613005E0FFD /* Project object */ = {
240240
isa = PBXProject;
241241
attributes = {
242-
LastUpgradeCheck = 0440;
242+
LastUpgradeCheck = 0730;
243243
ORGANIZATIONNAME = "Jungle Candy Software";
244244
};
245245
buildConfigurationList = EE83866F13897613005E0FFD /* Build configuration list for PBXProject "KSFileUtilities" */;
@@ -333,6 +333,8 @@
333333
EE83867113897614005E0FFD /* Debug */ = {
334334
isa = XCBuildConfiguration;
335335
buildSettings = {
336+
ENABLE_TESTABILITY = YES;
337+
ONLY_ACTIVE_ARCH = YES;
336338
RUN_CLANG_STATIC_ANALYZER = YES;
337339
};
338340
name = Debug;
@@ -349,10 +351,12 @@
349351
isa = XCBuildConfiguration;
350352
buildSettings = {
351353
ALWAYS_SEARCH_USER_PATHS = NO;
352-
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
353354
COMBINE_HIDPI_IMAGES = YES;
354355
COPY_PHASE_STRIP = NO;
355-
FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks";
356+
FRAMEWORK_SEARCH_PATHS = (
357+
"$(PLATFORM_DIR)/Developer/Library/Frameworks",
358+
"$(inherited)",
359+
);
356360
GCC_C_LANGUAGE_STANDARD = gnu99;
357361
GCC_DYNAMIC_NO_PIC = NO;
358362
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
@@ -368,24 +372,24 @@
368372
INFOPLIST_FILE = "TestKSFileUtilities/TestKSFileUtilities-Info.plist";
369373
MACOSX_DEPLOYMENT_TARGET = 10.6;
370374
ONLY_ACTIVE_ARCH = YES;
371-
OTHER_LDFLAGS = (
372-
"-framework",
373-
SenTestingKit,
374-
);
375+
OTHER_LDFLAGS = "";
376+
PRODUCT_BUNDLE_IDENTIFIER = "com.karelia.${PRODUCT_NAME:rfc1034identifier}";
375377
PRODUCT_NAME = "$(TARGET_NAME)";
376-
WRAPPER_EXTENSION = octest;
378+
SDKROOT = macosx;
377379
};
378380
name = Debug;
379381
};
380382
EE83868E13897644005E0FFD /* Release */ = {
381383
isa = XCBuildConfiguration;
382384
buildSettings = {
383385
ALWAYS_SEARCH_USER_PATHS = NO;
384-
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
385386
COMBINE_HIDPI_IMAGES = YES;
386387
COPY_PHASE_STRIP = YES;
387388
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
388-
FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks";
389+
FRAMEWORK_SEARCH_PATHS = (
390+
"$(PLATFORM_DIR)/Developer/Library/Frameworks",
391+
"$(inherited)",
392+
);
389393
GCC_C_LANGUAGE_STANDARD = gnu99;
390394
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
391395
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@@ -397,12 +401,10 @@
397401
HEADER_SEARCH_PATHS = "$(SOURCE_ROOT)";
398402
INFOPLIST_FILE = "TestKSFileUtilities/TestKSFileUtilities-Info.plist";
399403
MACOSX_DEPLOYMENT_TARGET = 10.6;
400-
OTHER_LDFLAGS = (
401-
"-framework",
402-
SenTestingKit,
403-
);
404+
OTHER_LDFLAGS = "";
405+
PRODUCT_BUNDLE_IDENTIFIER = "com.karelia.${PRODUCT_NAME:rfc1034identifier}";
404406
PRODUCT_NAME = "$(TARGET_NAME)";
405-
WRAPPER_EXTENSION = octest;
407+
SDKROOT = macosx;
406408
};
407409
name = Release;
408410
};

KSFileUtilities.xcodeproj/xcshareddata/xcschemes/TestKSFileUtilities.xcscheme

+43-5
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,84 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3+
LastUpgradeVersion = "0730"
34
version = "1.3">
45
<BuildAction
56
parallelizeBuildables = "YES"
67
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "NO"
13+
buildForArchiving = "NO"
14+
buildForAnalyzing = "NO">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "EE83867713897644005E0FFD"
18+
BuildableName = "TestKSFileUtilities.xctest"
19+
BlueprintName = "TestKSFileUtilities"
20+
ReferencedContainer = "container:KSFileUtilities.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
724
</BuildAction>
825
<TestAction
26+
buildConfiguration = "Debug"
927
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
1028
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
11-
shouldUseLaunchSchemeArgsEnv = "YES"
12-
buildConfiguration = "Debug">
29+
shouldUseLaunchSchemeArgsEnv = "YES">
1330
<Testables>
1431
<TestableReference
1532
skipped = "NO">
1633
<BuildableReference
1734
BuildableIdentifier = "primary"
1835
BlueprintIdentifier = "EE83867713897644005E0FFD"
19-
BuildableName = "TestKSFileUtilities.octest"
36+
BuildableName = "TestKSFileUtilities.xctest"
2037
BlueprintName = "TestKSFileUtilities"
2138
ReferencedContainer = "container:KSFileUtilities.xcodeproj">
2239
</BuildableReference>
2340
</TestableReference>
2441
</Testables>
42+
<AdditionalOptions>
43+
</AdditionalOptions>
2544
</TestAction>
2645
<LaunchAction
46+
buildConfiguration = "Debug"
2747
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2848
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
2949
launchStyle = "0"
3050
useCustomWorkingDirectory = "NO"
31-
buildConfiguration = "Debug"
3251
ignoresPersistentStateOnLaunch = "NO"
3352
debugDocumentVersioning = "YES"
53+
debugServiceExtension = "internal"
3454
allowLocationSimulation = "YES">
55+
<MacroExpansion>
56+
<BuildableReference
57+
BuildableIdentifier = "primary"
58+
BlueprintIdentifier = "EE83867713897644005E0FFD"
59+
BuildableName = "TestKSFileUtilities.xctest"
60+
BlueprintName = "TestKSFileUtilities"
61+
ReferencedContainer = "container:KSFileUtilities.xcodeproj">
62+
</BuildableReference>
63+
</MacroExpansion>
3564
<AdditionalOptions>
3665
</AdditionalOptions>
3766
</LaunchAction>
3867
<ProfileAction
68+
buildConfiguration = "Release"
3969
shouldUseLaunchSchemeArgsEnv = "YES"
4070
savedToolIdentifier = ""
4171
useCustomWorkingDirectory = "NO"
42-
buildConfiguration = "Release"
4372
debugDocumentVersioning = "YES">
73+
<MacroExpansion>
74+
<BuildableReference
75+
BuildableIdentifier = "primary"
76+
BlueprintIdentifier = "EE83867713897644005E0FFD"
77+
BuildableName = "TestKSFileUtilities.xctest"
78+
BlueprintName = "TestKSFileUtilities"
79+
ReferencedContainer = "container:KSFileUtilities.xcodeproj">
80+
</BuildableReference>
81+
</MacroExpansion>
4482
</ProfileAction>
4583
<AnalyzeAction
4684
buildConfiguration = "Debug">
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "F4374302C94F259354D7174C7FAEE12A70EFBBD3",
3+
"DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : {
4+
5+
},
6+
"DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
7+
"73F690BE1B6D95EB211CEAFEF8F4E7FC8A1A292F" : 0,
8+
"F4374302C94F259354D7174C7FAEE12A70EFBBD3" : 0
9+
},
10+
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "15AE6E1B-EFAE-48D0-8D98-6DB8C869FCFE",
11+
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
12+
"73F690BE1B6D95EB211CEAFEF8F4E7FC8A1A292F" : "KSFileUtilities\/IFUnicodeURL",
13+
"F4374302C94F259354D7174C7FAEE12A70EFBBD3" : "KSFileUtilities"
14+
},
15+
"DVTSourceControlWorkspaceBlueprintNameKey" : "KSFileUtilities",
16+
"DVTSourceControlWorkspaceBlueprintVersion" : 204,
17+
"DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "KSFileUtilities.xcworkspace",
18+
"DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [
19+
{
20+
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/karelia\/IFUnicodeURL.git",
21+
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
22+
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "73F690BE1B6D95EB211CEAFEF8F4E7FC8A1A292F"
23+
},
24+
{
25+
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/karelia\/KSFileUtilities.git",
26+
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
27+
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "F4374302C94F259354D7174C7FAEE12A70EFBBD3"
28+
}
29+
]
30+
}

TestKSFileUtilities/TestKSFileUtilities-Info.plist

+1-1
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.karelia.${PRODUCT_NAME:rfc1034identifier}</string>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
1111
<key>CFBundleInfoDictionaryVersion</key>
1212
<string>6.0</string>
1313
<key>CFBundlePackageType</key>

TestKSFileUtilities/TestKSPathUtilities.m

+27-26
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
// Created by Abizer Nasir on 22/05/2011.
66
//
77

8-
#import <SenTestingKit/SenTestingKit.h>
8+
//#import <SenTestingKit/SenTestingKit.h>
9+
#import <XCTest/XCTest.h>
910
#import "KSPathUtilities.h"
1011

1112

12-
@interface TestKSPathUtilities : SenTestCase {
13+
@interface TestKSPathUtilities : XCTestCase {
1314
@private
1415

1516
}
@@ -29,7 +30,7 @@ - (void)checkPath:(NSString *)path relativeToDirectory:(NSString *)dirPath again
2930
{
3031
NSString *result = [path ks_pathRelativeToDirectory:dirPath];
3132

32-
STAssertTrue([result isEqualToString:expectedResult],
33+
XCTAssertTrue([result isEqualToString:expectedResult],
3334
@"\'%@\' relative to \'%@\' should be \'%@\' instead of \'%@\'",
3435
path,
3536
dirPath,
@@ -54,16 +55,16 @@ - (void)checkPath:(NSString *)path relativeToDirectory:(NSString *)dirPath again
5455

5556
- (void)testEnumeratePathComponents;
5657
{
57-
STAssertEqualObjects([self componentsOfPath:@"foo/bar"], (@[@"foo", @"bar"]), nil);
58-
STAssertEqualObjects([self componentsOfPath:@"foo/bar/"], (@[@"foo", @"bar"]), nil);
59-
STAssertEqualObjects([self componentsOfPath:@"foo//bar/"], (@[@"foo", @"bar"]), nil);
60-
61-
STAssertEqualObjects([self componentsOfPath:@"/"], (@[@"/"]), nil);
62-
STAssertEqualObjects([self componentsOfPath:@"//"], (@[@"/"]), nil);
63-
STAssertEqualObjects([self componentsOfPath:@"/foo/bar"], (@[@"/", @"foo", @"bar"]), nil);
64-
STAssertEqualObjects([self componentsOfPath:@"/foo/bar/"], (@[@"/", @"foo", @"bar"]), nil);
65-
STAssertEqualObjects([self componentsOfPath:@"/foo//bar/"], (@[@"/", @"foo", @"bar"]), nil);
66-
STAssertEqualObjects([self componentsOfPath:@"//foo//bar/"], (@[@"/", @"foo", @"bar"]), nil);
58+
XCTAssertEqual([self componentsOfPath:@"foo/bar"], (@[@"foo", @"bar"]));
59+
XCTAssertEqual([self componentsOfPath:@"foo/bar/"], (@[@"foo", @"bar"]));
60+
XCTAssertEqual([self componentsOfPath:@"foo//bar/"], (@[@"foo", @"bar"]));
61+
62+
XCTAssertEqual([self componentsOfPath:@"/"], (@[@"/"]));
63+
XCTAssertEqual([self componentsOfPath:@"//"], (@[@"/"]));
64+
XCTAssertEqual([self componentsOfPath:@"/foo/bar"], (@[@"/", @"foo", @"bar"]));
65+
XCTAssertEqual([self componentsOfPath:@"/foo/bar/"], (@[@"/", @"foo", @"bar"]));
66+
XCTAssertEqual([self componentsOfPath:@"/foo//bar/"], (@[@"/", @"foo", @"bar"]));
67+
XCTAssertEqual([self componentsOfPath:@"//foo//bar/"], (@[@"/", @"foo", @"bar"]));
6768
}
6869

6970
- (NSArray *)componentsOfPath:(NSString *)path;
@@ -170,34 +171,34 @@ - (void)testPathRelativeToDirectory {
170171

171172
- (void)testIsSubpath;
172173
{
173-
STAssertTrue([@"/foo/bar/baz.html" ks_isSubpathOfPath:@"/foo"], @"/foo/bar/baz.html is a subpath of of /foo");
174-
STAssertTrue([@"/foo/bar/baz.html" ks_isSubpathOfPath:@"/foo/"], @"/foo/bar/baz.html is a subpath of of /foo/");
175-
STAssertFalse([@"/foo/bar/baz.html" ks_isSubpathOfPath:@"/fo"], nil);
174+
XCTAssertTrue([@"/foo/bar/baz.html" ks_isSubpathOfPath:@"/foo"], @"/foo/bar/baz.html is a subpath of of /foo");
175+
XCTAssertTrue([@"/foo/bar/baz.html" ks_isSubpathOfPath:@"/foo/"], @"/foo/bar/baz.html is a subpath of of /foo/");
176+
XCTAssertFalse([@"/foo/bar/baz.html" ks_isSubpathOfPath:@"/fo"]);
176177

177178
// Treat items as being subpaths of themselves
178-
STAssertTrue([@"/foo/bar/baz.html" ks_isSubpathOfPath:@"/foo/bar/baz.html"], nil);
179-
STAssertTrue([@"/foo/bar/baz.html" ks_isSubpathOfPath:@"/foo/bar/baz.html/"], nil);
180-
STAssertTrue([@"/foo/bar/baz.html/" ks_isSubpathOfPath:@"/foo/bar/baz.html"], nil);
181-
STAssertTrue([@"/foo/bar/baz.html/" ks_isSubpathOfPath:@"/foo/bar/baz.html/"], nil);
179+
XCTAssertTrue([@"/foo/bar/baz.html" ks_isSubpathOfPath:@"/foo/bar/baz.html"]);
180+
XCTAssertTrue([@"/foo/bar/baz.html" ks_isSubpathOfPath:@"/foo/bar/baz.html/"]);
181+
XCTAssertTrue([@"/foo/bar/baz.html/" ks_isSubpathOfPath:@"/foo/bar/baz.html"]);
182+
XCTAssertTrue([@"/foo/bar/baz.html/" ks_isSubpathOfPath:@"/foo/bar/baz.html/"]);
182183

183184
// Make sure similar things aren't mistaken
184-
STAssertFalse([@"/foo/abcdefg" ks_isSubpathOfPath:@"/foo/abcd"], nil);
185-
STAssertFalse([@"/foo/abcd" ks_isSubpathOfPath:@"/foo/abcdefg"], nil);
185+
XCTAssertFalse([@"/foo/abcdefg" ks_isSubpathOfPath:@"/foo/abcd"]);
186+
XCTAssertFalse([@"/foo/abcd" ks_isSubpathOfPath:@"/foo/abcdefg"]);
186187
}
187188

188189
- (void)testStringByIncrementingPath;
189190
{
190191
NSString *path = @"foo/bar.png//";
191192
path = [path ks_stringByIncrementingPath];
192193

193-
STAssertTrue([path isEqualToString:@"foo/bar-2.png"],
194+
XCTAssertTrue([path isEqualToString:@"foo/bar-2.png"],
194195
@"Incremented path \'%@\' should be \'%@\'",
195196
path,
196197
@"foo/bar-2.png");
197198

198199
path = [path ks_stringByIncrementingPath];
199200

200-
STAssertTrue([path isEqualToString:@"foo/bar-3.png"],
201+
XCTAssertTrue([path isEqualToString:@"foo/bar-3.png"],
201202
@"Incremented path \'%@\' should be \'%@\'",
202203
path,
203204
@"foo/bar-3.png");
@@ -207,14 +208,14 @@ - (void)testStringByIncrementingPath;
207208
path = @"foo/bar//";
208209
path = [path ks_stringByIncrementingPath];
209210

210-
STAssertTrue([path isEqualToString:@"foo/bar-2"],
211+
XCTAssertTrue([path isEqualToString:@"foo/bar-2"],
211212
@"Incremented path \'%@\' should be \'%@\'",
212213
path,
213214
@"foo/bar-2");
214215

215216
path = [path ks_stringByIncrementingPath];
216217

217-
STAssertTrue([path isEqualToString:@"foo/bar-3"],
218+
XCTAssertTrue([path isEqualToString:@"foo/bar-3"],
218219
@"Incremented path \'%@\' should be \'%@\'",
219220
path,
220221
@"foo/bar-3");

0 commit comments

Comments
 (0)