@@ -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
@@ -933,18 +978,74 @@ final class DeclarationTests: XCTestCase {
933
978
)
934
979
}
935
980
936
- func testTextRecovery ( ) {
981
+ func testTextRecovery1 ( ) {
937
982
assertParse (
938
983
"""
939
984
Lorem1️⃣ ipsum2️⃣ dolor3️⃣ sit4️⃣ amet5️⃣, consectetur adipiscing elit
940
985
""" ,
941
986
diagnostics: [
942
- DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " consecutive statements on a line must be separated by ';' " , fixIts: [ " insert ';' " ] ) ,
943
- DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " consecutive statements on a line must be separated by ';' " , fixIts: [ " insert ';' " ] ) ,
944
- DiagnosticSpec ( locationMarker: " 3️⃣ " , message: " consecutive statements on a line must be separated by ';' " , fixIts: [ " insert ';' " ] ) ,
945
- DiagnosticSpec ( locationMarker: " 4️⃣ " , message: " consecutive statements on a line must be separated by ';' " , fixIts: [ " insert ';' " ] ) ,
987
+ DiagnosticSpec (
988
+ locationMarker: " 1️⃣ " ,
989
+ message: " consecutive statements on a line must be separated by newline or ';' " ,
990
+ fixIts: [ " insert newline " , " insert ';' " ]
991
+ ) ,
992
+ DiagnosticSpec (
993
+ locationMarker: " 2️⃣ " ,
994
+ message: " consecutive statements on a line must be separated by newline or ';' " ,
995
+ fixIts: [ " insert newline " , " insert ';' " ]
996
+ ) ,
997
+ DiagnosticSpec (
998
+ locationMarker: " 3️⃣ " ,
999
+ message: " consecutive statements on a line must be separated by newline or ';' " ,
1000
+ fixIts: [ " insert newline " , " insert ';' " ]
1001
+ ) ,
1002
+ DiagnosticSpec (
1003
+ locationMarker: " 4️⃣ " ,
1004
+ message: " consecutive statements on a line must be separated by newline or ';' " ,
1005
+ fixIts: [ " insert newline " , " insert ';' " ]
1006
+ ) ,
1007
+ DiagnosticSpec ( locationMarker: " 5️⃣ " , message: " extraneous code ', consectetur adipiscing elit' at top level " ) ,
1008
+ ] ,
1009
+ applyFixIts: [ " insert newline " ] ,
1010
+ fixedSource: """
1011
+ Lorem
1012
+ ipsum
1013
+ dolor
1014
+ sit
1015
+ amet, consectetur adipiscing elit
1016
+ """
1017
+ )
1018
+ }
1019
+
1020
+ func testTextRecovery2( ) {
1021
+ assertParse (
1022
+ """
1023
+ Lorem1️⃣ ipsum2️⃣ dolor3️⃣ sit4️⃣ amet5️⃣, consectetur adipiscing elit
1024
+ """ ,
1025
+ diagnostics: [
1026
+ DiagnosticSpec (
1027
+ locationMarker: " 1️⃣ " ,
1028
+ message: " consecutive statements on a line must be separated by newline or ';' " ,
1029
+ fixIts: [ " insert newline " , " insert ';' " ]
1030
+ ) ,
1031
+ DiagnosticSpec (
1032
+ locationMarker: " 2️⃣ " ,
1033
+ message: " consecutive statements on a line must be separated by newline or ';' " ,
1034
+ fixIts: [ " insert newline " , " insert ';' " ]
1035
+ ) ,
1036
+ DiagnosticSpec (
1037
+ locationMarker: " 3️⃣ " ,
1038
+ message: " consecutive statements on a line must be separated by newline or ';' " ,
1039
+ fixIts: [ " insert newline " , " insert ';' " ]
1040
+ ) ,
1041
+ DiagnosticSpec (
1042
+ locationMarker: " 4️⃣ " ,
1043
+ message: " consecutive statements on a line must be separated by newline or ';' " ,
1044
+ fixIts: [ " insert newline " , " insert ';' " ]
1045
+ ) ,
946
1046
DiagnosticSpec ( locationMarker: " 5️⃣ " , message: " extraneous code ', consectetur adipiscing elit' at top level " ) ,
947
1047
] ,
1048
+ applyFixIts: [ " insert ';' " ] ,
948
1049
fixedSource: """
949
1050
Lorem; ipsum; dolor; sit; amet, consectetur adipiscing elit
950
1051
"""
0 commit comments