(t *testing.T)
| 76 | } |
| 77 | |
| 78 | func TestScanFilesIgnoresDirs(t *testing.T) { |
| 79 | tmpDir := t.TempDir() |
| 80 | |
| 81 | // Create files including one in an ignored directory |
| 82 | if err := os.MkdirAll(filepath.Join(tmpDir, "node_modules"), 0755); err != nil { |
| 83 | t.Fatal(err) |
| 84 | } |
| 85 | if err := os.WriteFile(filepath.Join(tmpDir, "node_modules", "package.json"), []byte("{}"), 0644); err != nil { |
| 86 | t.Fatal(err) |
| 87 | } |
| 88 | if err := os.WriteFile(filepath.Join(tmpDir, "main.go"), []byte("package main"), 0644); err != nil { |
| 89 | t.Fatal(err) |
| 90 | } |
| 91 | |
| 92 | result, err := ScanFiles(tmpDir, nil, nil, nil) |
| 93 | if err != nil { |
| 94 | t.Fatalf("ScanFiles failed: %v", err) |
| 95 | } |
| 96 | |
| 97 | // Should only have main.go, not node_modules/package.json |
| 98 | if len(result) != 1 { |
| 99 | t.Errorf("Expected 1 file (main.go), got %d files", len(result)) |
| 100 | } |
| 101 | |
| 102 | if len(result) > 0 && result[0].Path != "main.go" { |
| 103 | t.Errorf("Expected main.go, got %s", result[0].Path) |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | func TestScanFilesExtensions(t *testing.T) { |
| 108 | tmpDir := t.TempDir() |
nothing calls this directly
no test coverage detected