Ensure that a bucket that gets a non-existent key returns nil.
(t *testing.T)
| 23 | |
| 24 | // Ensure that a bucket that gets a non-existent key returns nil. |
| 25 | func TestBucket_Get_NonExistent(t *testing.T) { |
| 26 | db := btesting.MustCreateDB(t) |
| 27 | |
| 28 | if err := db.Update(func(tx *bolt.Tx) error { |
| 29 | b, err := tx.CreateBucket([]byte("widgets")) |
| 30 | if err != nil { |
| 31 | t.Fatal(err) |
| 32 | } |
| 33 | if v := b.Get([]byte("foo")); v != nil { |
| 34 | t.Fatal("expected nil value") |
| 35 | } |
| 36 | return nil |
| 37 | }); err != nil { |
| 38 | t.Fatal(err) |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | // Ensure that a bucket can read a value that is not flushed yet. |
| 43 | func TestBucket_Get_FromNode(t *testing.T) { |
nothing calls this directly
no test coverage detected