Skip to content

Commit 7ec45a7

Browse files
committed
Fixup: Allow for whitespace in backpack-undeclared-signature-warning test
1 parent 12a2db3 commit 7ec45a7

2 files changed

Lines changed: 18 additions & 16 deletions

File tree

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
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+
--
4+
-- See: https://github.com/commercialhaskell/stack/issues/6937
35

4-
import Control.Monad ( unless, when )
5-
import Data.List ( isInfixOf )
6-
import StackTest
6+
import Control.Monad ( unless, when )
7+
import Data.List ( isInfixOf )
8+
import StackTest
79

810
main :: IO ()
911
main =
1012
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"
13+
expectMessage "Found Backpack signature file for Cabal entry" err
14+
expectMessage "Logger" err
15+
expectMessage "not listed in the component's" err
16+
expectMessage "signatures" err
1517
when ("custom-preprocessor-extensions" `isInfixOf` err) $
1618
error $
17-
"Expected no custom-preprocessor warning for Logger.hsig, got: "
18-
++ show err
19+
"Expected no custom-preprocessor warning for Logger.hsig, got:\n\n"
20+
++ err
1921

20-
expect :: String -> String -> IO ()
21-
expect err msg =
22-
unless (msg `isInfixOf` err) $
23-
error $ "Expected " ++ show msg ++ " in stderr, got: " ++ show err
22+
expectMessage :: String -> String -> IO ()
23+
expectMessage msg stderr = do
24+
unless (words msg `isInfixOf` words stderr) $
25+
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)