From 8cec091e04e9bf1fa8cad01056d1c9cbed4fa44f Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Wed, 9 Feb 2011 19:57:25 +0100 Subject: Add some tests for RelativizeUrls --- tests/Hakyll/Web/Page/Tests.hs | 3 +-- tests/Hakyll/Web/RelativizeUrls/Tests.hs | 21 +++++++++++++++++++++ tests/TestSuite.hs | 3 +++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 tests/Hakyll/Web/RelativizeUrls/Tests.hs (limited to 'tests') 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" + [ "bar" @=? + relativizeUrls ".." "bar" + , "" @=? + relativizeUrls "../.." "" + , "Haskell" @=? + relativizeUrls "../.." "Haskell" + ] 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 ] -- cgit v1.2.3