aboutsummaryrefslogtreecommitdiff
path: root/rwtransaction_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'rwtransaction_test.go')
-rw-r--r--rwtransaction_test.go39
1 files changed, 35 insertions, 4 deletions
diff --git a/rwtransaction_test.go b/rwtransaction_test.go
index 5bf3f9f..88a246f 100644
--- a/rwtransaction_test.go
+++ b/rwtransaction_test.go
@@ -17,11 +17,12 @@ func TestRWTransaction(t *testing.T) {
txn, err := db.RWTransaction()
assert.NotNil(t, txn)
assert.NoError(t, err)
+ assert.Equal(t, txn.DB(), db)
})
}
// Ensure that a bucket can be created and retrieved.
-func TestTransactionCreateBucket(t *testing.T) {
+func TestRWTransactionCreateBucket(t *testing.T) {
withOpenDB(func(db *DB, path string) {
// Create a bucket.
err := db.CreateBucket("widgets")
@@ -35,7 +36,7 @@ func TestTransactionCreateBucket(t *testing.T) {
}
// Ensure that a bucket cannot be created twice.
-func TestTransactionRecreateBucket(t *testing.T) {
+func TestRWTransactionRecreateBucket(t *testing.T) {
withOpenDB(func(db *DB, path string) {
// Create a bucket.
err := db.CreateBucket("widgets")
@@ -48,7 +49,7 @@ func TestTransactionRecreateBucket(t *testing.T) {
}
// Ensure that a bucket is created with a non-blank name.
-func TestTransactionCreateBucketWithoutName(t *testing.T) {
+func TestRWTransactionCreateBucketWithoutName(t *testing.T) {
withOpenDB(func(db *DB, path string) {
err := db.CreateBucket("")
assert.Equal(t, err, &Error{"bucket name cannot be blank", nil})
@@ -56,7 +57,7 @@ func TestTransactionCreateBucketWithoutName(t *testing.T) {
}
// Ensure that a bucket name is not too long.
-func TestTransactionCreateBucketWithLongName(t *testing.T) {
+func TestRWTransactionCreateBucketWithLongName(t *testing.T) {
withOpenDB(func(db *DB, path string) {
err := db.CreateBucket(strings.Repeat("X", 255))
assert.NoError(t, err)
@@ -66,6 +67,36 @@ func TestTransactionCreateBucketWithLongName(t *testing.T) {
})
}
+// Ensure that a bucket can be deleted.
+func TestRWTransactionDeleteBucket(t *testing.T) {
+ t.Skip("pending") // TODO(benbjohnson)
+}
+
+// Ensure that an error is returned when inserting into a bucket that doesn't exist.
+func TestRWTransactionPutBucketNotFound(t *testing.T) {
+ t.Skip("pending") // TODO(benbjohnson)
+}
+
+// Ensure that an error is returned when inserting with an empty key.
+func TestRWTransactionPutEmptyKey(t *testing.T) {
+ t.Skip("pending") // TODO(benbjohnson)
+}
+
+// Ensure that an error is returned when inserting with a key that's too large.
+func TestRWTransactionPutKeyTooLarge(t *testing.T) {
+ t.Skip("pending") // TODO(benbjohnson)
+}
+
+// Ensure that an error is returned when inserting with data that's too large.
+func TestRWTransactionPutDataTooLarge(t *testing.T) {
+ t.Skip("pending") // TODO(benbjohnson)
+}
+
+// Ensure that an error is returned when deleting from a bucket that doesn't exist.
+func TestRWTransactionDeleteBucketNotFound(t *testing.T) {
+ t.Skip("pending") // TODO(benbjohnson)
+}
+
// Ensure that a bucket can write random keys and values across multiple txns.
func TestRWTransactionPutSingle(t *testing.T) {
index := 0