@@ -3,78 +3,78 @@ import Dispatch
33#endif
44
55/// Make an ``AsyncExpectation`` on a given actual value. The value given is lazily evaluated.
6- public func expect< T: Sendable > ( fileID : String = #fileID , file : FileString = #filePath , line : UInt = #line , column : UInt = #column , _ expression: @escaping @Sendable ( ) async throws -> T ? ) -> AsyncExpectation < T > {
6+ public func expect< T: Sendable > ( location : SourceLocation = SourceLocation ( ) , _ expression: @escaping @Sendable ( ) async throws -> T ? ) -> AsyncExpectation < T > {
77 return AsyncExpectation (
88 expression: AsyncExpression (
99 expression: expression,
10- location: SourceLocation ( fileID : fileID , filePath : file , line : line , column : column ) ,
10+ location: location ,
1111 isClosure: true ) )
1212}
1313
1414/// Make an ``AsyncExpectation`` on a given actual value. The closure is lazily invoked.
15- public func expect< T: Sendable > ( fileID : String = #fileID , file : FileString = #filePath , line : UInt = #line , column : UInt = #column , _ expression: @Sendable ( ) -> ( @Sendable ( ) async throws -> T ) ) -> AsyncExpectation < T > {
15+ public func expect< T: Sendable > ( location : SourceLocation = SourceLocation ( ) , _ expression: @Sendable ( ) -> ( @Sendable ( ) async throws -> T ) ) -> AsyncExpectation < T > {
1616 return AsyncExpectation (
1717 expression: AsyncExpression (
1818 expression: expression ( ) ,
19- location: SourceLocation ( fileID : fileID , filePath : file , line : line , column : column ) ,
19+ location: location ,
2020 isClosure: true ) )
2121}
2222
2323/// Make an ``AsyncExpectation`` on a given actual value. The closure is lazily invoked.
24- public func expect< T: Sendable > ( fileID : String = #fileID , file : FileString = #filePath , line : UInt = #line , column : UInt = #column , _ expression: @Sendable ( ) -> ( @Sendable ( ) async throws -> T ? ) ) -> AsyncExpectation < T > {
24+ public func expect< T: Sendable > ( location : SourceLocation = SourceLocation ( ) , _ expression: @Sendable ( ) -> ( @Sendable ( ) async throws -> T ? ) ) -> AsyncExpectation < T > {
2525 return AsyncExpectation (
2626 expression: AsyncExpression (
2727 expression: expression ( ) ,
28- location: SourceLocation ( fileID : fileID , filePath : file , line : line , column : column ) ,
28+ location: location ,
2929 isClosure: true ) )
3030}
3131
3232/// Make an ``AsyncExpectation`` on a given actual value. The closure is lazily invoked.
33- public func expect( fileID : String = #fileID , file : FileString = #filePath , line : UInt = #line , column : UInt = #column , _ expression: @Sendable ( ) -> ( @Sendable ( ) async throws -> Void ) ) -> AsyncExpectation < Void > {
33+ public func expect( location : SourceLocation = SourceLocation ( ) , _ expression: @Sendable ( ) -> ( @Sendable ( ) async throws -> Void ) ) -> AsyncExpectation < Void > {
3434 return AsyncExpectation (
3535 expression: AsyncExpression (
3636 expression: expression ( ) ,
37- location: SourceLocation ( fileID : fileID , filePath : file , line : line , column : column ) ,
37+ location: location ,
3838 isClosure: true ) )
3939}
4040
4141/// Make an ``AsyncExpectation`` on a given actual value. The value given is lazily evaluated.
4242/// This is provided to avoid confusion between `expect -> SyncExpectation` and `expect -> AsyncExpectation`.
43- public func expecta< T: Sendable > ( fileID : String = #fileID , file : FileString = #filePath , line : UInt = #line , column : UInt = #column , _ expression: @autoclosure @escaping @Sendable ( ) async throws -> T ? ) async -> AsyncExpectation < T > {
43+ public func expecta< T: Sendable > ( location : SourceLocation = SourceLocation ( ) , _ expression: @autoclosure @escaping @Sendable ( ) async throws -> T ? ) async -> AsyncExpectation < T > {
4444 return AsyncExpectation (
4545 expression: AsyncExpression (
4646 expression: expression,
47- location: SourceLocation ( fileID : fileID , filePath : file , line : line , column : column ) ,
47+ location: location ,
4848 isClosure: true ) )
4949}
5050
5151/// Make an ``AsyncExpectation`` on a given actual value. The closure is lazily invoked.
5252/// This is provided to avoid confusion between `expect -> SyncExpectation` and `expect -> AsyncExpectation`
53- public func expecta< T: Sendable > ( fileID : String = #fileID , file : FileString = #filePath , line : UInt = #line , column : UInt = #column , _ expression: @autoclosure @Sendable ( ) -> ( @Sendable ( ) async throws -> T ) ) async -> AsyncExpectation < T > {
53+ public func expecta< T: Sendable > ( location : SourceLocation = SourceLocation ( ) , _ expression: @autoclosure @Sendable ( ) -> ( @Sendable ( ) async throws -> T ) ) async -> AsyncExpectation < T > {
5454 return AsyncExpectation (
5555 expression: AsyncExpression (
5656 expression: expression ( ) ,
57- location: SourceLocation ( fileID : fileID , filePath : file , line : line , column : column ) ,
57+ location: location ,
5858 isClosure: true ) )
5959}
6060
6161/// Make an ``AsyncExpectation`` on a given actual value. The closure is lazily invoked.
6262/// This is provided to avoid confusion between `expect -> SyncExpectation` and `expect -> AsyncExpectation`
63- public func expecta< T: Sendable > ( fileID : String = #fileID , file : FileString = #filePath , line : UInt = #line , column : UInt = #column , _ expression: @autoclosure @Sendable ( ) -> ( @Sendable ( ) async throws -> T ? ) ) async -> AsyncExpectation < T > {
63+ public func expecta< T: Sendable > ( location : SourceLocation = SourceLocation ( ) , _ expression: @autoclosure @Sendable ( ) -> ( @Sendable ( ) async throws -> T ? ) ) async -> AsyncExpectation < T > {
6464 return AsyncExpectation (
6565 expression: AsyncExpression (
6666 expression: expression ( ) ,
67- location: SourceLocation ( fileID : fileID , filePath : file , line : line , column : column ) ,
67+ location: location ,
6868 isClosure: true ) )
6969}
7070
7171/// Make an ``AsyncExpectation`` on a given actual value. The closure is lazily invoked.
7272/// This is provided to avoid confusion between `expect -> SyncExpectation` and `expect -> AsyncExpectation`
73- public func expecta( fileID : String = #fileID , file : FileString = #filePath , line : UInt = #line , column : UInt = #column , _ expression: @autoclosure @Sendable ( ) -> ( @Sendable ( ) async throws -> Void ) ) async -> AsyncExpectation < Void > {
73+ public func expecta( location : SourceLocation = SourceLocation ( ) , _ expression: @autoclosure @Sendable ( ) -> ( @Sendable ( ) async throws -> Void ) ) async -> AsyncExpectation < Void > {
7474 return AsyncExpectation (
7575 expression: AsyncExpression (
7676 expression: expression ( ) ,
77- location: SourceLocation ( fileID : fileID , filePath : file , line : line , column : column ) ,
77+ location: location ,
7878 isClosure: true ) )
7979}
8080
@@ -89,15 +89,12 @@ public func expecta(fileID: String = #fileID, file: FileString = #filePath, line
8989/// Unlike the synchronous version of this call, this does not support catching Objective-C exceptions.
9090public func waitUntil(
9191 timeout: NimbleTimeInterval = PollingDefaults . timeout,
92- fileID: String = #fileID,
93- file: FileString = #filePath,
94- line: UInt = #line,
95- column: UInt = #column,
92+ location: SourceLocation = SourceLocation ( ) ,
9693 action: @escaping @Sendable ( @escaping @Sendable ( ) -> Void ) async -> Void
9794) async {
9895 await throwableUntil (
9996 timeout: timeout,
100- sourceLocation: SourceLocation ( fileID : fileID , filePath : file , line : line , column : column )
97+ sourceLocation: location
10198 ) { done in
10299 await action ( done)
103100 }
@@ -112,15 +109,12 @@ public func waitUntil(
112109/// Unlike the synchronous version of this call, this does not support catching Objective-C exceptions.
113110public func waitUntil(
114111 timeout: NimbleTimeInterval = PollingDefaults . timeout,
115- fileID: String = #fileID,
116- file: FileString = #filePath,
117- line: UInt = #line,
118- column: UInt = #column,
112+ location: SourceLocation = SourceLocation ( ) ,
119113 action: @escaping @Sendable ( @escaping @Sendable ( ) -> Void ) -> Void
120114) async {
121115 await throwableUntil (
122116 timeout: timeout,
123- sourceLocation: SourceLocation ( fileID : fileID , filePath : file , line : line , column : column )
117+ sourceLocation: location
124118 ) { done in
125119 action ( done)
126120 }
@@ -154,34 +148,22 @@ private func throwableUntil(
154148 case . blockedRunLoop:
155149 fail (
156150 blockedRunLoopErrorMessageFor ( " -waitUntil() " , leeway: leeway) ,
157- fileID: sourceLocation. fileID,
158- file: sourceLocation. filePath,
159- line: sourceLocation. line,
160- column: sourceLocation. column
151+ location: sourceLocation
161152 )
162153 case . timedOut:
163154 fail (
164155 " Waited more than \( timeout. description) " ,
165- fileID: sourceLocation. fileID,
166- file: sourceLocation. filePath,
167- line: sourceLocation. line,
168- column: sourceLocation. column
156+ location: sourceLocation
169157 )
170158 case let . errorThrown( error) :
171159 fail (
172160 " Unexpected error thrown: \( error) " ,
173- fileID: sourceLocation. fileID,
174- file: sourceLocation. filePath,
175- line: sourceLocation. line,
176- column: sourceLocation. column
161+ location: sourceLocation
177162 )
178163 case . completed( . error( let error) ) :
179164 fail (
180165 " Unexpected error thrown: \( error) " ,
181- fileID: sourceLocation. fileID,
182- file: sourceLocation. filePath,
183- line: sourceLocation. line,
184- column: sourceLocation. column
166+ location: sourceLocation
185167 )
186168 case . completed( . none) : // success
187169 break
0 commit comments