Skip to content

Commit

Permalink
add cursor Seek("") check
Browse files Browse the repository at this point in the history
  • Loading branch information
Preetam committed Oct 5, 2016
1 parent 221aede commit c1b0c8e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lm2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,24 @@ func TestWriteBatch(t *testing.T) {
}
i++
}

// Check if cursor can be reset
cur.Seek("")
i = 0
for cur.Next() {
if cur.current.Deleted > 0 {
continue
}
if i == len(expected) {
t.Fatal("unexpected key", cur.Key())
}
if cur.Key() != expected[i][0] || cur.Value() != expected[i][1] {
t.Errorf("expected %v => %v, got %v => %v",
expected[i][0], expected[i][1], cur.Key(), cur.Value())
t.Logf("%+#v", cur.current)
}
i++
}
}

func TestWriteBatch1(t *testing.T) {
Expand Down

0 comments on commit c1b0c8e

Please sign in to comment.