Un-ignore .bat files
[cabal.git] / cabal-testsuite / PackageTests / ExternalCommandHelp / cabal.test.hs
blob1932d49ed4815f633530148b7f9376b53460682d
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
9 import Data.Maybe
10 import System.Environment
12 main = do
13 cabalTest $ do
14 res <- cabalWithStdin "v2-build" ["all"] ""
15 exe_path <- withPlan $ planExePath "setup-test" "cabal-aaaa"
16 addToPath (takeDirectory exe_path) $ do
17 res <- cabal_raw_action ["help", "aaaa"] (\h -> () <$ Process.waitForProcess h)
18 assertOutputContains "I am helping with the aaaa command" res
21 cabal_raw_action :: [String] -> (Process.ProcessHandle -> IO ()) -> TestM Result
22 cabal_raw_action args action = do
23 configured_prog <- requireProgramM cabalProgram
24 env <- getTestEnv
25 r <- liftIO $ runAction (testVerbosity env)
26 (Just $ testCurrentDir env)
27 (testEnvironment env)
28 (programPath configured_prog)
29 args
30 Nothing
31 action
32 recordLog r
33 requireSuccess r