MCPcopy
hub / github.com/perkeep/perkeep / test

Method test

pkg/index/sqlite/sqlite_test.go:64–81  ·  view source on GitHub ↗
(t *testing.T, tfn func(*testing.T, func() *index.Index))

Source from the content-addressed store, hash-verified

62type tester struct{}
63
64func (tester) test(t *testing.T, tfn func(*testing.T, func() *index.Index)) {
65 var mu sync.Mutex // guards cleanups
66 var cleanups []func()
67 defer func() {
68 mu.Lock() // never unlocked
69 for _, fn := range cleanups {
70 fn()
71 }
72 }()
73 makeIndex := func() *index.Index {
74 s, cleanup := newSorted(t)
75 mu.Lock()
76 cleanups = append(cleanups, cleanup)
77 mu.Unlock()
78 return indextest.MustNew(t, s)
79 }
80 tfn(t, makeIndex)
81}
82
83func TestIndex_SQLite(t *testing.T) {
84 tester{}.test(t, indextest.Index)

Callers 5

TestIndex_SQLiteFunction · 0.45
TestFiles_SQLiteFunction · 0.45
TestEdgesTo_SQLiteFunction · 0.45
TestDelete_SQLiteFunction · 0.45

Calls 4

MustNewFunction · 0.92
newSortedFunction · 0.85
LockMethod · 0.80
UnlockMethod · 0.80

Tested by

no test coverage detected