diff options
author | Mekeor Melire <mekeor@ymail.com> | 2012-08-11 01:31:27 +0200 |
---|---|---|
committer | Mekeor Melire <mekeor@ymail.com> | 2012-08-11 01:31:27 +0200 |
commit | 0f484c49be07f0729d89d562f02a40109872737a (patch) | |
tree | b47bab7a72db5cdb80345eda3d0822f41bbb75a3 /tests/Hakyll | |
parent | 998db08a7f0f3464515fe0328d22fb91ffd9dc11 (diff) | |
parent | a0f5193d970a0fc387c37c8629b37a1088a8e5f4 (diff) | |
download | hakyll-0f484c49be07f0729d89d562f02a40109872737a.tar.gz |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'tests/Hakyll')
-rw-r--r-- | tests/Hakyll/Web/Template/Tests.hs | 17 |
1 files changed, 9 insertions, 8 deletions
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)) |