Move doctests to shell script
This fixes various problems with doctest: * https://github.com/sol/doctest/issues/245 * https://github.com/composewell/streamly/issues/83 Also clean up travis.yml for cabal-3.
This commit is contained in:
parent
3529ec2a15
commit
f5c541b9cc
40
.travis.yml
40
.travis.yml
@ -7,18 +7,18 @@ dist: trusty
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- env: CABALVER=2.2 GHCVER=7.6.3
|
||||
addons: {apt: {packages: [cabal-install-2.2,ghc-7.6.3], sources: [hvr-ghc]}}
|
||||
- env: CABALVER=2.2 GHCVER=7.8.4
|
||||
addons: {apt: {packages: [cabal-install-2.2,ghc-7.8.4], sources: [hvr-ghc]}}
|
||||
- env: CABALVER=2.2 GHCVER=7.10.2
|
||||
addons: {apt: {packages: [cabal-install-2.2,ghc-7.10.2], sources: [hvr-ghc]}}
|
||||
- env: CABALVER=2.2 GHCVER=8.0.1
|
||||
addons: {apt: {packages: [cabal-install-2.2,ghc-8.0.1], sources: [hvr-ghc]}}
|
||||
- env: CABALVER=2.2 GHCVER=8.2.2
|
||||
addons: {apt: {packages: [cabal-install-2.2,ghc-8.2.2], sources: [hvr-ghc]}}
|
||||
- env: CABALVER=2.2 GHCVER=8.4.1
|
||||
addons: {apt: {packages: [cabal-install-2.2,ghc-8.4.1], sources: [hvr-ghc]}}
|
||||
- env: CABALVER=3.0 GHCVER=7.6.3 SKIP_DOCTESTS=yes
|
||||
addons: {apt: {packages: [cabal-install-3.0,ghc-7.6.3], sources: [hvr-ghc]}}
|
||||
- env: CABALVER=3.0 GHCVER=7.8.4 SKIP_DOCTESTS=yes
|
||||
addons: {apt: {packages: [cabal-install-3.0,ghc-7.8.4], sources: [hvr-ghc]}}
|
||||
- env: CABALVER=3.0 GHCVER=7.10.2 SKIP_DOCTESTS=yes
|
||||
addons: {apt: {packages: [cabal-install-3.0,ghc-7.10.2], sources: [hvr-ghc]}}
|
||||
- env: CABALVER=3.0 GHCVER=8.0.1 SKIP_DOCTESTS=yes
|
||||
addons: {apt: {packages: [cabal-install-3.0,ghc-8.0.1], sources: [hvr-ghc]}}
|
||||
- env: CABALVER=3.0 GHCVER=8.2.2
|
||||
addons: {apt: {packages: [cabal-install-3.0,ghc-8.2.2], sources: [hvr-ghc]}}
|
||||
- env: CABALVER=3.0 GHCVER=8.4.1
|
||||
addons: {apt: {packages: [cabal-install-3.0,ghc-8.4.1], sources: [hvr-ghc]}}
|
||||
- env: CABALVER=head GHCVER=head
|
||||
addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}}
|
||||
|
||||
@ -36,27 +36,15 @@ before_install:
|
||||
install:
|
||||
- cabal --version
|
||||
- travis_retry cabal update
|
||||
- cabal sandbox init
|
||||
- cabal install --only-dependencies --enable-tests -j
|
||||
|
||||
script:
|
||||
- cabal configure --enable-tests -v2
|
||||
- cabal build
|
||||
- cabal test
|
||||
- ./run-doctests.sh
|
||||
- cabal check
|
||||
- cabal sdist
|
||||
- cabal haddock --hyperlink-source --html-location=https://hackage.haskell.org/package/\$pkg-\$version/docs/
|
||||
# check that the generated source-distribution can be built & installed
|
||||
- export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ;
|
||||
cd dist/;
|
||||
cabal sandbox init;
|
||||
if [ -f "$SRC_TGZ" ]; then
|
||||
cabal install "$SRC_TGZ" --enable-tests;
|
||||
else
|
||||
echo "expected '$SRC_TGZ' not found";
|
||||
exit 1;
|
||||
fi;
|
||||
cd ..
|
||||
- cabal install --enable-tests --lib
|
||||
|
||||
after_script:
|
||||
- ./update-gh-pages.sh
|
||||
|
@ -1,13 +0,0 @@
|
||||
module Main where
|
||||
|
||||
|
||||
import Test.DocTest
|
||||
import Test.HUnit
|
||||
|
||||
main =
|
||||
doctest
|
||||
["-isrc"
|
||||
, "-XOverloadedStrings"
|
||||
, "src/HPath.hs"
|
||||
]
|
||||
|
@ -1,25 +0,0 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Main where
|
||||
|
||||
import Control.Applicative
|
||||
import System.Posix.Directory.Traversals
|
||||
|
||||
import Test.DocTest
|
||||
import Test.HUnit
|
||||
|
||||
main = do
|
||||
doctest
|
||||
[ "-isrc"
|
||||
, "-XOverloadedStrings"
|
||||
, "System.Posix.FilePath"
|
||||
]
|
||||
runTestTT unitTests
|
||||
|
||||
|
||||
unitTests :: Test
|
||||
unitTests = test
|
||||
[ TestCase $ do
|
||||
r <- (==) <$> allDirectoryContents "." <*> allDirectoryContents' "."
|
||||
assertBool "allDirectoryContents == allDirectoryContents'" r
|
||||
]
|
34
hpath.cabal
34
hpath.cabal
@ -13,8 +13,6 @@ cabal-version: 1.14
|
||||
extra-source-files: README.md
|
||||
CHANGELOG
|
||||
cbits/dirutils.h
|
||||
doctests-hpath.hs
|
||||
doctests-posix.hs
|
||||
|
||||
library
|
||||
if os(windows)
|
||||
@ -41,7 +39,6 @@ library
|
||||
, deepseq
|
||||
, exceptions
|
||||
, hspec
|
||||
, simple-sendfile >= 0.2.24
|
||||
, streamly >= 0.7
|
||||
, unix >= 2.5
|
||||
, unix-bytestring
|
||||
@ -49,37 +46,6 @@ library
|
||||
, word8
|
||||
|
||||
|
||||
test-suite doctests-hpath
|
||||
if os(windows)
|
||||
build-depends: unbuildable<0
|
||||
buildable: False
|
||||
default-language: Haskell2010
|
||||
type: exitcode-stdio-1.0
|
||||
ghc-options: -threaded
|
||||
main-is: doctests-hpath.hs
|
||||
build-depends: base
|
||||
, HUnit
|
||||
, QuickCheck
|
||||
, doctest >= 0.8
|
||||
, hpath
|
||||
|
||||
test-suite doctests-posix
|
||||
if os(windows)
|
||||
build-depends: unbuildable<0
|
||||
buildable: False
|
||||
default-language: Haskell2010
|
||||
type: exitcode-stdio-1.0
|
||||
ghc-options: -threaded
|
||||
main-is: doctests-posix.hs
|
||||
build-depends: base,
|
||||
bytestring >= 0.10.0.0,
|
||||
unix,
|
||||
hpath,
|
||||
doctest >= 0.8,
|
||||
HUnit,
|
||||
QuickCheck,
|
||||
word8
|
||||
|
||||
test-suite spec
|
||||
if os(windows)
|
||||
build-depends: unbuildable<0
|
||||
|
22
run-doctests.sh
Executable file
22
run-doctests.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ -n "${SKIP_DOCTESTS}" ] ; then
|
||||
echo "Skipping doctests"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! command -v doctest >/dev/null ; then
|
||||
tempdir="$(mktemp -d)"
|
||||
(
|
||||
cd "${tempdir}"
|
||||
cabal install --installdir="${tempdir}" doctest
|
||||
)
|
||||
export PATH="${tempdir}:$PATH"
|
||||
fi
|
||||
|
||||
set -x
|
||||
|
||||
cabal exec doctest -- -isrc -XOverloadedStrings System.Posix.FilePath
|
||||
cabal exec doctest -- -isrc -XOverloadedStrings HPath
|
Loading…
Reference in New Issue
Block a user