(t *testing.T)
| 36 | } |
| 37 | |
| 38 | func TestScanFiles(t *testing.T) { |
| 39 | // Create a temporary directory structure for testing |
| 40 | tmpDir := t.TempDir() |
| 41 | |
| 42 | // Create test files |
| 43 | files := []string{ |
| 44 | "main.go", |
| 45 | "README.md", |
| 46 | "src/app.go", |
| 47 | "src/util/helper.go", |
| 48 | } |
| 49 | |
| 50 | for _, f := range files { |
| 51 | path := filepath.Join(tmpDir, f) |
| 52 | if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil { |
| 53 | t.Fatalf("Failed to create directory: %v", err) |
| 54 | } |
| 55 | if err := os.WriteFile(path, []byte("test content"), 0644); err != nil { |
| 56 | t.Fatalf("Failed to create file: %v", err) |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | // Scan the directory |
| 61 | result, err := ScanFiles(tmpDir, nil, nil, nil) |
| 62 | if err != nil { |
| 63 | t.Fatalf("ScanFiles failed: %v", err) |
| 64 | } |
| 65 | |
| 66 | if len(result) != len(files) { |
| 67 | t.Errorf("Expected %d files, got %d", len(files), len(result)) |
| 68 | } |
| 69 | |
| 70 | // Verify file info |
| 71 | for _, fi := range result { |
| 72 | if fi.Size == 0 { |
| 73 | t.Errorf("File %s has zero size", fi.Path) |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | func TestScanFilesIgnoresDirs(t *testing.T) { |
| 79 | tmpDir := t.TempDir() |
nothing calls this directly
no test coverage detected