@@ -986,6 +986,76 @@ final class ExpressionTests: XCTestCase {
986
986
"""#
987
987
)
988
988
}
989
+
990
+ func testEmptyLineInMultilineStringLiteral( ) {
991
+ AssertParse (
992
+ #"""
993
+ """
994
+ line 1
995
+
996
+ line 2
997
+ """
998
+ """# ,
999
+ substructure: Syntax (
1000
+ StringLiteralExprSyntax (
1001
+ openDelimiter: nil ,
1002
+ openQuote: . multilineStringQuoteToken( leadingTrivia: [ . spaces( 2 ) ] , trailingTrivia: . newline) ,
1003
+ segments: StringLiteralSegmentsSyntax ( [
1004
+ . stringSegment( StringSegmentSyntax ( content: . stringSegment( " line 1 \n " , leadingTrivia: [ . spaces( 2 ) ] ) ) ) ,
1005
+ . stringSegment( StringSegmentSyntax ( content: . stringSegment( " \n " ) ) ) ,
1006
+ . stringSegment( StringSegmentSyntax ( content: . stringSegment( " line 2 " , leadingTrivia: [ . spaces( 2 ) ] , trailingTrivia: . newline) ) ) ,
1007
+ ] ) ,
1008
+ closeQuote: . multilineStringQuoteToken( leadingTrivia: [ . spaces( 2 ) ] ) ,
1009
+ closeDelimiter: nil
1010
+ )
1011
+ ) ,
1012
+ options: [ . substructureCheckTrivia]
1013
+ )
1014
+
1015
+ AssertParse (
1016
+ #"""
1017
+ """
1018
+ line 1
1019
+
1020
+ """
1021
+ """# ,
1022
+ substructure: Syntax (
1023
+ StringLiteralExprSyntax (
1024
+ openDelimiter: nil ,
1025
+ openQuote: . multilineStringQuoteToken( leadingTrivia: [ . spaces( 2 ) ] , trailingTrivia: . newline) ,
1026
+ segments: StringLiteralSegmentsSyntax ( [
1027
+ . stringSegment( StringSegmentSyntax ( content: . stringSegment( " line 1 \n " , leadingTrivia: [ . spaces( 2 ) ] ) ) ) ,
1028
+ . stringSegment( StringSegmentSyntax ( content: . stringSegment( " " , trailingTrivia: . newline) ) ) ,
1029
+ ] ) ,
1030
+ closeQuote: . multilineStringQuoteToken( leadingTrivia: [ . spaces( 2 ) ] ) ,
1031
+ closeDelimiter: nil
1032
+ )
1033
+ ) ,
1034
+ options: [ . substructureCheckTrivia]
1035
+ )
1036
+ }
1037
+
1038
+ func testUnderIndentedWhitespaceonlyLineInMultilineStringLiteral( ) {
1039
+ AssertParse (
1040
+ #"""
1041
+ """
1042
+ line 1
1043
+ 1️⃣
1044
+ line 2
1045
+ """
1046
+ """# ,
1047
+ diagnostics: [
1048
+ DiagnosticSpec ( message: " insufficient indentation of line in multi-line string literal " )
1049
+ ] ,
1050
+ fixedSource: #"""
1051
+ """
1052
+ line 1
1053
+ \#( " " )
1054
+ line 2
1055
+ """
1056
+ """#
1057
+ )
1058
+ }
989
1059
}
990
1060
991
1061
final class MemberExprTests : XCTestCase {
0 commit comments