Skip to content

Commit

Permalink
Merge pull request Quick#372 from ikesyo/swiftpm-xctestobservation
Browse files Browse the repository at this point in the history
[SwiftPM] Add the `CurrentTestCaseTracker` instance to `XCTestObservationCenter` on macOS (Objective-C runtime)
  • Loading branch information
jeffh authored Nov 30, 2016
2 parents 0594748 + a3b391e commit cc51c84
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Sources/Nimble/Adapters/NimbleXCTestHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,16 @@ class NimbleXCTestUnavailableHandler : AssertionHandler {
}

#if _runtime(_ObjC)
/// Helper class providing access to the currently executing XCTestCase instance, if any

#if SWIFT_PACKAGE
extension XCTestObservationCenter {
override open class func initialize() {
self.shared().addTestObserver(CurrentTestCaseTracker.sharedInstance)
}
}
#endif

/// Helper class providing access to the currently executing XCTestCase instance, if any
@objc final internal class CurrentTestCaseTracker: NSObject, XCTestObservation {
@objc static let sharedInstance = CurrentTestCaseTracker()

Expand Down

0 comments on commit cc51c84

Please sign in to comment.