summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Hakyll/Web/Util/Url/Tests.hs25
-rw-r--r--tests/TestSuite.hs3
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/Hakyll/Web/Util/Url/Tests.hs b/tests/Hakyll/Web/Util/Url/Tests.hs
new file mode 100644
index 0000000..aab4172
--- /dev/null
+++ b/tests/Hakyll/Web/Util/Url/Tests.hs
@@ -0,0 +1,25 @@
+module Hakyll.Web.Util.Url.Tests
+ ( tests
+ ) where
+
+import Test.Framework
+import Test.HUnit hiding (Test)
+
+import Hakyll.Web.Util.Url
+import TestSuite.Util
+
+tests :: [Test]
+tests = concat
+ [ fromAssertions "toUrl"
+ [ "/foo/bar.html" @=? toUrl "foo/bar.html"
+ , "/" @=? toUrl "/"
+ , "/funny-pics.html" @=? toUrl "/funny-pics.html"
+ ]
+
+ , fromAssertions "toSiteRoot"
+ [ ".." @=? toSiteRoot "/foo/bar.html"
+ , "." @=? toSiteRoot "index.html"
+ , "." @=? toSiteRoot "/index.html"
+ , "../.." @=? toSiteRoot "foo/bar/qux"
+ ]
+ ]
diff --git a/tests/TestSuite.hs b/tests/TestSuite.hs
index 8787bbd..cb6113d 100644
--- a/tests/TestSuite.hs
+++ b/tests/TestSuite.hs
@@ -8,6 +8,7 @@ import qualified Hakyll.Core.Routes.Tests
import qualified Hakyll.Web.Page.Tests
import qualified Hakyll.Web.RelativizeUrls.Tests
import qualified Hakyll.Web.Template.Tests
+import qualified Hakyll.Web.Util.Url.Tests
main :: IO ()
main = defaultMain
@@ -23,4 +24,6 @@ main = defaultMain
Hakyll.Web.RelativizeUrls.Tests.tests
, testGroup "Hakyll.Web.Template.Tests"
Hakyll.Web.Template.Tests.tests
+ , testGroup "Hakyll.Web.Util.Url.Tests"
+ Hakyll.Web.Util.Url.Tests.tests
]