diff --git a/taggy.cabal b/taggy.cabal index b79a60d..5de7c84 100644 --- a/taggy.cabal +++ b/taggy.cabal @@ -68,7 +68,7 @@ test-suite spec base == 4.* , text , hspec - , hspec-expectations + , hspec-attoparsec , vector , attoparsec , unordered-containers diff --git a/tests/Text/Taggy/ParserSpec.hs b/tests/Text/Taggy/ParserSpec.hs index 3643ebe..7d1381a 100644 --- a/tests/Text/Taggy/ParserSpec.hs +++ b/tests/Text/Taggy/ParserSpec.hs @@ -2,16 +2,14 @@ module Text.Taggy.ParserSpec where -import Control.Monad import Data.Attoparsec.Text.Lazy import Data.Text.Lazy import Test.Hspec +import Test.Hspec.Attoparsec (shouldParse) +import qualified Test.Hspec.Attoparsec.Source (Source((~>))) import Text.Taggy.Parser import Text.Taggy.Types -main :: IO () -main = hspec spec - spec :: Spec spec = do describe "tagopen parser" $ do @@ -100,18 +98,4 @@ spec = do ] (~>) :: Text -> Parser a -> Either String a -t ~> p = eitherResult $ parse p t - -shouldParse :: (Eq a, Show a) => Either String a -> a -> Expectation -res `shouldParse` expectedVal = - either (expectationFailure . errmsg) - checkEquality - res - - where errmsg err = " expected: " ++ show expectedVal - ++ "\n but parse failed with error: " ++ err - - checkEquality parsedVal = - when (parsedVal /= expectedVal) $ - expectationFailure $ " expected: " ++ show expectedVal - ++ "\n but got: " ++ show parsedVal \ No newline at end of file +(~>) = (Test.Hspec.Attoparsec.Source.~>)