|
1 | | --- Stack should explain likely Backpack signature mistakes with a Backpack |
2 | | --- warning, not the custom-preprocessor warning. |
| 1 | +-- | Stack explains likely Backpack signature mistakes with a useful warning, |
| 2 | +-- and not an inappropriate warning about custom preprocessors. |
3 | 3 |
|
4 | | -import Control.Monad ( unless, when ) |
5 | | -import Data.List ( isInfixOf ) |
6 | | -import StackTest |
| 4 | +import Control.Monad ( unless, when ) |
| 5 | +import Data.List ( isInfixOf ) |
| 6 | +import StackTest |
7 | 7 |
|
8 | 8 | main :: IO () |
9 | 9 | main = |
10 | 10 | stackErrStderr ["build"] $ \err -> do |
11 | | - expect err "Found Backpack signature file for Cabal entry" |
12 | | - expect err "Logger" |
13 | | - expect err "not listed in the component's" |
14 | | - expect err "signatures" |
| 11 | + expectMessage "Found Backpack signature file for Cabal entry" err |
| 12 | + expectMessage "Logger" err |
| 13 | + expectMessage "not listed in the component's" err |
| 14 | + expectMessage "signatures" err |
15 | 15 | when ("custom-preprocessor-extensions" `isInfixOf` err) $ |
16 | 16 | error $ |
17 | | - "Expected no custom-preprocessor warning for Logger.hsig, got: " |
18 | | - ++ show err |
| 17 | + "Expected no custom-preprocessor warning for Logger.hsig, got:\n\n" |
| 18 | + ++ err |
19 | 19 |
|
20 | | -expect :: String -> String -> IO () |
21 | | -expect err msg = |
22 | | - unless (msg `isInfixOf` err) $ |
23 | | - error $ "Expected " ++ show msg ++ " in stderr, got: " ++ show err |
| 20 | +expectMessage :: String -> String -> IO () |
| 21 | +expectMessage msg stderr = do |
| 22 | + unless (words msg `isInfixOf` words stderr) $ |
| 23 | + error $ "Expected " ++ show msg ++ " in stderr, got:\n\n" ++ stderr |
0 commit comments