Skip to content

Commit 3667756

Browse files
authored
Merge pull request #10391 from MercuryTechnologies/wiggles/add-repl-keep-temp-files-test-custom-setup
Add `repl --keep-temp-files` test with custom `Setup.hs`
2 parents 5e3bb1a + 878a019 commit 3667756

File tree

11 files changed

+109
-0
lines changed

11 files changed

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

0 commit comments

Comments
 (0)