@@ -36,6 +36,7 @@ extension XCTestCase {
36
36
let tests = self . allTests
37
37
var totalDuration = 0.0
38
38
var totalFailures = 0
39
+ var unexpectedFailures = 0
39
40
for (name, test) in tests {
40
41
XCTCurrentTestCase = self
41
42
let method = " \( self . dynamicType) . \( name) "
@@ -57,6 +58,9 @@ extension XCTestCase {
57
58
for failure in XCTCurrentFailures {
58
59
failure. emit ( method)
59
60
totalFailures++
61
+ if failure. expected == false {
62
+ unexpectedFailures++
63
+ }
60
64
}
61
65
var result = " passed "
62
66
if XCTCurrentFailures . count > 0 {
@@ -78,15 +82,15 @@ extension XCTestCase {
78
82
let averageDuration = totalDuration / Double( tests. count)
79
83
80
84
81
- print ( " Executed \( tests. count) test \( testCountSuffix) , with \( totalFailures) failure \( failureSuffix) (0 unexpected) in \( round ( averageDuration * 1000.0 ) / 1000.0 ) ( \( round ( totalDuration * 1000.0 ) / 1000.0 ) ) seconds " )
85
+ print ( " Executed \( tests. count) test \( testCountSuffix) , with \( totalFailures) failure \( failureSuffix) \( unexpectedFailures ) unexpected) in \( round ( averageDuration * 1000.0 ) / 1000.0 ) ( \( round ( totalDuration * 1000.0 ) / 1000.0 ) ) seconds " )
82
86
}
83
87
84
88
// This function is for the use of XCTestCase only, but we must make it public or clients will get a link failure when using XCTest (23476006)
85
- public func testFailure( message: String , file: StaticString , line: UInt ) {
89
+ public func testFailure( message: String , expected : Bool , file: StaticString , line: UInt ) {
86
90
if !continueAfterFailure {
87
91
assert ( false , message, file: file, line: line)
88
92
} else {
89
- XCTCurrentFailures . append ( XCTFailure ( message: message, file: file, line: line) )
93
+ XCTCurrentFailures . append ( XCTFailure ( message: message, expected : expected , file: file, line: line) )
90
94
}
91
95
}
92
96
0 commit comments