summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2012-11-19 15:12:53 +0100
committerJasper Van der Jeugt <m@jaspervdj.be>2012-11-19 15:12:53 +0100
commit802742cdbed1bb0afa022e072621e621d21158f6 (patch)
tree3fa7e6bd6d7bdb70257bf2f7717607a3fdf0d702 /tests
parent88ffd3c5bea6b5e5cb1004173130b5691a7591f6 (diff)
downloadhakyll-802742cdbed1bb0afa022e072621e621d21158f6.tar.gz
Remove hamlet, add function fields
Diffstat (limited to 'tests')
-rw-r--r--tests/Hakyll/Web/Template/Tests.hs13
-rw-r--r--tests/data/template.html1
-rw-r--r--tests/data/template.html.out (renamed from tests/data/example.md.out)1
3 files changed, 13 insertions, 2 deletions
diff --git a/tests/Hakyll/Web/Template/Tests.hs b/tests/Hakyll/Web/Template/Tests.hs
index 42be506..4e49d1f 100644
--- a/tests/Hakyll/Web/Template/Tests.hs
+++ b/tests/Hakyll/Web/Template/Tests.hs
@@ -6,6 +6,7 @@ module Hakyll.Web.Template.Tests
--------------------------------------------------------------------------------
+import Data.Monoid (mconcat)
import Test.Framework (Test, testGroup)
import Test.Framework.Providers.HUnit (testCase)
import Test.HUnit (Assertion, (@=?))
@@ -32,9 +33,17 @@ case01 :: Assertion
case01 = withTestStore $ \store -> do
provider <- newTestProvider store
- out <- resourceString provider "example.md.out"
+ out <- resourceString provider "template.html.out"
tpl <- testCompilerDone store provider "template.html" $ templateCompiler
item <- testCompilerDone store provider "example.md" $
- pageCompiler >>= applyTemplate (itemBody tpl) defaultContext
+ pageCompiler >>= applyTemplate (itemBody tpl) testContext
out @=? itemBody item
+
+
+--------------------------------------------------------------------------------
+testContext :: Context String
+testContext = mconcat
+ [ functionField "echo" (\args _ -> return $ unwords args)
+ , defaultContext
+ ]
diff --git a/tests/data/template.html b/tests/data/template.html
index 8fa47e4..52189a3 100644
--- a/tests/data/template.html
+++ b/tests/data/template.html
@@ -1,3 +1,4 @@
<div>
+ $echo test$
$body$
</div>
diff --git a/tests/data/example.md.out b/tests/data/template.html.out
index f2c4c28..51a105e 100644
--- a/tests/data/example.md.out
+++ b/tests/data/template.html.out
@@ -1,3 +1,4 @@
<div>
+ test
<p>This is an example.</p>
</div>