Skip to content

Commit 05aec88

Browse files
committed
Add substructure test case for unterminated string literal
Adds a test case for #778
1 parent 1159abd commit 05aec88

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Tests/SwiftParserTest/ExpressionTests.swift

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,27 @@ final class ExpressionTests: XCTestCase {
900900
]
901901
)
902902
}
903+
904+
func testFoo() {
905+
AssertParse(
906+
"""
907+
"This is unterminated1️⃣
908+
x
909+
""",
910+
substructure: Syntax(
911+
StringLiteralExprSyntax(
912+
openQuote: .stringQuoteToken(),
913+
segments: StringLiteralSegmentsSyntax([
914+
.stringSegment(StringSegmentSyntax(content: .stringSegment("This is unterminated")))
915+
]),
916+
closeQuote: .stringQuoteToken(presence: .missing)
917+
)
918+
),
919+
diagnostics: [
920+
DiagnosticSpec(message: #"expected '"' to end string literal"#)
921+
]
922+
)
923+
}
903924
}
904925

905926
final class MemberExprTests: XCTestCase {

0 commit comments

Comments
 (0)