diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-05-27 18:25:09 +0200 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-05-27 18:25:09 +0200 |
commit | e2cce1b341fdbf65c270c7e64bb2f5264b8a4468 (patch) | |
tree | 081d546954662876f4af1d98c2b376921b38d94e /tests/TestSuite/Util.hs | |
parent | 0807e4c49aeb66fdbe9ea9a755b6865bfb075336 (diff) | |
parent | 5849ab36c784eebc6f0d9ae2ff7efe91c2f6e4ac (diff) | |
download | hakyll-e2cce1b341fdbf65c270c7e64bb2f5264b8a4468.tar.gz |
Merge branch 'master' into type-safe-identifiers
Diffstat (limited to 'tests/TestSuite/Util.hs')
-rw-r--r-- | tests/TestSuite/Util.hs | 28 |
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 |