diff options
author | Nick Boultbee <declension@users.noreply.github.com> | 2017-11-17 14:55:27 +0000 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2017-11-17 15:55:27 +0100 |
commit | 7ee4e6134cc447c8b053129e7557d9883c7e8e01 (patch) | |
tree | edd011fd7b7ced8f40690410c77211ab91b63da7 /tests | |
parent | 7a1f5cd5ff057af2bf3bc542d2073c94f046a84a (diff) | |
download | hakyll-7ee4e6134cc447c8b053129e7557d9883c7e8e01.tar.gz |
Make unixFilter output stderr when failing
Fixes #581.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Hakyll/Core/UnixFilter/Tests.hs | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/tests/Hakyll/Core/UnixFilter/Tests.hs b/tests/Hakyll/Core/UnixFilter/Tests.hs index 255b043..521d051 100644 --- a/tests/Hakyll/Core/UnixFilter/Tests.hs +++ b/tests/Hakyll/Core/UnixFilter/Tests.hs @@ -17,6 +17,7 @@ import Hakyll.Core.Compiler import Hakyll.Core.Compiler.Internal import Hakyll.Core.Item import Hakyll.Core.UnixFilter +import Hakyll.Core.Identifier import TestSuite.Util @@ -25,16 +26,19 @@ tests :: TestTree tests = testGroup "Hakyll.Core.UnixFilter.Tests" [ testCase "unixFilter rev" unixFilterRev , testCase "unixFilter false" unixFilterFalse + , testCase "unixFilter error" unixFilterError ] +testMarkdown :: Identifier +testMarkdown = "russian.md" -------------------------------------------------------------------------------- unixFilterRev :: H.Assertion unixFilterRev = do store <- newTestStore provider <- newTestProvider store - output <- testCompilerDone store provider "russian.md" compiler - expected <- testCompilerDone store provider "russian.md" getResourceString + output <- testCompilerDone store provider testMarkdown compiler + expected <- testCompilerDone store provider testMarkdown getResourceString H.assert $ rev (itemBody expected) == lines (itemBody output) cleanTestEnv where @@ -47,10 +51,24 @@ unixFilterFalse :: H.Assertion unixFilterFalse = do store <- newTestStore provider <- newTestProvider store - result <- testCompiler store provider "russian.md" compiler + result <- testCompiler store provider testMarkdown compiler H.assert $ case result of CompilerError es -> any ("exit code" `isInfixOf`) es _ -> False cleanTestEnv where compiler = getResourceString >>= withItemBody (unixFilter "false" []) + + +-------------------------------------------------------------------------------- +unixFilterError :: H.Assertion +unixFilterError = do + store <- newTestStore + provider <- newTestProvider store + result <- testCompiler store provider testMarkdown compiler + H.assert $ case result of + CompilerError es -> any ("invalid option" `isInfixOf`) es + _ -> False + cleanTestEnv + where + compiler = getResourceString >>= withItemBody (unixFilter "head" ["-#"])
\ No newline at end of file |