aboutsummaryrefslogtreecommitdiff
path: root/cmd/bolt/set_test.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-04-11 14:31:34 -0600
committerBen Johnson <benbjohnson@yahoo.com>2014-04-11 14:31:34 -0600
commit714436100adf98a5132e6f4ddb3290231ff89dfd (patch)
tree8a9272322aa759b3d911d3698e6ec21cf71e78d7 /cmd/bolt/set_test.go
parentAdd nested buckets. (diff)
parentMerge pull request #128 from benbjohnson/import-export (diff)
downloaddedo-714436100adf98a5132e6f4ddb3290231ff89dfd.tar.gz
dedo-714436100adf98a5132e6f4ddb3290231ff89dfd.tar.xz
Merge branch 'master' into nested-keys
Conflicts: db_test.go tx_test.go
Diffstat (limited to 'cmd/bolt/set_test.go')
-rw-r--r--cmd/bolt/set_test.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/cmd/bolt/set_test.go b/cmd/bolt/set_test.go
index d76b3c0..519d888 100644
--- a/cmd/bolt/set_test.go
+++ b/cmd/bolt/set_test.go
@@ -11,13 +11,14 @@ import (
// Ensure that a value can be set from the CLI.
func TestSet(t *testing.T) {
SetTestMode(true)
- open(func(db *bolt.DB) {
+ open(func(db *bolt.DB, path string) {
db.Update(func(tx *bolt.Tx) error {
tx.CreateBucket("widgets")
return nil
})
- assert.Equal(t, "", run("set", db.Path(), "widgets", "foo", "bar"))
- assert.Equal(t, "bar", run("get", db.Path(), "widgets", "foo"))
+ db.Close()
+ assert.Equal(t, "", run("set", path, "widgets", "foo", "bar"))
+ assert.Equal(t, "bar", run("get", path, "widgets", "foo"))
})
}
@@ -31,8 +32,9 @@ func TestSetDBNotFound(t *testing.T) {
// Ensure that an error is reported if the bucket is not found.
func TestSetBucketNotFound(t *testing.T) {
SetTestMode(true)
- open(func(db *bolt.DB) {
- output := run("set", db.Path(), "widgets", "foo", "bar")
+ open(func(db *bolt.DB, path string) {
+ db.Close()
+ output := run("set", path, "widgets", "foo", "bar")
assert.Equal(t, "bucket not found: widgets", output)
})
}