Skip to content

Commit b06dd5a

Browse files
LinksmtLinksmt
authored andcommitted
Fix Swift 2.3
1 parent 2661dd9 commit b06dd5a

File tree

2 files changed

+59
-174
lines changed

2 files changed

+59
-174
lines changed

Mockingjay.xcodeproj/project.pbxproj

Lines changed: 0 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,14 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
2705946B1C4FA7A6002A3AA9 /* MockingjayXCTestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2705946A1C4FA7A6002A3AA9 /* MockingjayXCTestTests.swift */; };
1110
274367921AA27A7C0030C97B /* Mockingjay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 274367911AA27A7C0030C97B /* Mockingjay.swift */; };
1211
274367941AA27AAD0030C97B /* MockingjayProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 274367931AA27AAD0030C97B /* MockingjayProtocol.swift */; };
13-
274367961AA27B170030C97B /* MockingjayProtocolTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 274367951AA27B170030C97B /* MockingjayProtocolTests.swift */; };
1412
274367981AA28AFC0030C97B /* Matchers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 274367971AA28AFC0030C97B /* Matchers.swift */; };
15-
2743679A1AA28B0D0030C97B /* MatcherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 274367991AA28B0D0030C97B /* MatcherTests.swift */; };
1613
274367AE1AA29AED0030C97B /* URITemplate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 274367A91AA29ADA0030C97B /* URITemplate.framework */; };
1714
274367B01AA29E510030C97B /* Builders.swift in Sources */ = {isa = PBXBuildFile; fileRef = 274367AF1AA29E510030C97B /* Builders.swift */; };
18-
274367B21AA29E620030C97B /* BuildersTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 274367B11AA29E620030C97B /* BuildersTests.swift */; };
1915
274367C61AA35FD00030C97B /* NSURLSessionConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 274367C51AA35FD00030C97B /* NSURLSessionConfiguration.swift */; };
2016
2746CDC51A702F7800719B66 /* Mockingjay.h in Headers */ = {isa = PBXBuildFile; fileRef = 2746CDC41A702F7800719B66 /* Mockingjay.h */; settings = {ATTRIBUTES = (Public, ); }; };
21-
2746CDCB1A702F7800719B66 /* Mockingjay.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2746CDBF1A702F7800719B66 /* Mockingjay.framework */; };
22-
2746CDD21A702F7800719B66 /* MockingjayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2746CDD11A702F7800719B66 /* MockingjayTests.swift */; };
2317
27703A631CE2560600194732 /* MockingjayURLSessionConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 27703A621CE2560600194732 /* MockingjayURLSessionConfiguration.m */; };
24-
444EA6091C5261DE000C3A9F /* MockingjayAsyncProtocolTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 444EA6081C5261DE000C3A9F /* MockingjayAsyncProtocolTests.swift */; };
25-
444EA60C1C52666D000C3A9F /* TestAudio.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 444EA60B1C52666D000C3A9F /* TestAudio.m4a */; };
2618
A1E3C5701AA4EA130069C998 /* XCTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2743679B1AA28D4D0030C97B /* XCTest.swift */; };
2719
/* End PBXBuildFile section */
2820

@@ -48,13 +40,6 @@
4840
remoteGlobalIDString = 77356D7F1A253325002822CF;
4941
remoteInfo = URITemplate;
5042
};
51-
2746CDCC1A702F7800719B66 /* PBXContainerItemProxy */ = {
52-
isa = PBXContainerItemProxy;
53-
containerPortal = 2746CDB61A702F7800719B66 /* Project object */;
54-
proxyType = 1;
55-
remoteGlobalIDString = 2746CDBE1A702F7800719B66;
56-
remoteInfo = Mockingjay;
57-
};
5843
/* End PBXContainerItemProxy section */
5944

