summaryrefslogtreecommitdiff
path: root/tests/Hakyll
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-02-09 19:57:25 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-02-09 19:57:25 +0100
commit8cec091e04e9bf1fa8cad01056d1c9cbed4fa44f (patch)
tree3f783078f1a0f28d71b9e738d6c3bf32c57827ab /tests/Hakyll
parentd9e0c3e86b03834a03e7ddf37b70cc141eccfe1c (diff)
downloadhakyll-8cec091e04e9bf1fa8cad01056d1c9cbed4fa44f.tar.gz
Add some tests for RelativizeUrls
Diffstat (limited to 'tests/Hakyll')
-rw-r--r--tests/Hakyll/Web/Page/Tests.hs3
-rw-r--r--tests/Hakyll/Web/RelativizeUrls/Tests.hs21
2 files changed, 22 insertions, 2 deletions
diff --git a/tests/Hakyll/Web/Page/Tests.hs b/tests/Hakyll/Web/Page/Tests.hs
index 14f3d7e..4f53988 100644
--- a/tests/Hakyll/Web/Page/Tests.hs
+++ b/tests/Hakyll/Web/Page/Tests.hs
@@ -15,8 +15,7 @@ import Hakyll.Web.Page.Read
import TestSuite.Util
tests :: [Test]
-tests = fromAssertions "applyTemplate"
- -- Hakyll templates
+tests = fromAssertions "readPage"
[ Page (M.singleton "foo" "bar") "body\n" @=? readPage
"--- \n\
\foo: bar \n\
diff --git a/tests/Hakyll/Web/RelativizeUrls/Tests.hs b/tests/Hakyll/Web/RelativizeUrls/Tests.hs
new file mode 100644
index 0000000..033c5fd
--- /dev/null
+++ b/tests/Hakyll/Web/RelativizeUrls/Tests.hs
@@ -0,0 +1,21 @@
+{-# LANGUAGE OverloadedStrings #-}
+module Hakyll.Web.RelativizeUrls.Tests
+ ( tests
+ ) where
+
+import Test.Framework
+import Test.Framework.Providers.HUnit
+import Test.HUnit hiding (Test)
+
+import Hakyll.Web.RelativizeUrls
+import TestSuite.Util
+
+tests :: [Test]
+tests = fromAssertions "relativizeUrls"
+ [ "<a href=\"../foo\">bar</a>" @=?
+ relativizeUrls ".." "<a href=\"/foo\">bar</a>"
+ , "<img src=\"../../images/lolcat.png\"></img>" @=?
+ relativizeUrls "../.." "<img src=\"/images/lolcat.png\" />"
+ , "<a href=\"http://haskell.org\">Haskell</a>" @=?
+ relativizeUrls "../.." "<a href=\"http://haskell.org\">Haskell</a>"
+ ]