-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist_test.go
More file actions
45 lines (35 loc) · 742 Bytes
/
list_test.go
File metadata and controls
45 lines (35 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package bitcask
import (
"io/ioutil"
"testing"
"github.com/stretchr/testify/assert"
)
func TestList(t *testing.T) {
assert := assert.New(t)
testdir, err := ioutil.TempDir("", "bitcask")
assert.NoError(err)
var (
db *Bitcask
l *List
)
t.Run("Setup", func(t *testing.T) {
t.Run("Open", func(t *testing.T) {
db, err = Open(testdir)
assert.NoError(err)
l = db.List([]byte("foo"))
})
})
t.Run("Append", func(t *testing.T) {
err := l.Append([]byte("one"))
assert.NoError(err)
err = l.Append([]byte("two"))
assert.NoError(err)
err = l.Append([]byte("three"))
assert.NoError(err)
})
t.Run("Len", func(t *testing.T) {
len, err := l.Len()
assert.NoError(err)
assert.Equal(int64(3), len)
})
}