@@ -1025,6 +1025,76 @@ final class ExpressionTests: XCTestCase {
1025
1025
"""#
1026
1026
)
1027
1027
}
1028
+
1029
+ func testEmptyLineInMultilineStringLiteral( ) {
1030
+ AssertParse (
1031
+ #"""
1032
+ """
1033
+ line 1
1034
+
1035
+ line 2
1036
+ """
1037
+ """# ,
1038
+ substructure: Syntax (
1039
+ StringLiteralExprSyntax (
1040
+ openDelimiter: nil ,
1041
+ openQuote: . multilineStringQuoteToken( leadingTrivia: [ . spaces( 2 ) ] , trailingTrivia: . newline) ,
1042
+ segments: StringLiteralSegmentsSyntax ( [
1043
+ . stringSegment( StringSegmentSyntax ( content: . stringSegment( " line 1 \n " , leadingTrivia: [ . spaces( 2 ) ] ) ) ) ,
1044
+ . stringSegment( StringSegmentSyntax ( content: . stringSegment( " \n " ) ) ) ,
1045
+ . stringSegment( StringSegmentSyntax ( content: . stringSegment( " line 2 " , leadingTrivia: [ . spaces( 2 ) ] , trailingTrivia: . newline) ) ) ,
1046
+ ] ) ,
1047
+ closeQuote: . multilineStringQuoteToken( leadingTrivia: [ . spaces( 2 ) ] ) ,
1048
+ closeDelimiter: nil
1049
+ )
1050
+ ) ,
1051
+ options: [ . substructureCheckTrivia]
1052
+ )
1053
+
1054
+ AssertParse (
1055
+ #"""
1056
+ """
1057
+ line 1
1058
+
1059
+ """
1060
+ """# ,
1061
+ substructure: Syntax (
1062
+ StringLiteralExprSyntax (
1063
+ openDelimiter: nil ,
1064
+ openQuote: . multilineStringQuoteToken( leadingTrivia: [ . spaces( 2 ) ] , trailingTrivia: . newline) ,
1065
+ segments: StringLiteralSegmentsSyntax ( [
1066
+ . stringSegment( StringSegmentSyntax ( content: . stringSegment( " line 1 \n " , leadingTrivia: [ . spaces( 2 ) ] ) ) ) ,
1067
+ . stringSegment( StringSegmentSyntax ( content: . stringSegment( " " , trailingTrivia: . newline) ) ) ,
1068
+ ] ) ,
1069
+ closeQuote: . multilineStringQuoteToken( leadingTrivia: [ . spaces( 2 ) ] ) ,
1070
+ closeDelimiter: nil
1071
+ )
1072
+ ) ,
1073
+ options: [ . substructureCheckTrivia]
1074
+ )
1075
+ }
1076
+
1077
+ func testUnderIndentedWhitespaceonlyLineInMultilineStringLiteral( ) {
1078
+ AssertParse (
1079
+ #"""
1080
+ """
1081
+ line 1
1082
+ 1️⃣
1083
+ line 2
1084
+ """
1085
+ """# ,
1086
+ diagnostics: [
1087
+ DiagnosticSpec ( message: " insufficient indentation of line in multi-line string literal " )
1088
+ ] ,
1089
+ fixedSource: #"""
1090
+ """
1091
+ line 1
1092
+ \#( " " )
1093
+ line 2
1094
+ """
1095
+ """#
1096
+ )
1097
+ }
1028
1098
}
1029
1099
1030
1100
final class MemberExprTests : XCTestCase {
0 commit comments