summaryrefslogtreecommitdiff
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
parentd9e0c3e86b03834a03e7ddf37b70cc141eccfe1c (diff)
downloadhakyll-8cec091e04e9bf1fa8cad01056d1c9cbed4fa44f.tar.gz
Add some tests for RelativizeUrls
-rw-r--r--tests/Hakyll/Web/Page/Tests.hs3
-rw-r--r--tests/Hakyll/Web/RelativizeUrls/Tests.hs21
-rw-r--r--tests/TestSuite.hs3
3 files changed, 25 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>"
+ ]
diff --git a/tests/TestSuite.hs b/tests/TestSuite.hs
index 5d401d2..8787bbd 100644
--- a/tests/TestSuite.hs
+++ b/tests/TestSuite.hs
@@ -6,6 +6,7 @@ import qualified Hakyll.Core.DirectedGraph.Tests
import qualified Hakyll.Core.Identifier.Tests
import qualified Hakyll.Core.Routes.Tests
import qualified Hakyll.Web.Page.Tests
+import qualified Hakyll.Web.RelativizeUrls.Tests
import qualified Hakyll.Web.Template.Tests
main :: IO ()
@@ -18,6 +19,8 @@ main = defaultMain
Hakyll.Core.Routes.Tests.tests
, testGroup "Hakyll.Web.Page.Tests"
Hakyll.Web.Page.Tests.tests
+ , testGroup "Hakyll.Web.RelativizeUrls.Tests"
+ Hakyll.Web.RelativizeUrls.Tests.tests
, testGroup "Hakyll.Web.Template.Tests"
Hakyll.Web.Template.Tests.tests
]