From ee24437bfcb34dbf2549ecd26adc972c1eb7dc16 Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Sat, 11 Jan 2014 22:51:01 -0700 Subject: Initial db.open. --- db_test.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 db_test.go (limited to 'db_test.go') 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) +} -- cgit v1.2.3