@@ -17,6 +17,7 @@ import Hakyll.Core.Compiler
1717import Hakyll.Core.Compiler.Internal
1818import Hakyll.Core.Item
1919import Hakyll.Core.UnixFilter
20+import Hakyll.Core.Identifier
2021import TestSuite.Util
2122
2223
@@ -25,16 +26,19 @@ tests :: TestTree
2526tests = testGroup "Hakyll.Core.UnixFilter.Tests"
2627 [ testCase "unixFilter rev" unixFilterRev
2728 , testCase "unixFilter false" unixFilterFalse
29+ , testCase "unixFilter error" unixFilterError
2830 ]
2931
32+testMarkdown :: Identifier
33+testMarkdown = "russian.md"
3034
3135--------------------------------------------------------------------------------
3236unixFilterRev :: H.Assertion
3337unixFilterRev = do
3438 store <- newTestStore
3539 provider <- newTestProvider store
36− output <- testCompilerDone store provider "russian.md" compiler
37− expected <- testCompilerDone store provider "russian.md" getResourceString
40+ output <- testCompilerDone store provider testMarkdown compiler
41+ expected <- testCompilerDone store provider testMarkdown getResourceString
3842 H.assert $ rev (itemBody expected) == lines (itemBody output)
3943 cleanTestEnv
4044 where
@@ -47,10 +51,24 @@ unixFilterFalse :: H.Assertion
4751unixFilterFalse = do
4852 store <- newTestStore
4953 provider <- newTestProvider store
50− result <- testCompiler store provider "russian.md" compiler
54+ result <- testCompiler store provider testMarkdown compiler
5155 H.assert $ case result of
5256 CompilerError es -> any ("exit code" `isInfixOf`) es
5357 _ -> False
5458 cleanTestEnv
5559 where
5660 compiler = getResourceString >>= withItemBody (unixFilter "false" [])
61+
62+
63+--------------------------------------------------------------------------------
64+unixFilterError :: H.Assertion
65+unixFilterError = do
66+ store <- newTestStore
67+ provider <- newTestProvider store
68+ result <- testCompiler store provider testMarkdown compiler
69+ H.assert $ case result of
70+ CompilerError es -> any ("invalid option" `isInfixOf`) es
71+ _ -> False
72+ cleanTestEnv
73+ where
74+ compiler = getResourceString >>= withItemBody (unixFilter "head" ["-#"])