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 13
13
withKnownIssue {
14
14
reportIssue ( )
15
15
} matching: { issue in
16
- issue. description == " Expectation failed: "
16
+ issue. description == " Issue recorded "
17
17
}
18
18
}
19
19
20
20
@Test func reportIssue_CustomMessage( ) {
21
21
withKnownIssue {
22
22
reportIssue ( " Something went wrong " )
23
23
} matching: { issue in
24
- issue. description == " Expectation failed : Something went wrong"
24
+ issue. description == " Issue recorded : Something went wrong"
25
25
}
26
26
}
27
27
Original file line number Diff line number Diff line change @@ -251,7 +251,7 @@ public var XCTCurrentTestCase: AnyObject? {
251
251
}
252
252
253
253
@_disfavoredOverload
254
- @available ( * , deprecated , renamed: " unimplemented(_:placeholder:) " )
254
+ @available ( * , unavailable , renamed: " unimplemented(_:placeholder:) " )
255
255
public func unimplemented< Result> (
256
256
_ description: @autoclosure @escaping @Sendable ( ) -> String = " " ,
257
257
file filePath: StaticString = #filePath,
@@ -260,23 +260,10 @@ public func unimplemented<Result>(
260
260
line: UInt = #line,
261
261
column: UInt = #column
262
262
) -> 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 ( )
278
264
}
279
265
266
+ @_disfavoredOverload
280
267
@available ( * , deprecated, renamed: " unimplemented(_:placeholder:) " )
281
268
public func unimplemented< each Argument , Result> (
282
269
_ description: @autoclosure @escaping @Sendable ( ) -> String = " " ,
Original file line number Diff line number Diff line change 122
122
"""
123
123
}
124
124
}
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
+ }
125
154
}
126
155
#endif
Original file line number Diff line number Diff line change @@ -110,12 +110,11 @@ struct User { let id: UUID }
110
110
@available ( * , deprecated)
111
111
@MainActor let fm01 : @MainActor ( ) -> Int = unimplemented ( " fm01 " )
112
112
113
- @available ( * , deprecated)
114
113
private struct Autoclosing {
115
114
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 )
120
119
) async { }
121
120
}
You can’t perform that action at this time.
0 commit comments