|
1 |
| -import StackTest |
| 1 | +import Control.Monad ( unless ) |
| 2 | +import Data.List ( isInfixOf ) |
| 3 | +import StackTest |
2 | 4 |
|
3 | 5 | main :: IO ()
|
4 | 6 | main = do
|
5 |
| - removeDirIgnore ".stack-work" |
| 7 | + removeDirIgnore ".stack-work" |
6 | 8 |
|
7 |
| --- Disabling the test with GHC 9.8.4 because, unlike earlier versions, it fails |
8 |
| --- to fail, despite the Haddock options working as expected. |
9 |
| --- |
10 |
| --- -- Fails to work because BAR is defined here and FOO in stack file |
11 |
| --- stackErr ["haddock", "--haddock-arguments", "--optghc=-DBAR"] |
12 |
| - stack ["clean"] |
13 |
| - -- Works just fine, test #3099 while at it. |
14 |
| - stack ["haddock", "--no-haddock-hyperlink-source"] |
15 |
| - stack ["clean"] |
16 |
| - -- Fails to work because we have bad argument |
17 |
| - stackErr ["haddock", "--haddock-arguments", "--stack_it_badhaddockargument"] |
| 9 | + -- BAR is defined here and FOO in stack.yaml file |
| 10 | + stackCheckStderr ["haddock", "--haddock-arguments", "--optghc=-DBAR"] $ \s -> |
| 11 | + unless (errorMsg `isInfixOf` s) $ |
| 12 | + error "FOO and BAR not both defined" |
| 13 | + stack ["clean"] |
| 14 | + -- Works just fine, test #3099 while at it. |
| 15 | + stack ["haddock", "--no-haddock-hyperlink-source"] |
| 16 | + stack ["clean"] |
| 17 | + -- Fails to work because we have bad argument |
| 18 | + stackErr ["haddock", "--haddock-arguments", "--stack_it_badhaddockargument"] |
| 19 | + |
| 20 | +-- The error message differs by operating system |
| 21 | +errorMsg :: String |
| 22 | +errorMsg = if isLinux |
| 23 | + then "error: #error FOO and BAR is defined" |
| 24 | + else "error: FOO and BAR is defined" |
0 commit comments