on master help sign in
Add some tests for RelativizeUrls
commit8cec091e04e9bf1fa8cad01056d1c9cbed4fa44f authorJasper Van der Jeugt <jaspervdj@gmail.com> dateWed 9 Feb 2011, 19:57 (16 years ago) parentd9e0c3e
3 files changed+25−2
tests/Hakyll/Web/Page/Tests.hs+1−2 tests/Hakyll/Web/RelativizeUrls/Tests.hs+21 tests/TestSuite.hs+3
tests/Hakyll/Web/Page/Tests.hs+1−2
@@ -15,8 +15,7 @@ import Hakyll.Web.Page.Read
1515import TestSuite.Util
1616
1717tests :: [Test]
18−tests = fromAssertions "applyTemplate"
19− -- Hakyll templates
18+tests = fromAssertions "readPage"
2019 [ Page (M.singleton "foo" "bar") "body\n" @=? readPage
2120 "--- \n\
2221 \foo: bar \n\
tests/Hakyll/Web/RelativizeUrls/Tests.hsnew file+21
@@ -0,0 +1,21 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+module Hakyll.Web.RelativizeUrls.Tests
3+ ( tests
4+ ) where
5+
6+import Test.Framework
7+import Test.Framework.Providers.HUnit
8+import Test.HUnit hiding (Test)
9+
10+import Hakyll.Web.RelativizeUrls
11+import TestSuite.Util
12+
13+tests :: [Test]
14+tests = fromAssertions "relativizeUrls"
15+ [ "<a href=\"../foo\">bar</a>" @=?
16+ relativizeUrls ".." "<a href=\"/foo\">bar</a>"
17+ , "<img src=\"../../images/lolcat.png\"></img>" @=?
18+ relativizeUrls "../.." "<img src=\"/images/lolcat.png\" />"
19+ , "<a href=\"http://haskell.org\">Haskell</a>" @=?
20+ relativizeUrls "../.." "<a href=\"http://haskell.org\">Haskell</a>"
21+ ]
tests/TestSuite.hs+3
@@ -6,6 +6,7 @@ import qualified Hakyll.Core.DirectedGraph.Tests
66import qualified Hakyll.Core.Identifier.Tests
77import qualified Hakyll.Core.Routes.Tests
88import qualified Hakyll.Web.Page.Tests
9+import qualified Hakyll.Web.RelativizeUrls.Tests
910import qualified Hakyll.Web.Template.Tests
1011
1112main :: IO ()
@@ -18,6 +19,8 @@ main = defaultMain
1819 Hakyll.Core.Routes.Tests.tests
1920 , testGroup "Hakyll.Web.Page.Tests"
2021 Hakyll.Web.Page.Tests.tests
22+ , testGroup "Hakyll.Web.RelativizeUrls.Tests"
23+ Hakyll.Web.RelativizeUrls.Tests.tests
2124 , testGroup "Hakyll.Web.Template.Tests"
2225 Hakyll.Web.Template.Tests.tests
2326 ]