diff options
Diffstat (limited to 'tests/Hakyll')
-rw-r--r-- | tests/Hakyll/Core/Runtime/Tests.hs | 28 | ||||
-rw-r--r-- | tests/Hakyll/Core/Store/Tests.hs | 1 |
2 files changed, 18 insertions, 11 deletions
diff --git a/tests/Hakyll/Core/Runtime/Tests.hs b/tests/Hakyll/Core/Runtime/Tests.hs index bb39a5f..0d202c7 100644 --- a/tests/Hakyll/Core/Runtime/Tests.hs +++ b/tests/Hakyll/Core/Runtime/Tests.hs @@ -6,17 +6,14 @@ module Hakyll.Core.Runtime.Tests -------------------------------------------------------------------------------- -import System.FilePath ((</>)) -import Test.Framework (Test, testGroup) -import Test.HUnit (Assertion, (@?=)) +import System.FilePath ((</>)) +import Test.Framework (Test, testGroup) +import Test.HUnit (Assertion, (@?=)) -------------------------------------------------------------------------------- -import Hakyll.Core.Configuration -import Hakyll.Core.Routes -import Hakyll.Core.Rules +import Hakyll import Hakyll.Core.Runtime -import Hakyll.Web.Page import TestSuite.Util @@ -31,7 +28,18 @@ case01 = withTestConfiguration $ \config -> do _ <- run config $ do match "*.md" $ do route $ setExtension "html" - compile $ pageCompiler + compile $ do + body <- getResourceBody + saveSnapshot "raw" body + return $ renderPandoc body - out <- readFile $ destinationDirectory config </> "example.html" - lines out @?= ["<p>This is an example.</p>"] + match "bodies.txt" $ route idRoute + create "bodies.txt" $ do + items <- requireAllSnapshots "*.md" "raw" :: Compiler [Item String] + makeItem $ concat $ map itemBody items + + example <- readFile $ destinationDirectory config </> "example.html" + lines example @?= ["<p>This is an example.</p>"] + + bodies <- readFile $ destinationDirectory config </> "bodies.txt" + head (lines bodies) @?= "This is an example." diff --git a/tests/Hakyll/Core/Store/Tests.hs b/tests/Hakyll/Core/Store/Tests.hs index bd6cba2..11a1a63 100644 --- a/tests/Hakyll/Core/Store/Tests.hs +++ b/tests/Hakyll/Core/Store/Tests.hs @@ -61,7 +61,6 @@ wrongType = withTestStore $ \store -> do -- Store a string and try to fetch an int Store.set store ["foo", "bar"] ("qux" :: String) value <- Store.get store ["foo", "bar"] :: IO (Store.Result Int) - print value H.assert $ case value of Store.WrongType e t -> e == typeOf (undefined :: Int) && |