tasty-hspec 1.1.5.1 → 1.1.6
raw patch · 6 files changed
+92/−168 lines, 6 filesdep ~basedep ~tastyPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, tasty
API changes (from Hackage documentation)
- Test.Tasty.Hspec: Failure :: TreatPendingAs
- Test.Tasty.Hspec: Success :: TreatPendingAs
+ Test.Tasty.Hspec: TreatPendingAsFailure :: TreatPendingAs
+ Test.Tasty.Hspec: TreatPendingAsSuccess :: TreatPendingAs
Files
- .gitignore +1/−0
- .travis.yml +0/−110
- CHANGELOG.md +6/−0
- README.md +6/−2
- src/Test/Tasty/Hspec.hs +49/−32
- tasty-hspec.cabal +30/−24
.gitignore view
@@ -1,4 +1,5 @@ .ghc.environment.*+.ghcid .stack-work/ dist/ dist-newstyle/
− .travis.yml
@@ -1,110 +0,0 @@-# This Travis job script has been generated by a script via-#-# runghc make_travis_yml_2.hs 'tasty-hspec.cabal' '-o' '.travis.yml'-#-# For more information, see https://github.com/haskell-CI/haskell-ci-#-language: c-sudo: false--git:- submodules: false # whether to recursively clone submodules--cache:- directories:- - $HOME/.cabal/packages- - $HOME/.cabal/store--before_cache:- - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log- # remove files that are regenerated by 'cabal update'- - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*- - rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json- - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache- - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar- - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx-- - rm -rfv $HOME/.cabal/packages/head.hackage--matrix:- include:- - 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"- # 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}- - HCPKG=${HC/ghc/ghc-pkg}- - unset CC- - ROOTDIR=$(pwd)- - mkdir -p $HOME/.local/bin- - "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"- - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))- - echo $HCNUMVER--install:- - cabal --version- - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"- - BENCH=${BENCH---enable-benchmarks}- - TEST=${TEST---enable-tests}- - HADDOCK=${HADDOCK-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- - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'- - "printf 'packages: \".\"\\n' > 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- - 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- - 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"- - 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 & run tests, build benchmarks- - cabal new-build -w ${HC} ${TEST} ${BENCH} all-- # cabal check- - (cd tasty-hspec-* && cabal check)-- # haddock- - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi-- # 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,12 @@ 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.6] - 2020-11-11++### Changed+- Rename `Success`/`Failure` to `TreatPendingAsSuccess`/`TreatPendingAsFailure`+- Support tasty-1.4+ ## [1.1.5.1] - 2018-11-15 ### Changed
README.md view
@@ -1,5 +1,9 @@ # tasty-hspec -Hspec provider for tasty- [](https://travis-ci.org/mitchellwrosen/tasty-hspec)+[](https://hackage.haskell.org/package/tasty-hspec)+[](https://www.stackage.org/lts/package/tasty-hspec)+[](https://www.stackage.org/nightly/package/tasty-hspec)+[](https://packdeps.haskellers.com/reverse/tasty-hspec)++Hspec provider for tasty
src/Test/Tasty/Hspec.hs view
@@ -6,7 +6,6 @@ -- -- However, in a pinch, this module allows you to run an @hspec@ 'H.Spec' as a -- @tasty@ 'T.TestTree'.--- module Test.Tasty.Hspec ( -- * Tests@@ -56,6 +55,18 @@ -- ]) -- @ --+-- You can treat an 'H.pending'/'H.pendingWith' test as a success instead of a+-- failure (the default):+--+-- @+-- tests :: TestTree+-- tests =+-- localOption TreatPendingAsSuccess $ testGroup "My Hspec TestTree"+-- $ [ unsafePerformIO (testSpec "My first Hspec test" spec_firstHspecTest)+-- , ...+-- ]+-- @+-- -- However, if you don't do any @IO@ during 'Spec' creation, or the @IO@ need -- not be performed at any particular time relative to other @IO@ actions, it's -- perfectly fine to use 'System.IO.unsafePerformIO'.@@ -122,10 +133,8 @@ pending_ :: String -> T.Result pending_ = case T.lookupOption opts of- Failure ->- T.testFailed- Success ->- T.testPassed+ TreatPendingAsFailure -> T.testFailed+ TreatPendingAsSuccess -> T.testPassed let params :: H.Params@@ -143,43 +152,46 @@ where sc_depth :: Int- sc_depth = depth- where- TSC.SmallCheckDepth depth = T.lookupOption opts+ sc_depth =+ case T.lookupOption opts of+ TSC.SmallCheckDepth depth ->+ depth hprogress :: H.Progress -> IO ()- hprogress (x,y) = progress T.Progress- { T.progressText = ""- , T.progressPercent = fromIntegral x / fromIntegral y- }+ hprogress (x,y) =+ progress T.Progress+ { T.progressText = ""+ , T.progressPercent = fromIntegral x / fromIntegral y+ } -- testOptions :: Tagged Item [T.OptionDescription]- testOptions = return- [ T.Option (Proxy :: Proxy TreatPendingAs)- , T.Option (Proxy :: Proxy TQC.QuickCheckTests)- , T.Option (Proxy :: Proxy TQC.QuickCheckReplay)- , T.Option (Proxy :: Proxy TQC.QuickCheckMaxSize)- , T.Option (Proxy :: Proxy TQC.QuickCheckMaxRatio)- , T.Option (Proxy :: Proxy TSC.SmallCheckDepth)- ]+ testOptions =+ return+ [ T.Option (Proxy :: Proxy TreatPendingAs)+ , T.Option (Proxy :: Proxy TQC.QuickCheckTests)+ , T.Option (Proxy :: Proxy TQC.QuickCheckReplay)+ , T.Option (Proxy :: Proxy TQC.QuickCheckMaxSize)+ , T.Option (Proxy :: Proxy TQC.QuickCheckMaxRatio)+ , T.Option (Proxy :: Proxy TSC.SmallCheckDepth)+ ] tastyOptionSetToQuickCheckArgs :: T.OptionSet -> IO QC.Args tastyOptionSetToQuickCheckArgs opts = #if MIN_VERSION_tasty_quickcheck(0,9,1) snd <$> TQC.optionSetToArgs opts #else- return (QC.stdArgs+ return QC.stdArgs { QC.chatty = False , QC.maxDiscardRatio = max_ratio , QC.maxSize = max_size , QC.maxSuccess = num_tests , QC.replay = replay- })- where- TQC.QuickCheckTests num_tests = T.lookupOption opts- TQC.QuickCheckReplay replay = T.lookupOption opts- TQC.QuickCheckMaxSize max_size = T.lookupOption opts- TQC.QuickCheckMaxRatio max_ratio = T.lookupOption opts+ }+ where+ TQC.QuickCheckTests num_tests = T.lookupOption opts+ TQC.QuickCheckReplay replay = T.lookupOption opts+ TQC.QuickCheckMaxSize max_size = T.lookupOption opts+ TQC.QuickCheckMaxRatio max_ratio = T.lookupOption opts #endif hspecResultToTastyResult :: (String -> T.Result) -> H.Result -> T.Result@@ -266,17 +278,17 @@ -- -- Set via the command line flag @--treat-pending-as (success|failure)@. data TreatPendingAs- = Failure- | Success+ = TreatPendingAsFailure+ | TreatPendingAsSuccess instance T.IsOption TreatPendingAs where defaultValue =- Failure+ TreatPendingAsFailure parseValue s = case s of- "failure" -> Just Failure- "success" -> Just Success+ "failure" -> Just TreatPendingAsFailure+ "success" -> Just TreatPendingAsSuccess _ -> Nothing optionName =@@ -284,3 +296,8 @@ optionHelp = pure "How to treat pending hspec tests ('failure' or 'success')"++#if MIN_VERSION_tasty(1,3,0)+ showDefaultValue _ =+ Just "failure"+#endif
tasty-hspec.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.0 name: tasty-hspec-version: 1.1.5.1+version: 1.1.6 synopsis: Hspec support for the Tasty test framework. description: This package provides a Tasty provider for Hspec test suites.@@ -12,14 +12,9 @@ maintainer: mitchellwrosen@gmail.com category: Testing build-type: Simple-tested-with: GHC == 8.0.2,- GHC == 8.2.2,- GHC == 8.4.4,- GHC == 8.6.2 extra-source-files: .gitignore- .travis.yml cabal.project CHANGELOG.md examples/example.hs@@ -32,11 +27,35 @@ library exposed-modules: Test.Tasty.Hspec hs-source-dirs: src- 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+ build-depends: base+ ^>= 4.9+ || ^>= 4.10+ || ^>= 4.11+ || ^>= 4.12+ || ^>= 4.13+ || ^>= 4.14+ , hspec >= 2 && < 2.8+ , hspec-core >= 2 && < 2.8+ , QuickCheck+ ^>= 2.7+ || ^>= 2.8+ || ^>= 2.9+ || ^>= 2.10+ || ^>= 2.11+ || ^>= 2.12+ || ^>= 2.13+ || ^>= 2.14+ , tasty+ ^>= 0.8+ || ^>= 0.9+ || ^>= 0.10+ || ^>= 0.11+ || ^>= 0.12+ || ^>= 1.0+ || ^>= 1.1+ || ^>= 1.2+ || ^>= 1.3+ || ^>= 1.4 , tasty-smallcheck >= 0.1 && < 0.9 -- 0.9 is missing 'optionSetToArgs' , tasty-quickcheck >=0.3 && <0.9 || ^>=0.9.1 || ^>= 0.10@@ -48,16 +67,3 @@ ghc-options: -Wall if impl(ghc >= 8.0) ghc-options: -Wcompat---- This is a fake test-suite that I comment in to see the output---- test-suite tests--- hs-source-dirs: test--- main-is: Main.hs--- type: exitcode-stdio-1.0--- build-depends: base--- , hspec--- , tasty--- , tasty-hspec--- default-language: Haskell2010--- ghc-options: -Wall