MCPcopy Create free account
hub / github.com/JordanCoin/codemap / TestShouldIncludeFile

Function TestShouldIncludeFile

scanner/walker_test.go:607–706  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

605}
606
607func TestShouldIncludeFile(t *testing.T) {
608 tests := []struct {
609 name string
610 relPath string
611 ext string
612 only []string
613 exclude []string
614 want bool
615 }{
616 {
617 name: "no filters includes file",
618 relPath: "src/main.go",
619 ext: ".go",
620 only: nil,
621 exclude: nil,
622 want: true,
623 },
624 {
625 name: "only filter match",
626 relPath: "src/main.go",
627 ext: ".go",
628 only: []string{"go", "ts"},
629 exclude: nil,
630 want: true,
631 },
632 {
633 name: "only filter no match",
634 relPath: "src/main.py",
635 ext: ".py",
636 only: []string{"go", "ts"},
637 exclude: nil,
638 want: false,
639 },
640 {
641 name: "exclude extension pattern",
642 relPath: "assets/logo.png",
643 ext: ".png",
644 only: nil,
645 exclude: []string{".png"},
646 want: false,
647 },
648 {
649 name: "exclude directory pattern",
650 relPath: "src/generated/file.go",
651 ext: ".go",
652 only: []string{"go"},
653 exclude: []string{"generated"},
654 want: false,
655 },
656 {
657 name: "included by only extension with dot mix",
658 relPath: "pkg/main.go",
659 ext: ".go",
660 only: []string{"go", ".py"},
661 exclude: nil,
662 want: true,
663 },
664 {

Callers

nothing calls this directly

Calls 1

shouldIncludeFileFunction · 0.85

Tested by

no test coverage detected