Skip to content

Commit feaca9e

Browse files
authored
Merge pull request #6064 from commercialhaskell/test-cabal-sublibrary-dependency
Update cabal-sublibrary-dependency test
2 parents 93b8e8e + affcc64 commit feaca9e

File tree

10 files changed

+37
-37
lines changed

10 files changed

+37
-37
lines changed

test/integration/tests/cabal-sublibrary-dependency/Main.hs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@ import Control.Monad (unless)
22
import Data.List (isInfixOf)
33
import StackTest
44

5-
main :: IO ()
6-
main = do
7-
putStrLn "Disabled: CI doesn't have GHC 8.8.1"
8-
{-
9-
stackErrStderr ["build"] $ \str ->
10-
let msg = "SubLibrary dependency is not supported, this will almost certainly fail" in
5+
-- This tests building two local packages, one of which depends on the other
6+
-- (subproject). The dependency has a library and a visible sub-library named
7+
-- sub, each of which exposes a module that exports a function.
118

12-
unless (msg `isInfixOf` str) $
13-
error $ "Expected a warning: \n" ++ show msg
14-
-}
9+
main :: IO ()
10+
-- The '--install-ghc' flag is passed here, because etc/scripts/release.hs
11+
-- passes `--no-install-ghc` when `--alpine` is passed to its 'check' command.
12+
-- (See stack.yaml; using GHC 9.4.4.)
13+
main = stackErrStderr ["build", "--install-ghc"] $ \str ->
14+
let msg = "SubLibrary dependency is not supported, this will almost \
15+
\certainly fail."
16+
in unless (msg `isInfixOf` str) $
17+
error $ "Expected a warning: \n" ++ show msg

test/integration/tests/cabal-sublibrary-dependency/files/files.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cabal-version: 3.0
1+
cabal-version: 3.8
22
name: files
33
version: 0.1.0.0
44
build-type: Simple
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
module Lib
1+
module Lib
22
( someFunc
33
) where
44

5+
import Subproject.Lib ( libFunc )
6+
import Subproject.SubLib ( subLibFunc )
7+
58
someFunc :: IO ()
6-
someFunc = putStrLn "someFunc"
9+
someFunc = do
10+
libFunc
11+
subLibFunc

test/integration/tests/cabal-sublibrary-dependency/files/src/Sub/Sub.hs

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
resolver: nightly-2020-01-17
1+
resolver: nightly-2023-03-04 # GHC 9.4.4
22
packages:
33
- .
44
- subproject
5-
extra-deps:
6-
- github: snoyberg/filelock
7-
commit: 4f080496d8bf153fbe26e64d1f52cf73c7db25f6

test/integration/tests/cabal-sublibrary-dependency/files/subproject/src/Lib.hs

Lines changed: 0 additions & 6 deletions
This file was deleted.

test/integration/tests/cabal-sublibrary-dependency/files/subproject/src/SubLib.hs

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Subproject.Lib
2+
( libFunc
3+
) where
4+
5+
libFunc :: IO ()
6+
libFunc = putStrLn "libFunc"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Subproject.SubLib
2+
( subLibFunc
3+
) where
4+
5+
subLibFunc :: IO ()
6+
subLibFunc = putStrLn "subLibFunc"
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1+
cabal-version: 3.8
12
name: subproject
23
version: 0.1.0.0
34
build-type: Simple
4-
cabal-version: >=1.10
55

66
library
77
hs-source-dirs: src
8-
exposed-modules: Lib
8+
exposed-modules: Subproject.Lib
99
build-depends: base >= 4.7 && < 5
1010
default-language: Haskell2010
1111

1212
library sub
13+
visibility: public
1314
hs-source-dirs: src
14-
exposed-modules: SubLib
15+
exposed-modules: Subproject.SubLib
1516
build-depends: base >= 4.7 && < 5
1617
default-language: Haskell2010

0 commit comments

Comments
 (0)