Skip to content

Commit f168971

Browse files
committed
Fix up some tests
1 parent 5a83ae0 commit f168971

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

Tests/TestingMacrosTests/ConditionMacroTests.swift

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ struct ConditionMacroTests {
225225
"""
226226
// Source comment
227227
/** Doc comment */
228-
try Testing.__checkCondition({ (__ec: Testing.__ExpectationContext) -> Swift.Bool in try __ec(x(), 0x4) }, sourceCode: [0x4: "x()"], comments: [.__line("// Source comment"),.__documentationBlock("/** Doc comment */"),"Argument comment"], isRequired: false, sourceLocation: Testing.SourceLocation.__here()).__expected()
228+
try Testing.__checkCondition({ (__ec: Testing.__ExpectationContext) -> Swift.Bool in try __ec(x(), 0x4) }, sourceCode: [0x4: "x()"], comments: [.__line("// Source comment"),.__documentationBlock("/** Doc comment */"),"Argument comment"], isRequired: false, sourceLocation: Testing.SourceLocation.__here()).__expected()
229229
""",
230230
231231
"""
@@ -238,7 +238,7 @@ struct ConditionMacroTests {
238238
// Ignore me
239239
240240
// Capture me
241-
try Testing.__checkCondition({ (__ec: Testing.__ExpectationContext) -> Swift.Bool in try __ec(x(), 0x4) }, sourceCode: [0x4: "x()"], comments: [.__line("// Capture me")], isRequired: false, sourceLocation: Testing.SourceLocation.__here()).__expected()
241+
try Testing.__checkCondition({ (__ec: Testing.__ExpectationContext) -> Swift.Bool in try __ec(x(), 0x4) }, sourceCode: [0x4: "x()"], comments: [.__line("// Capture me")], isRequired: false, sourceLocation: Testing.SourceLocation.__here()).__expected()
242242
""",
243243
244244
"""
@@ -251,7 +251,7 @@ struct ConditionMacroTests {
251251
// Ignore me
252252
\t
253253
// Capture me
254-
try Testing.__checkCondition({ (__ec: Testing.__ExpectationContext) -> Swift.Bool in try __ec(x(), 0x4) }, sourceCode: [0x4: "x()"], comments: [.__line("// Capture me")], isRequired: false, sourceLocation: Testing.SourceLocation.__here()).__expected()
254+
try Testing.__checkCondition({ (__ec: Testing.__ExpectationContext) -> Swift.Bool in try __ec(x(), 0x4) }, sourceCode: [0x4: "x()"], comments: [.__line("// Capture me")], isRequired: false, sourceLocation: Testing.SourceLocation.__here()).__expected()
255255
""",
256256
257257
"""
@@ -260,7 +260,7 @@ struct ConditionMacroTests {
260260
""":
261261
"""
262262
// Capture me
263-
try Testing.__checkValue(x, expression: .__fromSyntaxNode("x"), comments: [.__line("// Capture me")], isRequired: false, sourceLocation: Testing.SourceLocation.__here()).__expected()
263+
try Testing.__checkCondition({ (__ec: Testing.__ExpectationContext) -> Swift.Bool in __ec(x, 0x0) }, sourceCode: [0x0: "x"], comments: [.__line("// Capture me")], isRequired: false, sourceLocation: Testing.SourceLocation.__here()).__expected()
264264
""",
265265
266266
"""
@@ -269,7 +269,7 @@ struct ConditionMacroTests {
269269
""":
270270
"""
271271
// Capture me
272-
await Testing.__checkValue(x, expression: .__fromSyntaxNode("x"), comments: [.__line("// Capture me")], isRequired: false, sourceLocation: Testing.SourceLocation.__here()).__expected()
272+
await Testing.__checkCondition({ (__ec: Testing.__ExpectationContext) -> Swift.Bool in __ec(x, 0x0) }, sourceCode: [0x0: "x"], comments: [.__line("// Capture me")], isRequired: false, sourceLocation: Testing.SourceLocation.__here()).__expected()
273273
""",
274274
275275
"""
@@ -288,7 +288,7 @@ struct ConditionMacroTests {
288288
// Comment for await
289289
await
290290
// Comment for expect
291-
Testing.__checkValue(x, expression: .__fromSyntaxNode("x"), comments: [.__line("// Comment for try"), .__line("// Comment for await"), .__line("// Comment for expect")], isRequired: false, sourceLocation: Testing.SourceLocation.__here()).__expected()
291+
Testing.__checkCondition({ (__ec: Testing.__ExpectationContext) -> Swift.Bool in __ec(x, 0x0) }, sourceCode: [0x0: "x"], comments: [.__line("// Comment for try"), .__line("// Comment for await"), .__line("// Comment for expect")], isRequired: false, sourceLocation: Testing.SourceLocation.__here()).__expected()
292292
""",
293293
294294
"""
@@ -301,9 +301,7 @@ struct ConditionMacroTests {
301301
"""
302302
func example() {
303303
// Capture me
304-
Testing.__checkFunctionCall((), calling: { _ in
305-
x()
306-
}, expression: .__fromFunctionCall(nil, "x"), comments: [.__line("// Capture me")], isRequired: false, sourceLocation: Testing.SourceLocation.__here()).__expected()
304+
Testing.__checkCondition({ (__ec: Testing.__ExpectationContext) -> Swift.Bool in __ec(x(), 0x0) }, sourceCode: [0x0: "x()"], comments: [.__line("// Capture me")], isRequired: false, sourceLocation: Testing.SourceLocation.__here()).__expected()
307305
}
308306
""",
309307
]

Tests/TestingTests/EventRecorderTests.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ struct EventRecorderTests {
178178
.first != nil
179179
)
180180
}
181-
181+
182182
@available(_regexAPI, *)
183183
@Test(
184184
"Log the total number of test cases in parameterized tests at the end of the test run",
@@ -568,8 +568,10 @@ struct EventRecorderTests {
568568
// The first message is something along the lines of "Test foo recorded a
569569
// known issue" and includes a source location, so is inconvenient to
570570
// include in our expectation here.
571-
let actualComments = messages.rawValue.dropFirst().map(\.stringValue)
572-
#expect(actualComments == expectedComments)
571+
let actualComments = messages.rawValue.map(\.stringValue)
572+
for expectedComment in expectedComments {
573+
#expect(actualComments.contains(expectedComment))
574+
}
573575
}
574576
}
575577

0 commit comments

Comments
 (0)