aboutsummaryrefslogtreecommitdiff
path: root/db_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'db_test.go')
-rw-r--r--db_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/db_test.go b/db_test.go
new file mode 100644
index 0000000..534bc3c
--- /dev/null
+++ b/db_test.go
@@ -0,0 +1,27 @@
+package bolt
+
+import (
+ "io/ioutil"
+ "os"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestDBOpen(t *testing.T) {
+ withDB(func(db *DB, path string) {
+ err := db.Open(path, 0666)
+ assert.NoError(t, err)
+ })
+}
+
+func withDB(fn func(*DB, string)) {
+ f, _ := ioutil.TempFile("", "bolt-")
+ path := f.Name()
+ f.Close()
+ os.Remove(path)
+ defer os.RemoveAll(path)
+
+ db := NewDB()
+ fn(db, path)
+}