summaryrefslogtreecommitdiff
path: root/tests/Hakyll/Core/Runtime/Tests.hs
blob: bb39a5fc34ab8da8505fe7d19a2e759d69426cc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--------------------------------------------------------------------------------
{-# LANGUAGE OverloadedStrings #-}
module Hakyll.Core.Runtime.Tests
    ( tests
    ) where


--------------------------------------------------------------------------------
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.Core.Runtime
import           Hakyll.Web.Page
import           TestSuite.Util


--------------------------------------------------------------------------------
tests :: Test
tests = testGroup "Hakyll.Core.Runtime.Tests" $ fromAssertions "run" [case01]


--------------------------------------------------------------------------------
case01 :: Assertion
case01 = withTestConfiguration $ \config -> do
    _ <- run config $ do
        match "*.md" $ do
            route   $ setExtension "html"
            compile $ pageCompiler

    out <- readFile $ destinationDirectory config </> "example.html"
    lines out @?=  ["<p>This is an example.</p>"]