diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-05-24 22:29:47 +0200 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-05-24 22:29:47 +0200 |
commit | 6025e2fab8eae692b6af8ad8f2a6e3f27ebeafc4 (patch) | |
tree | c26db0be8b52f7b15e280630afdc1c5a7456d3af /tests/Hakyll/Core/Rules | |
parent | 1dff099486f5baaf7bebd74eb70247647ab342f0 (diff) | |
download | hakyll-6025e2fab8eae692b6af8ad8f2a6e3f27ebeafc4.tar.gz |
Finish rules test
Diffstat (limited to 'tests/Hakyll/Core/Rules')
-rw-r--r-- | tests/Hakyll/Core/Rules/Tests.hs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/Hakyll/Core/Rules/Tests.hs b/tests/Hakyll/Core/Rules/Tests.hs index 42b95fc..1b388e8 100644 --- a/tests/Hakyll/Core/Rules/Tests.hs +++ b/tests/Hakyll/Core/Rules/Tests.hs @@ -4,10 +4,14 @@ module Hakyll.Core.Rules.Tests where import qualified Data.Map as M +import qualified Data.Set as S import Test.Framework +import Test.Framework.Providers.HUnit +import Test.HUnit hiding (Test) import Hakyll.Core.Rules +import Hakyll.Core.Rules.Internal import Hakyll.Core.Identifier import Hakyll.Core.Routes import Hakyll.Core.Compiler @@ -15,6 +19,26 @@ import Hakyll.Core.Resource.Provider import Hakyll.Core.Resource.Provider.Dummy import Hakyll.Web.Page +tests :: [Test] +tests = + [ testCase "runRules" rulesTest + ] + +-- | Main test +-- +rulesTest :: Assertion +rulesTest = do + p <- provider + let ruleSet = runRules rules p + assert $ expected == S.fromList (map fst (rulesCompilers ruleSet)) + where + expected = S.fromList + [ Identifier Nothing "posts/a-post.markdown" + , Identifier Nothing "posts/some-other-post.markdown" + , Identifier (Just "raw") "posts/a-post.markdown" + , Identifier (Just "raw") "posts/some-other-post.markdown" + ] + -- | Dummy resource provider -- provider :: IO ResourceProvider @@ -34,6 +58,7 @@ rules = do -- Compile them, raw group "raw" $ do + route idRoute match "posts/*" $ do route $ setExtension "html" compile getResourceString |