@@ -29,6 +29,27 @@ public class SyntaxVisitorTests: XCTestCase {
29
29
///
30
30
/// The source file is hard-coded so this test case doesn't need to depend on the parser.
31
31
static var nestedFunctionsFile : SourceFileSyntax {
32
+ let innerBody = CodeBlockSyntax (
33
+ leftBrace: . leftBraceToken( ) ,
34
+ statements: CodeBlockItemListSyntax ( [
35
+ CodeBlockItemSyntax (
36
+ item: CodeBlockItemSyntax . Item (
37
+ IntegerLiteralExprSyntax (
38
+ digits: . integerLiteral(
39
+ " 0xG " ,
40
+ leadingTrivia: [
41
+ . newlines( 1 ) ,
42
+ . spaces( 6 ) ,
43
+ . blockComment( " /*Unknown token */" ) ,
44
+ ]
45
+ )
46
+ )
47
+ )
48
+ )
49
+ ] ) ,
50
+ rightBrace: . rightBraceToken( leadingTrivia: [ . newlines( 1 ) , . spaces( 4 ) ] )
51
+ )
52
+
32
53
let source = SourceFileSyntax (
33
54
statements: CodeBlockItemListSyntax ( [
34
55
CodeBlockItemSyntax (
@@ -76,26 +97,7 @@ public class SyntaxVisitorTests: XCTestCase {
76
97
rightParen: . rightParenToken( trailingTrivia: . space)
77
98
)
78
99
) ,
79
- body: CodeBlockSyntax (
80
- leftBrace: . leftBraceToken( ) ,
81
- statements: CodeBlockItemListSyntax ( [
82
- CodeBlockItemSyntax (
83
- item: CodeBlockItemSyntax . Item (
84
- IntegerLiteralExprSyntax (
85
- digits: . integerLiteral(
86
- " 0xG " ,
87
- leadingTrivia: [
88
- . newlines( 1 ) ,
89
- . spaces( 6 ) ,
90
- . blockComment( " /*Unknown token */" ) ,
91
- ]
92
- )
93
- )
94
- )
95
- )
96
- ] ) ,
97
- rightBrace: . rightBraceToken( leadingTrivia: [ . newlines( 1 ) , . spaces( 4 ) ] )
98
- )
100
+ body: innerBody
99
101
)
100
102
)
101
103
)
0 commit comments