Skip to content

Commit da8e48f

Browse files
authored
Merge pull request #1279 from ahoppen/ahoppen/test-case-for-778
Add substructure test case for unterminated string literal
2 parents 82ff647 + 05aec88 commit da8e48f

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
@@ -918,6 +918,27 @@ final class ExpressionTests: XCTestCase {
918918
]
919919
)
920920
}
921+
922+
func testFoo() {
923+
AssertParse(
924+
"""
925+
"This is unterminated1️⃣
926+
x
927+
""",
928+
substructure: Syntax(
929+
StringLiteralExprSyntax(
930+
openQuote: .stringQuoteToken(),
931+
segments: StringLiteralSegmentsSyntax([
932+
.stringSegment(StringSegmentSyntax(content: .stringSegment("This is unterminated")))
933+
]),
934+
closeQuote: .stringQuoteToken(presence: .missing)
935+
)
936+
),
937+
diagnostics: [
938+
DiagnosticSpec(message: #"expected '"' to end string literal"#)
939+
]
940+
)
941+
}
921942
}
922943

923944
final class MemberExprTests: XCTestCase {

0 commit comments

Comments
 (0)