Skip to content

Commit c71faa7

Browse files
committed
Add repl --keep-temp-files test
1 parent c53a03a commit c71faa7

File tree

8 files changed

+81
-0
lines changed

8 files changed

+81
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# cabal clean
2+
# cabal v2-repl
3+
Resolving dependencies...
4+
Build profile: -w ghc-<GHCVER> -O1
5+
In order, the following will be built:
6+
- pkg-a-1 (interactive) (lib) (first run)
7+
- pkg-b-0 (interactive) (lib) (first run)
8+
Configuring library for pkg-a-1...
9+
Preprocessing library for pkg-a-1...
10+
Configuring library for pkg-b-0...
11+
Preprocessing library for pkg-b-0...
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
packages: pkg-a/*.cabal
2+
packages: pkg-b/*.cabal
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import Test.Cabal.Prelude
2+
3+
main = do
4+
cabalTest' "yes" $ do
5+
skipUnlessGhcVersion ">= 9.4"
6+
cabal' "clean" []
7+
res <-
8+
cabalWithStdin
9+
"v2-repl"
10+
[ "--keep-temp-files"
11+
, "--enable-multi-repl"
12+
, "pkg-b"
13+
, "pkg-a"
14+
]
15+
"Bar.bar"
16+
assertOutputContains "foo is 42" res
17+
void $ assertGlobMatchesTestDir testDistDir "multi-out*/"
18+
19+
cabalTest' "no" $ do
20+
skipUnlessGhcVersion ">= 9.4"
21+
cabal' "clean" []
22+
res <-
23+
cabalWithStdin
24+
"v2-repl"
25+
[ "--enable-multi-repl"
26+
, "pkg-b"
27+
, "pkg-a"
28+
]
29+
"Bar.bar"
30+
assertOutputContains "foo is 42" res
31+
void $ assertGlobDoesNotMatchTestDir testDistDir "multi-out*/"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# cabal clean
2+
# cabal v2-repl
3+
Resolving dependencies...
4+
Build profile: -w ghc-<GHCVER> -O1
5+
In order, the following will be built:
6+
- pkg-a-1 (interactive) (lib) (first run)
7+
- pkg-b-0 (interactive) (lib) (first run)
8+
Configuring library for pkg-a-1...
9+
Preprocessing library for pkg-a-1...
10+
Configuring library for pkg-b-0...
11+
Preprocessing library for pkg-b-0...
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module Foo where
2+
3+
foo :: Int
4+
foo = 42
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
cabal-version: 2.2
2+
name: pkg-a
3+
version: 1
4+
5+
library
6+
default-language: Haskell2010
7+
build-depends: base
8+
exposed-modules: Foo
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Bar (foo, bar) where
2+
3+
import Foo (foo)
4+
5+
bar :: String
6+
bar = "foo is " <> show foo
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
cabal-version: 2.2
2+
name: pkg-b
3+
version: 0
4+
5+
library
6+
default-language: Haskell2010
7+
build-depends: base, pkg-a
8+
exposed-modules: Bar

0 commit comments

Comments
 (0)