diff --git a/tests/integration/tests/haddock-options/Main.hs b/tests/integration/tests/haddock-options/Main.hs index 28cda62853..1c65576206 100644 --- a/tests/integration/tests/haddock-options/Main.hs +++ b/tests/integration/tests/haddock-options/Main.hs @@ -1,17 +1,24 @@ -import StackTest +import Control.Monad ( unless ) +import Data.List ( isInfixOf ) +import StackTest main :: IO () main = do - removeDirIgnore ".stack-work" + removeDirIgnore ".stack-work" --- Disabling the test with GHC 9.8.4 because, unlike earlier versions, it fails --- to fail, despite the Haddock options working as expected. --- --- -- Fails to work because BAR is defined here and FOO in stack file --- stackErr ["haddock", "--haddock-arguments", "--optghc=-DBAR"] - stack ["clean"] - -- Works just fine, test #3099 while at it. - stack ["haddock", "--no-haddock-hyperlink-source"] - stack ["clean"] - -- Fails to work because we have bad argument - stackErr ["haddock", "--haddock-arguments", "--stack_it_badhaddockargument"] + -- BAR is defined here and FOO in stack.yaml file + stackCheckStderr ["haddock", "--haddock-arguments", "--optghc=-DBAR"] $ \s -> + unless (errorMsg `isInfixOf` s) $ + error "FOO and BAR not both defined" + stack ["clean"] + -- Works just fine, test #3099 while at it. + stack ["haddock", "--no-haddock-hyperlink-source"] + stack ["clean"] + -- Fails to work because we have bad argument + stackErr ["haddock", "--haddock-arguments", "--stack_it_badhaddockargument"] + +-- The error message differs by operating system +errorMsg :: String +errorMsg = if isLinux + then "error: #error FOO and BAR is defined" + else "error: FOO and BAR is defined"