yesod-test 1.5.1.1 → 1.5.2
raw patch · 3 files changed
+46/−18 lines, 3 filesdep +pretty-showPVP ok
version bump matches the API change (PVP)
Dependencies added: pretty-show
API changes (from Hackage documentation)
+ Yesod.Test: assertEq :: (Eq a, Show a) => String -> a -> a -> YesodExample site ()
+ Yesod.Test: assertEqualNoShow :: (Eq a) => String -> a -> a -> YesodExample site ()
Files
- ChangeLog.md +4/−0
- Yesod/Test.hs +24/−1
- yesod-test.cabal +18/−17
ChangeLog.md view
@@ -1,3 +1,7 @@+## 1.5.2++* Added assertEq, deprecated assertEqual [#1259](https://github.com/yesodweb/yesod/pull/1259)+ ## 1.5.1.1 * Fix `addToken_` needing a trailing space and allows multiples spaces in css selector.
Yesod/Test.hs view
@@ -4,6 +4,7 @@ {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TypeFamilies #-}+ {-| Yesod.Test is a pragmatic framework for testing web applications built using wai and persistent.@@ -84,6 +85,9 @@ -- * Assertions , assertEqual+ , assertEqualNoShow+ , assertEq+ , assertHeader , assertNoHeader , statusIs@@ -139,6 +143,7 @@ import qualified Blaze.ByteString.Builder as Builder import Data.Time.Clock (getCurrentTime) import Control.Applicative ((<$>))+import Text.Show.Pretty (ppShow) -- | The state used in a single test case defined using 'yit' --@@ -315,8 +320,26 @@ htmlQuery = htmlQuery' yedResponse [] -- | Asserts that the two given values are equal.+--+-- In case they are not equal, error mesasge includes the two values.+--+-- @since 1.5.2+assertEq :: (Eq a, Show a) => String -> a -> a -> YesodExample site ()+assertEq m a b =+ liftIO $ HUnit.assertBool msg (a == b)+ where msg = "Assertion: " ++ m ++ "\n" +++ "First argument: " ++ ppShow a ++ "\n" +++ "Second argument: " ++ ppShow b ++ "\n"++{-# DEPRECATED assertEqual "Use assertEq instead" #-} assertEqual :: (Eq a) => String -> a -> a -> YesodExample site ()-assertEqual msg a b = liftIO $ HUnit.assertBool msg (a == b)+assertEqual = assertEqualNoShow++-- | Asserts that the two given values are equal.+--+-- @since 1.5.2+assertEqualNoShow :: (Eq a) => String -> a -> a -> YesodExample site ()+assertEqualNoShow msg a b = liftIO $ HUnit.assertBool msg (a == b) -- | Assert the last response status is as expected. statusIs :: Int -> YesodExample site ()
yesod-test.cabal view
@@ -1,5 +1,5 @@ name: yesod-test-version: 1.5.1.1+version: 1.5.2 license: MIT license-file: LICENSE author: Nubis <nubis@woobiz.com.ar>@@ -14,29 +14,30 @@ extra-source-files: README.md, LICENSE, test/main.hs, ChangeLog.md library- build-depends: base >= 4.3 && < 5+ build-depends: HUnit >= 1.2 , attoparsec >= 0.10- , persistent >= 1.0- , transformers >= 0.2.2- , wai >= 3.0- , wai-extra- , network >= 2.2- , http-types >= 0.7- , HUnit >= 1.2- , hspec-core == 2.*+ , base >= 4.3 && < 5+ , blaze-builder+ , blaze-html >= 0.5+ , blaze-markup >= 0.5.1 , bytestring >= 0.9 , case-insensitive >= 0.2- , text- , xml-conduit >= 1.0- , xml-types >= 0.3 , containers+ , cookie+ , hspec-core == 2.* , html-conduit >= 0.1- , blaze-html >= 0.5- , blaze-markup >= 0.5.1+ , http-types >= 0.7 , monad-control+ , network >= 2.2+ , persistent >= 1.0+ , pretty-show >= 1.6+ , text , time- , blaze-builder- , cookie+ , transformers >= 0.2.2+ , wai >= 3.0+ , wai-extra+ , xml-conduit >= 1.0+ , xml-types >= 0.3 , yesod-core >= 1.4.14 exposed-modules: Yesod.Test