1 import Test
.Cabal
.Prelude
2 import qualified System
.Process
as Process
3 import Control
.Concurrent
(threadDelay
)
4 import System
.Directory
(removeFile)
5 import Control
.Exception
(catch, throwIO
)
6 import System
.IO.Error
(isDoesNotExistError)
7 import qualified Data
.Time
.Clock
as Time
8 import qualified Data
.Time
.Format
as Time
10 import System
.Environment
11 import System
.FilePath
15 res
<- cabalWithStdin
"v2-build" ["all"] ""
16 exe_path
<- withPlan
$ planExePath
"setup-test" "cabal-aaaa"
17 addToPath
(takeDirectory exe_path
) $ do
18 -- Test that the thing works at all
19 res
<- cabal_raw_action
["aaaa"] (\h
-> () <$ Process
.waitForProcess h
)
20 assertOutputContains
"aaaa" res
22 -- Test that the extra arguments are passed on
23 res
<- cabal_raw_action
["aaaa", "--foobaz"] (\h
-> () <$ Process
.waitForProcess h
)
24 assertOutputContains
"--foobaz" res
26 -- Test what happens with "global" flags
27 res
<- cabal_raw_action
["aaaa", "--version"] (\h
-> () <$ Process
.waitForProcess h
)
28 assertOutputContains
"--version" res
30 -- Test what happens with "global" flags
31 res
<- cabal_raw_action
["aaaa", "--config-file", "abc"] (\h
-> () <$ Process
.waitForProcess h
)
32 assertOutputContains
"--config-file" res
35 cabal_raw_action
:: [String] -> (Process
.ProcessHandle
-> IO ()) -> TestM Result
36 cabal_raw_action args action
= do
37 configured_prog
<- requireProgramM cabalProgram
39 r
<- liftIO
$ runAction
(testVerbosity env
)
40 (Just
$ testCurrentDir env
)
42 (programPath configured_prog
)