diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-11-24 10:56:19 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-11-24 10:56:19 +0100 |
commit | 0a6b2b259862b90ccca11281de89091e2e01cb4d (patch) | |
tree | 9b4841724ad8d6d06df9682168c714cd3d3d7901 /tests/Hakyll/Core | |
parent | bc192a127b8c57ccb45ff6c773f5917fdbf7ec85 (diff) | |
download | hakyll-0a6b2b259862b90ccca11281de89091e2e01cb4d.tar.gz |
Add snapshots
Diffstat (limited to 'tests/Hakyll/Core')
-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) && |