6045
/* Begin PBXFileReference section */
@@ -72,7 +57,6 @@
7257
2746CDBF1A702F7800719B66 /* Mockingjay.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Mockingjay.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7358
2746CDC31A702F7800719B66 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
7459
2746CDC41A702F7800719B66 /* Mockingjay.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Mockingjay.h; sourceTree = "<group>"; };
75-
2746CDCA1A702F7800719B66 /* MockingjayTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MockingjayTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
7660
2746CDD01A702F7800719B66 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
7761
2746CDD11A702F7800719B66 /* MockingjayTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockingjayTests.swift; sourceTree = "<group>"; };
7862
2746CDDC1A702FC100719B66 /* UniversalFramework_Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = UniversalFramework_Base.xcconfig; sourceTree = "<group>"; };
@@ -92,14 +76,6 @@
9276
);
9377
runOnlyForDeploymentPostprocessing = 0;
9478
};
95-
2746CDC71A702F7800719B66 /* Frameworks */ = {
96-
isa = PBXFrameworksBuildPhase;
97-
buildActionMask = 2147483647;
98-
files = (
99-
2746CDCB1A702F7800719B66 /* Mockingjay.framework in Frameworks */,
100-
);
101-
runOnlyForDeploymentPostprocessing = 0;
102-
};
10379
/* End PBXFrameworksBuildPhase section */
10480

10581
/* Begin PBXGroup section */
@@ -129,7 +105,6 @@
129105
isa = PBXGroup;
130106
children = (
131107
2746CDBF1A702F7800719B66 /* Mockingjay.framework */,
132-
2746CDCA1A702F7800719B66 /* MockingjayTests.xctest */,
133108
);
134109
name = Products;
135110
sourceTree = "<group>";
@@ -232,24 +207,6 @@
232207
productReference = 2746CDBF1A702F7800719B66 /* Mockingjay.framework */;
233208
productType = "com.apple.product-type.framework";
234209
};
235-
2746CDC91A702F7800719B66 /* MockingjayTests */ = {
236-
isa = PBXNativeTarget;
237-
buildConfigurationList = 2746CDD81A702F7800719B66 /* Build configuration list for PBXNativeTarget "MockingjayTests" */;
238-
buildPhases = (
239-
2746CDC61A702F7800719B66 /* Sources */,
240-
2746CDC71A702F7800719B66 /* Frameworks */,
241-
2746CDC81A702F7800719B66 /* Resources */,
242-
);
243-
buildRules = (
244-
);
245-
dependencies = (
246-
2746CDCD1A702F7800719B66 /* PBXTargetDependency */,
247-
);
248-
name = MockingjayTests;
249-
productName = MockingjayTests;
250-
productReference = 2746CDCA1A702F7800719B66 /* MockingjayTests.xctest */;
251-
productType = "com.apple.product-type.bundle.unit-test";
252-
};
253210
/* End PBXNativeTarget section */
254211

255212
/* Begin PBXProject section */
@@ -265,10 +222,6 @@
265222
CreatedOnToolsVersion = 6.1.1;
266223
LastSwiftMigration = 0800;
267224
};
268-
2746CDC91A702F7800719B66 = {
269-
CreatedOnToolsVersion = 6.1.1;
270-
LastSwiftMigration = 0800;
271-
};
272225
};
273226
};
274227
buildConfigurationList = 2746CDB91A702F7800719B66 /* Build configuration list for PBXProject "Mockingjay" */;
@@ -290,7 +243,6 @@
290243
projectRoot = "";
291244
targets = (
292245
2746CDBE1A702F7800719B66 /* Mockingjay */,
293-
2746CDC91A702F7800719B66 /* MockingjayTests */,
294246
);
295247
};
296248
/* End PBXProject section */
@@ -320,14 +272,6 @@
320272
);
321273
runOnlyForDeploymentPostprocessing = 0;
322274
};
323-
2746CDC81A702F7800719B66 /* Resources */ = {
324-
isa = PBXResourcesBuildPhase;
325-
buildActionMask = 2147483647;
326-
files = (
327-
444EA60C1C52666D000C3A9F /* TestAudio.m4a in Resources */,
328-
);
329-
runOnlyForDeploymentPostprocessing = 0;
330-
};
331275
/* End PBXResourcesBuildPhase section */
332276

