packages feed

hspec-megaparsec 1.0.0 → 1.1.0

raw patch · 5 files changed

+56/−20 lines, 5 filesdep ~hspec-expectations

Dependency ranges changed: hspec-expectations

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+## Hspec Megaparsec 1.1.0++* Add `HasCallStack` constraint to combinators to improve detection of+  locations where test failures happen.+ ## Hspec Megaparsec 1.0.0  * To be used with Megaparsec 6.
LICENSE.md view
@@ -1,4 +1,4 @@-Copyright © 2016–2017 Mark Karpov+Copyright © 2016–2018 Mark Karpov  All rights reserved. 
README.md view
@@ -5,7 +5,6 @@ [![Stackage Nightly](http://stackage.org/package/hspec-megaparsec/badge/nightly)](http://stackage.org/nightly/package/hspec-megaparsec) [![Stackage LTS](http://stackage.org/package/hspec-megaparsec/badge/lts)](http://stackage.org/lts/package/hspec-megaparsec) [![Build Status](https://travis-ci.org/mrkkrp/hspec-megaparsec.svg?branch=master)](https://travis-ci.org/mrkkrp/hspec-megaparsec)-[![Coverage Status](https://coveralls.io/repos/mrkkrp/hspec-megaparsec/badge.svg?branch=master&service=github)](https://coveralls.io/github/mrkkrp/hspec-megaparsec?branch=master)  The package is the recommended library for testing [`Megaparsec`](https://hackage.haskell.org/package/megaparsec)@@ -19,6 +18,6 @@  ## License -Copyright © 2016–2017 Mark Karpov+Copyright © 2016–2018 Mark Karpov  Distributed under BSD 3 clause license.
Test/Hspec/Megaparsec.hs view
@@ -1,6 +1,6 @@ -- | -- Module      :  Test.Hspec.Megaparsec--- Copyright   :  © 2016–2017 Mark Karpov+-- Copyright   :  © 2016–2018 Mark Karpov -- License     :  BSD 3 clause -- -- Maintainer  :  Mark Karpov <markkarpov92@gmail.com>@@ -14,6 +14,7 @@ {-# LANGUAGE RankNTypes          #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies        #-}+{-# LANGUAGE ConstraintKinds     #-}  module Test.Hspec.Megaparsec   ( -- * Basic expectations@@ -44,7 +45,12 @@ -- -- > parse letterChar "" "x" `shouldParse` 'x' -shouldParse :: (Ord t, ShowToken t, ShowErrorComponent e, Eq a, Show a)+shouldParse :: ( HasCallStack+               , Ord t+               , ShowToken t+               , ShowErrorComponent e+               , Eq a+               , Show a )   => Either (ParseError t e) a      -- ^ Result of parsing as returned by function like 'parse'   -> a                 -- ^ Desired result@@ -60,7 +66,11 @@ -- -- > parse (many punctuationChar) "" "?!!" `parseSatisfies` ((== 3) . length) -parseSatisfies :: (Ord t, ShowToken t, ShowErrorComponent e, Show a)+parseSatisfies :: ( HasCallStack+                  , Ord t+                  , ShowToken t+                  , ShowErrorComponent e+                  , Show a )   => Either (ParseError t e) a      -- ^ Result of parsing as returned by function like 'parse'   -> (a -> Bool)       -- ^ Predicate@@ -76,7 +86,7 @@ -- -- > parse (char 'x') "" `shouldFailOn` "a" -shouldFailOn :: Show a+shouldFailOn :: (HasCallStack, Show a)   => (s -> Either (ParseError t e) a)      -- ^ Parser that takes stream and produces result or error message   -> s                 -- ^ Input that the parser should fail on@@ -87,7 +97,11 @@ -- -- > parse (char 'x') "" `shouldSucceedOn` "x" -shouldSucceedOn :: (Ord t, ShowToken t, ShowErrorComponent e, Show a)+shouldSucceedOn :: ( HasCallStack+                   , Ord t+                   , ShowToken t+                   , ShowErrorComponent e+                   , Show a )   => (s -> Either (ParseError t e) a)      -- ^ Parser that takes stream and produces result or error message   -> s                 -- ^ Input that the parser should succeed on@@ -103,7 +117,11 @@ -- -- > parse (char 'x') "" "b" `shouldFailWith` err posI (utok 'b' <> etok 'x') -shouldFailWith :: (Ord t, ShowToken t, ShowErrorComponent e, Show a)+shouldFailWith :: ( HasCallStack+                  , Ord t+                  , ShowToken t+                  , ShowErrorComponent e+                  , Show a )   => Either (ParseError t e) a   -> ParseError t e   -> Expectation@@ -126,7 +144,11 @@ -- -- See also: 'initialState'. -failsLeaving :: (Show a, Eq s, Show s, Stream s)+failsLeaving :: ( HasCallStack+                , Show a+                , Eq s+                , Show s+                , Stream s )   => (State s, Either (ParseError (Token s) e) a)      -- ^ Parser that takes stream and produces result along with actual      -- state information@@ -144,7 +166,8 @@ -- -- See also: 'initialState'. -succeedsLeaving :: ( ShowToken (Token s)+succeedsLeaving :: ( HasCallStack+                   , ShowToken (Token s)                    , ShowErrorComponent e                    , Show a                    , Eq s@@ -176,7 +199,7 @@  -- | Expectation that argument is result of a failed parser. -shouldFail :: Show a+shouldFail :: (HasCallStack, Show a)   => Either (ParseError t e) a   -> Expectation shouldFail r = case r of@@ -186,7 +209,11 @@  -- | Expectation that argument is result of a succeeded parser. -shouldSucceed :: (Ord t, ShowToken t, ShowErrorComponent e, Show a)+shouldSucceed :: ( HasCallStack+                 , Ord t+                 , ShowToken t+                 , ShowErrorComponent e+                 , Show a )   => Either (ParseError t e) a   -> Expectation shouldSucceed r = case r of@@ -197,7 +224,7 @@  -- | Compare two streams for equality and in the case of mismatch report it. -checkUnconsumed :: (Eq s, Show s, Stream s)+checkUnconsumed :: (HasCallStack, Eq s, Show s, Stream s)   => s                 -- ^ Expected unconsumed input   -> s                 -- ^ Actual unconsumed input   -> Expectation
hspec-megaparsec.cabal view
@@ -1,7 +1,7 @@ name:                 hspec-megaparsec-version:              1.0.0-cabal-version:        >= 1.18-tested-with:          GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.1+version:              1.1.0+cabal-version:        1.18+tested-with:          GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.3 license:              BSD3 license-file:         LICENSE.md author:               Mark Karpov <markkarpov92@gmail.com>@@ -23,18 +23,23 @@ library   build-depends:      base               >= 4.7 && < 5.0                     , containers         >= 0.5 && < 0.6-                    , hspec-expectations >= 0.5 && < 0.9+                    , hspec-expectations >= 0.8 && < 0.9                     , megaparsec         >= 6.0 && < 7.0   if !impl(ghc >= 7.8)     build-depends:    tagged             == 0.8.*   if !impl(ghc >= 8.0)     build-depends:    semigroups         == 0.18.*-   exposed-modules:    Test.Hspec.Megaparsec   if flag(dev)     ghc-options:      -Wall -Werror   else     ghc-options:      -Wall+  if flag(dev) && impl(ghc >= 8.0)+    ghc-options:      -Wcompat+                      -Wincomplete-record-updates+                      -Wincomplete-uni-patterns+                      -Wnoncanonical-monad-instances+                      -Wnoncanonical-monadfail-instances   default-language:   Haskell2010  test-suite tests@@ -47,7 +52,7 @@     ghc-options:      -Wall   build-depends:      base               >= 4.7 && < 5.0                     , hspec              >= 2.0 && < 3.0-                    , hspec-expectations >= 0.5 && < 0.9+                    , hspec-expectations >= 0.8 && < 0.9                     , hspec-megaparsec                     , megaparsec         >= 6.0 && < 7.0   if !impl(ghc >= 7.8)