Skip to content

Commit f1b5ce2

Browse files
committed
Fixup: Allow for whitespace in backpack-undeclared-signature-warning test
1 parent e45efad commit f1b5ce2

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
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.
33

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
77

88
main :: IO ()
99
main =
1010
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
1515
when ("custom-preprocessor-extensions" `isInfixOf` err) $
1616
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
1919

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

tests/integration/tests/backpack-undeclared-signature-warning/files/package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ dependencies:
77

88
library:
99
source-dirs: src
10-
exposed-modules: Lib
10+
# In error, Logger is listed under other-modules rather than signatures:
1111
other-modules: Logger

0 commit comments

Comments
 (0)