333277
/* Begin PBXSourcesBuildPhase section */
@@ -345,19 +289,6 @@
345289
);
346290
runOnlyForDeploymentPostprocessing = 0;
347291
};
348-
2746CDC61A702F7800719B66 /* Sources */ = {
349-
isa = PBXSourcesBuildPhase;
350-
buildActionMask = 2147483647;
351-
files = (
352-
2743679A1AA28B0D0030C97B /* MatcherTests.swift in Sources */,
353-
274367961AA27B170030C97B /* MockingjayProtocolTests.swift in Sources */,
354-
444EA6091C5261DE000C3A9F /* MockingjayAsyncProtocolTests.swift in Sources */,
355-
274367B21AA29E620030C97B /* BuildersTests.swift in Sources */,
356-
2705946B1C4FA7A6002A3AA9 /* MockingjayXCTestTests.swift in Sources */,
357-
2746CDD21A702F7800719B66 /* MockingjayTests.swift in Sources */,
358-
);
359-
runOnlyForDeploymentPostprocessing = 0;
360-
};
361292
/* End PBXSourcesBuildPhase section */
362293

363294
/* Begin PBXTargetDependency section */
@@ -366,11 +297,6 @@
366297
name = URITemplate;
367298
targetProxy = 274367AC1AA29AE70030C97B /* PBXContainerItemProxy */;
368299
};
369-
2746CDCD1A702F7800719B66 /* PBXTargetDependency */ = {
370-
isa = PBXTargetDependency;
371-
target = 2746CDBE1A702F7800719B66 /* Mockingjay */;
372-
targetProxy = 2746CDCC1A702F7800719B66 /* PBXContainerItemProxy */;
373-
};
374300
/* End PBXTargetDependency section */
375301

376302
/* Begin XCBuildConfiguration section */
@@ -513,34 +439,6 @@
513439
};
514440
name = Release;
515441
};
516-
2746CDD91A702F7800719B66 /* Debug */ = {
517-
isa = XCBuildConfiguration;
518-
baseConfigurationReference = 2746CDDE1A702FC100719B66 /* UniversalFramework_Test.xcconfig */;
519-
buildSettings = {
520-
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
521-
COMBINE_HIDPI_IMAGES = YES;
522-
GCC_PREPROCESSOR_DEFINITIONS = (
523-
"DEBUG=1",
524-
"$(inherited)",
525-
);
526-
INFOPLIST_FILE = MockingjayTests/Info.plist;
527-
PRODUCT_BUNDLE_IDENTIFIER = "org.cocode.$(PRODUCT_NAME:rfc1034identifier)";
528-
PRODUCT_NAME = "$(TARGET_NAME)";
529-
};
530-
name = Debug;
531-
};
532-
2746CDDA1A702F7800719B66 /* Release */ = {
533-
isa = XCBuildConfiguration;
534-
baseConfigurationReference = 2746CDDE1A702FC100719B66 /* UniversalFramework_Test.xcconfig */;
535-
buildSettings = {
536-
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
537-
COMBINE_HIDPI_IMAGES = YES;
538-
INFOPLIST_FILE = MockingjayTests/Info.plist;
539-
PRODUCT_BUNDLE_IDENTIFIER = "org.cocode.$(PRODUCT_NAME:rfc1034identifier)";
540-
PRODUCT_NAME = "$(TARGET_NAME)";
541-
};
542-
name = Release;
543-
};
544442
/* End XCBuildConfiguration section */
545443

546444
/* Begin XCConfigurationList section */
@@ -562,15 +460,6 @@
562460
defaultConfigurationIsVisible = 0;
563461
defaultConfigurationName = Release;
564462
};
565-
2746CDD81A702F7800719B66 /* Build configuration list for PBXNativeTarget "MockingjayTests" */ = {
566-
isa = XCConfigurationList;
567-
buildConfigurations = (
568-
2746CDD91A702F7800719B66 /* Debug */,
569-
2746CDDA1A702F7800719B66 /* Release */,
570-
);
571-
defaultConfigurationIsVisible = 0;
572-
defaultConfigurationName = Release;
573-
};
574463
/* End XCConfigurationList section */
575464
};
576465
rootObject = 2746CDB61A702F7800719B66 /* Project object */;

Mockingjay/XCTest.swift

