@@ -33,16 +33,29 @@ class NotificationHandlerTestCase: XCTestCase {
33
33
NSNotificationCenter . defaultCenter ( ) . postNotificationName ( " returnTrue " , object: nil )
34
34
waitForExpectationsWithTimeout ( 0.1 , handler: nil )
35
35
}
36
+
37
+ // CHECK: Test Case 'NotificationHandlerTestCase.test_notificationNameIsObservedAfterTimeout_handlerIsNotCalled' started.
38
+ // CHECK: .*/Tests/Functional/Asynchronous/Notifications/Handler/main.swift:\d+: error: NotificationHandlerTestCase.test_notificationNameIsObservedAfterTimeout_handlerIsNotCalled : Asynchronous wait failed - Exceeded timeout of 0.1 seconds, with unfulfilled expectations: Expect notification 'note' from any object
39
+ // CHECK: Test Case 'NotificationHandlerTestCase.test_notificationNameIsObservedAfterTimeout_handlerIsNotCalled' failed \(\d+\.\d+ seconds\).
40
+ func test_notificationNameIsObservedAfterTimeout_handlerIsNotCalled( ) {
41
+ expectationForNotification ( " note " , object: nil , handler: { _ in
42
+ XCTFail ( " Should not call the notification expectation handler " )
43
+ return true
44
+ } )
45
+ waitForExpectationsWithTimeout ( 0.1 , handler: nil )
46
+ NSNotificationCenter . defaultCenter ( ) . postNotificationName ( " note " , object: nil )
47
+ }
36
48
37
49
static var allTests : [ ( String , NotificationHandlerTestCase -> ( ) throws -> Void ) ] {
38
50
return [
39
51
( " test_notificationNameIsObserved_handlerReturnsFalse_andFails " , test_notificationNameIsObserved_handlerReturnsFalse_andFails) ,
40
52
( " test_notificationNameIsObserved_handlerReturnsTrue_andPasses " , test_notificationNameIsObserved_handlerReturnsTrue_andPasses) ,
53
+ ( " test_notificationNameIsObservedAfterTimeout_handlerIsNotCalled " , test_notificationNameIsObservedAfterTimeout_handlerIsNotCalled) ,
41
54
]
42
55
}
43
56
}
44
57
45
58
XCTMain ( [ testCase ( NotificationHandlerTestCase . allTests) ] )
46
59
47
- // CHECK: Executed 2 tests, with 1 failure \(0 unexpected\) in \d+\.\d+ \(\d+\.\d+\) seconds
48
- // CHECK: Total executed 2 tests, with 1 failure \(0 unexpected\) in \d+\.\d+ \(\d+\.\d+\) seconds
60
+ // CHECK: Executed 3 tests, with 2 failures \(0 unexpected\) in \d+\.\d+ \(\d+\.\d+\) seconds
61
+ // CHECK: Total executed 3 tests, with 2 failures \(0 unexpected\) in \d+\.\d+ \(\d+\.\d+\) seconds
0 commit comments