MCPcopy
hub / github.com/etcd-io/bbolt / TestCursor_Bucket

Function TestCursor_Bucket

cursor_test.go:153–167  ·  view source on GitHub ↗

Ensure that a cursor can return a reference to the bucket that created it.

(t *testing.T)

Source from the content-addressed store, hash-verified

151
152// Ensure that a cursor can return a reference to the bucket that created it.
153func TestCursor_Bucket(t *testing.T) {
154 db := btesting.MustCreateDB(t)
155 if err := db.Update(func(tx *bolt.Tx) error {
156 b, err := tx.CreateBucket([]byte("widgets"))
157 if err != nil {
158 t.Fatal(err)
159 }
160 if cb := b.Cursor().Bucket(); !reflect.DeepEqual(cb, b) {
161 t.Fatal("cursor bucket mismatch")
162 }
163 return nil
164 }); err != nil {
165 t.Fatal(err)
166 }
167}
168
169// Ensure that a Tx cursor can seek to the appropriate keys.
170func TestCursor_Seek(t *testing.T) {

Callers

nothing calls this directly

Calls 6

MustCreateDBFunction · 0.92
UpdateMethod · 0.80
FatalMethod · 0.65
CreateBucketMethod · 0.45
BucketMethod · 0.45
CursorMethod · 0.45

Tested by

no test coverage detected