File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed
Tests/SwiftSyntaxBuilderTest Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // This source file is part of the Swift.org open source project
4
+ //
5
+ // Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors
6
+ // Licensed under Apache License v2.0 with Runtime Library Exception
7
+ //
8
+ // See https://swift.org/LICENSE.txt for license information
9
+ // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10
+ //
11
+ //===----------------------------------------------------------------------===//
12
+
13
+ import XCTest
14
+ import SwiftSyntax
15
+ import SwiftSyntaxBuilder
16
+
17
+ final class ForInStmtTests : XCTestCase {
18
+ func testForInStmtSyntax( ) throws {
19
+ let testCases : [ UInt : ( ForInStmtSyntax , String ) ] = [
20
+ #line: (
21
+ StmtSyntax (
22
+ """
23
+ for foo in bar {
24
+ _ = foo
25
+ }
26
+ """
27
+ ) . cast ( ForInStmtSyntax . self) ,
28
+ """
29
+ for foo in bar {
30
+ _ = foo
31
+ }
32
+ """
33
+ ) ,
34
+ #line: (
35
+ try ForInStmtSyntax ( " for try await foo in bar " ) { ExprSyntax ( " print(foo) " ) } ,
36
+ """
37
+ for try await foo in bar {
38
+ print(foo)
39
+ }
40
+ """
41
+ ) ,
42
+ ]
43
+
44
+ for (line, testCase) in testCases {
45
+ let ( builder, expected) = testCase
46
+ assertBuildResult ( builder, expected, line: line)
47
+ }
48
+ }
49
+ }
You can’t perform that action at this time.
0 commit comments