# 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.

<!-- Generated from the Go source of github.com/barevoidco/zelk/core/memory/memorytest (cmd/zelk/internal/reference TestReferenceGoAPI). Don't edit: change the code, then run make reference. -->

```go
import "github.com/barevoidco/zelk/core/memory/memorytest"
```

Package memorytest is the conformance kit every [memory.Store](/reference/go/memory/#store) passes: conditional creates, corrections and forgets, scope isolation, ordering, refusal of invalid notes, and concurrent writers.


## Run

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

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


## Factory

```go
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.


## Subject

```go
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.
