diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-05-21 13:46:12 -0600 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-05-21 13:46:12 -0600 |
commit | 7432bc341f8bbfc73eefc3278f2698e712e516b8 (patch) | |
tree | 33897520b5bd98383fe3b17cc9090e931c690b9c /bucket_test.go | |
parent | Merge pull request #171 from Shopify/tx_copy (diff) | |
parent | Fix freelist allocate(). (diff) | |
download | dedo-7432bc341f8bbfc73eefc3278f2698e712e516b8.tar.gz dedo-7432bc341f8bbfc73eefc3278f2698e712e516b8.tar.xz |
Merge pull request #169 from benbjohnson/allocation
Fix freelist allocation direction.
Diffstat (limited to 'bucket_test.go')
-rw-r--r-- | bucket_test.go | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/bucket_test.go b/bucket_test.go index f6bd13f..16172a5 100644 --- a/bucket_test.go +++ b/bucket_test.go @@ -899,30 +899,21 @@ func TestBucket_Delete_Quick(t *testing.T) { assert.NoError(t, err) // Remove items one at a time and check consistency. - for i, item := range items { + for _, item := range items { err := db.Update(func(tx *Tx) error { return tx.Bucket([]byte("widgets")).Delete(item.Key) }) assert.NoError(t, err) + } - // Anything before our deletion index should be nil. - db.View(func(tx *Tx) error { - b := tx.Bucket([]byte("widgets")) - for j, exp := range items { - value := b.Get(exp.Key) - if j > i { - if !assert.Equal(t, exp.Value, value) { - t.FailNow() - } - } else { - if !assert.Nil(t, value) { - t.FailNow() - } - } - } + // Anything before our deletion index should be nil. + db.View(func(tx *Tx) error { + tx.Bucket([]byte("widgets")).ForEach(func(k, v []byte) error { + t.Fatalf("bucket should be empty; found: %06x", trunc(k, 3)) return nil }) - } + return nil + }) }) return true } |