aboutsummaryrefslogtreecommitdiff
path: root/c/cursor_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'c/cursor_test.go')
-rw-r--r--c/cursor_test.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/c/cursor_test.go b/c/cursor_test.go
index 12710d9..ff6d547 100644
--- a/c/cursor_test.go
+++ b/c/cursor_test.go
@@ -30,16 +30,11 @@ func TestIterate(t *testing.T) {
// Iterate over all items and check consistency.
var index = 0
tx, _ = db.Begin(false)
- var k, v C.bolt_val
c := NewCursor(tx.Bucket("widgets"))
- C.bolt_cursor_first(c, &k, &v)
- key := C.GoBytes(k.data, k.size)
- for key != nil && index < len(items) {
+ for key, value := c.first(); key != nil && index < len(items); key, value = c.next() {
assert.Equal(t, key, items[index].Key)
- assert.Equal(t, C.GoBytes(v.data, v.size), items[index].Value)
+ assert.Equal(t, value, items[index].Value)
index++
- C.bolt_cursor_next(c, &k, &v)
- key := C.GoBytes(k.data, k.size)
}
assert.Equal(t, len(items), index)
assert.Equal(t, len(items), index)