hspec 1.11.0 → 1.11.1
raw patch · 5 files changed
+26/−44 lines, 5 filesdep −doctestdep ~basePVP ok
version bump matches the API change (PVP)
Dependencies removed: doctest
Dependency ranges changed: base
API changes (from Hackage documentation)
+ Test.Hspec: specify :: Example a => String -> a -> Spec
Files
- hspec.cabal +12/−20
- src/Test/Hspec.hs +6/−1
- src/Test/Hspec/Util.hs +4/−17
- test/Test/Hspec/UtilSpec.hs +4/−0
- test/doctests.hs +0/−6
hspec.cabal view
@@ -1,5 +1,5 @@ name: hspec-version: 1.11.0+version: 1.11.1 license: MIT license-file: LICENSE copyright: (c) 2011-2014 Simon Hengel,@@ -12,14 +12,19 @@ stability: experimental bug-reports: https://github.com/hspec/hspec/issues homepage: http://hspec.github.io/-synopsis: Behavior-Driven Development for Haskell-description: Behavior-Driven Development for Haskell+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: .- Hspec is roughly based on the Ruby library RSpec. However,- Hspec is just a framework for running HUnit and QuickCheck- tests. Compared to other options, it provides a much nicer- syntax that makes tests very easy to read.+ * a friendly DSL for defining tests .+ * integration with QuickCheck, SmallCheck, and HUnit+ .+ * parallel test execution+ .+ * automatic discovery of test files+ . The Hspec Manual is at <http://hspec.github.io/>. extra-source-files:@@ -117,19 +122,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@@ -18,6 +18,7 @@ , describe , context , it+, specify , example , pending , pendingWith@@ -60,6 +61,10 @@ -- > absolute (-1) == 1 it :: Example a => String -> a -> Spec it label action = fromSpecList [Core.it label action]++-- | An alias for `it`.+specify :: Example a => String -> a -> Spec+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/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"]