func recordFailure()

in Sources/XCTest/Public/XCTestRun.swift [129:152]


    func recordFailure(withDescription description: String, inFile filePath: String?, atLine lineNumber: Int, expected: Bool) {
        func failureLocation() -> String {
            if let filePath = filePath {
                return "\(test.name) (\(filePath):\(lineNumber))"
            } else {
                return "\(test.name)"
            }
        }

        guard isStarted else {
            fatalError("Invalid attempt to record a failure for a test run " +
                       "that has not yet been started: \(failureLocation())")
        }
        guard !isStopped else {
            fatalError("Invalid attempt to record a failure for a test run " +
                       "that has already been stopped: \(failureLocation())")
        }

        if expected {
            failureCount += 1
        } else {
            unexpectedExceptionCount += 1
        }
    }