From 889d29e2621e854959e7106797d5cc637dfdd2ab Mon Sep 17 00:00:00 2001 From: Grigory Entin Date: Wed, 14 Aug 2024 14:36:47 +0200 Subject: [PATCH 1/2] Added test for referencing unimplemented closures without placeholders. --- Tests/XCTestDynamicOverlayTests/TestHelpers.swift | 3 +++ Tests/XCTestDynamicOverlayTests/UnimplementedTests.swift | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/Tests/XCTestDynamicOverlayTests/TestHelpers.swift b/Tests/XCTestDynamicOverlayTests/TestHelpers.swift index ea9f1ee7..10379545 100644 --- a/Tests/XCTestDynamicOverlayTests/TestHelpers.swift +++ b/Tests/XCTestDynamicOverlayTests/TestHelpers.swift @@ -104,6 +104,9 @@ struct User { let id: UUID } @MainActor let f05: (String, Int, Double, [Int], User) -> Int = unimplemented( "f05", placeholder: 42) +let fm00: () -> Int = unimplemented("fm00") +let fm01: @MainActor () -> Int = unimplemented("fm01") + @available(*, deprecated) private struct Autoclosing { init( diff --git a/Tests/XCTestDynamicOverlayTests/UnimplementedTests.swift b/Tests/XCTestDynamicOverlayTests/UnimplementedTests.swift index 4916f2ef..59646a42 100644 --- a/Tests/XCTestDynamicOverlayTests/UnimplementedTests.swift +++ b/Tests/XCTestDynamicOverlayTests/UnimplementedTests.swift @@ -2,6 +2,12 @@ import XCTest final class UnimplementedTests: XCTestCase { + + func testXCTReferencingUnimplementedClosureDoesNotEvaluateIt() async throws { + _ = fm00; + _ = fm01; + } + func testXCTFailShouldFail() async throws { _ = XCTExpectFailure { f00() From fd8d72c2a214955a86b728a65359e25d4eaec5c5 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Wed, 14 Aug 2024 08:55:27 -0700 Subject: [PATCH 2/2] Fix test --- Sources/XCTestDynamicOverlay/Internal/Deprecations.swift | 1 - Tests/XCTestDynamicOverlayTests/TestHelpers.swift | 7 +++++-- Tests/XCTestDynamicOverlayTests/UnimplementedTests.swift | 8 +++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Sources/XCTestDynamicOverlay/Internal/Deprecations.swift b/Sources/XCTestDynamicOverlay/Internal/Deprecations.swift index 965df0bc..3b46ed60 100644 --- a/Sources/XCTestDynamicOverlay/Internal/Deprecations.swift +++ b/Sources/XCTestDynamicOverlay/Internal/Deprecations.swift @@ -277,7 +277,6 @@ public func unimplemented( } } -@_disfavoredOverload @available(*, deprecated, renamed: "unimplemented(_:placeholder:)") public func unimplemented( _ description: @autoclosure @escaping @Sendable () -> String = "", diff --git a/Tests/XCTestDynamicOverlayTests/TestHelpers.swift b/Tests/XCTestDynamicOverlayTests/TestHelpers.swift index 10379545..730c978e 100644 --- a/Tests/XCTestDynamicOverlayTests/TestHelpers.swift +++ b/Tests/XCTestDynamicOverlayTests/TestHelpers.swift @@ -104,8 +104,11 @@ struct User { let id: UUID } @MainActor let f05: (String, Int, Double, [Int], User) -> Int = unimplemented( "f05", placeholder: 42) -let fm00: () -> Int = unimplemented("fm00") -let fm01: @MainActor () -> Int = unimplemented("fm01") +@available(*, deprecated) +@MainActor let fm00: () -> Int = unimplemented("fm00") + +@available(*, deprecated) +@MainActor let fm01: @MainActor () -> Int = unimplemented("fm01") @available(*, deprecated) private struct Autoclosing { diff --git a/Tests/XCTestDynamicOverlayTests/UnimplementedTests.swift b/Tests/XCTestDynamicOverlayTests/UnimplementedTests.swift index 59646a42..60972641 100644 --- a/Tests/XCTestDynamicOverlayTests/UnimplementedTests.swift +++ b/Tests/XCTestDynamicOverlayTests/UnimplementedTests.swift @@ -2,10 +2,12 @@ import XCTest final class UnimplementedTests: XCTestCase { - + + @available(*, deprecated) + @MainActor func testXCTReferencingUnimplementedClosureDoesNotEvaluateIt() async throws { - _ = fm00; - _ = fm01; + _ = fm00 + _ = fm01 } func testXCTFailShouldFail() async throws {