| 8 | ) |
| 9 | |
| 10 | func TestCCache_Setup_Enabled(t *testing.T) { |
| 11 | disable, _ := os.LookupEnv("CCACHE_DISABLE") |
| 12 | defer func() { |
| 13 | if disable != "" { |
| 14 | os.Setenv("CCACHE_DISABLE", disable) |
| 15 | } else { |
| 16 | os.Unsetenv("CCACHE_DISABLE") |
| 17 | } |
| 18 | }() |
| 19 | |
| 20 | dir := t.TempDir() |
| 21 | ccache := &CCache{Enabled: true, Dir: dir} |
| 22 | |
| 23 | if err := ccache.Setup(); err != nil { |
| 24 | t.Fatalf("Setup() error = %v", err) |
| 25 | } |
| 26 | |
| 27 | if v := os.Getenv("CCACHE_DISABLE"); v == "1" { |
| 28 | t.Errorf("CCACHE_DISABLE = %q, want 0", v) |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | func TestCCache_Setup_Disabled(t *testing.T) { |
| 33 | disable, _ := os.LookupEnv("CCACHE_DISABLE") |