File tree Expand file tree Collapse file tree 1 file changed +28
-3
lines changed
Expand file tree Collapse file tree 1 file changed +28
-3
lines changed Original file line number Diff line number Diff line change 22
33set -euo pipefail
44
5- # Install doctest's Cabal integration
6- cabal install doctest --flag cabal-doctest --ignore-project --overwrite-policy=always
5+ # Packages to run doctests for; defaults to all packages if none are specified
6+ PACKAGES=(" $@ " )
7+
8+ # Install doctest's Cabal integration, if it's not present already
9+ if [[ -z " $( type -t cabal-doctest) " ]]
10+ then
11+ cabal install doctest --flag cabal-doctest --ignore-project --overwrite-policy=always
12+ fi
13+
14+ # Ensure doctest and PATH are using the same ghc version
15+
16+ getExecutablePath ()
17+ {
18+ " $1 " -package-env - -e ' import System.Environment' -e ' putStrLn =<< getExecutablePath'
19+ }
20+
21+ default_ghc=$( type -p ghc)
22+ doctest_ghc=$( doctest --info | ghc -e ' interact $ maybe "" id . lookup "ghc" . read' )
23+
24+ if [[ " $( getExecutablePath " $default_ghc " ) " != " $( getExecutablePath " $doctest_ghc " ) " ]]
25+ then
26+ echo " Incompatible GHC's:" >&2
27+ echo " Default ghc: $( getExecutablePath " $default_ghc " ) " >&2
28+ echo " Doctest ghc: $( getExecutablePath " $doctest_ghc " ) " >&2
29+ exit 1
30+ fi
731
832# Ensure the cabal-doctest executable can be found
933PATH=$( cabal path --installdir) :$PATH
@@ -21,9 +45,10 @@ cardano-ledger-api:lib:cardano-ledger-api --build-depends=cardano-ledger-babbage
2145EOF
2246
2347# Run the doctests for some or all packages
24- cabal-targets.hs " $@ " |
48+ cabal-targets.hs " ${PACKAGES[@]} " |
2549sort | join -t' ' -a1 -j1 - " $EXTRA_ARGS " |
2650while read -ra ARGS
2751do
52+ echo " ***** cabal doctest ${ARGS[0]} *****"
2853 cabal doctest --repl-options=' -w -Wdefault' " ${ARGS[@]} "
2954done
You can’t perform that action at this time.
0 commit comments