Un-ignore .bat files
[cabal.git] / cabal-testsuite / PackageTests / AutoconfBadPaths / cabal.test.hs
blob93ce9825a36f776b7fb8fca38fa610a65fecc655
1 import Test.Cabal.Prelude
2 import Data.Foldable (traverse_)
3 import Distribution.Simple.Utils
4 import System.Directory
5 main = cabalTest $ do
6 -- Test the forbidden characters except NUL. Reference:
7 -- https://www.gnu.org/software/autoconf/manual/autoconf.html#File-System-Conventions
8 -- Most of these are magic on Windows, so don't bother testing there.
9 --
10 -- Note: we bundle the configure script so no need to autoreconf
11 -- while building
12 skipIfWindows
13 traverse_ check
14 [ "foo bar"
15 , "foo\tbar"
16 , "foo\nbar"
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"
32 , "foo`bar"
33 , "foo|bar"
35 where
36 setup dir = do
37 env <- getTestEnv
38 let cwd = testCurrentDir env
39 liftIO $ createDirectory (testCurrentDir env </> dir)
40 liftIO $ copyFiles minBound (testCurrentDir env </> dir)
41 [ (cwd, "configure")
42 , (cwd, "Setup.hs")
43 , (cwd, "test.cabal")
45 -- 'cabal' from the prelude requires the command to succeed; we
46 -- don't mind if it fails, so long as we get the warning. This is
47 -- an inlined+specialised version of 'cabal' for v1-configure.
48 check dir =
49 defaultRecordMode RecordMarked $ do
50 setup dir
51 recordHeader ["cabal", "v1-configure"]
52 env <- getTestEnv
53 let args =
54 [ "v1-configure"
55 , "-vverbose +markoutput +nowrap"
56 , "--builddir"
57 , testDistDir env
59 configured_prog <- requireProgramM cabalProgram
60 r <- liftIO $ run (testVerbosity env)
61 (Just $ testCurrentDir env </> dir)
62 (testEnvironment env)
63 (programPath configured_prog)
64 args Nothing
65 recordLog r