(t *testing.T)
| 12 | ) |
| 13 | |
| 14 | func newTestDevArtifactCache(t *testing.T) *DevArtifactCache { |
| 15 | t.Helper() |
| 16 | |
| 17 | // Redirect workspace so TmpFilesDir is inside the sandbox. |
| 18 | oldWS := dirs.WorkspaceDir |
| 19 | tmpWS := t.TempDir() |
| 20 | dirs.Init(tmpWS) |
| 21 | t.Cleanup(func() { dirs.Init(oldWS) }) |
| 22 | |
| 23 | cacheDir := filepath.Join(tmpWS, "devcache") |
| 24 | if err := os.MkdirAll(cacheDir, os.ModePerm); err != nil { |
| 25 | t.Fatal(err) |
| 26 | } |
| 27 | |
| 28 | return NewDevArtifactCache(fakeContext{}, cacheDir) |
| 29 | } |
| 30 | |
| 31 | // makePackageDir creates a fake built package directory with a couple of files |
| 32 | // inside, mimicking what doInstallFromSource leaves behind. |
no test coverage detected