diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-01-11 22:51:01 -0700 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-01-11 22:51:01 -0700 |
commit | ee24437bfcb34dbf2549ecd26adc972c1eb7dc16 (patch) | |
tree | 5fe178109b3ece4a4d66fdc40cfbd70e52f48850 /db_test.go | |
parent | DB.Open(), pages, and meta. (diff) | |
download | dedo-ee24437bfcb34dbf2549ecd26adc972c1eb7dc16.tar.gz dedo-ee24437bfcb34dbf2549ecd26adc972c1eb7dc16.tar.xz |
Initial db.open.
Diffstat (limited to 'db_test.go')
-rw-r--r-- | db_test.go | 27 |
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) +} |