Ensure that a bucket retrieved via Get() returns a nil.
(t *testing.T)
| 62 | |
| 63 | // Ensure that a bucket retrieved via Get() returns a nil. |
| 64 | func TestBucket_Get_IncompatibleValue(t *testing.T) { |
| 65 | db := btesting.MustCreateDB(t) |
| 66 | if err := db.Update(func(tx *bolt.Tx) error { |
| 67 | _, err := tx.CreateBucket([]byte("widgets")) |
| 68 | if err != nil { |
| 69 | t.Fatal(err) |
| 70 | } |
| 71 | |
| 72 | if _, err := tx.Bucket([]byte("widgets")).CreateBucket([]byte("foo")); err != nil { |
| 73 | t.Fatal(err) |
| 74 | } |
| 75 | |
| 76 | if tx.Bucket([]byte("widgets")).Get([]byte("foo")) != nil { |
| 77 | t.Fatal("expected nil value") |
| 78 | } |
| 79 | return nil |
| 80 | }); err != nil { |
| 81 | t.Fatal(err) |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | // Ensure that a slice returned from a bucket has a capacity equal to its length. |
| 86 | // This also allows slices to be appended to since it will require a realloc by Go. |
nothing calls this directly
no test coverage detected