@@ -50,6 +50,29 @@ public class SyntaxVisitorTests: XCTestCase {
50
50
rightBrace: . rightBraceToken( leadingTrivia: [ . newlines( 1 ) , . spaces( 4 ) ] )
51
51
)
52
52
53
+ let innerCodeBlock = CodeBlockSyntax (
54
+ leftBrace: . leftBraceToken( ) ,
55
+ statements: CodeBlockItemListSyntax ( [
56
+ CodeBlockItemSyntax (
57
+ item: CodeBlockItemSyntax . Item (
58
+ FunctionDeclSyntax (
59
+ funcKeyword: . keyword( . func, leadingTrivia: [ . newlines( 1 ) , . spaces( 4 ) ] , trailingTrivia: . space) ,
60
+ name: . identifier( " foo " ) ,
61
+ signature: FunctionSignatureSyntax (
62
+ parameterClause: FunctionParameterClauseSyntax (
63
+ leftParen: . leftParenToken( ) ,
64
+ parameters: FunctionParameterListSyntax ( [ ] ) ,
65
+ rightParen: . rightParenToken( trailingTrivia: . space)
66
+ )
67
+ ) ,
68
+ body: innerBody
69
+ )
70
+ )
71
+ )
72
+ ] ) ,
73
+ rightBrace: . rightBraceToken( leadingTrivia: [ . newlines( 1 ) , . spaces( 2 ) ] )
74
+ )
75
+
53
76
let source = SourceFileSyntax (
54
77
statements: CodeBlockItemListSyntax ( [
55
78
CodeBlockItemSyntax (
@@ -82,28 +105,7 @@ public class SyntaxVisitorTests: XCTestCase {
82
105
rightParen: . rightParenToken( trailingTrivia: . space)
83
106
)
84
107
) ,
85
- body: CodeBlockSyntax (
86
- leftBrace: . leftBraceToken( ) ,
87
- statements: CodeBlockItemListSyntax ( [
88
- CodeBlockItemSyntax (
89
- item: CodeBlockItemSyntax . Item (
90
- FunctionDeclSyntax (
91
- funcKeyword: . keyword( . func, leadingTrivia: [ . newlines( 1 ) , . spaces( 4 ) ] , trailingTrivia: . space) ,
92
- name: . identifier( " foo " ) ,
93
- signature: FunctionSignatureSyntax (
94
- parameterClause: FunctionParameterClauseSyntax (
95
- leftParen: . leftParenToken( ) ,
96
- parameters: FunctionParameterListSyntax ( [ ] ) ,
97
- rightParen: . rightParenToken( trailingTrivia: . space)
98
- )
99
- ) ,
100
- body: innerBody
101
- )
102
- )
103
- )
104
- ] ) ,
105
- rightBrace: . rightBraceToken( leadingTrivia: [ . newlines( 1 ) , . spaces( 2 ) ] )
106
- )
108
+ body: innerCodeBlock
107
109
)
108
110
)
109
111
)
0 commit comments