Merge pull request #10493 from Sdywolf/doc-refine/repl
[cabal.git] / cabal-testsuite / PackageTests / ReplOptions / cabal.test.hs
blob6c72166ed5f246b539ca5f1e6f4e38a3bf1563c9
1 import Test.Cabal.Prelude
3 main = do
4 cabalTest' "single-repl-options" $ do
5 cabal' "clean" []
6 res <- cabalWithStdin "v2-repl" ["--repl-options=-fwrite-interface"] ":set"
7 assertOutputContains "Ok, two modules loaded." res
8 assertOutputContains " -fwrite-interface" res
9 cabalTest' "multiple-repl-options" $ do
10 cabal' "clean" []
11 res <- cabalWithStdin "v2-repl" ["--repl-options=-fwrite-interface", "--repl-options=-fdefer-typed-holes"] ":set"
12 assertOutputContains "Ok, two modules loaded." res
13 assertOutputContains " -fwrite-interface" res
14 assertOutputContains " -fdefer-typed-holes" res
15 cabalTest' "single-repl-options-multiple-flags" $ do
16 cabal' "clean" []
17 res <- cabalWithStdin "v2-repl" ["--repl-options=-fdefer-typed-holes -fwrite-interface"] ":set"
18 assertOutputContains "Ok, two modules loaded." res
19 assertOutputContains " -fwrite-interface" res
20 assertOutputContains " -fdefer-typed-holes" res
21 cabalTest' "single-repl-options-multiple-flags-negative" $ do
22 cabal' "clean" []
23 res <- fails $ cabalWithStdin "v2-repl" ["--repl-options=-fwrite-interface -fdiagnostics-show-baret"] ":set"
24 assertOutputDoesNotContain "Ok, two modules loaded." res
25 assertOutputContains "unrecognised flag: -fdiagnostics-show-baret" res
26 assertOutputContains "did you mean one of:" res
27 cabalTest' "multiple-repl-options-multiple-flags" $ do
28 cabal' "clean" []
29 res <- cabalWithStdin "v2-repl" [
30 "--repl-options=-fforce-recomp -fwrite-interface",
31 "--repl-options=-fdefer-type-errors -fdefer-typed-holes"
32 ] ":set"
33 assertOutputContains "Ok, two modules loaded." res
34 assertOutputContains " -fwrite-interface" res
35 assertOutputContains " -fforce-recomp" res
36 assertOutputContains " -fdefer-typed-holes" res
37 assertOutputContains " -fdefer-type-errors" res