summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2012-12-25 22:49:17 +0100
committerJasper Van der Jeugt <m@jaspervdj.be>2012-12-25 22:49:29 +0100
commit69ffbe03563cdbc7be6b826e2def2fc797442792 (patch)
tree3792ce42ee2e9983876f9177533201dd712b76d1 /tests
parent2ae11c9d7f3138fe9e8397059c641e1962ede197 (diff)
downloadhakyll-69ffbe03563cdbc7be6b826e2def2fc797442792.tar.gz
Add demoteHeaders, refactor a bit
Diffstat (limited to 'tests')
-rw-r--r--tests/Hakyll/Web/Html/RelativizeUrls/Tests.hs (renamed from tests/Hakyll/Web/Urls/Relativize/Tests.hs)10
-rw-r--r--tests/Hakyll/Web/Html/Tests.hs (renamed from tests/Hakyll/Web/Urls/Tests.hs)24
-rw-r--r--tests/Hakyll/Web/Util/Html/Tests.hs29
-rw-r--r--tests/TestSuite.hs12
4 files changed, 30 insertions, 45 deletions
diff --git a/tests/Hakyll/Web/Urls/Relativize/Tests.hs b/tests/Hakyll/Web/Html/RelativizeUrls/Tests.hs
index 802a1ca..7799217 100644
--- a/tests/Hakyll/Web/Urls/Relativize/Tests.hs
+++ b/tests/Hakyll/Web/Html/RelativizeUrls/Tests.hs
@@ -1,22 +1,22 @@
--------------------------------------------------------------------------------
{-# LANGUAGE OverloadedStrings #-}
-module Hakyll.Web.Urls.Relativize.Tests
+module Hakyll.Web.Html.RelativizeUrls.Tests
( tests
) where
--------------------------------------------------------------------------------
-import Test.Framework (Test, testGroup)
-import Test.HUnit ((@=?))
+import Test.Framework (Test, testGroup)
+import Test.HUnit ((@=?))
--------------------------------------------------------------------------------
-import Hakyll.Web.Urls.Relativize
+import Hakyll.Web.Html.RelativizeUrls
import TestSuite.Util
--------------------------------------------------------------------------------
tests :: Test
-tests = testGroup "Hakyll.Web.Urls.Relativize.Tests" $
+tests = testGroup "Hakyll.Web.Html.RelativizeUrls.Tests" $
fromAssertions "relativizeUrls"
[ "<a href=\"../foo\">bar</a>" @=?
relativizeUrlsWith ".." "<a href=\"/foo\">bar</a>"
diff --git a/tests/Hakyll/Web/Urls/Tests.hs b/tests/Hakyll/Web/Html/Tests.hs
index 648f308..35ffe27 100644
--- a/tests/Hakyll/Web/Urls/Tests.hs
+++ b/tests/Hakyll/Web/Html/Tests.hs
@@ -1,5 +1,5 @@
--------------------------------------------------------------------------------
-module Hakyll.Web.Urls.Tests
+module Hakyll.Web.Html.Tests
( tests
) where
@@ -11,14 +11,19 @@ import Test.HUnit (assert, (@=?))
--------------------------------------------------------------------------------
-import Hakyll.Web.Urls
+import Hakyll.Web.Html
import TestSuite.Util
--------------------------------------------------------------------------------
tests :: Test
-tests = testGroup "Hakyll.Web.Urls.Tests" $ concat
- [ fromAssertions "withUrls"
+tests = testGroup "Hakyll.Web.Html.Tests" $ concat
+ [ fromAssertions "demoteHeaders"
+ [ "<h2>A h1 title</h2>" @=?
+ demoteHeaders "<h1>A h1 title</h1>"
+ ]
+
+ , fromAssertions "withUrls"
[ "<a href=\"FOO\">bar</a>" @=?
withUrls (map toUpper) "<a href=\"foo\">bar</a>"
, "<img src=\"OH BAR\" />" @=?
@@ -52,4 +57,15 @@ tests = testGroup "Hakyll.Web.Urls.Tests" $ concat
, assert (not (isExternal "../header.png"))
, assert (not (isExternal "/foo/index.html"))
]
+
+ , fromAssertions "stripTags"
+ [ "foo" @=? stripTags "<p>foo</p>"
+ , "foo bar" @=? stripTags "<p>foo</p> bar"
+ , "foo" @=? stripTags "<p>foo</p"
+ ]
+
+ , fromAssertions "escapeHtml"
+ [ "Me &amp; Dean" @=? escapeHtml "Me & Dean"
+ , "&lt;img&gt;" @=? escapeHtml "<img>"
+ ]
]
diff --git a/tests/Hakyll/Web/Util/Html/Tests.hs b/tests/Hakyll/Web/Util/Html/Tests.hs
deleted file mode 100644
index 3a99ca7..0000000
--- a/tests/Hakyll/Web/Util/Html/Tests.hs
+++ /dev/null
@@ -1,29 +0,0 @@
---------------------------------------------------------------------------------
-module Hakyll.Web.Util.Html.Tests
- ( tests
- ) where
-
-
---------------------------------------------------------------------------------
-import Test.Framework (Test, testGroup)
-import Test.HUnit ((@=?))
-
-
---------------------------------------------------------------------------------
-import Hakyll.Web.Util.Html
-import TestSuite.Util
-
-
---------------------------------------------------------------------------------
-tests :: Test
-tests = testGroup "Hakyll.Web.Util.Html" $ concat
- [ fromAssertions "stripTags"
- [ "foo" @=? stripTags "<p>foo</p>"
- , "foo bar" @=? stripTags "<p>foo</p> bar"
- , "foo" @=? stripTags "<p>foo</p"
- ]
- , fromAssertions "escapeHtml"
- [ "Me &amp; Dean" @=? escapeHtml "Me & Dean"
- , "&lt;img&gt;" @=? escapeHtml "<img>"
- ]
- ]
diff --git a/tests/TestSuite.hs b/tests/TestSuite.hs
index 15eea6d..9be857c 100644
--- a/tests/TestSuite.hs
+++ b/tests/TestSuite.hs
@@ -5,7 +5,7 @@ module Main
--------------------------------------------------------------------------------
-import Test.Framework (defaultMain)
+import Test.Framework (defaultMain)
--------------------------------------------------------------------------------
@@ -18,11 +18,10 @@ import qualified Hakyll.Core.Runtime.Tests
import qualified Hakyll.Core.Store.Tests
import qualified Hakyll.Core.UnixFilter.Tests
import qualified Hakyll.Core.Util.String.Tests
+import qualified Hakyll.Web.Html.RelativizeUrls.Tests
+import qualified Hakyll.Web.Html.Tests
import qualified Hakyll.Web.Template.Context.Tests
import qualified Hakyll.Web.Template.Tests
-import qualified Hakyll.Web.Urls.Relativize.Tests
-import qualified Hakyll.Web.Urls.Tests
-import qualified Hakyll.Web.Util.Html.Tests
--------------------------------------------------------------------------------
@@ -37,9 +36,8 @@ main = defaultMain
, Hakyll.Core.Store.Tests.tests
, Hakyll.Core.UnixFilter.Tests.tests
, Hakyll.Core.Util.String.Tests.tests
+ , Hakyll.Web.Html.RelativizeUrls.Tests.tests
+ , Hakyll.Web.Html.Tests.tests
, Hakyll.Web.Template.Context.Tests.tests
, Hakyll.Web.Template.Tests.tests
- , Hakyll.Web.Urls.Relativize.Tests.tests
- , Hakyll.Web.Urls.Tests.tests
- , Hakyll.Web.Util.Html.Tests.tests
]