Fix many test suite warnings.

This commit is contained in:
Felipe Lessa 2012-09-05 16:02:11 -03:00
parent 7bb68cc233
commit 3b3ef75373
2 changed files with 11 additions and 31 deletions

View File

@ -45,7 +45,6 @@ test-suite test
, HUnit , HUnit
, QuickCheck , QuickCheck
, hspec == 1.3.* , hspec == 1.3.*
, hspec-expectations == 0.3.*
, persistent-sqlite == 1.0.* , persistent-sqlite == 1.0.*
, persistent-template == 1.0.* , persistent-template == 1.0.*
, monad-control , monad-control

View File

@ -13,7 +13,6 @@ import Database.Persist.TH
import Language.Haskell.TH (Loc(..)) import Language.Haskell.TH (Loc(..))
import System.IO (stderr) import System.IO (stderr)
import Test.Hspec import Test.Hspec
import Test.Hspec.Expectations
import qualified Control.Monad.Trans.Reader as R import qualified Control.Monad.Trans.Reader as R
import qualified Data.Conduit as C import qualified Data.Conduit as C
@ -144,38 +143,20 @@ main = do
in return () :: IO () in return () :: IO ()
it "throws an error for using on without joins" $ it "throws an error for using on without joins" $
run (do run (select $
p1e <- insert' p1 from $ \(p, mb) -> do
p2e <- insert' p2 on (just (p ^. PersonId) ==. mb ?. BlogPostAuthorId)
p3e <- insert' p3 orderBy [ asc (p ^. PersonName), asc (mb ?. BlogPostTitle) ]
p4e <- insert' p4 return (p, mb)
b12e <- insert' $ BlogPost "b" (entityKey p1e)
b11e <- insert' $ BlogPost "a" (entityKey p1e)
b31e <- insert' $ BlogPost "c" (entityKey p3e)
ret <- select $
from $ \(p, mb) -> do
on (just (p ^. PersonId) ==. mb ?. BlogPostAuthorId)
orderBy [ asc (p ^. PersonName), asc (mb ?. BlogPostTitle) ]
return (p, mb)
return ()
) `shouldThrow` (\(OnClauseWithoutMatchingJoinException _) -> True) ) `shouldThrow` (\(OnClauseWithoutMatchingJoinException _) -> True)
it "throws an error for using too many ons" $ it "throws an error for using too many ons" $
run (do run (select $
p1e <- insert' p1 from $ \(p `FullOuterJoin` mb) -> do
p2e <- insert' p2 on (just (p ^. PersonId) ==. mb ?. BlogPostAuthorId)
p3e <- insert' p3 on (just (p ^. PersonId) ==. mb ?. BlogPostAuthorId)
p4e <- insert' p4 orderBy [ asc (p ^. PersonName), asc (mb ?. BlogPostTitle) ]
b12e <- insert' $ BlogPost "b" (entityKey p1e) return (p, mb)
b11e <- insert' $ BlogPost "a" (entityKey p1e)
b31e <- insert' $ BlogPost "c" (entityKey p3e)
ret <- select $
from $ \(p `FullOuterJoin` mb) -> do
on (just (p ^. PersonId) ==. mb ?. BlogPostAuthorId)
on (just (p ^. PersonId) ==. mb ?. BlogPostAuthorId)
orderBy [ asc (p ^. PersonName), asc (mb ?. BlogPostTitle) ]
return (p, mb)
return ()
) `shouldThrow` (\(OnClauseWithoutMatchingJoinException _) -> True) ) `shouldThrow` (\(OnClauseWithoutMatchingJoinException _) -> True)
describe "select/where_" $ do describe "select/where_" $ do