Skip to content

Commit a4c2b6d

Browse files
Fix regression: don't fatalError eagerly when calling deprecated unimplemented endpoints (#114)
* Added test for referencing unimplemented closures without placeholders. * Fix test --------- Co-authored-by: Stephen Celis <[email protected]>
1 parent 0b9e076 commit a4c2b6d

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

Sources/XCTestDynamicOverlay/Internal/Deprecations.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,6 @@ public func unimplemented<Result>(
277277
}
278278
}
279279

280-
@_disfavoredOverload
281280
@available(*, deprecated, renamed: "unimplemented(_:placeholder:)")
282281
public func unimplemented<each Argument, Result>(
283282
_ description: @autoclosure @escaping @Sendable () -> String = "",

Tests/XCTestDynamicOverlayTests/TestHelpers.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ struct User { let id: UUID }
104104
@MainActor let f05: (String, Int, Double, [Int], User) -> Int = unimplemented(
105105
"f05", placeholder: 42)
106106

107+
@available(*, deprecated)
108+
@MainActor let fm00: () -> Int = unimplemented("fm00")
109+
110+
@available(*, deprecated)
111+
@MainActor let fm01: @MainActor () -> Int = unimplemented("fm01")
112+
107113
@available(*, deprecated)
108114
private struct Autoclosing {
109115
init(

Tests/XCTestDynamicOverlayTests/UnimplementedTests.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
import XCTest
33

44
final class UnimplementedTests: XCTestCase {
5+
6+
@available(*, deprecated)
7+
@MainActor
8+
func testXCTReferencingUnimplementedClosureDoesNotEvaluateIt() async throws {
9+
_ = fm00
10+
_ = fm01
11+
}
12+
513
func testXCTFailShouldFail() async throws {
614
_ = XCTExpectFailure {
715
f00()

0 commit comments

Comments
 (0)