| 90 | } |
| 91 | |
| 92 | func TestCCache_Setup_MkdirFails(t *testing.T) { |
| 93 | // Use a path that cannot be created: parent is a file, not a directory. |
| 94 | dir := t.TempDir() |
| 95 | badDir := filepath.Join(dir, "file") |
| 96 | if err := os.WriteFile(badDir, []byte("x"), 0644); err != nil { |
| 97 | t.Fatalf("setup: %v", err) |
| 98 | } |
| 99 | impossibleDir := filepath.Join(badDir, "subdir") |
| 100 | |
| 101 | ccache := &CCache{Enabled: true, Dir: impossibleDir, MaxSize: "1G"} |
| 102 | if err := ccache.Setup(); err == nil { |
| 103 | t.Error("Setup() should fail when mkdir fails") |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | func TestCCache_Generate(t *testing.T) { |
| 108 | var builder strings.Builder |