Merge pull request #367 from mdlayher/master

bucket_test: add test for ErrValueTooLarge on insert
pull/34/head
Ben Johnson 2015-06-03 13:34:06 -06:00
commit 34b7c13e04
1 changed files with 12 additions and 0 deletions

View File

@ -640,6 +640,18 @@ func TestBucket_Put_KeyTooLarge(t *testing.T) {
})
}
// Ensure that an error is returned when inserting a value that's too large.
func TestBucket_Put_ValueTooLarge(t *testing.T) {
db := NewTestDB()
defer db.Close()
db.Update(func(tx *bolt.Tx) error {
tx.CreateBucket([]byte("widgets"))
err := tx.Bucket([]byte("widgets")).Put([]byte("foo"), make([]byte, bolt.MaxValueSize+1))
equals(t, err, bolt.ErrValueTooLarge)
return nil
})
}
// Ensure a bucket can calculate stats.
func TestBucket_Stats(t *testing.T) {
db := NewTestDB()