summaryrefslogtreecommitdiff
path: root/tests/Hakyll/Core/UnixFilter/Tests.hs
blob: c3e1c99723b89608a9cb54d3d3312fce8bcaff21 (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.UnixFilter.Tests
    ( tests
    ) where


--------------------------------------------------------------------------------
import           Test.Framework                 (Test, testGroup)
import           Test.Framework.Providers.HUnit (testCase)
import qualified Test.HUnit                     as H


--------------------------------------------------------------------------------
import           Hakyll.Core.Compiler
import           Hakyll.Core.Item
import           Hakyll.Core.UnixFilter
import           TestSuite.Util


--------------------------------------------------------------------------------
tests :: Test
tests = testGroup "Hakyll.Core.UnixFilter.Tests"
    [ testCase "unixFilter rev" unixFilterRev
    ]


--------------------------------------------------------------------------------
unixFilterRev :: H.Assertion
unixFilterRev = withTestStore $ \store -> do
    provider <- newTestProvider store
    output   <- testCompilerDone store provider "russian.md" compiler
    expected <- testCompilerDone store provider "russian.md" getResourceString
    H.assert $ rev (itemBody expected) == lines (itemBody output)
  where
    compiler = getResourceString >>= withItemBody (unixFilter "rev" [])
    rev      = map reverse . lines