Add test cases that reproduce #7241.
[cabal.git] / cabal-testsuite / PackageTests / AutoconfBadPaths / cabal.test.hs
blob74c9d8806b882c7b7b83f30cb6a972a77543e301
1 import Test.Cabal.Prelude
2 import Data.Foldable (traverse_)
3 main = cabalTest $ do
4 -- Test the forbidden characters except NUL. Reference:
5 -- https://www.gnu.org/software/autoconf/manual/autoconf.html#File-System-Conventions
6 -- Most of these are magic on Windows, so don't bother testing there.
7 --
8 -- Note: we bundle the configure script so no need to autoreconf
9 -- while building
10 skipIfWindows
11 traverse_ check
12 [ "foo bar"
13 , "foo\tbar"
14 , "foo\nbar"
15 , "foo\"bar"
16 , "foo#bar"
17 , "foo$bar"
18 , "foo&bar"
19 , "foo'bar"
20 , "foo(bar"
21 , "foo)bar"
22 , "foo*bar"
23 , "foo;bar"
24 , "foo<bar"
25 , "foo=bar"
26 , "foo>bar"
27 , "foo?bar"
28 , "foo[bar"
29 , "foo\\bar"
30 , "foo`bar"
31 , "foo|bar"
33 where
34 -- 'cabal' from the prelude requires the command to succeed; we
35 -- don't mind if it fails, so long as we get the warning. This is
36 -- an inlined+specialised version of 'cabal' for v1-configure.
37 check dir = withSourceCopyDir dir $
38 defaultRecordMode RecordMarked $ do
39 recordHeader ["cabal", "v1-configure"]
40 env <- getTestEnv
41 let args =
42 [ "v1-configure"
43 , "-vverbose +markoutput +nowrap"
44 , "--builddir"
45 , testDistDir env
47 configured_prog <- requireProgramM cabalProgram
48 r <- liftIO $ run (testVerbosity env)
49 (Just (testCurrentDir env))
50 (testEnvironment env)
51 (programPath configured_prog)
52 args Nothing
53 recordLog r