MCPcopy
hub / github.com/rclone/rclone / setup

Function setup

lib/cache/cache_test.go:19–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

17)
18
19func setup(t *testing.T) (*Cache, CreateFunc) {
20 called = 0
21 create := func(path string) (any, bool, error) {
22 assert.Equal(t, 0, called)
23 called++
24 switch path {
25 case "/":
26 return "/", true, nil
27 case "/file.txt":
28 return "/file.txt", true, errCached
29 case "/error":
30 return nil, false, errSentinel
31 case "/err":
32 return nil, false, errSentinel
33 }
34 panic(fmt.Sprintf("Unknown path %q", path))
35 }
36 c := New()
37 return c, create
38}
39
40func TestGet(t *testing.T) {
41 c, create := setup(t)

Callers 12

TestGetFunction · 0.85
TestGetFileFunction · 0.85
TestGetErrorFunction · 0.85
TestPutErrFunction · 0.85
TestPutFunction · 0.85
TestCacheExpireFunction · 0.85
TestCacheNoExpireFunction · 0.85
TestCachePinFunction · 0.85
TestClearFunction · 0.85
TestEntriesFunction · 0.85
TestGetMaybeFunction · 0.85
TestDeleteFunction · 0.85

Calls 2

NewFunction · 0.70
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…