diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2019-08-30 11:46:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-30 11:46:13 +0200 |
commit | 036c583ea243869f05a5a311c90b94943a2b635c (patch) | |
tree | aadee7988980544f84b83d808707080481568cc5 /tests/Hakyll/Core/UnixFilter/Tests.hs | |
parent | 779fa66c7b1719e071dc3f4d38a4cc2feb9492c6 (diff) | |
download | hakyll-036c583ea243869f05a5a311c90b94943a2b635c.tar.gz |
Improve error messages
Diffstat (limited to 'tests/Hakyll/Core/UnixFilter/Tests.hs')
-rw-r--r-- | tests/Hakyll/Core/UnixFilter/Tests.hs | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/tests/Hakyll/Core/UnixFilter/Tests.hs b/tests/Hakyll/Core/UnixFilter/Tests.hs index 29e2cbf..e4e0f23 100644 --- a/tests/Hakyll/Core/UnixFilter/Tests.hs +++ b/tests/Hakyll/Core/UnixFilter/Tests.hs @@ -6,18 +6,16 @@ module Hakyll.Core.UnixFilter.Tests -------------------------------------------------------------------------------- -import Data.List (isInfixOf) -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.HUnit (testCase) -import qualified Test.Tasty.HUnit as H +import Test.Tasty (TestTree, testGroup) +import Test.Tasty.HUnit (testCase) +import qualified Test.Tasty.HUnit as H -------------------------------------------------------------------------------- import Hakyll.Core.Compiler -import Hakyll.Core.Compiler.Internal +import Hakyll.Core.Identifier import Hakyll.Core.Item import Hakyll.Core.UnixFilter -import Hakyll.Core.Identifier import TestSuite.Util @@ -51,10 +49,7 @@ unixFilterFalse :: H.Assertion unixFilterFalse = do store <- newTestStore provider <- newTestProvider store - result <- testCompiler store provider testMarkdown compiler - case result of - CompilerError es -> True H.@=? any ("exit code" `isInfixOf`) es - _ -> H.assertFailure "Expecting CompilerError" + testCompilerError store provider testMarkdown compiler "exit code" cleanTestEnv where compiler = getResourceString >>= withItemBody (unixFilter "false" []) @@ -65,12 +60,7 @@ unixFilterError :: H.Assertion unixFilterError = do store <- newTestStore provider <- newTestProvider store - result <- testCompiler store provider testMarkdown compiler - case result of - CompilerError es -> True H.@=? any containsIncorrectOptionMessage es - _ -> H.assertFailure "Expecting CompilerError" + testCompilerError store provider testMarkdown compiler "option" cleanTestEnv where compiler = getResourceString >>= withItemBody (unixFilter "head" ["-#"]) - incorrectOptionMessages = ["invalid option", "illegal option"] - containsIncorrectOptionMessage output = any (`isInfixOf` output) incorrectOptionMessages |