Skip to content

Commit d6f56de

Browse files
committed
Add a test case for effective ForInStmtSyntax
1 parent 7f73088 commit d6f56de

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Tests/SwiftSyntaxBuilderTest/ForInStmtTests.swift

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,28 @@ final class ForInStmtTests: XCTestCase {
5757
assertBuildResult(builder, expected, line: line)
5858
}
5959
}
60+
61+
func testEffectiveForInStmtSyntax() throws {
62+
let buildable = ForInStmtSyntax(
63+
tryKeyword: .keyword(.try),
64+
awaitKeyword: .keyword(.await),
65+
pattern: PatternSyntax("foo"),
66+
sequenceExpr: ExprSyntax("bar"),
67+
body: CodeBlockSyntax(
68+
statements: [
69+
.init(item: .decl("let baz = await foo.baz")),
70+
.init(item: .expr("print(foo.baz)"))
71+
]
72+
)
73+
)
74+
assertBuildResult(
75+
buildable,
76+
"""
77+
for try await foo in bar {
78+
let baz = await foo.baz
79+
print(foo.baz)
80+
}
81+
"""
82+
)
83+
}
6084
}

0 commit comments

Comments
 (0)