summaryrefslogtreecommitdiff
path: root/tests/TestSuite
diff options
context:
space:
mode:
Diffstat (limited to 'tests/TestSuite')
-rw-r--r--tests/TestSuite/Util.hs16
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/TestSuite/Util.hs b/tests/TestSuite/Util.hs
index 6b19333..9403ce5 100644
--- a/tests/TestSuite/Util.hs
+++ b/tests/TestSuite/Util.hs
@@ -2,6 +2,8 @@
-- | Test utilities
module TestSuite.Util
( fromAssertions
+ , newTestStore
+ , cleanTestStore
, withTestStore
, newTestProvider
, testCompiler
@@ -36,11 +38,21 @@ fromAssertions name = zipWith testCase names
--------------------------------------------------------------------------------
+newTestStore :: IO Store
+newTestStore = Store.new True "_teststore"
+
+
+--------------------------------------------------------------------------------
+cleanTestStore :: IO ()
+cleanTestStore = removeDirectoryRecursive "_teststore"
+
+
+--------------------------------------------------------------------------------
withTestStore :: (Store -> IO a) -> IO a
withTestStore f = do
- store <- Store.new True "_teststore"
+ store <- newTestStore
result <- f store
- removeDirectoryRecursive "_teststore"
+ cleanTestStore
return result