Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression: don't fatalError eagerly when calling deprecated unimplemented endpoints #114

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Sources/XCTestDynamicOverlay/Internal/Deprecations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ public func unimplemented<Result>(
}
}

@_disfavoredOverload
@available(*, deprecated, renamed: "unimplemented(_:placeholder:)")
public func unimplemented<each Argument, Result>(
_ description: @autoclosure @escaping @Sendable () -> String = "",
Expand Down
6 changes: 6 additions & 0 deletions Tests/XCTestDynamicOverlayTests/TestHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ struct User { let id: UUID }
@MainActor let f05: (String, Int, Double, [Int], User) -> Int = unimplemented(
"f05", placeholder: 42)

@available(*, deprecated)
@MainActor let fm00: () -> Int = unimplemented("fm00")

@available(*, deprecated)
@MainActor let fm01: @MainActor () -> Int = unimplemented("fm01")

@available(*, deprecated)
private struct Autoclosing {
init(
Expand Down
8 changes: 8 additions & 0 deletions Tests/XCTestDynamicOverlayTests/UnimplementedTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
import XCTest

final class UnimplementedTests: XCTestCase {

@available(*, deprecated)
@MainActor
func testXCTReferencingUnimplementedClosureDoesNotEvaluateIt() async throws {
_ = fm00
_ = fm01
}

func testXCTFailShouldFail() async throws {
_ = XCTExpectFailure {
f00()
Expand Down