summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2012-08-10 09:38:31 +0900
committerJasper Van der Jeugt <m@jaspervdj.be>2012-08-10 09:38:31 +0900
commit3751d0a7ad5feea6a7c79d2e041c250a1d0a356f (patch)
treed11d3a2226db44d67599050751a25cad6bd11c3f
parentedfdb7d677e443a6809b1d98e54d861898109412 (diff)
downloadhakyll-3751d0a7ad5feea6a7c79d2e041c250a1d0a356f.tar.gz
Bump hamlet dependency
Closes #81
-rw-r--r--hakyll.cabal4
-rw-r--r--tests/Hakyll/Web/Template/Tests.hs17
2 files changed, 11 insertions, 10 deletions
diff --git a/hakyll.cabal b/hakyll.cabal
index 271439c..b9d2378 100644
--- a/hakyll.cabal
+++ b/hakyll.cabal
@@ -74,7 +74,7 @@ Library
cryptohash >= 0.7 && < 0.8,
directory >= 1.0 && < 1.2,
filepath >= 1.0 && < 1.4,
- hamlet >= 1.0 && < 1.1,
+ hamlet >= 1.0 && < 1.2,
mtl >= 1 && < 2.2,
old-locale >= 1.0 && < 1.1,
old-time >= 1.0 && < 1.2,
@@ -182,7 +182,7 @@ Test-suite hakyll-tests
cryptohash >= 0.7 && < 0.8,
directory >= 1.0 && < 1.2,
filepath >= 1.0 && < 1.4,
- hamlet >= 1.0 && < 1.1,
+ hamlet >= 1.0 && < 1.2,
mtl >= 1 && < 2.2,
old-locale >= 1.0 && < 1.1,
old-time >= 1.0 && < 1.2,
diff --git a/tests/Hakyll/Web/Template/Tests.hs b/tests/Hakyll/Web/Template/Tests.hs
index 36c4374..991a76f 100644
--- a/tests/Hakyll/Web/Template/Tests.hs
+++ b/tests/Hakyll/Web/Template/Tests.hs
@@ -17,17 +17,18 @@ tests :: [Test]
tests = fromAssertions "applyTemplate"
-- Hakyll templates
[ applyTemplateAssertion readTemplate applyTemplate
- "bar" "$foo$" [("foo", "bar")]
+ ("bar" @=?) "$foo$" [("foo", "bar")]
, applyTemplateAssertion readTemplate applyTemplate
- "$ barqux" "$$ $foo$$bar$" [("foo", "bar"), ("bar", "qux")]
+ ("$ barqux" @=?) "$$ $foo$$bar$" [("foo", "bar"), ("bar", "qux")]
, applyTemplateAssertion readTemplate applyTemplate
- "$foo$" "$foo$" []
+ ("$foo$" @=?) "$foo$" []
-- Hamlet templates
, applyTemplateAssertion readHamletTemplate applyTemplate
- "<head><title>notice</title></head><body>A paragraph</body>"
+ (("<head><title>notice</title></head><body>A paragraph</body>" @=?) .
+ filter (/= '\n'))
"<head>\n\
\ <title>#{title}\n\
\<body>\n\
@@ -39,16 +40,16 @@ tests = fromAssertions "applyTemplate"
missing "bar" = "qux"
missing x = reverse x
in applyTemplateAssertion readTemplate (applyTemplateWith missing)
- "bar foo ver" "$foo$ $bar$ $rev$" [("bar", "foo")]
+ ("bar foo ver" @=?) "$foo$ $bar$ $rev$" [("bar", "foo")]
]
-- | Utility function to create quick template tests
--
applyTemplateAssertion :: (String -> Template)
-> (Template -> Page String -> Page String)
- -> String
+ -> (String -> Assertion)
-> String
-> [(String, String)]
-> Assertion
-applyTemplateAssertion parser apply expected template page =
- expected @=? pageBody (apply (parser template) (fromMap $ M.fromList page))
+applyTemplateAssertion parser apply correct template page =
+ correct $ pageBody (apply (parser template) (fromMap $ M.fromList page))