(t *testing.T, tfn func(*testing.T, func() *index.Index))
| 62 | type tester struct{} |
| 63 | |
| 64 | func (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 | |
| 83 | func TestIndex_SQLite(t *testing.T) { |
| 84 | tester{}.test(t, indextest.Index) |
no test coverage detected