Ensure that a cursor can return a reference to the bucket that created it.
(t *testing.T)
| 151 | |
| 152 | // Ensure that a cursor can return a reference to the bucket that created it. |
| 153 | func 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. |
| 170 | func TestCursor_Seek(t *testing.T) { |
nothing calls this directly
no test coverage detected