(t *testing.T)
| 105 | } |
| 106 | |
| 107 | func TestScanFilesExtensions(t *testing.T) { |
| 108 | tmpDir := t.TempDir() |
| 109 | |
| 110 | testFiles := map[string]string{ |
| 111 | "main.go": ".go", |
| 112 | "app.py": ".py", |
| 113 | "index.js": ".js", |
| 114 | "style.css": ".css", |
| 115 | "Makefile": "", |
| 116 | "README": "", |
| 117 | "config.json": ".json", |
| 118 | } |
| 119 | |
| 120 | for name := range testFiles { |
| 121 | if err := os.WriteFile(filepath.Join(tmpDir, name), []byte("content"), 0644); err != nil { |
| 122 | t.Fatal(err) |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | result, err := ScanFiles(tmpDir, nil, nil, nil) |
| 127 | if err != nil { |
| 128 | t.Fatal(err) |
| 129 | } |
| 130 | |
| 131 | extMap := make(map[string]string) |
| 132 | for _, f := range result { |
| 133 | extMap[filepath.Base(f.Path)] = f.Ext |
| 134 | } |
| 135 | |
| 136 | for name, expectedExt := range testFiles { |
| 137 | if got := extMap[name]; got != expectedExt { |
| 138 | t.Errorf("File %s: expected ext %q, got %q", name, expectedExt, got) |
| 139 | } |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | func TestFilterToChanged(t *testing.T) { |
| 144 | files := []FileInfo{ |
nothing calls this directly
no test coverage detected