Merge remote-tracking branch 'origin/fix-doctests'

This commit is contained in:
Julian Ospald 2019-12-30 23:00:24 +01:00
commit 8412ea96fb
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28
5 changed files with 48 additions and 102 deletions

View File

@ -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.10.3 SKIP_DOCTESTS=yes
addons: {apt: {packages: [cabal-install-3.0,ghc-7.10.3], sources: [hvr-ghc]}}
- env: CABALVER=3.0 GHCVER=8.0.2 SKIP_DOCTESTS=yes
addons: {apt: {packages: [cabal-install-3.0,ghc-8.0.2], 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.4
addons: {apt: {packages: [cabal-install-3.0,ghc-8.4.4], sources: [hvr-ghc]}}
- env: CABALVER=3.0 GHCVER=8.6.5
addons: {apt: {packages: [cabal-install-3.0,ghc-8.6.5], sources: [hvr-ghc]}}
- env: CABALVER=3.0 GHCVER=8.8.1
addons: {apt: {packages: [cabal-install-3.0,ghc-8.8.1], sources: [hvr-ghc]}}
- env: CABALVER=head GHCVER=head
addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}}
@ -31,32 +31,22 @@ env:
before_install:
- sudo apt-get install -y hscolour
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
- export PATH=~/.cabal/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
install:
- cabal --version
- travis_retry cabal update
- cabal sandbox init
- cabal install --only-dependencies --enable-tests -j
- cabal install --installdir=$HOME/.cabal/bin hspec-discover
- cabal install --installdir=$HOME/.cabal/bin doctest
script:
- cabal configure --enable-tests -v2
- cabal build
- cabal build --enable-tests
- 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 haddock --haddock-hyperlink-source --haddock-html-location=https://hackage.haskell.org/package/\$pkg-\$version/docs/
- cabal install --lib
after_script:
- ./update-gh-pages.sh

View File

@ -1,13 +0,0 @@
module Main where
import Test.DocTest
import Test.HUnit
main =
doctest
["-isrc"
, "-XOverloadedStrings"
, "src/HPath.hs"
]

View File

@ -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
]

View File

@ -10,11 +10,15 @@ copyright: Julian Ospald 2016
category: Filesystem
build-type: Simple
cabal-version: 1.14
tested-with: GHC==7.10.3
, GHC==8.0.2
, GHC==8.2.2
, GHC==8.4.4
, GHC==8.6.5
, GHC==8.8.1
extra-source-files: README.md
CHANGELOG
cbits/dirutils.h
doctests-hpath.hs
doctests-posix.hs
library
if os(windows)
@ -35,13 +39,12 @@ library
System.Posix.FD,
System.Posix.FilePath
other-modules: HPath.Internal
build-depends: base >= 4.6 && <5
build-depends: base >= 4.8 && <5
, IfElse
, bytestring >= 0.10.0.0
, deepseq
, exceptions
, hspec
, simple-sendfile >= 0.2.24
, streamly >= 0.7
, unix >= 2.5
, unix-bytestring
@ -49,37 +52,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
View 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