make LTS branch pre-releases
[cabal.git] / cabal-testsuite / PackageTests / Install / ProgramAffixes / cabal.test.hs
blobc02eda531f6b5093cb59231e2c18fccbe47da27d
1 import Test.Cabal.Prelude
2 import Data.Foldable (traverse_)
4 -- Test that program affixes options result in successful installation:
5 -- • Valid symlinks (--install-method=symlink)
6 -- • Valid copy of executables (--install-method=copy)
7 main = cabalTest $ do
8 env <- getTestEnv
9 recordMode DoNotRecord $ do
10 let installdir = testPrefixDir env </> "bin"
11 commonOpts = ["p", "--installdir", installdir, "--overwrite-policy=always"]
12 testAllAffixes installMethod = do
13 let testAffixes' = testAffixes
14 (commonOpts ++ ["--install-method", installMethod])
15 testAffixes' Nothing Nothing
16 testAffixes' (Just "a-") Nothing
17 testAffixes' Nothing (Just "-z")
18 testAffixes' (Just "a-") (Just "-z")
19 traverse_ testAllAffixes ["symlink", "copy"]
20 where
21 mkAffixOption option = maybe [] (\a -> ["--program-" ++ option, a])
22 mkProgramName p s = maybe [] id p ++ "p" ++ maybe [] id s
23 testAffixes commonOpts prefix suffix = do
24 cabal "install" ( commonOpts
25 ++ mkAffixOption "prefix" prefix
26 ++ mkAffixOption "suffix" suffix)
27 runInstalledExe (mkProgramName prefix suffix) []