Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cabal repl --keep-temp-files test #10390

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/cabal.no.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# cabal clean
# cabal v2-repl
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
- pkg-a-1 (interactive) (lib) (first run)
- pkg-b-0 (interactive) (lib) (first run)
Configuring library for pkg-a-1...
Preprocessing library for pkg-a-1...
Configuring library for pkg-b-0...
Preprocessing library for pkg-b-0...
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages: pkg-a/*.cabal
packages: pkg-b/*.cabal
31 changes: 31 additions & 0 deletions cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/cabal.test.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import Test.Cabal.Prelude

main = do
cabalTest' "yes" $ do
skipUnlessGhcVersion ">= 9.4"
cabal' "clean" []
res <-
cabalWithStdin
"v2-repl"
[ "--keep-temp-files"
, "--enable-multi-repl"
, "pkg-b"
, "pkg-a"
]
"Bar.bar"
assertOutputContains "foo is 42" res
void $ assertGlobMatchesTestDir testDistDir "multi-out*/"

cabalTest' "no" $ do
skipUnlessGhcVersion ">= 9.4"
cabal' "clean" []
res <-
cabalWithStdin
"v2-repl"
[ "--enable-multi-repl"
, "pkg-b"
, "pkg-a"
]
"Bar.bar"
assertOutputContains "foo is 42" res
void $ assertGlobDoesNotMatchTestDir testDistDir "multi-out*/"
11 changes: 11 additions & 0 deletions cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/cabal.yes.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# cabal clean
# cabal v2-repl
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
- pkg-a-1 (interactive) (lib) (first run)
- pkg-b-0 (interactive) (lib) (first run)
Configuring library for pkg-a-1...
Preprocessing library for pkg-a-1...
Configuring library for pkg-b-0...
Preprocessing library for pkg-b-0...
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Foo where

foo :: Int
foo = 42
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cabal-version: 2.2
name: pkg-a
version: 1

library
default-language: Haskell2010
build-depends: base
exposed-modules: Foo
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module Bar (foo, bar) where

import Foo (foo)

bar :: String
bar = "foo is " <> show foo
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cabal-version: 2.2
name: pkg-b
version: 0

library
default-language: Haskell2010
build-depends: base, pkg-a
exposed-modules: Bar
Loading