8000 Add test case · swiftlang/swift-syntax@aa066cb · GitHub
[go: up one dir, main page]

Skip to content

Commit aa066cb

Browse files
kitasukeakyrtzi
authored andcommitted
Add test case
1 parent 83af507 commit aa066cb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Tests/SwiftSyntaxTest/SyntaxFactory.swift

Lines changed: 13 additions & 0 deletions
("testFunctionCallSyntaxBuilder", testFunctionCallSyntaxBuilder),
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class SyntaxFactoryAPITestCase: XCTestCase {
2424
2525
("testWithOptionalChild", testWithOptionalChild),
2626
("testUnknownSyntax", testUnknownSyntax),
27+
("testMakeStringLiteralExpr", testMakeStringLiteralExpr),
2728
]
2829

2930
public func testGenerated() {
@@ -160,4 +161,16 @@ public class SyntaxFactoryAPITestCase: XCTestCase {
160161
XCTAssertNoThrow(try SyntaxVerifier.verify(expr))
161162
XCTAssertThrowsError(try SyntaxVerifier.verify(unknown))
162163
}
164+
165+
public func testMakeStringLiteralExpr() {
166+
let expr = SyntaxFactory.makeStringLiteralExpr(
167+
"Hello, world!",
168+
leadingTrivia: .init(pieces: [.lineComment("// hello"), .newlines(1)])
169+
)
170+
let expected = """
171+
// hello
172+
"Hello, world!"
173+
"""
174+
XCTAssertEqual(expr.description, expected)
175+
}
163176
}

0 commit comments

Comments
 (0)
0