Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 22 additions & 20 deletions Tests/SwiftSyntaxTest/SyntaxVisitorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
)
)
)
Expand Down