@@ -328,9 +328,54 @@ final class DeclarationTests: XCTestCase {
328
328
internal(set) var defaultProp = 0
329
329
""" ,
330
330
diagnostics: [
331
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " consecutive statements on a line must be separated by ';' " , fixIts: [ " insert ';' " ] ) ,
332
- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " consecutive statements on a line must be separated by ';' " , fixIts: [ " insert ';' " ] ) ,
331
+ DiagnosticSpec (
332
+ locationMarker: " 1️⃣ " ,
333
+ message: " consecutive statements on a line must be separated by newline or ';' " ,
334
+ fixIts: [ " insert newline " , " insert ';' " ]
335
+ ) ,
336
+ DiagnosticSpec (
337
+ locationMarker: " 2️⃣ " ,
338
+ message: " consecutive statements on a line must be separated by newline or ';' " ,
339
+ fixIts: [ " insert newline " , " insert ';' " ]
340
+ ) ,
341
+ ] ,
342
+ applyFixIts: [ " insert newline " ] ,
343
+ fixedSource: """
344
+ open
345
+ open(set)
346
+ var openProp = 0
347
+ public public(set) var publicProp = 0
348
+ package package(set) var packageProp = 0
349
+ internal internal(set) var internalProp = 0
350
+ fileprivate fileprivate(set) var fileprivateProp = 0
351
+ private private(set) var privateProp = 0
352
+ internal(set) var defaultProp = 0
353
+ """
354
+ )
355
+
356
+ assertParse (
357
+ """
358
+ open1️⃣ open(set)2️⃣ var openProp = 0
359
+ public public(set) var publicProp = 0
360
+ package package(set) var packageProp = 0
361
+ internal internal(set) var internalProp = 0
362
+ fileprivate fileprivate(set) var fileprivateProp = 0
363
+ private private(set) var privateProp = 0
364
+ internal(set) var defaultProp = 0
365
+ """ ,
366
+ diagnostics: [
367
+ DiagnosticSpec (
368
+ locationMarker: " 1️⃣ " ,
369
+ message: " consecutive statements on a line must be separated by newline or ';' " ,
370
+ fixIts: [ " insert newline " , " insert ';' " ]
371
+ ) ,
372
+ DiagnosticSpec (
373
+ locationMarker: " 2️⃣ " ,
374
+ message: " consecutive statements on a line must be separated by newline or ';' " ,
375
+ fixIts: [ " insert newline " , " insert ';' " ]
376
+ ) ,
333
377
] ,
378
+ applyFixIts: [ " insert ';' " ] ,
334
379
fixedSource: """
335
380
open; open(set); var openProp = 0
336
381
public public(set) var publicProp = 0
@@ -1024,18 +1069,74 @@ final class DeclarationTests: XCTestCase {
1024
1069
)
1025
1070
}
1026
1071
1027
- func testTextRecovery ( ) {
1072
+ func testTextRecovery1 ( ) {
1028
1073
assertParse (
1029
1074
"""
1030
1075
Lorem1️⃣ ipsum2️⃣ dolor3️⃣ sit4️⃣ amet5️⃣, consectetur adipiscing elit
1031
1076
""" ,
1032
1077
diagnostics: [
1033
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " consecutive statements on a line must be separated by ';' " , fixIts: [ " insert ';' " ] ) ,
1034
- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " consecutive statements on a line must be separated by ';' " , fixIts: [ " insert ';' " ] ) ,
1035
- DiagnosticSpec ( locationMarker: " 3️⃣ " , message: " consecutive statements on a line must be separated by ';' " , fixIts: [ " insert ';' " ] ) ,
1036
- DiagnosticSpec ( locationMarker: " 4️⃣ " , message: " consecutive statements on a line must be separated by ';' " , fixIts: [ " insert ';' " ] ) ,
1078
+ DiagnosticSpec (
1079
+ locationMarker: " 1️⃣ " ,
1080
+ message: " consecutive statements on a line must be separated by newline or ';' " ,
1081
+ fixIts: [ " insert newline " , " insert ';' " ]
1082
+ ) ,
1083
+ DiagnosticSpec (
1084
+ locationMarker: " 2️⃣ " ,
1085
+ message: " consecutive statements on a line must be separated by newline or ';' " ,
1086
+ fixIts: [ " insert newline " , " insert ';' " ]
1087
+ ) ,
1088
+ DiagnosticSpec (
1089
+ locationMarker: " 3️⃣ " ,
1090
+ message: " consecutive statements on a line must be separated by newline or ';' " ,
1091
+ fixIts: [ " insert newline " , " insert ';' " ]
1092
+ ) ,
1093
+ DiagnosticSpec (
1094
+ locationMarker: " 4️⃣ " ,
1095
+ message: " consecutive statements on a line must be separated by newline or ';' " ,
1096
+ fixIts: [ " insert newline " , " insert ';' " ]
1097
+ ) ,
1098
+ DiagnosticSpec ( locationMarker: " 5️⃣ " , message: " extraneous code ', consectetur adipiscing elit' at top level " ) ,
1099
+ ] ,
1100
+ applyFixIts: [ " insert newline " ] ,
1101
+ fixedSource: """
1102
+ Lorem
1103
+ ipsum
1104
+ dolor
1105
+ sit
1106
+ amet, consectetur adipiscing elit
1107
+ """
1108
+ )
1109
+ }
1110
+
1111
+ func testTextRecovery2( ) {
1112
+ assertParse (
1113
+ """
1114
+ Lorem1️⃣ ipsum2️⃣ dolor3️⃣ sit4️⃣ amet5️⃣, consectetur adipiscing elit
1115
+ """ ,
1116
+ diagnostics: [
1117
+ DiagnosticSpec (
1118
+ locationMarker: " 1️⃣ " ,
1119
+ message: " consecutive statements on a line must be separated by newline or ';' " ,
1120
+ fixIts: [ " insert newline " , " insert ';' " ]
1121
+ ) ,
1122
+ DiagnosticSpec (
1123
+ locationMarker: " 2️⃣ " ,
1124
+ message: " consecutive statements on a line must be separated by newline or ';' " ,
1125
+ fixIts: [ " insert newline " , " insert ';' " ]
1126
+ ) ,
1127
+ DiagnosticSpec (
1128
+ locationMarker: " 3️⃣ " ,
1129
+ message: " consecutive statements on a line must be separated by newline or ';' " ,
1130
+ fixIts: [ " insert newline " , " insert ';' " ]
1131
+ ) ,
1132
+ DiagnosticSpec (
1133
+ locationMarker: " 4️⃣ " ,
1134
+ message: " consecutive statements on a line must be separated by newline or ';' " ,
1135
+ fixIts: [ " insert newline " , " insert ';' " ]
1136
+ ) ,
1037
1137
DiagnosticSpec ( locationMarker: " 5️⃣ " , message: " extraneous code ', consectetur adipiscing elit' at top level " ) ,
1038
1138
] ,
1139
+ applyFixIts: [ " insert ';' " ] ,
1039
1140
fixedSource: """
1040
1141
Lorem; ipsum; dolor; sit; amet, consectetur adipiscing elit
1041
1142
"""
0 commit comments