@@ -52,7 +52,8 @@ late File testFile9;
52
52
late File testFile10;
53
53
late File excludeFile1;
54
54
late File excludeFile2;
55
- late File skippedFile;
55
+ late File skipFile;
56
+ late File doNothingFile;
56
57
57
58
void main () {
58
59
group ('config file tests' , () {
@@ -257,27 +258,6 @@ text that should be added to the file. */''',
257
258
}
258
259
});
259
260
260
- test ('update skipped if license text not found' , () async {
261
- var errorMessage = '' ;
262
- final header = LicenseHeader ();
263
- try {
264
- await header.getReplacementInfo (
265
- file: testFile9,
266
- existingLicenseText: 'test' ,
267
- replacementLicenseText: 'test' ,
268
- byteCount: 50 ,
269
- );
270
- } on StateError catch (e) {
271
- errorMessage = e.toString ();
272
- }
273
- expect (
274
- errorMessage,
275
- equals (
276
- 'Bad state: License header expected in ${testFile9 .path }, but not found!' ,
277
- ),
278
- );
279
- });
280
-
281
261
test ("update skipped if file can't be read" , () async {
282
262
var errorMessage = '' ;
283
263
final header = LicenseHeader ();
@@ -363,7 +343,7 @@ text that should be added to the file. */''',
363
343
364
344
final includedPaths = results.includedPaths;
365
345
expect (includedPaths, isNotNull);
366
- expect (includedPaths.length, equals (8 ));
346
+ expect (includedPaths.length, equals (9 ));
367
347
// Order is not guaranteed
368
348
expect (includedPaths.contains (testFile1.path), true );
369
349
expect (contentsBeforeUpdate, isNot (equals (contentsAfterUpdate)));
@@ -373,7 +353,8 @@ text that should be added to the file. */''',
373
353
expect (includedPaths.contains (testFile8.path), true );
374
354
expect (includedPaths.contains (testFile9.path), true );
375
355
expect (includedPaths.contains (testFile10.path), true );
376
- expect (includedPaths.contains (skippedFile.path), true );
356
+ expect (includedPaths.contains (skipFile.path), true );
357
+ expect (includedPaths.contains (doNothingFile.path), true );
377
358
378
359
final updatedPaths = results.updatedPaths;
379
360
expect (updatedPaths, isNotNull);
@@ -386,7 +367,8 @@ text that should be added to the file. */''',
386
367
expect (updatedPaths.contains (testFile8.path), true );
387
368
expect (updatedPaths.contains (testFile9.path), true );
388
369
expect (updatedPaths.contains (testFile10.path), true );
389
- expect (updatedPaths.contains (skippedFile.path), false );
370
+ expect (updatedPaths.contains (skipFile.path), false );
371
+ expect (updatedPaths.contains (doNothingFile.path), false );
390
372
});
391
373
392
374
test ('license headers bulk update can be dry run' , () async {
@@ -544,6 +526,10 @@ update_paths:
544
526
ext2:
545
527
remove:
546
528
- 2
529
+ add: 1
530
+ ext3:
531
+ remove:
532
+ - 3
547
533
add: 1''' ;
548
534
549
535
configFile.writeAsStringSync (contents, flush: true );
@@ -588,9 +574,17 @@ Future<void> _setupTestDirectoryStructure() async {
588
574
..createSync (recursive: true );
589
575
testFile2.writeAsStringSync (licenseText3 + extraText, flush: true );
590
576
591
- skippedFile = File (p.join (repoRoot.path, 'test.skip' ))
577
+ final licenseText = '''
578
+ # This is other 2001 multiline license
579
+ # text that should be added to the file.
580
+ ''' ;
581
+ doNothingFile = File (p.join (repoRoot.path, 'doNothingFile.ext3' ))
582
+ ..createSync (recursive: true );
583
+ doNothingFile.writeAsStringSync (licenseText + extraText, flush: true );
584
+
585
+ skipFile = File (p.join (repoRoot.path, 'test.skip' ))
592
586
..createSync (recursive: true );
593
- skippedFile .writeAsStringSync (extraText, flush: true );
587
+ skipFile .writeAsStringSync (extraText, flush: true );
594
588
595
589
// Setup /repo_root/.hidden directory structure
596
590
Directory (p.join (repoRoot.path, '.hidden' )).createSync (recursive: true );
0 commit comments