File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Tests/SwiftSyntaxBuilderTest Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -36,4 +36,33 @@ final class IfStmtTests: XCTestCase {
36
36
}
37
37
""" )
38
38
}
39
+
40
+ func testIfLetStmt( ) {
41
+ let buildable = IfStmt (
42
+ conditions: OptionalBindingCondition (
43
+ letOrVarKeyword: . let,
44
+ pattern: " x " ,
45
+ initializer: InitializerClause ( value: " y " )
46
+ )
47
+ ) { }
48
+ let syntax = buildable. buildSyntax ( format: Format ( ) )
49
+ XCTAssertEqual ( syntax. description, """
50
+ if let x = y {
51
+ }
52
+ """ )
53
+ }
54
+
55
+ func testIfCaseStmt( ) {
56
+ let buildable = IfStmt (
57
+ conditions: MatchingPatternCondition (
58
+ pattern: ExpressionPattern ( expression: MemberAccessExpr ( name: " x " ) ) ,
59
+ initializer: InitializerClause ( value: " y " )
60
+ )
61
+ ) { }
62
+ let syntax = buildable. buildSyntax ( format: Format ( ) )
63
+ XCTAssertEqual ( syntax. description, """
64
+ if case .x = y {
65
+ }
66
+ """ )
67
+ }
39
68
}
You can’t perform that action at this time.
0 commit comments