MCPcopy Create free account
hub / github.com/cli/cli / useCacheDir

Function useCacheDir

script/ghmock/schemafiles_test.go:42–49  ·  view source on GitHub ↗

useCacheDir gives a test its own cache folder and returns ghmock's folder inside it.

(t *testing.T)

Source from the content-addressed store, hash-verified

40// useCacheDir gives a test its own cache folder and returns ghmock's folder
41// inside it.
42func 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
51func readTestdata(t *testing.T, name string) string {
52 t.Helper()

Callers 2

TestSchemaSourceLocateFunction · 0.85
TestCmdSchemasFunction · 0.85

Calls 2

JoinMethod · 0.80
HelperMethod · 0.65

Tested by

no test coverage detected