aboutsummaryrefslogtreecommitdiff
path: root/tx_test.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-05-29 08:02:15 -0600
committerBen Johnson <benbjohnson@yahoo.com>2014-05-29 08:02:15 -0600
commit2eaf8f7ce0ced2b5660f41a169447a8520bcc943 (patch)
tree338a93407332c554e0b703cb649a63a9874afff2 /tx_test.go
parentMerge pull request #177 from tv42/tx-copy-rollback (diff)
downloaddedo-2eaf8f7ce0ced2b5660f41a169447a8520bcc943.tar.gz
dedo-2eaf8f7ce0ced2b5660f41a169447a8520bcc943.tar.xz
Add freelist assertion on every free().
This commit performs a check on the freelist pages to ensure that a double free can never happen.
Diffstat (limited to 'tx_test.go')
-rw-r--r--tx_test.go25
1 files changed, 0 insertions, 25 deletions
diff --git a/tx_test.go b/tx_test.go
index 5cbe20f..2fe4723 100644
--- a/tx_test.go
+++ b/tx_test.go
@@ -288,31 +288,6 @@ func TestTx_OnCommit_Rollback(t *testing.T) {
assert.Equal(t, 0, x)
}
-// Ensure that a Tx in strict mode will fail when corrupted.
-func TestTx_Check_Corrupt(t *testing.T) {
- var msg string
- func() {
- defer func() {
- msg = fmt.Sprintf("%s", recover())
- }()
-
- withOpenDB(func(db *DB, path string) {
- db.StrictMode = true
- db.Update(func(tx *Tx) error {
- tx.CreateBucket([]byte("foo"))
-
- // Corrupt the DB by adding a page to the freelist.
- warn("---")
- db.freelist.free(0, tx.page(3))
-
- return nil
- })
- })
- }()
-
- assert.Equal(t, "check fail: page 3: already freed", msg)
-}
-
// Ensure that the database can be copied to a file path.
func TestTx_CopyFile(t *testing.T) {
withOpenDB(func(db *DB, path string) {