summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-05-24 14:40:45 +0200
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-05-24 14:40:45 +0200
commit1dff099486f5baaf7bebd74eb70247647ab342f0 (patch)
tree92e0556dec73f6f61f419575410cb060aa972664
parentf5c018a26d7593618e6fa52361e81e32128b0d2f (diff)
downloadhakyll-1dff099486f5baaf7bebd74eb70247647ab342f0.tar.gz
Rules tests should look like that
-rw-r--r--tests/Hakyll/Core/Rules/Tests.hs41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/Hakyll/Core/Rules/Tests.hs b/tests/Hakyll/Core/Rules/Tests.hs
new file mode 100644
index 0000000..42b95fc
--- /dev/null
+++ b/tests/Hakyll/Core/Rules/Tests.hs
@@ -0,0 +1,41 @@
+{-# LANGUAGE OverloadedStrings #-}
+{-# OPTIONS_GHC -fno-warn-unused-do-bind #-}
+module Hakyll.Core.Rules.Tests
+ where
+
+import qualified Data.Map as M
+
+import Test.Framework
+
+import Hakyll.Core.Rules
+import Hakyll.Core.Identifier
+import Hakyll.Core.Routes
+import Hakyll.Core.Compiler
+import Hakyll.Core.Resource.Provider
+import Hakyll.Core.Resource.Provider.Dummy
+import Hakyll.Web.Page
+
+-- | Dummy resource provider
+--
+provider :: IO ResourceProvider
+provider = dummyResourceProvider $ M.fromList $ map (flip (,) "No content")
+ [ "posts/a-post.markdown"
+ , "posts/some-other-post.markdown"
+ ]
+
+-- | Example rules
+--
+rules :: Rules
+rules = do
+ -- Compile some posts
+ match "posts/*" $ do
+ route $ setExtension "html"
+ compile pageCompiler
+
+ -- Compile them, raw
+ group "raw" $ do
+ match "posts/*" $ do
+ route $ setExtension "html"
+ compile getResourceString
+
+ return ()