tasty-hspec 1.1.5 → 1.1.5.1
raw patch · 4 files changed
+91/−64 lines, 4 filesdep ~QuickCheckdep ~basedep ~hspecPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: QuickCheck, base, hspec, hspec-core, tasty
API changes (from Hackage documentation)
Files
- .travis.yml +30/−41
- CHANGELOG.md +5/−0
- src/Test/Tasty/Hspec.hs +47/−11
- tasty-hspec.cabal +9/−12
.travis.yml view
@@ -1,8 +1,8 @@ # This Travis job script has been generated by a script via #-# runghc make_travis_yml_2.hs 'tasty-hspec.cabal'+# runghc make_travis_yml_2.hs 'tasty-hspec.cabal' '-o' '.travis.yml' #-# For more information, see https://github.com/hvr/multi-ghc-travis+# For more information, see https://github.com/haskell-CI/haskell-ci # language: c sudo: false@@ -28,20 +28,18 @@ matrix: include:- - compiler: "ghc-7.4.2"- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.4.2], sources: [hvr-ghc]}}- - compiler: "ghc-7.6.3"- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.6.3], sources: [hvr-ghc]}}- - compiler: "ghc-7.8.4"- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.8.4], sources: [hvr-ghc]}}- - compiler: "ghc-7.10.3"- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-7.10.3], sources: [hvr-ghc]}}- - compiler: "ghc-8.0.2"- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.0.2], sources: [hvr-ghc]}}+ - compiler: "ghc-8.6.2"+ # env: TEST=--disable-tests BENCH=--disable-benchmarks+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.6.2], sources: [hvr-ghc]}}+ - compiler: "ghc-8.4.4"+ # env: TEST=--disable-tests BENCH=--disable-benchmarks+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.4.4], sources: [hvr-ghc]}} - compiler: "ghc-8.2.2"- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.2], sources: [hvr-ghc]}}- - compiler: "ghc-8.4.2"- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.4.2], sources: [hvr-ghc]}}+ # env: TEST=--disable-tests BENCH=--disable-benchmarks+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.2.2], sources: [hvr-ghc]}}+ - compiler: "ghc-8.0.2"+ # env: TEST=--disable-tests BENCH=--disable-benchmarks+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.0.2], sources: [hvr-ghc]}} before_install: - HC=${CC}@@ -59,54 +57,43 @@ - BENCH=${BENCH---enable-benchmarks} - TEST=${TEST---enable-tests} - HADDOCK=${HADDOCK-true}- - INSTALLED=${INSTALLED-true}+ - UNCONSTRAINED=${UNCONSTRAINED-true}+ - NOINSTALLEDCONSTRAINTS=${NOINSTALLEDCONSTRAINTS-false} - GHCHEAD=${GHCHEAD-false} - travis_retry cabal update -v - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config" - rm -fv cabal.project cabal.project.local- # Overlay Hackage Package Index for GHC HEAD: https://github.com/hvr/head.hackage- - |- if $GHCHEAD; then- sed -i.bak 's/-- allow-newer:.*/allow-newer: *:base, *:template-haskell, *:ghc, *:Cabal/' ${HOME}/.cabal/config-- echo 'repository head.hackage' >> ${HOME}/.cabal/config- echo ' url: http://head.hackage.haskell.org/' >> ${HOME}/.cabal/config- echo ' secure: True' >> ${HOME}/.cabal/config- echo ' root-keys: 07c59cb65787dedfaef5bd5f987ceb5f7e5ebf88b904bbd4c5cbdeb2ff71b740' >> ${HOME}/.cabal/config- echo ' 2e8555dde16ebd8df076f1a8ef13b8f14c66bad8eafefd7d9e37d0ed711821fb' >> ${HOME}/.cabal/config- echo ' 8f79fd2389ab2967354407ec852cbe73f2e8635793ac446d09461ffb99527f6e' >> ${HOME}/.cabal/config- echo ' key-threshold: 3' >> ${HOME}/.cabal.config-- cabal new-update head.hackage -v- fi - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$' - "printf 'packages: \".\"\\n' > cabal.project"- - cat cabal.project+ - touch cabal.project.local+ - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- tasty-hspec | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"+ - cat cabal.project || true+ - cat cabal.project.local || true - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi - rm -f cabal.project.freeze - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all- - rm -rf "."/.ghc.environment.* "."/dist+ - rm -rf .ghc.environment.* "."/dist - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX) # Here starts the actual work to be performed for the package under test; # any command which exits with a non-zero exit code causes the build to fail. script: # test that source-distributions can be generated- - (cd "." && cabal sdist)- - mv "."/dist/tasty-hspec-*.tar.gz ${DISTDIR}/+ - cabal new-sdist all+ - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/ - cd ${DISTDIR} || false - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \; - "printf 'packages: tasty-hspec-*/*.cabal\\n' > cabal.project"- - cat cabal.project+ - touch cabal.project.local+ - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- tasty-hspec | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"+ - cat cabal.project || true+ - cat cabal.project.local || true # this builds all libraries and executables (without tests/benchmarks) - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all - # Build with installed constraints for packages in global-db- - if $INSTALLED; then echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks $(${HCPKG} list --global --simple-output --names-only | sed 's/\([a-zA-Z0-9-]\{1,\}\) */--constraint="\1 installed" /g') all | sh; else echo "Not building with installed constraints"; fi- # build & run tests, build benchmarks - cabal new-build -w ${HC} ${TEST} ${BENCH} all @@ -114,8 +101,10 @@ - (cd tasty-hspec-* && cabal check) # haddock- - rm -rf ./dist-newstyle - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi -# REGENDATA ["tasty-hspec.cabal"]+ # Build without installed constraints for packages in global-db+ - if $UNCONSTRAINED; then rm -f cabal.project.local; echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks all; else echo "Not building without installed constraints"; fi++# REGENDATA ["tasty-hspec.cabal","-o",".travis.yml"] # EOF
CHANGELOG.md view
@@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to the [Haskell Package Versioning Policy](https://pvp.haskell.org/). +## [1.1.5.1] - 2018-11-15++### Changed+- Support hspec-2.6.0+ ## [1.1.5] - 2018-06-27 ### Added
src/Test/Tasty/Hspec.hs view
@@ -22,8 +22,8 @@ import Control.Applicative ((<$>)) import Control.Exception (SomeException)-import Data.Maybe (catMaybes, fromMaybe)-import Data.Monoid (mconcat)+import Control.Monad (guard)+import Data.Maybe (catMaybes, fromMaybe, mapMaybe) import Data.Proxy import Data.Typeable (Typeable) @@ -79,20 +79,35 @@ -- 'H.Spec'. This returns the same tests as 'testSpec' but doesn't create -- a <https://hackage.haskell.org/package/tasty tasty> test group from them. testSpecs :: H.Spec -> IO [T.TestTree]-testSpecs spec = map specTreeToTestTree <$> H.runSpecM spec+testSpecs spec =+ catMaybes . map specTreeToTestTree <$>+ -- In hspec 2.6.0, "focus" was introduced. Here we do as hspec does, which+ -- is pre-process a spec by focusing the whole thing, which is a no-op if+ -- anything inside is already focused, but otherwise focuses every item.+ -- Then, when creating a tasty test tree, we just toss the unfocused items.+ H.runSpecM (doFocus spec)+ where+ doFocus :: H.Spec -> H.Spec+ doFocus =+#if MIN_VERSION_hspec(2,6,0)+ H.focus+#else+ id+#endif -specTreeToTestTree :: H.SpecTree () -> T.TestTree+specTreeToTestTree :: H.SpecTree () -> Maybe T.TestTree specTreeToTestTree spec_tree = case spec_tree of H.Node name spec_trees ->- T.testGroup name (map specTreeToTestTree spec_trees)+ Just (T.testGroup name (mapMaybe specTreeToTestTree spec_trees)) H.NodeWithCleanup cleanup spec_trees ->- T.WithResource (T.ResourceSpec (return ()) cleanup) (const test_tree)+ T.WithResource (T.ResourceSpec (return ()) cleanup) . const <$> test_tree where- test_tree :: T.TestTree+ test_tree :: Maybe T.TestTree test_tree = specTreeToTestTree (H.Node "(unnamed)" spec_trees)- H.Leaf item ->- T.singleTest (H.itemRequirement item) (Item item)+ H.Leaf item -> do+ guard (hspecItemIsFocused item)+ Just (T.singleTest (H.itemRequirement item) (Item item)) newtype Item = Item (H.Item ())@@ -100,7 +115,7 @@ instance T.IsTest Item where -- run :: T.OptionSet -> Item -> (T.Progress -> IO ()) -> IO T.Result- run opts (Item (H.Item _ _ _ ex)) progress = do+ run opts (Item item) progress = do qc_args <- tastyOptionSetToQuickCheckArgs opts let@@ -124,7 +139,7 @@ #else hspecResultToTastyResult pending_ #endif- <$> ex params ($ ()) hprogress+ <$> hspecItemToExample item params ($ ()) hprogress where sc_depth :: Int@@ -192,6 +207,27 @@ #else H.Fail str -> T.testFailed str #endif++hspecItemIsFocused :: H.Item a -> Bool+hspecItemIsFocused =+#if MIN_VERSION_hspec(2,6,0)+ H.itemIsFocused+#else+ const True+#endif++hspecItemToExample+ :: H.Item a+ -> H.Params+ -> (H.ActionWith a -> IO ())+ -> H.ProgressCallback+ -> IO H.Result+#if MIN_VERSION_hspec(2,6,0)+hspecItemToExample (H.Item _ _ _ _ ex) = ex+#else+hspecItemToExample (H.Item _ _ _ ex) = ex+#endif+ handleResultPending :: (String -> T.Result) -> Maybe String -> T.Result handleResultPending pending_ x =
tasty-hspec.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.0 name: tasty-hspec-version: 1.1.5+version: 1.1.5.1 synopsis: Hspec support for the Tasty test framework. description: This package provides a Tasty provider for Hspec test suites.@@ -12,13 +12,10 @@ maintainer: mitchellwrosen@gmail.com category: Testing build-type: Simple-tested-with: GHC == 7.4.2,- GHC == 7.6.3,- GHC == 7.8.4,- GHC == 7.10.3,- GHC == 8.0.2,+tested-with: GHC == 8.0.2, GHC == 8.2.2,- GHC == 8.4.3+ GHC == 8.4.4,+ GHC == 8.6.2 extra-source-files: .gitignore@@ -35,11 +32,11 @@ library exposed-modules: Test.Tasty.Hspec hs-source-dirs: src- build-depends: base >= 4.5 && < 5- , hspec >= 2 && < 2.6- , hspec-core >= 2 && < 2.6- , QuickCheck >= 2.7 && < 2.12- , tasty >= 0.8 && < 1.2+ build-depends: base ^>= 4.9 || ^>= 4.10 || ^>= 4.11 || ^>= 4.12+ , hspec >= 2 && < 2.7+ , hspec-core >= 2 && < 2.7+ , QuickCheck >= 2.7 && < 2.13+ , tasty >= 0.8 && < 1.2 , tasty-smallcheck >= 0.1 && < 0.9 -- 0.9 is missing 'optionSetToArgs' , tasty-quickcheck >=0.3 && <0.9 || ^>=0.9.1 || ^>= 0.10