@@ -16,6 +16,8 @@ class ErrorHandling: XCTestCase {
16
16
static var allTests = {
17
17
return [
18
18
// Tests for XCTAssertThrowsError
19
+ ( " test_shouldRethrowErrorFromHandler " , test_shouldRethrowErrorFromHandler) ,
20
+ ( " test_shouldNotRethrowWhenHandlerDoesNotThrow " , test_shouldNotRethrowWhenHandlerDoesNotThrow) ,
19
21
( " test_shouldButDoesNotThrowErrorInAssertion " , test_shouldButDoesNotThrowErrorInAssertion) ,
20
22
( " test_shouldThrowErrorInAssertion " , test_shouldThrowErrorInAssertion) ,
21
23
( " test_throwsErrorInAssertionButFailsWhenCheckingError " , test_throwsErrorInAssertionButFailsWhenCheckingError) ,
@@ -59,6 +61,19 @@ class ErrorHandling: XCTestCase {
59
61
throw SomeError . anError ( " an error message " )
60
62
}
61
63
64
+ // CHECK: Test Case 'ErrorHandling.test_shouldRethrowErrorFromHandler' started at \d+-\d+-\d+ \d+:\d+:\d+\.\d+
65
+ // CHECK: .*[/\\]ErrorHandling[/\\]main.swift:[[@LINE+3]]: error: ErrorHandling.test_shouldRethrowErrorFromHandler : XCTAssertThrowsError threw error "anError\("an error message"\)" -
66
+ // CHECK: Test Case 'ErrorHandling.test_shouldRethrowErrorFromHandler' failed \(\d+\.\d+ seconds\)
67
+ func test_shouldRethrowErrorFromHandler( ) throws {
68
+ try XCTAssertThrowsError ( try functionThatDoesThrowError ( ) ) { _ in try functionThatDoesThrowError ( ) }
69
+ }
70
+
71
+ // CHECK: Test Case 'ErrorHandling.test_shouldNotRethrowWhenHandlerDoesNotThrow' started at \d+-\d+-\d+ \d+:\d+:\d+\.\d+
72
+ // CHECK: Test Case 'ErrorHandling.test_shouldNotRethrowWhenHandlerDoesNotThrow' passed \(\d+\.\d+ seconds\)
73
+ func test_shouldNotRethrowWhenHandlerDoesNotThrow( ) throws {
74
+ try XCTAssertThrowsError ( try functionThatDoesThrowError ( ) ) { _ in try functionThatDoesNotThrowError ( ) }
75
+ }
76
+
62
77
// CHECK: Test Case 'ErrorHandling.test_shouldButDoesNotThrowErrorInAssertion' started at \d+-\d+-\d+ \d+:\d+:\d+\.\d+
63
78
// CHECK: .*[/\\]ErrorHandling[/\\]main.swift:[[@LINE+3]]: error: ErrorHandling.test_shouldButDoesNotThrowErrorInAssertion : XCTAssertThrowsError failed: did not throw error -
64
79
// CHECK: Test Case 'ErrorHandling.test_shouldButDoesNotThrowErrorInAssertion' failed \(\d+\.\d+ seconds\)
@@ -278,11 +293,11 @@ class ErrorHandling: XCTestCase {
278
293
}
279
294
280
295
// CHECK: Test Suite 'ErrorHandling' failed at \d+-\d+-\d+ \d+:\d+:\d+\.\d+
281
- // CHECK: \t Executed \d+ tests, with \d+ failures \(5 unexpected\) in \d+\.\d+ \(\d+\.\d+\) seconds
296
+ // CHECK: \t Executed \d+ tests, with \d+ failures \(6 unexpected\) in \d+\.\d+ \(\d+\.\d+\) seconds
282
297
283
298
XCTMain ( [ testCase ( ErrorHandling . allTests) ] )
284
299
285
300
// CHECK: Test Suite '.*\.xctest' failed at \d+-\d+-\d+ \d+:\d+:\d+\.\d+
286
- // CHECK: \t Executed \d+ tests, with \d+ failures \(5 unexpected\) in \d+\.\d+ \(\d+\.\d+\) seconds
301
+ // CHECK: \t Executed \d+ tests, with \d+ failures \(6 unexpected\) in \d+\.\d+ \(\d+\.\d+\) seconds
287
302
// CHECK: Test Suite 'All tests' failed at \d+-\d+-\d+ \d+:\d+:\d+\.\d+
288
- // CHECK: \t Executed \d+ tests, with \d+ failures \(5 unexpected\) in \d+\.\d+ \(\d+\.\d+\) seconds
303
+ // CHECK: \t Executed \d+ tests, with \d+ failures \(6 unexpected\) in \d+\.\d+ \(\d+\.\d+\) seconds
0 commit comments