From 8b08bd4a8065cb7a240761c3683e8f837b06cc3c Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Sun, 27 Dec 2015 15:27:39 -0700 Subject: test suite refactoring This commit refactors the test suite to make it cleaner and to use the standard testing library better. The `assert()`, `equals()`, and `ok()` functions have been removed and some test names have been changed for clarity. No functionality has been changed. --- simulation_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'simulation_test.go') diff --git a/simulation_test.go b/simulation_test.go index ceb8bae..c691527 100644 --- a/simulation_test.go +++ b/simulation_test.go @@ -42,8 +42,8 @@ func testSimulate(t *testing.T, threadCount, parallelism int) { var versions = make(map[int]*QuickDB) versions[1] = NewQuickDB() - db := NewTestDB() - defer db.Close() + db := MustOpenDB() + defer db.MustClose() var mutex sync.Mutex @@ -89,10 +89,12 @@ func testSimulate(t *testing.T, threadCount, parallelism int) { versions[tx.ID()] = qdb mutex.Unlock() - ok(t, tx.Commit()) + if err := tx.Commit(); err != nil { + t.Fatal(err) + } }() } else { - defer tx.Rollback() + defer func() { _ = tx.Rollback() }() } // Ignore operation if we don't have data yet. -- cgit v1.2.3