Merge pull request #174 from modocache/sr-1901-remove-workarounds
[SR-1901] Remove workarounds for private symbols
diff --git a/Sources/XCTest/Public/XCNotificationExpectationHandler.swift b/Sources/XCTest/Public/Asynchronous/XCNotificationExpectationHandler.swift
similarity index 100%
rename from Sources/XCTest/Public/XCNotificationExpectationHandler.swift
rename to Sources/XCTest/Public/Asynchronous/XCNotificationExpectationHandler.swift
diff --git a/Sources/XCTest/Public/XCPredicateExpectationHandler.swift b/Sources/XCTest/Public/Asynchronous/XCPredicateExpectationHandler.swift
similarity index 100%
rename from Sources/XCTest/Public/XCPredicateExpectationHandler.swift
rename to Sources/XCTest/Public/Asynchronous/XCPredicateExpectationHandler.swift
diff --git a/Sources/XCTest/Public/XCTestCase+Asynchronous.swift b/Sources/XCTest/Public/Asynchronous/XCTestCase+Asynchronous.swift
similarity index 62%
rename from Sources/XCTest/Public/XCTestCase+Asynchronous.swift
rename to Sources/XCTest/Public/Asynchronous/XCTestCase+Asynchronous.swift
index 7380db7..b218614 100644
--- a/Sources/XCTest/Public/XCTestCase+Asynchronous.swift
+++ b/Sources/XCTest/Public/Asynchronous/XCTestCase+Asynchronous.swift
@@ -151,94 +151,6 @@
completionHandler(error)
}
}
-
- /// Creates and returns an expectation for a notification.
- ///
- /// - Parameter notificationName: The name of the notification the
- /// expectation observes.
- /// - Parameter object: The object whose notifications the expectation will
- /// receive; that is, only notifications with this object are observed by
- /// the test case. If you pass nil, the expectation doesn't use
- /// a notification's object to decide whether it is fulfilled.
- /// - Parameter handler: If provided, the handler will be invoked when the
- /// notification is observed. It will not be invoked on timeout. Use the
- /// handler to further investigate if the notification fulfills the
- /// expectation.
- @discardableResult func expectation(forNotification notificationName: String, object objectToObserve: AnyObject?, handler: XCNotificationExpectationHandler? = nil) -> XCTestExpectation {
- let objectDescription = objectToObserve == nil ? "any object" : "\(objectToObserve!)"
- let expectation = self.expectation(description: "Expect notification '\(notificationName)' from " + objectDescription)
- // Start observing the notification with specified name and object.
- var observer: NSObjectProtocol? = nil
- func removeObserver() {
- if let observer = observer {
- NotificationCenter.default.removeObserver(observer)
- }
- }
-
- weak var weakExpectation = expectation
- observer = NotificationCenter
- .default
- .addObserver(forName: Notification.Name(rawValue: notificationName),
- object: objectToObserve,
- queue: nil,
- usingBlock: {
- notification in
- guard let expectation = weakExpectation else {
- removeObserver()
- return
- }
-
- // If the handler is invoked, the test will
- // only pass if true is returned.
- if let handler = handler {
- if handler(notification) {
- expectation.fulfill()
- removeObserver()
- }
- } else {
- expectation.fulfill()
- removeObserver()
- }
- })
-
- return expectation
- }
-
- /// Creates and returns an expectation that is fulfilled if the predicate
- /// returns true when evaluated with the given object. The expectation
- /// periodically evaluates the predicate and also may use notifications or
- /// other events to optimistically re-evaluate.
- ///
- /// - Parameter predicate: The predicate that will be used to evaluate the
- /// object.
- /// - Parameter object: The object that is evaluated against the conditions
- /// specified by the predicate.
- /// - Parameter file: The file name to use in the error message if
- /// this expectation is not waited for. Default is the file
- /// containing the call to this method. It is rare to provide this
- /// parameter when calling this method.
- /// - Parameter line: The line number to use in the error message if the
- /// this expectation is not waited for. Default is the line
- /// number of the call to this method in the calling file. It is rare to
- /// provide this parameter when calling this method.
- /// - Parameter handler: A block to be invoked when evaluating the predicate
- /// against the object returns true. If the block is not provided the
- /// first successful evaluation will fulfill the expectation. If provided,
- /// the handler can override that behavior which leaves the caller
- /// responsible for fulfilling the expectation.
- @discardableResult func expectation(for predicate: NSPredicate, evaluatedWith object: AnyObject, file: StaticString = #file, line: UInt = #line, handler: XCPredicateExpectationHandler? = nil) -> XCTestExpectation {
- let expectation = XCPredicateExpectation(
- predicate: predicate,
- object: object,
- description: "Expect `\(predicate)` for object \(object)",
- file: file,
- line: line,
- testCase: self,
- handler: handler)
- _allExpectations.append(expectation)
- expectation.considerFulfilling()
- return expectation
- }
}
internal extension XCTestCase {
diff --git a/Sources/XCTest/Public/Asynchronous/XCTestCase+NotificationExpectation.swift b/Sources/XCTest/Public/Asynchronous/XCTestCase+NotificationExpectation.swift
new file mode 100644
index 0000000..92f8d0a
--- /dev/null
+++ b/Sources/XCTest/Public/Asynchronous/XCTestCase+NotificationExpectation.swift
@@ -0,0 +1,71 @@
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+//
+// XCTestCase+NotificationExpectation.swift
+//
+
+#if os(Linux) || os(FreeBSD)
+ import Foundation
+#else
+ import SwiftFoundation
+#endif
+
+public extension XCTestCase {
+ /// Creates and returns an expectation for a notification.
+ ///
+ /// - Parameter notificationName: The name of the notification the
+ /// expectation observes.
+ /// - Parameter object: The object whose notifications the expectation will
+ /// receive; that is, only notifications with this object are observed by
+ /// the test case. If you pass nil, the expectation doesn't use
+ /// a notification's object to decide whether it is fulfilled.
+ /// - Parameter handler: If provided, the handler will be invoked when the
+ /// notification is observed. It will not be invoked on timeout. Use the
+ /// handler to further investigate if the notification fulfills the
+ /// expectation.
+ @discardableResult func expectation(forNotification notificationName: String, object objectToObserve: AnyObject?, handler: XCNotificationExpectationHandler? = nil) -> XCTestExpectation {
+ let objectDescription = objectToObserve == nil ? "any object" : "\(objectToObserve!)"
+ let expectation = self.expectation(description: "Expect notification '\(notificationName)' from " + objectDescription)
+ // Start observing the notification with specified name and object.
+ var observer: NSObjectProtocol? = nil
+ func removeObserver() {
+ if let observer = observer {
+ NotificationCenter.default.removeObserver(observer)
+ }
+ }
+
+ weak var weakExpectation = expectation
+ observer = NotificationCenter
+ .default
+ .addObserver(forName: Notification.Name(rawValue: notificationName),
+ object: objectToObserve,
+ queue: nil,
+ usingBlock: {
+ notification in
+ guard let expectation = weakExpectation else {
+ removeObserver()
+ return
+ }
+
+ // If the handler is invoked, the test will
+ // only pass if true is returned.
+ if let handler = handler {
+ if handler(notification) {
+ expectation.fulfill()
+ removeObserver()
+ }
+ } else {
+ expectation.fulfill()
+ removeObserver()
+ }
+ })
+
+ return expectation
+ }
+}
diff --git a/Sources/XCTest/Public/Asynchronous/XCTestCase+PredicateExpectation.swift b/Sources/XCTest/Public/Asynchronous/XCTestCase+PredicateExpectation.swift
new file mode 100644
index 0000000..e282c78
--- /dev/null
+++ b/Sources/XCTest/Public/Asynchronous/XCTestCase+PredicateExpectation.swift
@@ -0,0 +1,55 @@
+// This source file is part of the Swift.org open source project
+//
+// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
+// Licensed under Apache License v2.0 with Runtime Library Exception
+//
+// See http://swift.org/LICENSE.txt for license information
+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
+//
+//
+// XCTestCase+PredicateExpectation.swift
+//
+
+#if os(Linux) || os(FreeBSD)
+ import Foundation
+#else
+ import SwiftFoundation
+#endif
+
+public extension XCTestCase {
+ /// Creates and returns an expectation that is fulfilled if the predicate
+ /// returns true when evaluated with the given object. The expectation
+ /// periodically evaluates the predicate and also may use notifications or
+ /// other events to optimistically re-evaluate.
+ ///
+ /// - Parameter predicate: The predicate that will be used to evaluate the
+ /// object.
+ /// - Parameter object: The object that is evaluated against the conditions
+ /// specified by the predicate.
+ /// - Parameter file: The file name to use in the error message if
+ /// this expectation is not waited for. Default is the file
+ /// containing the call to this method. It is rare to provide this
+ /// parameter when calling this method.
+ /// - Parameter line: The line number to use in the error message if the
+ /// this expectation is not waited for. Default is the line
+ /// number of the call to this method in the calling file. It is rare to
+ /// provide this parameter when calling this method.
+ /// - Parameter handler: A block to be invoked when evaluating the predicate
+ /// against the object returns true. If the block is not provided the
+ /// first successful evaluation will fulfill the expectation. If provided,
+ /// the handler can override that behavior which leaves the caller
+ /// responsible for fulfilling the expectation.
+ @discardableResult func expectation(for predicate: NSPredicate, evaluatedWith object: AnyObject, file: StaticString = #file, line: UInt = #line, handler: XCPredicateExpectationHandler? = nil) -> XCTestExpectation {
+ let expectation = XCPredicateExpectation(
+ predicate: predicate,
+ object: object,
+ description: "Expect `\(predicate)` for object \(object)",
+ file: file,
+ line: line,
+ testCase: self,
+ handler: handler)
+ _allExpectations.append(expectation)
+ expectation.considerFulfilling()
+ return expectation
+ }
+}
diff --git a/Sources/XCTest/Public/XCTestExpectation.swift b/Sources/XCTest/Public/Asynchronous/XCTestExpectation.swift
similarity index 100%
rename from Sources/XCTest/Public/XCTestExpectation.swift
rename to Sources/XCTest/Public/Asynchronous/XCTestExpectation.swift
diff --git a/Sources/XCTest/Public/XCWaitCompletionHandler.swift b/Sources/XCTest/Public/Asynchronous/XCWaitCompletionHandler.swift
similarity index 100%
rename from Sources/XCTest/Public/XCWaitCompletionHandler.swift
rename to Sources/XCTest/Public/Asynchronous/XCWaitCompletionHandler.swift
diff --git a/XCTest.xcodeproj/project.pbxproj b/XCTest.xcodeproj/project.pbxproj
index 1187787..a6a87fb 100644
--- a/XCTest.xcodeproj/project.pbxproj
+++ b/XCTest.xcodeproj/project.pbxproj
@@ -8,22 +8,17 @@
/* Begin PBXBuildFile section */
AE2FE0FB1CFE86DB003EF0D7 /* XCAbstractTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2FE0EA1CFE86DB003EF0D7 /* XCAbstractTest.swift */; };
- AE2FE0FC1CFE86DB003EF0D7 /* XCNotificationExpectationHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2FE0EB1CFE86DB003EF0D7 /* XCNotificationExpectationHandler.swift */; };
- AE2FE0FD1CFE86DB003EF0D7 /* XCPredicateExpectationHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2FE0EC1CFE86DB003EF0D7 /* XCPredicateExpectationHandler.swift */; };
AE2FE0FE1CFE86DB003EF0D7 /* XCTAssert.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2FE0ED1CFE86DB003EF0D7 /* XCTAssert.swift */; };
AE2FE0FF1CFE86DB003EF0D7 /* XCTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2FE0EE1CFE86DB003EF0D7 /* XCTestCase.swift */; };
- AE2FE1001CFE86DB003EF0D7 /* XCTestCase+Asynchronous.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2FE0EF1CFE86DB003EF0D7 /* XCTestCase+Asynchronous.swift */; };
AE2FE1011CFE86DB003EF0D7 /* XCTestCase+Performance.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2FE0F01CFE86DB003EF0D7 /* XCTestCase+Performance.swift */; };
AE2FE1021CFE86DB003EF0D7 /* XCTestCaseRun.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2FE0F11CFE86DB003EF0D7 /* XCTestCaseRun.swift */; };
AE2FE1031CFE86DB003EF0D7 /* XCTestErrors.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2FE0F21CFE86DB003EF0D7 /* XCTestErrors.swift */; };
- AE2FE1041CFE86DB003EF0D7 /* XCTestExpectation.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2FE0F31CFE86DB003EF0D7 /* XCTestExpectation.swift */; };
AE2FE1051CFE86DB003EF0D7 /* XCTestMain.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2FE0F41CFE86DB003EF0D7 /* XCTestMain.swift */; };
AE2FE1061CFE86DB003EF0D7 /* XCTestObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2FE0F51CFE86DB003EF0D7 /* XCTestObservation.swift */; };
AE2FE1071CFE86DB003EF0D7 /* XCTestObservationCenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2FE0F61CFE86DB003EF0D7 /* XCTestObservationCenter.swift */; };
AE2FE1081CFE86DB003EF0D7 /* XCTestRun.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2FE0F71CFE86DB003EF0D7 /* XCTestRun.swift */; };
AE2FE1091CFE86DB003EF0D7 /* XCTestSuite.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2FE0F81CFE86DB003EF0D7 /* XCTestSuite.swift */; };
AE2FE10A1CFE86DB003EF0D7 /* XCTestSuiteRun.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2FE0F91CFE86DB003EF0D7 /* XCTestSuiteRun.swift */; };
- AE2FE10B1CFE86DB003EF0D7 /* XCWaitCompletionHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2FE0FA1CFE86DB003EF0D7 /* XCWaitCompletionHandler.swift */; };
AE2FE1151CFE86E6003EF0D7 /* ArgumentParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2FE10C1CFE86E6003EF0D7 /* ArgumentParser.swift */; };
AE2FE1161CFE86E6003EF0D7 /* ObjectWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2FE10D1CFE86E6003EF0D7 /* ObjectWrapper.swift */; };
AE2FE1171CFE86E6003EF0D7 /* PerformanceMeter.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2FE10E1CFE86E6003EF0D7 /* PerformanceMeter.swift */; };
@@ -35,6 +30,13 @@
AE2FE11D1CFE86E6003EF0D7 /* XCTestInternalObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2FE1141CFE86E6003EF0D7 /* XCTestInternalObservation.swift */; };
AE63767E1D01ED17002C0EA8 /* TestListing.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE63767D1D01ED17002C0EA8 /* TestListing.swift */; };
DA7805FA1C6704A2003C6636 /* SwiftFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA7805F91C6704A2003C6636 /* SwiftFoundation.framework */; };
+ DA9D44191D920A3500108768 /* XCNotificationExpectationHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9D44141D920A3500108768 /* XCNotificationExpectationHandler.swift */; };
+ DA9D441A1D920A3500108768 /* XCPredicateExpectationHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9D44151D920A3500108768 /* XCPredicateExpectationHandler.swift */; };
+ DA9D441B1D920A3500108768 /* XCTestCase+Asynchronous.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9D44161D920A3500108768 /* XCTestCase+Asynchronous.swift */; };
+ DA9D441C1D920A3500108768 /* XCTestExpectation.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9D44171D920A3500108768 /* XCTestExpectation.swift */; };
+ DA9D441D1D920A3500108768 /* XCWaitCompletionHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9D44181D920A3500108768 /* XCWaitCompletionHandler.swift */; };
+ DA9D441F1D920A5900108768 /* XCTestCase+PredicateExpectation.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9D441E1D920A5900108768 /* XCTestCase+PredicateExpectation.swift */; };
+ DA9D44211D920A6400108768 /* XCTestCase+NotificationExpectation.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA9D44201D920A6400108768 /* XCTestCase+NotificationExpectation.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -50,22 +52,17 @@
/* Begin PBXFileReference section */
5B5D86DB1BBC74AD00234F36 /* SwiftXCTest.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftXCTest.framework; sourceTree = BUILT_PRODUCTS_DIR; };
AE2FE0EA1CFE86DB003EF0D7 /* XCAbstractTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCAbstractTest.swift; sourceTree = "<group>"; };
- AE2FE0EB1CFE86DB003EF0D7 /* XCNotificationExpectationHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCNotificationExpectationHandler.swift; sourceTree = "<group>"; };
- AE2FE0EC1CFE86DB003EF0D7 /* XCPredicateExpectationHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCPredicateExpectationHandler.swift; sourceTree = "<group>"; };
AE2FE0ED1CFE86DB003EF0D7 /* XCTAssert.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCTAssert.swift; sourceTree = "<group>"; };
AE2FE0EE1CFE86DB003EF0D7 /* XCTestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCTestCase.swift; sourceTree = "<group>"; };
- AE2FE0EF1CFE86DB003EF0D7 /* XCTestCase+Asynchronous.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "XCTestCase+Asynchronous.swift"; sourceTree = "<group>"; };
AE2FE0F01CFE86DB003EF0D7 /* XCTestCase+Performance.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "XCTestCase+Performance.swift"; sourceTree = "<group>"; };
AE2FE0F11CFE86DB003EF0D7 /* XCTestCaseRun.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCTestCaseRun.swift; sourceTree = "<group>"; };
AE2FE0F21CFE86DB003EF0D7 /* XCTestErrors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCTestErrors.swift; sourceTree = "<group>"; };
- AE2FE0F31CFE86DB003EF0D7 /* XCTestExpectation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCTestExpectation.swift; sourceTree = "<group>"; };
AE2FE0F41CFE86DB003EF0D7 /* XCTestMain.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCTestMain.swift; sourceTree = "<group>"; };
AE2FE0F51CFE86DB003EF0D7 /* XCTestObservation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCTestObservation.swift; sourceTree = "<group>"; };
AE2FE0F61CFE86DB003EF0D7 /* XCTestObservationCenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCTestObservationCenter.swift; sourceTree = "<group>"; };
AE2FE0F71CFE86DB003EF0D7 /* XCTestRun.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCTestRun.swift; sourceTree = "<group>"; };
AE2FE0F81CFE86DB003EF0D7 /* XCTestSuite.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCTestSuite.swift; sourceTree = "<group>"; };
AE2FE0F91CFE86DB003EF0D7 /* XCTestSuiteRun.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCTestSuiteRun.swift; sourceTree = "<group>"; };
- AE2FE0FA1CFE86DB003EF0D7 /* XCWaitCompletionHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCWaitCompletionHandler.swift; sourceTree = "<group>"; };
AE2FE10C1CFE86E6003EF0D7 /* ArgumentParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArgumentParser.swift; sourceTree = "<group>"; };
AE2FE10D1CFE86E6003EF0D7 /* ObjectWrapper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ObjectWrapper.swift; sourceTree = "<group>"; };
AE2FE10E1CFE86E6003EF0D7 /* PerformanceMeter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PerformanceMeter.swift; sourceTree = "<group>"; };
@@ -81,6 +78,13 @@
B1384A421C1B3E8700EDF031 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
B1384A431C1B3E8700EDF031 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
DA7805F91C6704A2003C6636 /* SwiftFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftFoundation.framework; path = "../swift-corelibs-foundation/build/Debug/SwiftFoundation.framework"; sourceTree = "<group>"; };
+ DA9D44141D920A3500108768 /* XCNotificationExpectationHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCNotificationExpectationHandler.swift; sourceTree = "<group>"; };
+ DA9D44151D920A3500108768 /* XCPredicateExpectationHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCPredicateExpectationHandler.swift; sourceTree = "<group>"; };
+ DA9D44161D920A3500108768 /* XCTestCase+Asynchronous.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "XCTestCase+Asynchronous.swift"; sourceTree = "<group>"; };
+ DA9D44171D920A3500108768 /* XCTestExpectation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCTestExpectation.swift; sourceTree = "<group>"; };
+ DA9D44181D920A3500108768 /* XCWaitCompletionHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XCWaitCompletionHandler.swift; sourceTree = "<group>"; };
+ DA9D441E1D920A5900108768 /* XCTestCase+PredicateExpectation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "XCTestCase+PredicateExpectation.swift"; sourceTree = "<group>"; };
+ DA9D44201D920A6400108768 /* XCTestCase+NotificationExpectation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "XCTestCase+NotificationExpectation.swift"; sourceTree = "<group>"; };
EA3E74BB1BF2B6D500635A73 /* build_script.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = build_script.py; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -138,23 +142,19 @@
AE2FE0E91CFE86AE003EF0D7 /* Public */ = {
isa = PBXGroup;
children = (
+ DA9D44131D920A3500108768 /* Asynchronous */,
AE2FE0EA1CFE86DB003EF0D7 /* XCAbstractTest.swift */,
- AE2FE0EB1CFE86DB003EF0D7 /* XCNotificationExpectationHandler.swift */,
- AE2FE0EC1CFE86DB003EF0D7 /* XCPredicateExpectationHandler.swift */,
AE2FE0ED1CFE86DB003EF0D7 /* XCTAssert.swift */,
AE2FE0EE1CFE86DB003EF0D7 /* XCTestCase.swift */,
- AE2FE0EF1CFE86DB003EF0D7 /* XCTestCase+Asynchronous.swift */,
AE2FE0F01CFE86DB003EF0D7 /* XCTestCase+Performance.swift */,
AE2FE0F11CFE86DB003EF0D7 /* XCTestCaseRun.swift */,
AE2FE0F21CFE86DB003EF0D7 /* XCTestErrors.swift */,
- AE2FE0F31CFE86DB003EF0D7 /* XCTestExpectation.swift */,
AE2FE0F41CFE86DB003EF0D7 /* XCTestMain.swift */,
AE2FE0F51CFE86DB003EF0D7 /* XCTestObservation.swift */,
AE2FE0F61CFE86DB003EF0D7 /* XCTestObservationCenter.swift */,
AE2FE0F71CFE86DB003EF0D7 /* XCTestRun.swift */,
AE2FE0F81CFE86DB003EF0D7 /* XCTestSuite.swift */,
AE2FE0F91CFE86DB003EF0D7 /* XCTestSuiteRun.swift */,
- AE2FE0FA1CFE86DB003EF0D7 /* XCWaitCompletionHandler.swift */,
);
path = Public;
sourceTree = "<group>";
@@ -202,6 +202,20 @@
path = Tests;
sourceTree = "<group>";
};
+ DA9D44131D920A3500108768 /* Asynchronous */ = {
+ isa = PBXGroup;
+ children = (
+ DA9D44161D920A3500108768 /* XCTestCase+Asynchronous.swift */,
+ DA9D44171D920A3500108768 /* XCTestExpectation.swift */,
+ DA9D44181D920A3500108768 /* XCWaitCompletionHandler.swift */,
+ DA9D44151D920A3500108768 /* XCPredicateExpectationHandler.swift */,
+ DA9D441E1D920A5900108768 /* XCTestCase+PredicateExpectation.swift */,
+ DA9D44141D920A3500108768 /* XCNotificationExpectationHandler.swift */,
+ DA9D44201D920A6400108768 /* XCTestCase+NotificationExpectation.swift */,
+ );
+ path = Asynchronous;
+ sourceTree = "<group>";
+ };
EA3E74BC1BF2B6D700635A73 /* Linux Build */ = {
isa = PBXGroup;
children = (
@@ -314,32 +328,34 @@
buildActionMask = 2147483647;
files = (
AE2FE1071CFE86DB003EF0D7 /* XCTestObservationCenter.swift in Sources */,
- AE2FE1001CFE86DB003EF0D7 /* XCTestCase+Asynchronous.swift in Sources */,
+ DA9D441C1D920A3500108768 /* XCTestExpectation.swift in Sources */,
AE2FE1011CFE86DB003EF0D7 /* XCTestCase+Performance.swift in Sources */,
+ DA9D441B1D920A3500108768 /* XCTestCase+Asynchronous.swift in Sources */,
AE2FE1181CFE86E6003EF0D7 /* PrintObserver.swift in Sources */,
AE2FE1021CFE86DB003EF0D7 /* XCTestCaseRun.swift in Sources */,
+ DA9D441D1D920A3500108768 /* XCWaitCompletionHandler.swift in Sources */,
+ DA9D441A1D920A3500108768 /* XCPredicateExpectationHandler.swift in Sources */,
AE2FE1171CFE86E6003EF0D7 /* PerformanceMeter.swift in Sources */,
AE2FE1051CFE86DB003EF0D7 /* XCTestMain.swift in Sources */,
AE2FE11B1CFE86E6003EF0D7 /* XCPredicateExpectation.swift in Sources */,
+ DA9D44191D920A3500108768 /* XCNotificationExpectationHandler.swift in Sources */,
+ DA9D44211D920A6400108768 /* XCTestCase+NotificationExpectation.swift in Sources */,
AE63767E1D01ED17002C0EA8 /* TestListing.swift in Sources */,
AE2FE1151CFE86E6003EF0D7 /* ArgumentParser.swift in Sources */,
AE2FE0FF1CFE86DB003EF0D7 /* XCTestCase.swift in Sources */,
+ DA9D441F1D920A5900108768 /* XCTestCase+PredicateExpectation.swift in Sources */,
AE2FE11D1CFE86E6003EF0D7 /* XCTestInternalObservation.swift in Sources */,
AE2FE1061CFE86DB003EF0D7 /* XCTestObservation.swift in Sources */,
- AE2FE10B1CFE86DB003EF0D7 /* XCWaitCompletionHandler.swift in Sources */,
AE2FE0FB1CFE86DB003EF0D7 /* XCAbstractTest.swift in Sources */,
AE2FE1081CFE86DB003EF0D7 /* XCTestRun.swift in Sources */,
AE2FE10A1CFE86DB003EF0D7 /* XCTestSuiteRun.swift in Sources */,
- AE2FE0FD1CFE86DB003EF0D7 /* XCPredicateExpectationHandler.swift in Sources */,
AE2FE1161CFE86E6003EF0D7 /* ObjectWrapper.swift in Sources */,
AE2FE11A1CFE86E6003EF0D7 /* WallClockTimeMetric.swift in Sources */,
AE2FE1191CFE86E6003EF0D7 /* TestFiltering.swift in Sources */,
- AE2FE0FC1CFE86DB003EF0D7 /* XCNotificationExpectationHandler.swift in Sources */,
AE2FE1031CFE86DB003EF0D7 /* XCTestErrors.swift in Sources */,
AE2FE1091CFE86DB003EF0D7 /* XCTestSuite.swift in Sources */,
AE2FE11C1CFE86E6003EF0D7 /* XCTestCaseSuite.swift in Sources */,
AE2FE0FE1CFE86DB003EF0D7 /* XCTAssert.swift in Sources */,
- AE2FE1041CFE86DB003EF0D7 /* XCTestExpectation.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/build_script.py b/build_script.py
index 7d6ab90..334d5b4 100755
--- a/build_script.py
+++ b/build_script.py
@@ -10,7 +10,7 @@
# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
import argparse
-import glob
+import fnmatch
import os
import subprocess
import sys
@@ -39,6 +39,19 @@
run("mkdir -p {}".format(path))
+def _find_files_with_extension(path, extension):
+ """
+ In Python 3.5 and above, glob supports recursive patterns such as
+ '**/*.swift'. This function backports that functionality to Python 3.4
+ and below.
+ """
+ paths = []
+ for root, _, file_names in os.walk(path):
+ for file_name in fnmatch.filter(file_names, '*.{}'.format(extension)):
+ paths.append(os.path.join(root, file_name))
+ return paths
+
+
def symlink_force(target, link_name):
if os.path.isdir(link_name):
link_name = os.path.join(link_name, os.path.basename(target))
@@ -149,8 +162,9 @@
_mkdirp(build_dir)
- sourcePaths = glob.glob(os.path.join(
- SOURCE_DIR, 'Sources', 'XCTest', '*', '*.swift'))
+ sourcePaths = _find_files_with_extension(
+ os.path.join(SOURCE_DIR, 'Sources', 'XCTest'),
+ 'swift')
if args.build_style == "debug":
style_options = "-g"