(t *testing.T)
| 108 | } |
| 109 | |
| 110 | func TestIsPathExcluded(t *testing.T) { |
| 111 | tests := []struct { |
| 112 | name string |
| 113 | relPath string |
| 114 | patterns []string |
| 115 | want bool |
| 116 | }{ |
| 117 | {"hardcoded dir .git", ".git", nil, true}, |
| 118 | {"hardcoded dir prefix", ".git/config", nil, true}, |
| 119 | {"node_modules dir pattern", "node_modules/foo.js", []string{"node_modules/"}, true}, |
| 120 | {"gitignore pattern match", "debug.log", []string{"*.log"}, true}, |
| 121 | {"no match", "main.go", []string{"*.log"}, false}, |
| 122 | {"no patterns", "main.go", nil, false}, |
| 123 | } |
| 124 | for _, tt := range tests { |
| 125 | t.Run(tt.name, func(t *testing.T) { |
| 126 | got := IsPathExcluded(".", tt.relPath, tt.patterns) |
| 127 | if got != tt.want { |
| 128 | t.Errorf("IsPathExcluded(%q, %v) = %v, want %v", tt.relPath, tt.patterns, got, tt.want) |
| 129 | } |
| 130 | }) |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | func TestIsPathExcluded_DirectoryPatterns(t *testing.T) { |
| 135 | tests := []struct { |
nothing calls this directly
no test coverage detected