useCacheDir gives a test its own cache folder and returns ghmock's folder inside it.
(t *testing.T)
| 40 | // useCacheDir gives a test its own cache folder and returns ghmock's folder |
| 41 | // inside it. |
| 42 | func useCacheDir(t *testing.T) string { |
| 43 | t.Helper() |
| 44 | dir := t.TempDir() |
| 45 | old := userCacheDir |
| 46 | t.Cleanup(func() { userCacheDir = old }) |
| 47 | userCacheDir = func() (string, error) { return dir, nil } |
| 48 | return filepath.Join(dir, "ghmock") |
| 49 | } |
| 50 | |
| 51 | func readTestdata(t *testing.T, name string) string { |
| 52 | t.Helper() |
no test coverage detected