packages feed

hspec 2.4.8 → 2.11.17

raw patch · 14 files changed

Files

CHANGES.markdown view
@@ -1,3 +1,315 @@+## Changes in 2.11.17 (2026-03-04)+  - Compatibility with QuickCheck 2.18++## Changes in 2.11.16 (2025-12-12)+  - Add support for MicroHs++## Changes in 2.11.15 (2025-12-08)+  - Remove redundant `tf-random` dependency++## Changes in 2.11.14 (2025-09-30)+  - Make sure that `--pretty` completes in *O(n)* time++## Changes in 2.11.13 (2025-09-15)+  - Make diff algorithm line based+  - Improve pretty-printing of nested records++## Changes in 2.11.12 (2025-03-17)+  - Add `--no-rerun` and `--no-rerun-all-on-success`++## Changes in 2.11.11 (2025-02-17)+  - Compatibility with GHC 9.12++## Changes in 2.11.10 (2024-11-16)+  - Add (experimental) extensions API+  - Handle small terminal sizes more gracefully when reporting progress+  - Correctly indent multi-line pending messages+  - Use "erase in line" ANSI sequence to clear transient output (instead of+    overwriting it with spaces)++## Changes in 2.11.9 (2024-05-24)+  - Compatibility with GHC 9.10.1+  - Drop support for GHC 7.10.3++## Changes in 2.11.8 (2024-04-22)+  - Make the build pass with QuickCheck 2.15++## Changes in 2.11.7 (2023-10-22)+  - Include `--seed` in the note on how to rurun a failing item.++## Changes in 2.11.6 (2023-10-11)+  - Compatibility with GHC 9.8.1+  - Run cleanup actions on `--fail-fast` (see #860)++## Changes in 2.11.5 (2023-09-20)+  - Add `--show-exceptions` and `--display-exceptions`++## Changes in 2.11.4 (2023-07-20)+  - Depend on `hspec-expectations-0.8.4`++## Changes in 2.11.3 (2023-07-10)+  - Suppress informational output from QuickCheck when+    `Test.QuickCheck.Args.chatty` is `False` (#840)++## Changes in 2.11.2 (2023-07-06)+  - Add `--expert` mode++## Changes in 2.11.1 (2023-05-28)+  - Depend on `hspec-expectations-0.8.3`++## Changes in 2.11.0.1 (2023-04-28)+  - Don't crash when home directories are unsupported (WASM/WASI) (thanks+    @amesgen)++## Changes in 2.11.0 (2023-04-21)+  - Drop support for GHC < 7.10.3+  - Improve coloring of whitespace-only segments on `--diff`+  - Add `ColorizedReason` constructor to `FailureReason`+  - Provide a new package `hspec-api`, a stable API that can be used to extend+    Hspec's functionality.+  - Deprecate `Test.Hspec.Core.Formatters.V1` in favor of+    `Test.Hspec.Api.Formatters.V1`+  - Add `--fail-on=empty-description`+  - Print slow spec items to `stderr` instead of `stdout`+  - Handle quoting/escaping in `.hspec` files+  - Flush output handle after reporting progress on `-fprogress`++## Changes in 2.10.10 (2023-03-07)+  - Re-export `sequential` from `Test.Hspec`+  - Rerun `beforeAll` / `afterAll` on `--rerun-all-on-success` (#768)++## Changes in 2.10.9 (2023-01-13)+  - Print error message on `-—fail-on=empty`+  - Only fail on `-—fail-on=empty` if at least one spec item has been filtered+  - Re-export more types from `Test.Hspec.Core.Runner`+  - Fix a pretty-printing bug where `[]` would be pretty-printed as `""`+  - Don't pretty-print if the expected and actual value would be equal after+    pretty-printing+  - Prevent deadlocks on unguarded exceptions in runner (#771)++## Changes in 2.10.8 (2022-12-19)+  - Add pretty-printing support for rational numbers+  - Force / evaluate exceptions recursively (#763)+  - Add `xprop` and `fprop`, which use `xit` and `fit` (thanks @lehins)++## Changes in 2.10.7 (2022-12-03)+  - Do not depend on `ghc` for pretty-printing (#750, #752)++## Changes in 2.10.6 (2022-09-13)+  - Suppress excessive diff output (#449)+  - Allow the use of an external diff program.  This can e.g. be used by+    setting `HSPEC_DIFF_COMMAND="diff -u --color -L expected -L actual"` or+    `HSPEC_DIFF_COMMAND="git diff"`+  - Do not imply `--fail-on=empty` on `--strict`++## Changes in 2.10.5 (2022-09-09)+  - Add `--fail-on`.  This subsums `--fail-on-focused` and `--fail-on-pending`.+  - Add `--fail-on=empty` (#650)+  - Add `registerFormatter` and `registerDefaultFormatter` to+    `Test.Hspec.Runner`.+  - Revert deprecation of `Test.Hspec.Formatters` and+    `Test.Hspec.Core.Formatters`.  Instead the module documentation now says+    that they are deprecated in favor of `Test.Hspec.Core.Formatters.V1`.++## Changes in 2.10.4 (2022-09-06)+  - Make sure that whitespace-only diff output is colorized properly (#660)++## Changes in 2.10.3 (2022-09-05)+  - Deprecate `Test.Hspec.Formatters` and `Test.Hspec.Core.Formatters`+  - Disable (most) warnings in files generated by `hspec-discover` (#702)++## Changes in 2.10.2 (2022-09-03)+  - Add `--strict`+  - Add `--fail-on-pending`+  - Do not depend on `clock`++## Changes in 2.10.1 (2022-08-22)+  - Support for GHC 9.4.1+  - Generated modules now include an export list++## Changes in 2.10.0.1 (2022-08-06)+  - Fix a deadlock with nested failed `aroundAll`s (see #679)++## Changes in 2.10.0 (2022-05-12)+  - Allow to transform the config in `SpecM`+  - Allow to customize pretty-printing (via `configPrettyPrintFunction`)+  - Add `getSpecDescriptionPath` (#637, thanks @srid)+  - Do not treat `afterAll` as another spec item (fixes #414, #364, #363)+  - Change type of `paramsSmallCheckDepth` to Maybe (see #345)++## Changes in 2.9.7+  - Ensure that interim output does not interfere with output from tests This+    facilitates using `print` when debugging test cases.++## Changes in 2.9.6+  - Ensure color codes don't span newlines (#346, thanks @robx)+  - Disable progress reporting on Buildkite+  - Improve error messages on exceptions in hooks++## Changes in 2.9.5+  - Assume `--color` by default when running on GitHub Actions. Use+    `HSPEC_COLOR=no` or `--no-color` to opt out of this behavior.+  - Disable progress reporting on GitHub Actions.+  - Retain source formatting of numbers when pretty-printing.++## Changes in 2.9.4+  - Compatibility with GHCJS (see #599)++## Changes in 2.9.3+  - Pretty-print Haskell values in failure messages++## Changes in 2.9.2+  - Show multi-line diffs for string literals (disable with `--no-pretty`)++## Changes in 2.9.1+  - Recover unicode from `ExpectedButGot`+  - Preserve unicode in `To rerun use: --match ...` output++## Changes in 2.9.0+  - Add ASCII fallbacks to "checks" formatter (fixes #512)+  - Use `checks` formatter by default (to restore the old behavior use+    `--format specdoc`)+  - Allow to extend the list of available formatters for `--format`+    (`configAvailableFormatters`)+  - Add `getExpectedTotalCount` to `Test.Hspec.Core.Formatters.V2`+  - Rename `formatConfigItemCount` to `formatConfigExpectedTotalCount`+  - Rename `configFastFail` to `configFailFast`++## Changes in 2.8.5+  - hspec-core: Include help.txt in package tarball (close #568)+  - hspec-discover: Require base >=4.5.0.0 (fixes #554)++## Changes in 2.8.4+  - Better support for GHC 9.2.1+  - Support for setting options by individual environment variables, e.g.+    `HSPEC_COLOR=yes` will set `--color`++## Changes in 2.8.3+  - Better support for `--color=auto` on Windows+  - Add support for spec hooks to `hspec-discover` (via `SpecHook.hs`)+  - Propagate exceptions from `Test.Hspec.Core.Format.monadic`+  - Re-export `aroundAll_` from `Test.Hspec`++## Changes in 2.8.2+  - Add `mapSubject` and `ignoreSubject`++## Changes in 2.8.1+  - Take the environment variable `NO_COLOR` into account++## Changes in 2.8.0+  - Add `--times` to print times for individual spec items+  - Add `--print-slow-items`+  - Use `-XNoImplicitPrelude` and do not rely on `base` for `hspec-discover`+    generated test drivers. This ensures full compatibility with custom+    preludes.+  - Add new APIs for formatters `Test.Hspec.Core.Format` and+    `Test.Hspec.Core.Formatters.V2`+  - Add `getItemCount` to `Formatter` API+  - Add `--qc-max-shrinks` (see #380)+  - Add location information for failing `afterAll`-hooks+  - hspec-discover: Deprecate `--no-main` and `--formatter` (use+    `--module-name` instead) (#196)+  - Remove `--verbose` option (this has been a noop since at least 2013)+  - Remove `--out` option (use shell output redirection instead)++## Changes in 2.7.10+  - Add a new formatter (can be used with `--format checks`)+  - Add `exampleStarted` to `Formatter` API++## Changes in 2.7.9+  - Re-export `aroundAll` and `aroundAllWith` from `Test.Hspec`++## Changes in 2.7.8+  - Add `aroundAll` / `aroundAllWith` (see #255)++## Changes in 2.7.7+  - Add `aroundAll_` (see #255)+  - Correctly handle pending for `afterAll` actions++## Changes in 2.7.6+  - Add `beforeAllWith` (see #447)++## Changes in 2.7.5+  - Extract source locations from `NoMethodError` and `AssertionFailed`++## Changes in 2.7.4+  - Apply `--randomize` recursively++## Changes in 2.7.3+  - Add `--randomize`++## Changes in 2.7.2+  - Interrupt diff calculation if it takes longer than two seconds (see #415)++## Changes in 2.7.1+  - Add compatibility with QuickCheck 2.13.1 (see #410)++## Changes in 2.7.0+  - Add `--focused-only` (see #390)+  - Add `--fail-on-focused` (see #389)++## Changes in 2.6.1+  - Add `Test.Hspec.Runner.runSpec` (see #216)++## Changes in 2.6.0+  - Allow to focus individual spec items (see #319)+  - Do not calculate diff on `--no-diff` (see #332)+  - Remove deprecated module Test.Hspec.Core++## Changes in 2.5.9+  - Extract source locations from RecConError (see #375)++## Changes in 2.5.8+  - Add `modifyArgs` and `modifyMaxShrinks` to `Test.Hspec.QuickCheck` (see #380)++## Changes in 2.5.7+  - GHC 8.6.1 related changes++## Changes in 2.5.6+  - Compatibility with `QuickCheck-2.12`++## Changes in 2.5.5+  - Use `module[line:column]` instead of `module:line:column` as default label+    for `describe`/`it` (fixes #366)++## Changes in 2.5.4+  - Show how to rerun individual spec items on test failures (see #205)++## Changes in 2.5.3+  - Treat character escapes like `\NUL` as single tokens on `--diff` (see #351)+  - Allow a `/` at the beginning and at the end of an absolute path that is+    passed to `--match` or `--skip`++## Changes in 2.5.2+  - Use module:line:column as default label for describe/it (see #250)+  - Warn if user is affected by https://ghc.haskell.org/trac/ghc/ticket/13285 (see #329)++## Changes in 2.5.1+  - Disable tests for Test.Hspec.Core.Timer (see #352)++## Changes in 2.5.0+  - Add `sequential` (see #311)+  - Add support for `--diff` when `shouldBe` is uesd with+    `QuickCheck`-properties+  - Add source locations when `shouldBe` is uesd with `QuickCheck` properties+  - Print `QuickCheck` labels on success (see #297)+  - Retain output of `verbose`, `label`, `collect`, `classify`, etc. for+    `QuickCheck` properties (see #257)+  - Extract source location from error / undefined (see #316)+  - Parse source locations from pattern match failures+  - Include source column when formatting source locations+  - Colorize whitespaces with background color instead of foreground color with+    `--diff`+  - Run `Test.Hspec.Core.Formatters.exampleProgress` in `FormatM` instead of+    `IO`+  - Make sure that progress output is always cleared (fixes #301)+  - Add location information to `pending` (not used by any formatter yet)+  - Include duration for each spec item in new formatter API (see #315) (not yet exposed)+  - Removed deprecated module `Test.Hspec.HUnit`, use+    `Test.Hspec.Contrib.HUnit` instead+  - Deprecate `--out`+  - Remove `BestEffort` source locations+ ## Changes in 2.4.8   - compatibility with GHC 8.4.1-alpha3 @@ -289,7 +601,7 @@    `--print-cpu-time`.  ## Changes in 1.4.0- - We now have a manual at http://hspec.github.io/.  The sources are in+ - We now have a manual at https://hspec.github.io/.  The sources are in    `doc/`.  It's still work in progress.  Contributions are very welcome!  - The Haddock documentation now indicates the stability of each exposed    module.  `Test.Hspec` is now considered stable.@@ -341,7 +653,7 @@  - `hspec-discover`, a mechanism for automatic spec discovery, is now an    official part of Hspec.    Have a look at [`hspec-discover`'s README]-   (https://github.com/hspec/hspec/tree/master/hspec-discover#readme)+   (https://github.com/hspec/hspec/tree/main/hspec-discover#readme)    for a short introduction.  ## Changes in 1.2.0@@ -457,7 +769,7 @@   ] ``` -Specs consisting of several *desribes*, combined with `descriptions`, continue+Specs consisting of several *describes*, combined with `descriptions`, continue to work unchanged.  But `descriptions` is now a noop, and it will be removed in a future release.  So it is a good idea to drop it. @@ -490,7 +802,7 @@ ### A new monadic API for custom Formatters  For all the details, have a look at the [docs]-(http://hackage.haskell.org/packages/archive/hspec/latest/doc/html/Test-Hspec-Formatters.html).+(https://hackage.haskell.org/packages/archive/hspec/latest/doc/html/Test-Hspec-Formatters.html).   ### The total time required to run a spec is now included in the summary
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2011-2017 Simon Hengel <sol@typeful.net>+Copyright (c) 2011-2026 Simon Hengel <sol@typeful.net> Copyright (c) 2011-2012 Trystan Spangler <trystan.s@comcast.net> Copyright (c) 2011-2011 Greg Weber <greg@gregweber.info> 
hspec.cabal view
@@ -1,27 +1,26 @@--- This file has been generated from package.yaml by hpack version 0.25.0.+cabal-version: 1.12++-- This file has been generated from package.yaml by hpack version 0.39.1. -- -- see: https://github.com/sol/hpack------ hash: 4e6d8536db1ab37d1c42006f33479988a740fc613f7d80c8ac3d2bbc005d2108  name:             hspec-version:          2.4.8+version:          2.11.17 license:          MIT license-file:     LICENSE-copyright:        (c) 2011-2017 Simon Hengel,+copyright:        (c) 2011-2026 Simon Hengel,                   (c) 2011-2012 Trystan Spangler,                   (c) 2011 Greg Weber maintainer:       Simon Hengel <sol@typeful.net> build-type:       Simple-cabal-version:    >= 1.10 category:         Testing stability:        experimental bug-reports:      https://github.com/hspec/hspec/issues-homepage:         http://hspec.github.io/+author:           Simon Hengel <sol@typeful.net>+homepage:         https://hspec.github.io/ synopsis:         A Testing Framework for Haskell-description:      Hspec is a testing framework for Haskell. It is inspired by-                  the Ruby library RSpec. Some of Hspec's distinctive features-                  are:+description:      Hspec is a testing framework for Haskell.  Some of Hspec's distinctive+                  features are:                   .                   * a friendly DSL for defining tests                   .@@ -31,9 +30,9 @@                   .                   * automatic discovery of test files                   .-                  The Hspec Manual is at <http://hspec.github.io/>.-+                  The Hspec Manual is at <https://hspec.github.io/>. extra-source-files:+    version.yaml     CHANGES.markdown  source-repository head@@ -45,48 +44,19 @@   hs-source-dirs:       src   build-depends:-      HUnit >=1.2.5-    , QuickCheck >=2.5.1+      QuickCheck >=2.12     , base ==4.*-    , call-stack-    , hspec-core ==2.4.8-    , hspec-discover ==2.4.8-    , hspec-expectations ==0.8.2.*-    , transformers >=0.2.2.0+    , hspec-core ==2.11.17+    , hspec-discover ==2.11.17+    , hspec-expectations ==0.8.4.*   exposed-modules:       Test.Hspec-      Test.Hspec.Core       Test.Hspec.Discover       Test.Hspec.Formatters-      Test.Hspec.HUnit       Test.Hspec.QuickCheck       Test.Hspec.Runner   other-modules:       Paths_hspec   default-language: Haskell2010--test-suite spec-  type: exitcode-stdio-1.0-  ghc-options: -Wall-  hs-source-dirs:-      test-  main-is: Spec.hs-  other-modules:-      Helper-      HelperSpec-      Test.Hspec.DiscoverSpec-      Paths_hspec-  build-depends:-      HUnit >=1.2.5-    , QuickCheck >=2.5.1-    , base ==4.*-    , call-stack-    , directory-    , hspec-    , hspec-core ==2.4.8-    , hspec-discover ==2.4.8-    , hspec-expectations ==0.8.2.*-    , hspec-meta >=2.3.2-    , stringbuilder-    , transformers >=0.2.2.0-  default-language: Haskell2010+  if impl(ghc)+    cpp-options: -DENABLE_SPEC_HOOK_ARGS
src/Test/Hspec.hs view
@@ -4,14 +4,14 @@ -- Hspec is a testing framework for Haskell. -- -- This is the library reference for Hspec.--- The <http://hspec.github.io/ User's Manual> contains more in-depth+-- The <https://hspec.github.io/ User's Manual> contains more in-depth -- documentation. module Test.Hspec ( -- * Types   Spec , SpecWith-, Arg , Example+, Arg  -- * Setting expectations , module Test.Hspec.Expectations@@ -23,6 +23,7 @@ , context , example , parallel+, sequential , runIO  -- * Pending spec items@@ -39,6 +40,16 @@ , xdescribe , xcontext +-- * Focused spec items #focus#+-- |+-- During a test run, when a spec contains /focused/ spec items, all other spec+-- items are ignored.+, focus+, fit+, fspecify+, fdescribe+, fcontext+ -- * Hooks , ActionWith , before@@ -46,6 +57,7 @@ , beforeWith , beforeAll , beforeAll_+, beforeAllWith , after , after_ , afterAll@@ -53,6 +65,11 @@ , around , around_ , aroundWith+, aroundAll+, aroundAll_+, aroundAllWith+, mapSubject+, ignoreSubject  -- * Running a spec , hspec
− src/Test/Hspec/Core.hs
@@ -1,18 +0,0 @@--- | Stability: unstable-module Test.Hspec.Core {-# DEPRECATED "use \"Test.Hspec.Core.Spec\" instead" #-} (-  module Test.Hspec.Core.Spec--- * Deprecated functions-, describe-, it-) where--import           Test.Hspec.Core.Spec hiding (describe, it)---{-# DEPRECATED describe "use `specGroup` instead" #-}-describe :: String -> [SpecTree a] -> SpecTree a-describe = specGroup--{-# DEPRECATED it "use `specItem` instead" #-}-it :: Example a => String -> a -> SpecTree (Arg a)-it = specItem
src/Test/Hspec/Discover.hs view
@@ -1,3 +1,5 @@+{-# OPTIONS_GHC -fno-warn-deprecations #-}+{-# OPTIONS_HADDOCK hide #-} {-# LANGUAGE FlexibleInstances #-} module Test.Hspec.Discover {-# WARNING   "This module is used by @hspec-discover@.  It is not part of the public API and may change at any time."@@ -11,17 +13,9 @@ , module Prelude ) where -import           Prelude hiding (mapM)-import           Control.Applicative-import           Data.Maybe-import           Data.List-import           Data.Traversable-import           Control.Monad.Trans.State- import           Test.Hspec.Core.Spec import           Test.Hspec.Core.Runner-import           Test.Hspec.Formatters-import           Test.Hspec.Core.Util (safeTry)+import           Test.Hspec.Core.Formatters.V1  class IsFormatter a where   toFormatter :: a -> IO Formatter@@ -38,62 +32,4 @@   hspecWith defaultConfig {configFormatter = Just f} spec  postProcessSpec :: FilePath -> Spec -> Spec-postProcessSpec = locationHeuristicFromFile--locationHeuristicFromFile :: FilePath -> Spec -> Spec-locationHeuristicFromFile file spec = do-  mInput <- either (const Nothing) Just <$> (runIO . safeTry . readFile) file-  let lookupLoc = maybe (\_ _ _ -> Nothing) (lookupLocation file)  mInput-  runIO (runSpecM spec) >>= fromSpecList . addLoctions lookupLoc--addLoctions :: (Int -> Int -> String -> Maybe Location) -> [SpecTree a] -> [SpecTree a]-addLoctions lookupLoc = map (fmap f) . enumerate-  where-    f :: ((Int, Int), Item a) -> Item a-    f ((n, total), item) = item {itemLocation = itemLocation item <|> lookupLoc n total (itemRequirement item)}--type EnumerateM = State [(String, Int)]--enumerate :: [SpecTree a] -> [Tree (ActionWith a) ((Int, Int), (Item a))]-enumerate tree = (mapM (traverse addPosition) tree >>= mapM (traverse addTotal)) `evalState` []-  where-    addPosition :: Item a -> EnumerateM (Int, Item a)-    addPosition item = (,) <$> getOccurrence (itemRequirement item) <*> pure item--    addTotal :: (Int, Item a) -> EnumerateM ((Int, Int), Item a)-    addTotal (n, item) = do-      total <- getTotal (itemRequirement item)-      return ((n, total), item)--    getTotal :: String -> EnumerateM Int-    getTotal requirement = do-      gets $ fromMaybe err . lookup requirement-      where-        err = error ("Test.Hspec.Discover.getTotal: No entry for requirement " ++ show requirement ++ "!")--    getOccurrence :: String -> EnumerateM Int-    getOccurrence requirement = do-      xs <- get-      let n = maybe 1 succ (lookup requirement xs)-      put ((requirement, n) : filter ((/= requirement) . fst) xs)-      return n--lookupLocation :: FilePath -> String -> Int -> Int -> String -> Maybe Location-lookupLocation file input n total requirement = loc-  where-    loc :: Maybe Location-    loc = Location file <$> line <*> pure 0 <*> pure BestEffort--    line :: Maybe Int-    line = case occurrences of-      xs | length xs == total -> Just (xs !! pred n)-      _ -> Nothing--    occurrences :: [Int]-    occurrences = map fst (filter p inputLines)-      where-        p :: (Int, String) -> Bool-        p = isInfixOf (show requirement) . snd--    inputLines :: [(Int, String)]-    inputLines = zip [1..] (lines input)+postProcessSpec _ = id
src/Test/Hspec/Formatters.hs view
@@ -1,2 +1,8 @@-module Test.Hspec.Formatters (module Test.Hspec.Core.Formatters) where-import           Test.Hspec.Core.Formatters+{-# OPTIONS_GHC -fno-warn-deprecations #-}+-- |+-- Stability: deprecated+module Test.Hspec.Formatters+{-# DEPRECATED "Use [Test.Hspec.Api.Formatters.V1](https://hackage.haskell.org/package/hspec-api/docs/Test-Hspec-Api-Formatters-V1.html) instead." #-}+(module Test.Hspec.Core.Formatters.V1)+where+import           Test.Hspec.Core.Formatters.V1
− src/Test/Hspec/HUnit.hs
@@ -1,24 +0,0 @@-module Test.Hspec.HUnit {-# DEPRECATED "use \"Test.Hspec.Contrib.HUnit\" from package @hspec-contrib@ instead" #-}-(--- * Interoperability with HUnit-  fromHUnitTest-) where--import           Test.Hspec.Core.Spec-import           Test.HUnit (Test (..))---- |--- Convert a HUnit test suite to a spec.  This can be used to run existing--- HUnit tests with Hspec.-fromHUnitTest :: Test -> Spec-fromHUnitTest t = case t of-  TestList xs -> mapM_ go xs-  x -> go x-  where-    go :: Test -> Spec-    go t_ = case t_ of-      TestLabel s (TestCase e) -> it s e-      TestLabel s (TestList xs) -> describe s (mapM_ go xs)-      TestLabel s x -> describe s (go x)-      TestList xs -> describe "<unlabeled>" (mapM_ go xs)-      TestCase e -> it "<unlabeled>" e
src/Test/Hspec/QuickCheck.hs view
@@ -2,12 +2,16 @@ {-# LANGUAGE ConstraintKinds #-} module Test.Hspec.QuickCheck ( -- * Params-  modifyMaxSuccess+  modifyArgs+, modifyMaxSuccess , modifyMaxDiscardRatio , modifyMaxSize+, modifyMaxShrinks  -- * Shortcuts , prop+, xprop+, fprop ) where  import           Test.Hspec@@ -20,7 +24,37 @@ -- -- is a shortcut for ----- > it ".." $ property $--- >   ..+-- @+-- `it` ".." $ `property` $+--   ..+-- @ prop :: (HasCallStack, Testable prop) => String -> prop -> Spec prop s = it s . property+++-- |+-- > xprop ".." $+-- >   ..+--+-- is a shortcut for+--+-- @+-- `xit` ".." $ `property` $+--   ..+-- @+xprop :: (HasCallStack, Testable prop) => String -> prop -> Spec+xprop s = xit s . property+++-- |+-- > fprop ".." $+-- >   ..+--+-- is a shortcut for+--+-- @+-- `fit` ".." $ `property` $+--   ..+-- @+fprop :: (HasCallStack, Testable prop) => String -> prop -> Spec+fprop s = fit s . property
− test/Helper.hs
@@ -1,19 +0,0 @@-module Helper (-  module Test.Hspec.Meta-, withFileContent-) where--import           Control.Exception (finally)-import           System.Directory-import           System.IO-import           Test.Hspec.Meta--import           Test.Hspec.QuickCheck ()--withFileContent :: String -> (FilePath -> IO a) -> IO a-withFileContent input action = do-  dir <- getTemporaryDirectory-  (file, h) <- openTempFile dir "temp"-  hPutStr h input-  hClose h-  action file `finally` removeFile file
− test/HelperSpec.hs
@@ -1,18 +0,0 @@-module HelperSpec (main, spec) where--import           Helper-import           System.IO.Error (isDoesNotExistError)--main :: IO ()-main = hspec spec--spec :: Spec-spec = do-  describe "withFileContent" $ do-    it "creates a file with specified content and runs specified action" $ do-      withFileContent "foo" $ \file -> do-        readFile file `shouldReturn` "foo"--    it "removes file after action has been run" $ do-      file <- withFileContent "foo" return-      readFile file `shouldThrow` isDoesNotExistError
− test/Spec.hs
@@ -1,1 +0,0 @@-{-# OPTIONS_GHC -F -pgmF hspec-meta-discover #-}
− test/Test/Hspec/DiscoverSpec.hs
@@ -1,74 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-deprecations #-}-module Test.Hspec.DiscoverSpec (main, spec) where--import           Helper-import           Data.String-import           Data.String.Builder--import qualified Test.Hspec.Core.Spec as H-import           Test.Hspec.Core (Tree(..), Item(..), Location(..), LocationAccuracy(..), runSpecM)-import qualified Test.Hspec.Discover as H--infix 1 `shouldHaveLocation`--shouldHaveLocation :: Item a -> (String, Int) -> Expectation-item `shouldHaveLocation` (src, line) = itemLocation item `shouldBe` Just (Location src line 0 BestEffort)--removeLocations :: H.SpecWith a -> H.SpecWith a-removeLocations = H.mapSpecItem_ (\item -> item{H.itemLocation = Nothing})--main :: IO ()-main = hspec spec--spec :: Spec-spec = do-  describe "postProcessSpec" $ do-    it "adds heuristic source locations" $ do-      let c = build $ do-            ""-            strlit "foo"-            ""-            strlit "bar"-            ""-            strlit "baz"-      withFileContent c $ \src -> do-        [Leaf item1, Leaf item2, Leaf item3] <- runSpecM . H.postProcessSpec src . removeLocations $ do-          H.it "foo" True-          H.it "bar" True-          H.it "baz" True-        item1 `shouldHaveLocation` (src, 2)-        item2 `shouldHaveLocation` (src, 4)-        item3 `shouldHaveLocation` (src, 6)--    context "when same requirement is used multiple times" $ do-      it "assigns locations sequentially" $ do-        let c = build $ do-              strlit "foo"-              strlit "foo"-              strlit "foo"-        withFileContent c $ \src -> do-          [Leaf item1, Leaf item2, Leaf item3] <- runSpecM . H.postProcessSpec src . removeLocations $ do-            H.it "foo" True-            H.it "foo" True-            H.it "foo" True-          item1 `shouldHaveLocation` (src, 1)-          item2 `shouldHaveLocation` (src, 2)-          item3 `shouldHaveLocation` (src, 3)--      context "when a requirement occurs more often in the spec tree than in the source file" $ do-        it "assigns Nothing" $ do-          let c = build $ do-                strlit "foo"-                strlit "foo"-          withFileContent c $ \src -> do-            [Leaf item1, Leaf item2, Leaf item3] <- runSpecM . H.postProcessSpec src . removeLocations $ do-              H.it "foo" True-              H.it "foo" True-              H.it "foo" True-            itemLocation item1 `shouldBe` Nothing-            itemLocation item2 `shouldBe` Nothing-            itemLocation item3 `shouldBe` Nothing-  where-    strlit :: String -> Builder-    strlit = fromString . show
+ version.yaml view
@@ -0,0 +1,7 @@+version: &version 2.11.17+synopsis: A Testing Framework for Haskell+author: Simon Hengel <sol@typeful.net>+maintainer: Simon Hengel <sol@typeful.net>+category: Testing+stability: experimental+homepage: https://hspec.github.io/