Skip to content

React to changes coming in swift-corelibs-foundation #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Sources/XCTest/Public/XCTestCase+Asynchronous.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public extension XCTestCase {
// been fulfilled, it would be more efficient to use a runloop
// source that can be signaled to wake up when an expectation is
// fulfilled.
let runLoop = RunLoop.current()
let runLoop = RunLoop.current
let timeoutDate = Date(timeIntervalSinceNow: timeout)
repeat {
unfulfilledDescriptions = []
Expand Down Expand Up @@ -171,14 +171,14 @@ public extension XCTestCase {
var observer: NSObjectProtocol? = nil
func removeObserver() {
if let observer = observer as? AnyObject {
NotificationCenter.defaultCenter().removeObserver(observer)
NotificationCenter.default.removeObserver(observer)
}
}

weak var weakExpectation = expectation
observer = NotificationCenter
.defaultCenter()
.addObserverForName(Notification.Name(rawValue: notificationName),
.default
.addObserver(forName: Notification.Name(rawValue: notificationName),
object: objectToObserve,
queue: nil,
usingBlock: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class NotificationExpectationsTestCase: XCTestCase {
func test_observeNotificationWithName_passes() {
let notificationName = "notificationWithNameTest"
expectation(forNotification: notificationName, object:nil)
NotificationCenter.defaultCenter().postNotificationName(Notification.Name(rawValue: notificationName), object: nil)
NotificationCenter.default.postNotificationName(Notification.Name(rawValue: notificationName), object: nil)
waitForExpectations(timeout: 0.0)
}

Expand All @@ -31,7 +31,7 @@ class NotificationExpectationsTestCase: XCTestCase {
let notificationName = "notificationWithNameAndObjectTest"
let dummyObject = NSObject()
expectation(forNotification: notificationName, object:dummyObject)
NotificationCenter.defaultCenter().postNotificationName(Notification.Name(rawValue: notificationName), object: dummyObject)
NotificationCenter.default.postNotificationName(Notification.Name(rawValue: notificationName), object: dummyObject)
waitForExpectations(timeout: 0.0)
}

Expand All @@ -41,7 +41,7 @@ class NotificationExpectationsTestCase: XCTestCase {
let notificationName = "notificationWithNameAndObject_expectNoObjectTest"
expectation(forNotification: notificationName, object:nil)
let dummyObject = NSObject()
NotificationCenter.defaultCenter().postNotificationName(Notification.Name(rawValue: notificationName), object: dummyObject)
NotificationCenter.default.postNotificationName(Notification.Name(rawValue: notificationName), object: dummyObject)
waitForExpectations(timeout: 0.0)
}

Expand All @@ -50,7 +50,7 @@ class NotificationExpectationsTestCase: XCTestCase {
// CHECK: Test Case 'NotificationExpectationsTestCase.test_observeNotificationWithIncorrectName_fails' failed \(\d+\.\d+ seconds\).
func test_observeNotificationWithIncorrectName_fails() {
expectation(forNotification: "expectedName", object: nil)
NotificationCenter.defaultCenter().postNotificationName(Notification.Name(rawValue: "actualName"), object: nil)
NotificationCenter.default.postNotificationName(Notification.Name(rawValue: "actualName"), object: nil)
waitForExpectations(timeout: 0.1)
}

Expand All @@ -62,7 +62,7 @@ class NotificationExpectationsTestCase: XCTestCase {
let dummyObject: NSString = "dummyObject"
let anotherDummyObject = NSObject()
expectation(forNotification: notificationName, object: dummyObject)
NotificationCenter.defaultCenter().postNotificationName(Notification.Name(rawValue: notificationName), object:anotherDummyObject)
NotificationCenter.default.postNotificationName(Notification.Name(rawValue: notificationName), object:anotherDummyObject)
waitForExpectations(timeout: 0.1)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class NotificationHandlerTestCase: XCTestCase {
notification in
return false
})
NotificationCenter.defaultCenter().postNotificationName(Notification.Name(rawValue: "returnFalse"), object: nil)
NotificationCenter.default.postNotificationName(Notification.Name(rawValue: "returnFalse"), object: nil)
waitForExpectations(timeout: 0.1)
}

Expand All @@ -34,7 +34,7 @@ class NotificationHandlerTestCase: XCTestCase {
notification in
return true
})
NotificationCenter.defaultCenter().postNotificationName(Notification.Name(rawValue: "returnTrue"), object: nil)
NotificationCenter.default.postNotificationName(Notification.Name(rawValue: "returnTrue"), object: nil)
waitForExpectations(timeout: 0.1)
}

Expand All @@ -47,7 +47,7 @@ class NotificationHandlerTestCase: XCTestCase {
return true
})
waitForExpectations(timeout: 0.1, handler: nil)
NotificationCenter.defaultCenter().postNotificationName(Notification.Name(rawValue: "note"), object: nil)
NotificationCenter.default.postNotificationName(Notification.Name(rawValue: "note"), object: nil)
}

static var allTests = {
Expand Down