From 036c583ea243869f05a5a311c90b94943a2b635c Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Fri, 30 Aug 2019 11:46:13 +0200 Subject: Improve error messages --- tests/Hakyll/Core/UnixFilter/Tests.hs | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'tests/Hakyll/Core/UnixFilter/Tests.hs') 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 -- cgit v1.2.3