Skip to content

Commit 978a39a

Browse files
committed
WIP
1 parent 2154187 commit 978a39a

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

Tests/Tests/TestUtils.swift

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,13 @@ enum TestUtils {
4747
func introspection<Entity: AnyObject & Sendable>(
4848
of type: Entity.Type,
4949
timeout: TimeInterval = 3,
50+
sourceLocation: SourceLocation = #_sourceLocation,
5051
@ViewBuilder view: (
5152
_ spy1: @escaping (Entity) -> Void
5253
) -> some View
5354
) async throws -> Entity {
5455
var entity1: Entity?
55-
return try await confirmation(expectedCount: 1...) { confirmation1 in
56+
return try await confirmation(expectedCount: 1..., sourceLocation: sourceLocation) { confirmation1 in
5657
let view = view(
5758
{
5859
confirmation1()
@@ -70,7 +71,7 @@ func introspection<Entity: AnyObject & Sendable>(
7071
await Task.yield()
7172
}
7273

73-
return try #require(entity1)
74+
return try #require(entity1, sourceLocation: sourceLocation)
7475
}
7576
}
7677

@@ -79,15 +80,16 @@ func introspection<Entity: AnyObject & Sendable>(
7980
func introspection<Entity: AnyObject & Sendable>(
8081
of type: Entity.Type,
8182
timeout: TimeInterval = 3,
83+
sourceLocation: SourceLocation = #_sourceLocation,
8284
@ViewBuilder view: (
8385
_ spy1: @escaping (Entity) -> Void,
8486
_ spy2: @escaping (Entity) -> Void
8587
) -> some View
8688
) async throws -> (Entity, Entity) {
8789
var entity1: Entity?
8890
var entity2: Entity?
89-
return try await confirmation(expectedCount: 1...) { confirmation1 in
90-
try await confirmation(expectedCount: 1...) { confirmation2 in
91+
return try await confirmation(expectedCount: 1..., sourceLocation: sourceLocation) { confirmation1 in
92+
try await confirmation(expectedCount: 1..., sourceLocation: sourceLocation) { confirmation2 in
9193
let view = view(
9294
{
9395
confirmation1()
@@ -111,8 +113,8 @@ func introspection<Entity: AnyObject & Sendable>(
111113
}
112114

113115
return try (
114-
#require(entity1),
115-
#require(entity2),
116+
#require(entity1, sourceLocation: sourceLocation),
117+
#require(entity2, sourceLocation: sourceLocation),
116118
)
117119
}
118120
}
@@ -123,6 +125,7 @@ func introspection<Entity: AnyObject & Sendable>(
123125
func introspection<Entity: AnyObject & Sendable>(
124126
of type: Entity.Type,
125127
timeout: TimeInterval = 3,
128+
sourceLocation: SourceLocation = #_sourceLocation,
126129
@ViewBuilder view: (
127130
_ spy1: @escaping (Entity) -> Void,
128131
_ spy2: @escaping (Entity) -> Void,
@@ -132,9 +135,9 @@ func introspection<Entity: AnyObject & Sendable>(
132135
var entity1: Entity?
133136
var entity2: Entity?
134137
var entity3: Entity?
135-
return try await confirmation(expectedCount: 1...) { confirmation1 in
136-
try await confirmation(expectedCount: 1...) { confirmation2 in
137-
try await confirmation(expectedCount: 1...) { confirmation3 in
138+
return try await confirmation(expectedCount: 1..., sourceLocation: sourceLocation) { confirmation1 in
139+
try await confirmation(expectedCount: 1..., sourceLocation: sourceLocation) { confirmation2 in
140+
try await confirmation(expectedCount: 1..., sourceLocation: sourceLocation) { confirmation3 in
138141
let view = view(
139142
{
140143
confirmation1()
@@ -163,9 +166,9 @@ func introspection<Entity: AnyObject & Sendable>(
163166
}
164167

165168
return try (
166-
#require(entity1),
167-
#require(entity2),
168-
#require(entity3),
169+
#require(entity1, sourceLocation: sourceLocation),
170+
#require(entity2, sourceLocation: sourceLocation),
171+
#require(entity3, sourceLocation: sourceLocation),
169172
)
170173
}
171174
}
@@ -177,6 +180,7 @@ func introspection<Entity: AnyObject & Sendable>(
177180
func introspection<Entity: AnyObject & Sendable>(
178181
of type: Entity.Type,
179182
timeout: TimeInterval = 3,
183+
sourceLocation: SourceLocation = #_sourceLocation,
180184
@ViewBuilder view: (
181185
_ spy1: @escaping (Entity) -> Void,
182186
_ spy2: @escaping (Entity) -> Void,
@@ -188,10 +192,10 @@ func introspection<Entity: AnyObject & Sendable>(
188192
var entity2: Entity?
189193
var entity3: Entity?
190194
var entity4: Entity?
191-
return try await confirmation(expectedCount: 1...) { confirmation1 in
192-
try await confirmation(expectedCount: 1...) { confirmation2 in
193-
try await confirmation(expectedCount: 1...) { confirmation3 in
194-
try await confirmation(expectedCount: 1...) { confirmation4 in
195+
return try await confirmation(expectedCount: 1..., sourceLocation: sourceLocation) { confirmation1 in
196+
try await confirmation(expectedCount: 1..., sourceLocation: sourceLocation) { confirmation2 in
197+
try await confirmation(expectedCount: 1..., sourceLocation: sourceLocation) { confirmation3 in
198+
try await confirmation(expectedCount: 1..., sourceLocation: sourceLocation) { confirmation4 in
195199
let view = view(
196200
{
197201
confirmation1()
@@ -225,10 +229,10 @@ func introspection<Entity: AnyObject & Sendable>(
225229
}
226230

227231
return try (
228-
#require(entity1),
229-
#require(entity2),
230-
#require(entity3),
231-
#require(entity4),
232+
#require(entity1, sourceLocation: sourceLocation),
233+
#require(entity2, sourceLocation: sourceLocation),
234+
#require(entity3, sourceLocation: sourceLocation),
235+
#require(entity4, sourceLocation: sourceLocation),
232236
)
233237
}
234238
}

0 commit comments

Comments
 (0)