Adept Hspec tests for forward compatibility

* Don't use hspecX, it's deprecated.

 * Do not import Test.Hspec.HUnit.  It's no longer necessary and may be
   removed in the future.
This commit is contained in:
Simon Hengel 2012-10-16 13:51:22 +02:00
parent 9577083abd
commit dfae661878
16 changed files with 7 additions and 26 deletions

View File

@ -4,7 +4,6 @@
module YesodCoreTest.Cache (cacheTest, Widget) where
import Test.Hspec
import Test.Hspec.HUnit()
import Network.Wai
import Network.Wai.Test

View File

@ -4,7 +4,6 @@
module YesodCoreTest.CleanPath (cleanPathTest, Widget) where
import Test.Hspec
import Test.Hspec.HUnit()
import Yesod.Core hiding (Request)

View File

@ -6,7 +6,6 @@ module YesodCoreTest.ErrorHandling
) where
import Yesod.Core
import Test.Hspec
import Test.Hspec.HUnit()
import Network.Wai
import Network.Wai.Test
import Text.Hamlet (hamlet)

View File

@ -4,7 +4,6 @@
module YesodCoreTest.Exceptions (exceptionsTest, Widget) where
import Test.Hspec
import Test.Hspec.HUnit ()
import Yesod.Core hiding (Request)
import Network.Wai

View File

@ -7,7 +7,6 @@ import YesodCoreTest.JsLoaderSites.HeadAsync (HA(..))
import YesodCoreTest.JsLoaderSites.Bottom (B(..))
import Test.Hspec
import Test.Hspec.HUnit ()
import Yesod.Core hiding (Request)
import Network.Wai.Test

View File

@ -4,7 +4,6 @@
module YesodCoreTest.Links (linksTest, Widget) where
import Test.Hspec
import Test.Hspec.HUnit ()
import Yesod.Core hiding (Request)
import Text.Hamlet

View File

@ -5,7 +5,6 @@
module YesodCoreTest.Media (mediaTest, Widget) where
import Test.Hspec
import Test.Hspec.HUnit ()
import Yesod.Core hiding (Request)
import Network.Wai
import Network.Wai.Test

View File

@ -3,7 +3,6 @@
module YesodCoreTest.NoOverloadedStrings (noOverloadedTest, Widget) where
import Test.Hspec
import Test.Hspec.HUnit ()
import Yesod.Core hiding (Request)
import Network.Wai.Test

View File

@ -4,7 +4,6 @@
module YesodCoreTest.Widget (widgetTest) where
import Test.Hspec
import Test.Hspec.HUnit ()
import Yesod.Core hiding (Request)
import Text.Julius

View File

@ -13,7 +13,6 @@ import Yesod.Core hiding (Request)
import Network.Wai.Test
import Network.Wai
import Test.Hspec
import Test.Hspec.HUnit()
yesod :: (YesodDispatch y y, Yesod y) => y -> Session a -> IO a
yesod app f = toWaiApp app >>= runSession f

View File

@ -1,7 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}
import Test.HUnit
import Test.Hspec.Monadic
import Test.Hspec.HUnit ()
import Test.Hspec
import Data.Time (TimeOfDay (TimeOfDay))
import Data.Text (pack)
@ -10,7 +8,7 @@ import Yesod.Form.Types
main :: IO ()
main = hspec $
describe "parseTime" $ mapM_ (\(s, e) -> it s $ parseTime (pack s) @?= e)
describe "parseTime" $ mapM_ (\(s, e) -> it s $ parseTime (pack s) `shouldBe` e)
[ ("01:00:00", Right $ TimeOfDay 1 0 0)
, ("1:00", Right $ TimeOfDay 1 0 0)
, ("1:00 AM", Right $ TimeOfDay 1 0 0)

View File

@ -64,7 +64,6 @@ test-suite test
, yesod-form
, time
, hspec
, HUnit
, text
source-repository head

View File

@ -14,8 +14,7 @@ module Hierarchy
, toText
) where
import Test.Hspec.Monadic
import Test.Hspec.HUnit ()
import Test.Hspec
import Test.HUnit
import Yesod.Routes.Parse
import Yesod.Routes.TH
@ -92,7 +91,7 @@ getTableR _ t = append "TableR " t
instance RunHandler Hierarchy master where
runHandler h _ _ subRoute toMaster = (h, fmap toMaster subRoute)
hierarchy :: Specs
hierarchy :: Spec
hierarchy = describe "hierarchy" $ do
it "renders root correctly" $
renderRoute (AdminR 5 AdminRootR) @?= (["admin", "5"], [])

View File

@ -8,8 +8,7 @@
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE CPP #-}
import Test.Hspec.Monadic
import Test.Hspec.HUnit ()
import Test.Hspec
import Test.HUnit ((@?=))
import Data.Text (Text, pack, unpack, singleton)
import Yesod.Routes.Dispatch hiding (Static, Dynamic)
@ -195,7 +194,7 @@ thDispatchAlias master sub toMaster app404 handler405 method0 pieces0 =
-}
main :: IO ()
main = hspecX $ do
main = hspec $ do
describe "justRoot" $ do
it "dispatches correctly" $ test justRoot [] @?= Just 1
it "fails correctly" $ test justRoot ["foo"] @?= Nothing

View File

@ -1,8 +1,6 @@
module YesodStaticTest (specs) where
import Test.Hspec
import Test.HUnit ( (@?=) )
import Test.Hspec.HUnit ( )
import Yesod.Static (getFileListPieces)
@ -10,5 +8,4 @@ specs :: Spec
specs = do
describe "get file list" $ do
it "pieces" $ do
x <- getFileListPieces "test/fs"
x @?= [["foo"], ["bar", "baz"]]
getFileListPieces "test/fs" `shouldReturn` [["foo"], ["bar", "baz"]]

View File

@ -46,7 +46,6 @@ test-suite tests
cpp-options: -DTEST_EXPORT
build-depends: base
, hspec >= 1.3 && < 1.4
, HUnit
-- copy from above
, containers
, old-time