diff --git a/Tests/SwiftSyntaxTest/SyntaxVisitorTests.swift b/Tests/SwiftSyntaxTest/SyntaxVisitorTests.swift index b408b1aa073..9dff638264c 100644 --- a/Tests/SwiftSyntaxTest/SyntaxVisitorTests.swift +++ b/Tests/SwiftSyntaxTest/SyntaxVisitorTests.swift @@ -29,6 +29,27 @@ public class SyntaxVisitorTests: XCTestCase { /// /// The source file is hard-coded so this test case doesn't need to depend on the parser. static var nestedFunctionsFile: SourceFileSyntax { + let innerBody = CodeBlockSyntax( + leftBrace: .leftBraceToken(), + statements: CodeBlockItemListSyntax([ + CodeBlockItemSyntax( + item: CodeBlockItemSyntax.Item( + IntegerLiteralExprSyntax( + digits: .integerLiteral( + "0xG", + leadingTrivia: [ + .newlines(1), + .spaces(6), + .blockComment("/*Unknown token */"), + ] + ) + ) + ) + ) + ]), + rightBrace: .rightBraceToken(leadingTrivia: [.newlines(1), .spaces(4)]) + ) + let source = SourceFileSyntax( statements: CodeBlockItemListSyntax([ CodeBlockItemSyntax( @@ -76,26 +97,7 @@ public class SyntaxVisitorTests: XCTestCase { rightParen: .rightParenToken(trailingTrivia: .space) ) ), - body: CodeBlockSyntax( - leftBrace: .leftBraceToken(), - statements: CodeBlockItemListSyntax([ - CodeBlockItemSyntax( - item: CodeBlockItemSyntax.Item( - IntegerLiteralExprSyntax( - digits: .integerLiteral( - "0xG", - leadingTrivia: [ - .newlines(1), - .spaces(6), - .blockComment("/*Unknown token */"), - ] - ) - ) - ) - ) - ]), - rightBrace: .rightBraceToken(leadingTrivia: [.newlines(1), .spaces(4)]) - ) + body: innerBody ) ) )