Merge pull request #10525 from 9999years/field-stanza-names
[cabal.git] / cabal-testsuite / PackageTests / GhcPkgGuess / SymlinkGhcVersion / setup.test.hs
blobbf9b16fa1955ab2375bf8a801aac25592e7c0ae4
1 import Test.Cabal.Prelude
2 import System.Directory
4 main = setupAndCabalTest $ do
5 when isWindows $ do
6 sh <- fmap takeDirectory <$> liftIO (findExecutable "sh")
7 case sh of
8 Nothing -> skip "no sh"
9 Just sh' -> do
10 let sh'' = concatMap (\c -> case c of
11 '\\' -> "\\\\\\\\"
12 x -> [x]) sh'
13 void $ shell "sed" [ "-i", "-e", "s/FINDSH/" <> sh'' <> "/g", "bin/ghc-7.10.shim", "bin/ghc-pkg-7.10.shim"]
14 (if isWindows
15 then withSymlink "bin/ghc-7.10.exe" "ghc.exe" . withSymlink "bin/ghc-7.10.shim" "ghc.shim" . withSymlink "bin/ghc-7.10" "ghc"
16 else withSymlink "bin/ghc-7.10" "ghc") $ do
17 env <- getTestEnv
18 let cwd = testCurrentDir env
19 ghc_path <- programPathM ghcProgram
20 r <- withEnv [("WITH_GHC", Just ghc_path)]
21 . fails $ setup' "configure" ["-w", cwd </> if isWindows then "ghc.exe" else "ghc"]
22 assertOutputContains "is version 9999999" r