@@ -95,13 +95,23 @@ func TestRun(t *testing.T) {
95
95
"[PERIOD_TOP]" , "[CAPITAL_TOP]" ,
96
96
},
97
97
},
98
+ {
99
+ name : "scope: noinline" ,
100
+ scope : NoInlineScope ,
101
+ contains : []string {
102
+ "[PERIOD_DECL]" , "[CAPITAL_DECL]" ,
103
+ "[PERIOD_TOP]" , "[CAPITAL_TOP]" ,
104
+ "[PERIOD_ALL]" , "[CAPITAL_ALL]" ,
105
+ },
106
+ },
98
107
{
99
108
name : "scope: all" ,
100
109
scope : AllScope ,
101
110
contains : []string {
102
111
"[PERIOD_DECL]" , "[CAPITAL_DECL]" ,
103
112
"[PERIOD_TOP]" , "[CAPITAL_TOP]" ,
104
113
"[PERIOD_ALL]" , "[CAPITAL_ALL]" ,
114
+ "[PERIOD_INLINE]" , "[CAPITAL_INLINE]" ,
105
115
},
106
116
},
107
117
}
@@ -254,13 +264,36 @@ func TestFix(t *testing.T) {
254
264
assertEqualContent (t , expected , string (fixed ))
255
265
})
256
266
267
+ t .Run ("scope: noinline" , func (t * testing.T ) {
268
+ expected := strings .ReplaceAll (string (content ), "[PERIOD_DECL]" , "[PERIOD_DECL]." )
269
+ expected = strings .ReplaceAll (expected , "[PERIOD_TOP]" , "[PERIOD_TOP]." )
270
+ expected = strings .ReplaceAll (expected , "[PERIOD_ALL]" , "[PERIOD_ALL]." )
271
+ expected = strings .ReplaceAll (expected , "non-capital-decl" , "Non-capital-decl" )
272
+ expected = strings .ReplaceAll (expected , "non-capital-top" , "Non-capital-top" )
273
+ expected = strings .ReplaceAll (expected , "non-capital-all" , "Non-capital-all" )
274
+
275
+ fixed , err := Fix (testFile , file , fset , Settings {
276
+ Scope : NoInlineScope ,
277
+ Exclude : testExclude ,
278
+ Period : true ,
279
+ Capital : true ,
280
+ })
281
+ if err != nil {
282
+ t .Fatalf ("Unexpected error: %v" , err )
283
+ }
284
+
285
+ assertEqualContent (t , expected , string (fixed ))
286
+ })
287
+
257
288
t .Run ("scope: all" , func (t * testing.T ) {
258
289
expected := strings .ReplaceAll (string (content ), "[PERIOD_DECL]" , "[PERIOD_DECL]." )
259
290
expected = strings .ReplaceAll (expected , "[PERIOD_TOP]" , "[PERIOD_TOP]." )
260
291
expected = strings .ReplaceAll (expected , "[PERIOD_ALL]" , "[PERIOD_ALL]." )
292
+ expected = strings .ReplaceAll (expected , "[PERIOD_INLINE]" , "[PERIOD_INLINE]." )
261
293
expected = strings .ReplaceAll (expected , "non-capital-decl" , "Non-capital-decl" )
262
294
expected = strings .ReplaceAll (expected , "non-capital-top" , "Non-capital-top" )
263
295
expected = strings .ReplaceAll (expected , "non-capital-all" , "Non-capital-all" )
296
+ expected = strings .ReplaceAll (expected , "non-capital-inline" , "Non-capital-inline" )
264
297
265
298
fixed , err := Fix (testFile , file , fset , Settings {
266
299
Scope : AllScope ,
@@ -417,16 +450,46 @@ func TestReplace(t *testing.T) {
417
450
assertEqualContent (t , expected , string (fixed ))
418
451
})
419
452
453
+ t .Run ("scope: noinline" , func (t * testing.T ) {
454
+ defer func () {
455
+ os .WriteFile (testFile , content , mode )
456
+ }()
457
+ expected := strings .ReplaceAll (string (content ), "[PERIOD_DECL]" , "[PERIOD_DECL]." )
458
+ expected = strings .ReplaceAll (expected , "[PERIOD_TOP]" , "[PERIOD_TOP]." )
459
+ expected = strings .ReplaceAll (expected , "[PERIOD_ALL]" , "[PERIOD_ALL]." )
460
+ expected = strings .ReplaceAll (expected , "non-capital-decl" , "Non-capital-decl" )
461
+ expected = strings .ReplaceAll (expected , "non-capital-top" , "Non-capital-top" )
462
+ expected = strings .ReplaceAll (expected , "non-capital-all" , "Non-capital-all" )
463
+
464
+ err := Replace (testFile , file , fset , Settings {
465
+ Scope : NoInlineScope ,
466
+ Exclude : testExclude ,
467
+ Period : true ,
468
+ Capital : true ,
469
+ })
470
+ if err != nil {
471
+ t .Fatalf ("Unexpected error: %v" , err )
472
+ }
473
+ fixed , err := os .ReadFile (testFile )
474
+ if err != nil {
475
+ t .Fatalf ("Failed to read fixed file %s: %v" , testFile , err )
476
+ }
477
+
478
+ assertEqualContent (t , expected , string (fixed ))
479
+ })
480
+
420
481
t .Run ("scope: all" , func (t * testing.T ) {
421
482
defer func () {
422
483
os .WriteFile (testFile , content , mode )
423
484
}()
424
485
expected := strings .ReplaceAll (string (content ), "[PERIOD_DECL]" , "[PERIOD_DECL]." )
425
486
expected = strings .ReplaceAll (expected , "[PERIOD_TOP]" , "[PERIOD_TOP]." )
426
487
expected = strings .ReplaceAll (expected , "[PERIOD_ALL]" , "[PERIOD_ALL]." )
488
+ expected = strings .ReplaceAll (expected , "[PERIOD_INLINE]" , "[PERIOD_INLINE]." )
427
489
expected = strings .ReplaceAll (expected , "non-capital-decl" , "Non-capital-decl" )
428
490
expected = strings .ReplaceAll (expected , "non-capital-top" , "Non-capital-top" )
429
491
expected = strings .ReplaceAll (expected , "non-capital-all" , "Non-capital-all" )
492
+ expected = strings .ReplaceAll (expected , "non-capital-inline" , "Non-capital-inline" )
430
493
431
494
err := Replace (testFile , file , fset , Settings {
432
495
Scope : AllScope ,
0 commit comments