Lines changed: 59 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,59 @@
1-
//
2-
// XCTest.swift
3-
// Mockingjay
4-
//
5-
// Created by Kyle Fuller on 28/02/2015.
6-
// Copyright (c) 2015 Cocode. All rights reserved.
7-
//
8-
9-
import ObjectiveC
10-
import XCTest
11-
12-
var mockingjayTearDownSwizzleToken: dispatch_once_t = 0
13-
14-
var AssociatedMockingjayRemoveStubOnTearDownHandle: UInt8 = 0
15-
extension XCTest {
16-
// MARK: Stubbing
17-
18-
/// Whether Mockingjay should remove stubs on teardown
19-
public var mockingjayRemoveStubOnTearDown: Bool {
20-
get {
21-
let associatedResult = objc_getAssociatedObject(self, &AssociatedMockingjayRemoveStubOnTearDownHandle) as? Bool
22-
return associatedResult ?? true
23-
}
24-
25-
set {
26-
objc_setAssociatedObject(self, &AssociatedMockingjayRemoveStubOnTearDownHandle, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
27-
}
28-
}
29-
30-
public func stub(matcher:Matcher, builder:Builder) -> Stub {
31-
if mockingjayRemoveStubOnTearDown {
32-
XCTest.mockingjaySwizzleTearDown()
33-
}
34-
35-
return MockingjayProtocol.addStub(matcher, builder: builder)
36-
}
37-
38-
public func removeStub(stub:Stub) {
39-
MockingjayProtocol.removeStub(stub)
40-
}
41-
42-
public func removeAllStubs() {
43-
MockingjayProtocol.removeAllStubs()
44-
}
45-
46-
// MARK: Teardown
47-
48-
public class func mockingjaySwizzleTearDown() {
49-
dispatch_once(&mockingjayTearDownSwizzleToken) {
50-
let tearDown = class_getInstanceMethod(self, #selector(XCTest.tearDown))
51-
let mockingjayTearDown = class_getInstanceMethod(self, #selector(XCTest.mockingjayTearDown))
52-
method_exchangeImplementations(tearDown, mockingjayTearDown)
53-
}
54-
}
55-
56-
func mockingjayTearDown() {
57-
mockingjayTearDown()
58-
59-
if mockingjayRemoveStubOnTearDown {
60-
MockingjayProtocol.removeAllStubs()
61-
}
62-
}
63-
}
1+
#if !os(watchOS)
2+
3+
//import ObjectiveC
4+
//import XCTest
5+
//
6+
//var mockingjayTearDownSwizzleToken: dispatch_once_t = 0
7+
//
8+
//var AssociatedMockingjayRemoveStubOnTearDownHandle: UInt8 = 0
9+
//extension XCTest {
10+
// // MARK: Stubbing
11+
//
12+
// /// Whether Mockingjay should remove stubs on teardown
13+
// public var mockingjayRemoveStubOnTearDown: Bool {
14+
// get {
15+
// let associatedResult = objc_getAssociatedObject(self, &AssociatedMockingjayRemoveStubOnTearDownHandle) as? Bool
16+
// return associatedResult ?? true
17+
// }
18+
//
19+
// set {
20+
// objc_setAssociatedObject(self, &AssociatedMockingjayRemoveStubOnTearDownHandle, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
21+
// }
22+
// }
23+
//
24+
// public func stub(matcher:Matcher, builder:Builder) -> Stub {
25+
// if mockingjayRemoveStubOnTearDown {
26+
// XCTest.mockingjaySwizzleTearDown()
27+
// }
28+
//
29+
// return MockingjayProtocol.addStub(matcher, builder: builder)
30+
// }
31+
//
32+
// public func removeStub(stub:Stub) {
33+
// MockingjayProtocol.removeStub(stub)
34+
// }
35+
//
36+
// public func removeAllStubs() {
37+
// MockingjayProtocol.removeAllStubs()
38+
// }
39+
//
40+
// // MARK: Teardown
41+
//
42+
// public class func mockingjaySwizzleTearDown() {
43+
// dispatch_once(&mockingjayTearDownSwizzleToken) {
44+
// let tearDown = class_getInstanceMethod(self, #selector(XCTest.tearDown))
45+
// let mockingjayTearDown = class_getInstanceMethod(self, #selector(XCTest.mockingjayTearDown))
46+
// method_exchangeImplementations(tearDown, mockingjayTearDown)
47+
// }
48+
// }
49+
//
50+
// func mockingjayTearDown() {
51+
// mockingjayTearDown()
52+
//
53+
// if mockingjayRemoveStubOnTearDown {
54+
// MockingjayProtocol.removeAllStubs()
55+
// }
56+
// }
57+
//}
58+
59+
#endif

0 commit comments

Comments
 (0)