Files
dolt/chunks/test_utils.go
Chris Masone 7a84f6313e Cleanup Close() and Ref() semantics in ChunkStore impls
In both FileStore and S3Store, the behavior of calling Ref() twice, or of
calling Ref() after Close() was undefined and probably crashy. After this,
the semantics are as follows:

Once either Ref() or Close() is called, you can't Write() any more.
Ref() can be called any number of times
Close() can be called any number of times
Ref() and Close() can be called in any order.

Addresses issue #6
2015-07-07 15:54:20 -07:00

17 lines
351 B
Go

package chunks
import (
"io/ioutil"
"github.com/attic-labs/noms/ref"
"github.com/stretchr/testify/assert"
)
func assertInputInStore(input string, ref ref.Ref, s ChunkStore, assert *assert.Assertions) {
reader, err := s.Get(ref)
assert.NoError(err)
data, err := ioutil.ReadAll(reader)
assert.NoError(err)
assert.Equal(input, string(data))
}