summaryrefslogtreecommitdiff
path: root/tests/Hakyll/Web
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Hakyll/Web')
-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>"
+ ]