summaryrefslogtreecommitdiff
path: root/tests/TestSuite
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-05-25 11:24:33 +0200
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-05-25 11:24:33 +0200
commitd004dc19996c5d1a96a36c46c2580c3f0db33261 (patch)
tree9976bcbf12d2b91c069275d6345e929d61184b36 /tests/TestSuite
parent63a637f27cc51006c6b432337c232c17bfe0b0c2 (diff)
downloadhakyll-d004dc19996c5d1a96a36c46c2580c3f0db33261.tar.gz
Test for UnixFilter
Diffstat (limited to 'tests/TestSuite')
-rw-r--r--tests/TestSuite/Util.hs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/TestSuite/Util.hs b/tests/TestSuite/Util.hs
index f32bcad..d82b280 100644
--- a/tests/TestSuite/Util.hs
+++ b/tests/TestSuite/Util.hs
@@ -2,15 +2,43 @@
--
module TestSuite.Util
( fromAssertions
+ , makeStoreTest
+ , runCompilerJobTest
) where
+import Data.Monoid (mempty)
+
import Test.Framework
import Test.Framework.Providers.HUnit
import Test.HUnit hiding (Test)
+import Hakyll.Core.Compiler.Internal
+import Hakyll.Core.Identifier
+import Hakyll.Core.Logger
+import Hakyll.Core.Resource.Provider
+import Hakyll.Core.Store
+
fromAssertions :: String -- ^ Name
-> [Assertion] -- ^ Cases
-> [Test] -- ^ Result tests
fromAssertions name = zipWith testCase names
where
names = map (\n -> name ++ " [" ++ show n ++ "]") [1 :: Int ..]
+
+-- | Create a store for testing
+--
+makeStoreTest :: IO Store
+makeStoreTest = makeStore "_store"
+
+-- | Testing for 'runCompilerJob'
+--
+runCompilerJobTest :: Compiler () a
+ -> Identifier
+ -> ResourceProvider
+ -> [Identifier]
+ -> IO a
+runCompilerJobTest compiler id' provider uni = do
+ store <- makeStoreTest
+ logger <- makeLogger $ const $ return ()
+ Right x <- runCompilerJob compiler id' provider uni mempty store True logger
+ return x