hspec2 0.4.0 → 0.4.1
raw patch · 6 files changed
+18/−39 lines, 6 filesdep −doctestdep ~basedep ~hspec-expectationsPVP ok
version bump matches the API change (PVP)
Dependencies removed: doctest
Dependency ranges changed: base, hspec-expectations
API changes (from Hackage documentation)
+ Test.Hspec: specify :: Example e => String -> e -> SpecWith (Arg e)
Files
- hspec2.cabal +2/−15
- src/Test/Hspec.hs +6/−1
- src/Test/Hspec/Core/Type.hs +2/−0
- src/Test/Hspec/Util.hs +4/−17
- test/Test/Hspec/UtilSpec.hs +4/−0
- test/doctests.hs +0/−6
hspec2.cabal view
@@ -1,5 +1,5 @@ name: hspec2-version: 0.4.0+version: 0.4.1 license: MIT license-file: LICENSE copyright: (c) 2011-2014 Simon Hengel,@@ -48,7 +48,7 @@ , HUnit >= 1.2.5 , QuickCheck >= 2.5.1 , quickcheck-io- , hspec-expectations >= 0.5.0 && < 0.6.1+ , hspec-expectations == 0.6.1.* , async >= 2 exposed-modules: Test.Hspec@@ -113,19 +113,6 @@ , hspec-meta >= 1.9.1 , process , ghc-paths--test-suite doctests- main-is:- doctests.hs- type:- exitcode-stdio-1.0- ghc-options:- -Wall -Werror -threaded- hs-source-dirs:- test- build-depends:- base == 4.*- , doctest >= 0.9.4.1 test-suite example type:
src/Test/Hspec.hs view
@@ -1,7 +1,7 @@ -- | -- Stability: stable ----- Hspec is a testing library for Haskell.+-- 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@@ -21,6 +21,7 @@ , describe , context , it+, specify , example , pending , pendingWith@@ -70,6 +71,10 @@ -- > absolute (-1) == 1 it :: Example e => String -> e -> SpecWith (Arg e) it label action = fromSpecList [Core.it label action]++-- | An alias for `it`.+specify :: Example e => String -> e -> SpecWith (Arg e)+specify = it -- | This is a type restricted version of `id`. It can be used to get better -- error messages on type mismatches.
src/Test/Hspec/Core/Type.hs view
@@ -67,6 +67,8 @@ -- items. `runIO` allows you to run IO actions during this construction phase. -- The IO action is always run when the spec tree is constructed (e.g. even -- when @--dry-run@ is specified).+-- If you do not need the result of the IO action to construct the spec tree,+-- `Test.Hspec.beforeAll` may be more suitable for your use case. runIO :: IO r -> SpecM a r runIO = SpecM . liftIO
src/Test/Hspec/Util.hs view
@@ -16,31 +16,18 @@ import Test.Hspec.Compat (showType) ---- | Create a more readable display of a quantity of something.------ Examples:------ >>> pluralize 0 "example"--- "0 examples"------ >>> pluralize 1 "example"--- "1 example"------ >>> pluralize 2 "example"--- "2 examples" pluralize :: Int -> String -> String pluralize 1 s = "1 " ++ s pluralize n s = show n ++ " " ++ s ++ "s" -- | Convert an exception to a string. ----- The type of the exception is included. Here is an example:+-- This is different from `show`. The type of the exception is included, e.g.+-- `E.ArithException` is turned into: ----- >>> import Control.Applicative--- >>> import Control.Exception--- >>> either formatException show <$> (try . evaluate) (1 `div` 0)+-- @ -- "ArithException (divide by zero)"+-- @ formatException :: E.SomeException -> String formatException (E.SomeException e) = showType e ++ " (" ++ show e ++ ")"
test/Test/Hspec/UtilSpec.hs view
@@ -24,6 +24,10 @@ it "returns a plural word given the number 0" $ do pluralize 0 "thing" `shouldBe` "0 things" + describe "formatException" $ do+ it "converts exception to string" $ do+ formatException (E.toException E.DivideByZero) `shouldBe` "ArithException (divide by zero)"+ describe "lineBreaksAt" $ do it "inserts line breaks at word boundaries" $ do lineBreaksAt 20 "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod"
− test/doctests.hs
@@ -1,6 +0,0 @@-module Main where--import Test.DocTest--main :: IO ()-main = doctest ["-isrc", "-optP-include", "-optPdist/build/autogen/cabal_macros.h", "src/Test/Hspec/Util.hs", "src/Test/Hspec/Formatters.hs"]