@@ -377,9 +377,10 @@ func Test_walkerOptionsFromContext(t *testing.T) {
377377 Config : & todos.Config {
378378 Types : todos .DefaultTypes ,
379379 },
380- Charset : defaultCharset ,
381- IncludeHidden : true ,
382- Paths : []string {"." },
380+ Charset : defaultCharset ,
381+ IgnoreFileNames : defaultIgnoreFilenames ,
382+ IncludeHidden : true ,
383+ Paths : []string {"." },
383384 },
384385 },
385386 "output github" : {
@@ -389,9 +390,10 @@ func Test_walkerOptionsFromContext(t *testing.T) {
389390 Config : & todos.Config {
390391 Types : todos .DefaultTypes ,
391392 },
392- Charset : defaultCharset ,
393- IncludeHidden : true ,
394- Paths : []string {"." },
393+ Charset : defaultCharset ,
394+ IgnoreFileNames : defaultIgnoreFilenames ,
395+ IncludeHidden : true ,
396+ Paths : []string {"." },
395397 },
396398 },
397399 "invalid output" : {
@@ -404,9 +406,34 @@ func Test_walkerOptionsFromContext(t *testing.T) {
404406 Config : & todos.Config {
405407 Types : []string {"TODO" , "FIXME" },
406408 },
407- Charset : defaultCharset ,
408- IncludeHidden : true ,
409- Paths : []string {"." },
409+ Charset : defaultCharset ,
410+ IgnoreFileNames : defaultIgnoreFilenames ,
411+ IncludeHidden : true ,
412+ Paths : []string {"." },
413+ },
414+ },
415+ "ignore filename" : {
416+ args : []string {"--ignore-file-name=todo.ignore" },
417+ expected : & walker.Options {
418+ Config : & todos.Config {
419+ Types : todos .DefaultTypes ,
420+ },
421+ Charset : defaultCharset ,
422+ IgnoreFileNames : []string {"todo.ignore" },
423+ IncludeHidden : true ,
424+ Paths : []string {"." },
425+ },
426+ },
427+ "ignore filename multiple" : {
428+ args : []string {"--ignore-file-name=todo.ignore" , "--ignore-file-name=.todo.ignore" },
429+ expected : & walker.Options {
430+ Config : & todos.Config {
431+ Types : todos .DefaultTypes ,
432+ },
433+ Charset : defaultCharset ,
434+ IgnoreFileNames : []string {"todo.ignore" , ".todo.ignore" },
435+ IncludeHidden : true ,
436+ Paths : []string {"." },
410437 },
411438 },
412439 "exclude-hidden" : {
@@ -415,9 +442,10 @@ func Test_walkerOptionsFromContext(t *testing.T) {
415442 Config : & todos.Config {
416443 Types : todos .DefaultTypes ,
417444 },
418- Charset : defaultCharset ,
419- IncludeHidden : false ,
420- Paths : []string {"." },
445+ Charset : defaultCharset ,
446+ IgnoreFileNames : defaultIgnoreFilenames ,
447+ IncludeHidden : false ,
448+ Paths : []string {"." },
421449 },
422450 },
423451 "include-vcs" : {
@@ -426,10 +454,11 @@ func Test_walkerOptionsFromContext(t *testing.T) {
426454 Config : & todos.Config {
427455 Types : todos .DefaultTypes ,
428456 },
429- Charset : defaultCharset ,
430- IncludeHidden : true ,
431- IncludeVCS : true ,
432- Paths : []string {"." },
457+ Charset : defaultCharset ,
458+ IgnoreFileNames : defaultIgnoreFilenames ,
459+ IncludeHidden : true ,
460+ IncludeVCS : true ,
461+ Paths : []string {"." },
433462 },
434463 },
435464 "include-vendored" : {
@@ -439,6 +468,7 @@ func Test_walkerOptionsFromContext(t *testing.T) {
439468 Types : todos .DefaultTypes ,
440469 },
441470 Charset : defaultCharset ,
471+ IgnoreFileNames : defaultIgnoreFilenames ,
442472 IncludeHidden : true ,
443473 IncludeVendored : true ,
444474 Paths : []string {"." },
@@ -450,9 +480,10 @@ func Test_walkerOptionsFromContext(t *testing.T) {
450480 Config : & todos.Config {
451481 Types : todos .DefaultTypes ,
452482 },
453- Charset : defaultCharset ,
454- IncludeHidden : true ,
455- Paths : []string {"/path/to/code" },
483+ Charset : defaultCharset ,
484+ IgnoreFileNames : defaultIgnoreFilenames ,
485+ IncludeHidden : true ,
486+ Paths : []string {"/path/to/code" },
456487 },
457488 },
458489 "multiple-paths" : {
@@ -461,9 +492,10 @@ func Test_walkerOptionsFromContext(t *testing.T) {
461492 Config : & todos.Config {
462493 Types : todos .DefaultTypes ,
463494 },
464- Charset : defaultCharset ,
465- IncludeHidden : true ,
466- Paths : []string {"/path/to/code" , "/other/path" },
495+ Charset : defaultCharset ,
496+ IgnoreFileNames : defaultIgnoreFilenames ,
497+ IncludeHidden : true ,
498+ Paths : []string {"/path/to/code" , "/other/path" },
467499 },
468500 },
469501 "exclude-multiple" : {
@@ -472,10 +504,11 @@ func Test_walkerOptionsFromContext(t *testing.T) {
472504 Config : & todos.Config {
473505 Types : todos .DefaultTypes ,
474506 },
475- Charset : defaultCharset ,
476- IncludeHidden : true ,
477- ExcludeGlobs : []glob.Glob {glob .MustCompile ("exclude.*" ), glob .MustCompile ("foo" )},
478- Paths : []string {"." },
507+ Charset : defaultCharset ,
508+ IgnoreFileNames : defaultIgnoreFilenames ,
509+ IncludeHidden : true ,
510+ ExcludeGlobs : []glob.Glob {glob .MustCompile ("exclude.*" ), glob .MustCompile ("foo" )},
511+ Paths : []string {"." },
479512 },
480513 },
481514 "exclude-dir-multiple" : {
@@ -485,6 +518,7 @@ func Test_walkerOptionsFromContext(t *testing.T) {
485518 Types : todos .DefaultTypes ,
486519 },
487520 Charset : defaultCharset ,
521+ IgnoreFileNames : defaultIgnoreFilenames ,
488522 IncludeHidden : true ,
489523 ExcludeDirGlobs : []glob.Glob {glob .MustCompile ("exclude?" ), glob .MustCompile ("foo" )},
490524 Paths : []string {"." },
@@ -497,6 +531,7 @@ func Test_walkerOptionsFromContext(t *testing.T) {
497531 Types : todos .DefaultTypes ,
498532 },
499533 Charset : defaultCharset ,
534+ IgnoreFileNames : defaultIgnoreFilenames ,
500535 IncludeHidden : true ,
501536 ExcludeDirGlobs : []glob.Glob {glob .MustCompile ("exclude" )},
502537 Paths : []string {"." },
@@ -508,9 +543,10 @@ func Test_walkerOptionsFromContext(t *testing.T) {
508543 Config : & todos.Config {
509544 Types : todos .DefaultTypes ,
510545 },
511- Charset : "UTF-16" ,
512- IncludeHidden : true ,
513- Paths : []string {"." },
546+ Charset : "UTF-16" ,
547+ IgnoreFileNames : defaultIgnoreFilenames ,
548+ IncludeHidden : true ,
549+ Paths : []string {"." },
514550 },
515551 },
516552 "detect charset" : {
@@ -519,9 +555,10 @@ func Test_walkerOptionsFromContext(t *testing.T) {
519555 Config : & todos.Config {
520556 Types : todos .DefaultTypes ,
521557 },
522- Charset : "detect" ,
523- IncludeHidden : true ,
524- Paths : []string {"." },
558+ Charset : "detect" ,
559+ IgnoreFileNames : defaultIgnoreFilenames ,
560+ IncludeHidden : true ,
561+ Paths : []string {"." },
525562 },
526563 },
527564 "invalid charset" : {
@@ -534,10 +571,11 @@ func Test_walkerOptionsFromContext(t *testing.T) {
534571 Config : & todos.Config {
535572 Types : todos .DefaultTypes ,
536573 },
537- LabelGlobs : []glob.Glob {glob .MustCompile ("foo" ), glob .MustCompile ("bar-*" )},
538- Charset : defaultCharset ,
539- IncludeHidden : true ,
540- Paths : []string {"." },
574+ LabelGlobs : []glob.Glob {glob .MustCompile ("foo" ), glob .MustCompile ("bar-*" )},
575+ Charset : defaultCharset ,
576+ IgnoreFileNames : defaultIgnoreFilenames ,
577+ IncludeHidden : true ,
578+ Paths : []string {"." },
541579 },
542580 },
543581 }
0 commit comments