File tree Expand file tree Collapse file tree 4 files changed +38
-23
lines changed
Sources/XCTestDynamicOverlay/Internal
XCTestDynamicOverlayTests Expand file tree Collapse file tree 4 files changed +38
-23
lines changed Original file line number Diff line number Diff line change 1313 withKnownIssue {
1414 reportIssue ( )
1515 } matching: { issue in
16- issue. description == " Expectation failed: "
16+ issue. description == " Issue recorded "
1717 }
1818 }
1919
2020 @Test func reportIssue_CustomMessage( ) {
2121 withKnownIssue {
2222 reportIssue ( " Something went wrong " )
2323 } matching: { issue in
24- issue. description == " Expectation failed : Something went wrong"
24+ issue. description == " Issue recorded : Something went wrong"
2525 }
2626 }
2727
Original file line number Diff line number Diff line change @@ -251,7 +251,7 @@ public var XCTCurrentTestCase: AnyObject? {
251251}
252252
253253@_disfavoredOverload
254- @available ( * , deprecated , renamed: " unimplemented(_:placeholder:) " )
254+ @available ( * , unavailable , renamed: " unimplemented(_:placeholder:) " )
255255public func unimplemented< Result> (
256256 _ description: @autoclosure @escaping @Sendable ( ) -> String = " " ,
257257 file filePath: StaticString = #filePath,
@@ -260,23 +260,10 @@ public func unimplemented<Result>(
260260 line: UInt = #line,
261261 column: UInt = #column
262262) -> Result {
263- let description = description ( )
264- _fail (
265- description,
266- nil ,
267- fileID: fileID,
268- filePath: filePath,
269- function: function,
270- line: line,
271- column: column
272- )
273- do {
274- return try _generatePlaceholder ( )
275- } catch {
276- _unimplementedFatalError ( description, file: filePath, line: line)
277- }
263+ fatalError ( )
278264}
279265
266+ @_disfavoredOverload
280267@available ( * , deprecated, renamed: " unimplemented(_:placeholder:) " )
281268public func unimplemented< each Argument , Result> (
282269 _ description: @autoclosure @escaping @Sendable ( ) -> String = " " ,
Original file line number Diff line number Diff line change 122122 """
123123 }
124124 }
125+
126+ @MainActor
127+ @Test func mainActor( ) throws {
128+ final class Model : Sendable {
129+ let line = #line + 1
130+ let callback : @Sendable @MainActor ( ) throws -> Void = IssueReporting . unimplemented ( )
131+ }
132+
133+ let model = Model ( )
134+ try withKnownIssue {
135+ try withKnownIssue {
136+ _ = try model. callback ( )
137+ } matching: { issue in
138+ issue. description == """
139+ Issue recorded: Unimplemented …
140+
141+ Defined in 'Model' at:
142+ IssueReportingTests/UnimplementedTests.swift: \( model. line)
143+
144+ Invoked with:
145+ ()
146+ """
147+ }
148+ } matching: { issue in
149+ issue. description == """
150+ Caught error: UnimplementedFailure(description: " " )
151+ """
152+ }
153+ }
125154 }
126155#endif
Original file line number Diff line number Diff line change @@ -110,12 +110,11 @@ struct User { let id: UUID }
110110@available ( * , deprecated)
111111@MainActor let fm01 : @MainActor ( ) -> Int = unimplemented ( " fm01 " )
112112
113- @available ( * , deprecated)
114113private struct Autoclosing {
115114 init (
116- _: @autoclosure ( ) -> Int = unimplemented ( ) ,
117- _: @autoclosure ( ) async -> Int = unimplemented ( ) ,
118- _: @autoclosure ( ) throws -> Int = unimplemented ( ) ,
119- _: @autoclosure ( ) async throws -> Int = unimplemented ( )
115+ _: @autoclosure ( ) -> Int = unimplemented ( placeholder : 0 ) ,
116+ _: @autoclosure ( ) async -> Int = unimplemented ( placeholder : 0 ) ,
117+ _: @autoclosure ( ) throws -> Int = unimplemented ( placeholder : 0 ) ,
118+ _: @autoclosure ( ) async throws -> Int = unimplemented ( placeholder : 0 )
120119 ) async { }
121120}
You can’t perform that action at this time.
0 commit comments