Skip to content

Commit bd2ff0c

Browse files
committed
GHC 9.14 compat: replace async with time in a test for haddock-project
the test was using async from hackage as an exmaple global package. Currently, async has a too restrictive upper bound on base. It'll be more robust to rely on a boot package instead. Ideally we'd not rely on anything from Hackage in tests, but that's an issue for another day. Also, disable haddock-project on older Windows It fails for an unknown reason; possibly the output is in the wrong place compared to where the test looks, but tooling gets it right.
1 parent 62b8244 commit bd2ff0c

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

cabal-install/tests/IntegrationTests2.hs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2768,7 +2768,8 @@ testConfigOptionComments = do
27682768

27692769
testIgnoreProjectFlag :: Assertion
27702770
testIgnoreProjectFlag = do
2771-
-- Coverage flag should be false globally by default (~/.cabal folder)
2771+
-- Coverage flag should be false globally by default.
2772+
-- This should be covered by the vanilla config file created in `main`.
27722773
(_, _, prjConfigGlobal, _, _) <- configureProject testdir ignoreSetConfig
27732774
let globalCoverageFlag = packageConfigCoverage . projectConfigLocalPackages $ prjConfigGlobal
27742775
False @=? Flag.fromFlagOrDefault False globalCoverageFlag
@@ -2797,7 +2798,10 @@ testHaddockProjectDependencies config = do
27972798
(_, _, sharedConfig) <- planProject testdir config
27982799
-- `haddock-project` is only supported by `haddock-2.26.1` and above which is
27992800
-- shipped with `ghc-9.4`
2800-
when (compilerVersion (pkgConfigCompiler sharedConfig) > mkVersion [9, 4]) $ do
2801+
-- And doesn't work with older ghc on Windows for some reason (file in the
2802+
-- wrong place, perhaps?).
2803+
let safeMinor = if buildOS == Windows then 10 else 4
2804+
when (compilerVersion (pkgConfigCompiler sharedConfig) > mkVersion [9, safeMinor]) $ do
28012805
let dir = basedir </> testdir
28022806
cleanHaddockProject testdir
28032807
withCurrentDirectory dir $ do
@@ -2811,7 +2815,7 @@ testHaddockProjectDependencies config = do
28112815
["all"]
28122816
defaultGlobalFlags{globalStoreDir = Flag "store"}
28132817

2814-
let haddock = "haddocks" </> "async" </> "async.haddock"
2818+
let haddock = "haddocks" </> "time" </> "time.haddock"
28152819
hasHaddock <- doesFileExist haddock
28162820
unless hasHaddock $ assertFailure ("File `" ++ haddock ++ "` does not exist.")
28172821
cleanHaddockProject testdir

cabal-install/tests/IntegrationTests2/haddock-project/dependencies/a.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ cabal-version: >= 1.10
55

66
library
77
exposed-modules: MyLib
8-
build-depends: base, async
8+
build-depends: base, time
99
hs-source-dirs: src
1010
default-language: Haskell2010

cabal-install/tests/IntegrationTests2/haddock-project/dependencies/cabal.project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ jobs: 1
44

55
documentation: True
66

7-
package async
7+
package time
88
documentation: True
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module MyLib (someFunc) where
22

3-
import Control.Concurrent.Async
3+
import Data.Time.Clock
44

5-
someFunc :: IO (Async ())
6-
someFunc = async (return ())
5+
someFunc :: IO ()
6+
someFunc = print =<< getCurrentTime

0 commit comments

Comments
 (0)