summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Hakyll/Core/Rules/Tests.hs3
-rw-r--r--tests/Hakyll/Core/Runtime/Tests.hs2
-rw-r--r--tests/Hakyll/Web/Template/Tests.hs5
-rw-r--r--tests/TestSuite.hs5
-rw-r--r--tests/TestSuite/Util.hs12
5 files changed, 22 insertions, 5 deletions
diff --git a/tests/Hakyll/Core/Rules/Tests.hs b/tests/Hakyll/Core/Rules/Tests.hs
index c4c0f28..24b5b8c 100644
--- a/tests/Hakyll/Core/Rules/Tests.hs
+++ b/tests/Hakyll/Core/Rules/Tests.hs
@@ -17,7 +17,6 @@ import Hakyll.Core.Metadata
import Hakyll.Core.Routes
import Hakyll.Core.Rules
import Hakyll.Core.Rules.Internal
-import Hakyll.Web.Pandoc
import System.FilePath ((</>))
import Test.Tasty (TestTree, testGroup)
import Test.Tasty.HUnit (Assertion, (@=?))
@@ -75,7 +74,7 @@ rules01 ioref = do
-- Compile some posts
match "*.md" $ do
route $ setExtension "html"
- compile pandocCompiler
+ compile copyFileCompiler
-- Yeah. I don't know how else to test this stuff?
preprocess $ writeIORef ioref True
diff --git a/tests/Hakyll/Core/Runtime/Tests.hs b/tests/Hakyll/Core/Runtime/Tests.hs
index 5f27854..9c23162 100644
--- a/tests/Hakyll/Core/Runtime/Tests.hs
+++ b/tests/Hakyll/Core/Runtime/Tests.hs
@@ -39,7 +39,7 @@ case01 = do
compile $ do
getResourceBody
>>= saveSnapshot "raw"
- >>= renderPandoc
+ >>= renderParagraphs
match (fromList ["partial.html", "partial-helper.html"]) $
compile templateCompiler
diff --git a/tests/Hakyll/Web/Template/Tests.hs b/tests/Hakyll/Web/Template/Tests.hs
index 054a9bd..b63a0dd 100644
--- a/tests/Hakyll/Web/Template/Tests.hs
+++ b/tests/Hakyll/Web/Template/Tests.hs
@@ -16,7 +16,6 @@ import Hakyll.Core.Compiler
import Hakyll.Core.Identifier
import Hakyll.Core.Item
import Hakyll.Core.Provider
-import Hakyll.Web.Pandoc
import Hakyll.Web.Template
import Hakyll.Web.Template.Context
import Hakyll.Web.Template.Internal
@@ -89,7 +88,9 @@ test (outf, tplf, itemf) = do
out <- resourceString provider outf
tpl <- testCompilerDone store provider tplf templateBodyCompiler
item <- testCompilerDone store provider itemf $
- pandocCompiler >>= applyTemplate (itemBody tpl) testContext
+ getResourceBody
+ >>= renderParagraphs
+ >>= applyTemplate (itemBody tpl) testContext
out @=? itemBody item
cleanTestEnv
diff --git a/tests/TestSuite.hs b/tests/TestSuite.hs
index 4260eab..14e02d6 100644
--- a/tests/TestSuite.hs
+++ b/tests/TestSuite.hs
@@ -1,4 +1,5 @@
--------------------------------------------------------------------------------
+{-# LANGUAGE CPP #-}
module Main
( main
) where
@@ -22,7 +23,9 @@ import qualified Hakyll.Core.Util.String.Tests
import qualified Hakyll.Web.CompressCss.Tests
import qualified Hakyll.Web.Html.RelativizeUrls.Tests
import qualified Hakyll.Web.Html.Tests
+#ifdef USE_PANDOC
import qualified Hakyll.Web.Pandoc.FileType.Tests
+#endif
import qualified Hakyll.Web.Template.Context.Tests
import qualified Hakyll.Web.Template.Tests
@@ -43,7 +46,9 @@ main = defaultMain $ testGroup "Hakyll"
, Hakyll.Web.CompressCss.Tests.tests
, Hakyll.Web.Html.RelativizeUrls.Tests.tests
, Hakyll.Web.Html.Tests.tests
+#ifdef USE_PANDOC
, Hakyll.Web.Pandoc.FileType.Tests.tests
+#endif
, Hakyll.Web.Template.Context.Tests.tests
, Hakyll.Web.Template.Tests.tests
]
diff --git a/tests/TestSuite/Util.hs b/tests/TestSuite/Util.hs
index 33b26ef..fa411f8 100644
--- a/tests/TestSuite/Util.hs
+++ b/tests/TestSuite/Util.hs
@@ -8,6 +8,7 @@ module TestSuite.Util
, testCompilerDone
, testConfiguration
, cleanTestEnv
+ , renderParagraphs
) where
@@ -29,6 +30,7 @@ import Hakyll.Core.Provider
import Hakyll.Core.Store (Store)
import qualified Hakyll.Core.Store as Store
import Hakyll.Core.Util.File
+import Hakyll.Core.Item
--------------------------------------------------------------------------------
@@ -102,3 +104,13 @@ cleanTestEnv = do
removeDirectory $ destinationDirectory testConfiguration
removeDirectory $ storeDirectory testConfiguration
removeDirectory $ tmpDirectory testConfiguration
+
+
+--------------------------------------------------------------------------------
+-- | like 'Hakyll.Web.Pandoc.renderPandoc'
+-- | but allowing to test without the @usePandoc@ flag
+renderParagraphs :: Item String -> Compiler (Item String)
+renderParagraphs = withItemBody (return
+ . intercalate "\n" -- no trailing line
+ . map (("<p>"++) . (++"</p>"))
+ . lines)