Skip to content

Commit f0ca0dc

Browse files
committed
Resolve haskell#6409: Add public multilib test(s)
Also add a test for current behaviour of haskell#6083 And variant with mixin, for haskell#6281 The tests are disable for GHC older than 8.8 Should they work?
1 parent 9c148f7 commit f0ca0dc

File tree

32 files changed

+227
-1
lines changed

32 files changed

+227
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,4 @@ weeder :
197197
# tags
198198
.PHONY : tags
199199
tags :
200-
hasktags -b Cabal/Distribution Cabal/Cabal-described/src Cabal/Language cabal-install/Distribution
200+
hasktags -b Cabal/Distribution Cabal/Cabal-described/src Cabal/Language cabal-install/Distribution cabal-testsuite/src
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# cabal v2-run
2+
Resolving dependencies...
3+
Build profile: -w ghc-<GHCVER> -O1
4+
In order, the following will be built:
5+
- pkg-def-0.1.0.0 (lib:publib) (first run)
6+
- pkg-abc-0.1.0.0 (exe:program) (first run)
7+
Warning: pkg-def.cabal:13:27: visibility is experimental feature (issue #5660)
8+
Configuring library 'publib' for pkg-def-0.1.0.0..
9+
Preprocessing library 'publib' for pkg-def-0.1.0.0..
10+
Building library 'publib' for pkg-def-0.1.0.0..
11+
Warning: pkg-abc.cabal:10:15: colon specifier is experimental feature (issue #5660)
12+
Configuring executable 'program' for pkg-abc-0.1.0.0..
13+
Preprocessing executable 'program' for pkg-abc-0.1.0.0..
14+
Building executable 'program' for pkg-abc-0.1.0.0..
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
packages:
2+
pkg-abc
3+
pkg-def
4+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import Test.Cabal.Prelude
2+
main = cabalTest $ do
3+
-- https://github.com/haskell/cabal/pull/6047 should make this work for older GHCs too?
4+
skipIf =<< ghcVersionIs (< mkVersion [8,8])
5+
6+
cabal' "v2-run" ["pkg-abc:program"] >>= assertOutputContains "pkg-def:publib"
7+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Main (main) where
2+
import PkgDef (defValue)
3+
4+
main :: IO ()
5+
main = print defValue
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
cabal-version: 3.0
2+
name: pkg-abc
3+
version: 0.1.0.0
4+
5+
executable program
6+
default-language: Haskell2010
7+
main-is: Main.hs
8+
build-depends:
9+
, base
10+
, pkg-def:publib
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
cabal-version: 3.0
2+
name: pkg-def
3+
version: 0.1.0.0
4+
5+
library
6+
default-language: Haskell2010
7+
hs-source-dirs: src
8+
build-depends: base
9+
exposed-modules: PkgDef
10+
11+
library publib
12+
default-language: Haskell2010
13+
visibility: public
14+
hs-source-dirs: publib
15+
build-depends: base
16+
exposed-modules: PkgDef
17+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module PkgDef (defValue) where
2+
3+
defValue :: String
4+
defValue = "pkg-def:publib"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module PkgDef (defValue) where
2+
3+
defValue :: String
4+
defValue = "pkg-def:pkg-def"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# cabal v2-run
2+
Resolving dependencies...
3+
Build profile: -w ghc-<GHCVER> -O1
4+
In order, the following will be built:
5+
- pkg-abc-0.1.0.0 (lib:pkg-def) (first run)
6+
- pkg-abc-0.1.0.0 (exe:program) (first run)
7+
Warning: pkg-abc.cabal:19:15: colon specifier is experimental feature (issue #5660)
8+
Configuring library 'pkg-def' for pkg-abc-0.1.0.0..
9+
Preprocessing library 'pkg-def' for pkg-abc-0.1.0.0..
10+
Building library 'pkg-def' for pkg-abc-0.1.0.0..
11+
Warning: pkg-abc.cabal:19:15: colon specifier is experimental feature (issue #5660)
12+
Configuring executable 'program' for pkg-abc-0.1.0.0..
13+
Preprocessing executable 'program' for pkg-abc-0.1.0.0..
14+
Building executable 'program' for pkg-abc-0.1.0.0..
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
packages:
2+
pkg-abc
3+
pkg-def
4+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import Test.Cabal.Prelude
2+
3+
-- https://github.com/haskell/cabal/issues/6083
4+
-- see pkg-abc.cabal
5+
main = cabalTest $ do
6+
-- https://github.com/haskell/cabal/pull/6047 should make this work for older GHCs too?
7+
skipIf =<< ghcVersionIs (< mkVersion [8,8])
8+
9+
cabal' "v2-run" ["pkg-abc:program"] >>= assertOutputContains "pkg-abc:pkg-def"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Main (main) where
2+
import PkgDef (defValue)
3+
4+
main :: IO ()
5+
main = print defValue
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
cabal-version: 3.0
2+
name: pkg-abc
3+
version: 0.1.0.0
4+
5+
library pkg-def
6+
default-language: Haskell2010
7+
hs-source-dirs: pkg-def
8+
build-depends: base
9+
exposed-modules: PkgDef
10+
11+
executable program
12+
default-language: Haskell2010
13+
hs-source-dirs: exe
14+
main-is: Main.hs
15+
16+
-- we want that to resolve to pkg-def main library.
17+
build-depends:
18+
, base
19+
, pkg-def:pkg-def
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module PkgDef (defValue) where
2+
3+
defValue :: String
4+
defValue = "pkg-abc:pkg-def"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
cabal-version: 3.0
2+
name: pkg-def
3+
version: 0.1.0.0
4+
5+
library
6+
default-language: Haskell2010
7+
hs-source-dirs: src
8+
build-depends: base
9+
exposed-modules: PkgDef
10+
11+
library publib
12+
default-language: Haskell2010
13+
visibility: public
14+
hs-source-dirs: publib
15+
build-depends: base
16+
exposed-modules: PkgDef
17+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module PkgDef (defValue) where
2+
3+
defValue :: String
4+
defValue = "pkg-def:publib"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module PkgDef (defValue) where
2+
3+
defValue :: String
4+
defValue = "pkg-def:pkg-def"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# cabal v2-run
2+
Resolving dependencies...
3+
Build profile: -w ghc-<GHCVER> -O1
4+
In order, the following will be built:
5+
- pkg-abc-0.1.0.0 (lib:pkg-def) (first run)
6+
- pkg-abc-0.1.0.0 (exe:program) (first run)
7+
Warning: pkg-abc.cabal:20:15: colon specifier is experimental feature (issue #5660)
8+
Configuring library 'pkg-def' for pkg-abc-0.1.0.0..
9+
Preprocessing library 'pkg-def' for pkg-abc-0.1.0.0..
10+
Building library 'pkg-def' for pkg-abc-0.1.0.0..
11+
Warning: pkg-abc.cabal:20:15: colon specifier is experimental feature (issue #5660)
12+
Configuring executable 'program' for pkg-abc-0.1.0.0..
13+
Preprocessing executable 'program' for pkg-abc-0.1.0.0..
14+
Building executable 'program' for pkg-abc-0.1.0.0..
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
packages:
2+
pkg-abc
3+
pkg-def
4+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import Test.Cabal.Prelude
2+
3+
-- This is like T6083Pre, but also goes via mixins
4+
--
5+
main = cabalTest $ do
6+
-- https://github.com/haskell/cabal/pull/6047 should make this work for older GHCs too?
7+
skipIf =<< ghcVersionIs (< mkVersion [8,8])
8+
9+
cabal' "v2-run" ["pkg-abc:program"] >>= assertOutputContains "pkg-abc:pkg-def"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Main (main) where
2+
import Mixin (defValue)
3+
4+
main :: IO ()
5+
main = print defValue
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
cabal-version: 3.0
2+
name: pkg-abc
3+
version: 0.1.0.0
4+
5+
library pkg-def
6+
default-language: Haskell2010
7+
hs-source-dirs: pkg-def
8+
build-depends: base
9+
exposed-modules: PkgDef
10+
11+
executable program
12+
default-language: Haskell2010
13+
hs-source-dirs: exe
14+
main-is: Main.hs
15+
mixins: pkg-def (PkgDef as Mixin)
16+
17+
-- we want that to resolve to pkg-def main library.
18+
build-depends:
19+
, base
20+
, pkg-def:pkg-def
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module PkgDef (defValue) where
2+
3+
defValue :: String
4+
defValue = "pkg-abc:pkg-def"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
cabal-version: 3.0
2+
name: pkg-def
3+
version: 0.1.0.0
4+
5+
library
6+
default-language: Haskell2010
7+
hs-source-dirs: src
8+
build-depends: base
9+
exposed-modules: PkgDef
10+
11+
library publib
12+
default-language: Haskell2010
13+
visibility: public
14+
hs-source-dirs: publib
15+
build-depends: base
16+
exposed-modules: PkgDef
17+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module PkgDef (defValue) where
2+
3+
defValue :: String
4+
defValue = "pkg-def:publib"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module PkgDef (defValue) where
2+
3+
defValue :: String
4+
defValue = "pkg-def:pkg-def"

0 commit comments

Comments
 (0)