diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-04-16 09:38:53 -0400 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-04-16 09:38:53 -0400 |
commit | 63a8cddd2bdc0b27e9174609a8bb8bcf0288f091 (patch) | |
tree | 85a7dd3971047fc8c13e0c1ceb0b93517476bf04 /cursor_test.go | |
parent | Merge pull request #130 from benbjohnson/create-bucket-api (diff) | |
download | dedo-63a8cddd2bdc0b27e9174609a8bb8bcf0288f091.tar.gz dedo-63a8cddd2bdc0b27e9174609a8bb8bcf0288f091.tar.xz |
Add Cursor.Bucket() function.
This commit adds an accessor to the Cursor type to retrieve the Bucket that
it was created from.
Diffstat (limited to 'cursor_test.go')
-rw-r--r-- | cursor_test.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/cursor_test.go b/cursor_test.go index 00fc561..5dd178e 100644 --- a/cursor_test.go +++ b/cursor_test.go @@ -8,6 +8,18 @@ import ( "github.com/stretchr/testify/assert" ) +// Ensure that a cursor can return a reference to the bucket that created it. +func TestCursor_Bucket(t *testing.T) { + withOpenDB(func(db *DB, path string) { + db.Update(func(tx *Tx) error { + b, _ := tx.CreateBucket([]byte("widgets")) + c := b.Cursor() + assert.Equal(t, b, c.Bucket()) + return nil + }) + }) +} + // Ensure that a Tx cursor can seek to the appropriate keys. func TestCursor_Seek(t *testing.T) { withOpenDB(func(db *DB, path string) { |