Files
nixpkgs/pkgs/by-name/xc/xcodegen/0001-spectre-xct-record.patch

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
1.7 KiB
Diff
Raw Permalink Normal View History

2025-10-09 14:15:47 +02:00
diff --git a/Sources/Spectre/XCTest.swift b/Sources/Spectre/XCTest.swift
index 3704436..e759f14 100644
--- a/Sources/Spectre/XCTest.swift
+++ b/Sources/Spectre/XCTest.swift
@@ -31,28 +31,6 @@ class XcodeReporter: ContextReporter {
func addDisabled(_ name: String) {}
func addFailure(_ name: String, failure: FailureType) {
- // Xcode 12 removed `recordFailure` and replaced with `record(_:)`
- #if swift(>=4.2)
- // The `compiler` statement was added in swift 4.2, so it needs to be in a separate statement to retain
- // compatibility with 4.x.
- #if compiler(>=5.3) && os(macOS)
- let location = XCTSourceCodeLocation(filePath: failure.file, lineNumber: failure.line)
- #if Xcode
- // As of Xcode 12.0.1, XCTIssue is unavailable even though it is documented:
- // https://developer.apple.com/documentation/xctest/xctissue
- // When building with `swift build`, it is available. Perhaps the xctest overlay behaves differently between the two.
- let issue = XCTIssueReference(type: .assertionFailure, compactDescription: "\(name): \(failure.reason)", detailedDescription: nil, sourceCodeContext: .init(location: location), associatedError: nil, attachments: [])
- #else
- let issue = XCTIssue(type: .assertionFailure, compactDescription: "\(name): \(failure.reason)", detailedDescription: nil, sourceCodeContext: .init(location: location), associatedError: nil, attachments: [])
- #endif
- #if compiler(>=5.4)
- testCase.record(issue as XCTIssue)
- #else
- testCase.record(issue)
- #endif
- #else
testCase.recordFailure(withDescription: "\(name): \(failure.reason)", inFile: failure.file, atLine: failure.line, expected: false)
- #endif
- #endif
}
}
\ No newline at end of file