Skip to content
Source on GitHub (opens in a new tab)
import "github.com/barevoidco/zelk/core/memory/memorytest"

Package memorytest is the conformance kit every memory.Store passes: conditional creates, corrections and forgets, scope isolation, ordering, refusal of invalid notes, and concurrent writers.

func Run(t *testing.T, f Factory)

Run checks that the stores made by f behave as memory.Store requires.

type Factory func(t *testing.T, now func() time.Time) Subject

Factory sets up one store’s empty backing state for a case. The stores it opens stamp notes with now.

type Subject struct {
// Open opens a store over the state. Every store opened must share it:
// for an in-memory store, the same store; for one kept in files, a new
// store over the same files, as another process would open.
Open func(t *testing.T) memory.Store
}

Subject is one case’s backing state.