Skip to content

Xcode12 support#40

Closed
kenmaz wants to merge 1 commit intokylef:masterfrom
kenmaz:master
Closed

Xcode12 support#40
kenmaz wants to merge 1 commit intokylef:masterfrom
kenmaz:master

Conversation

@kenmaz
Copy link
Copy Markdown

@kenmaz kenmaz commented Jul 4, 2020

XCTestCase.recordFailure(..) method has been deprecated on Xcode12+ and it will cause compile error on Xcode12.

スクリーンショット 2020-07-05 0 41 33

To avoid that, added @available block.
In the future, XCTestCase. recordFailure(..) should be replaced with new API, XCTestCase.record(_:).

Video
https://developer.apple.com/videos/play/wwdc2020/10687/
Document
https://developer.apple.com/documentation/xctest/xctestcase/3546549-record

@amine2233
Copy link
Copy Markdown

you can use this code instead of just checking if you are on macosx 10.13

if #available(OSX 10.13, *) {
        testCase.recordFailure(withDescription: "\(name): \(failure.reason)", inFile: failure.file, atLine: failure.line, expected: false)
    } else {
        let location = XCTSourceCodeLocation(filePath: failure.file, lineNumber: failure.line)
        let issue = XCTIssue(type: .assertionFailure, compactDescription: "\(name): \(failure.reason)", detailedDescription: nil, sourceCodeContext: .init(location: location), associatedError: nil, attachments: [])
        testCase.record(issue)
    }

@amine2233
Copy link
Copy Markdown

please it's very important to merge this pr and create a new release, because some project needed to run on Xcode 12 and on macOS Big Sur like XcodeGen

@aaronbrethorst
Copy link
Copy Markdown

Hey @kylef - any word?

@kylef
Copy link
Copy Markdown
Owner

kylef commented Aug 9, 2020

These changes would render Spectre test failures as successes with the Xcode reporter in many cases. This change won't be accepted in its current state, this must be fixed before this change can be considered.

@kylef kylef closed this in ca16256 Aug 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants