Merge pull request #10493 from Sdywolf/doc-refine/repl
[cabal.git] / cabal-testsuite / PackageTests / UserConfig / cabal.test.hs
blob300bcc59ea5ca751cb5a60af9e269dfd71978e1b
1 import Test.Cabal.Prelude
2 main = cabalTest $ do
3 workdir <- fmap testWorkDir getTestEnv
4 let conf = workdir </> "cabal-config"
5 cabalG ["--config-file", conf] "user-config" ["init"]
6 shouldExist conf
7 fails $ cabalG ["--config-file", workdir </> "cabal-config"] "user-config" ["init"]
8 cabalG ["--config-file", conf] "user-config" ["-f", "init"]
9 shouldExist conf
10 let conf2 = workdir </> "cabal-config2"
11 withEnv [("CABAL_CONFIG", Just conf2)] $ do
12 cabal "user-config" ["init"]
13 shouldExist conf2
14 cabalG ["--config-file", conf] "user-config" ["update", "-f", "-a", "extra-prog-path: foo", "-a", "extra-prog-path: bar"]
15 assertFileDoesContain conf "foo,bar"
16 cabalG ["--config-file", conf] "user-config" ["update", "-f", "-a", "extra-prog-path: foo, bar"]
17 assertFileDoesContain conf "foo,bar"
19 -- regression test for #6268 (password-command parsing)
20 cabalG ["--config-file", conf]
21 "user-config" ["update", "-f", "-a", "password-command: sh -c \"echo secret\""]
22 -- non-quoted tokens do get quoted when writing, but this is expected
23 assertFileDoesContain conf "password-command: \"sh\" \"-c\" \"echo secret\""