Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

New monad-logger

  • Loading branch information...
commit f52a5a49b543b470b4966b4f370d239a1c2b2845 1 parent f08dfe4
@snoyberg snoyberg authored
Showing with 6 additions and 4 deletions.
  1. +4 −3 persistent-test/Init.hs
  2. +2 −1  persistent-test/PersistentTest.hs
View
7 persistent-test/Init.hs
@@ -47,6 +47,7 @@ import Test.QuickCheck
import Database.Persist
import Database.Persist.Store (PersistValue(..))
import Control.Monad.Trans.Resource (ResourceT, runResourceT)
+import Control.Monad.Logger
#if WITH_MONGODB
import qualified Database.MongoDB as MongoDB
@@ -158,8 +159,8 @@ type BackendMonad = SqlBackend
sqlite_database :: Text
sqlite_database = "test/testdb.sqlite3"
-- sqlite_database = ":memory:"
-runConn :: (MonadIO m, MonadBaseControl IO m) => SqlPersist m t -> m ()
-runConn f = do
+runConn :: (MonadIO m, MonadBaseControl IO m) => SqlPersist (NoLoggingT m) t -> m ()
+runConn f = runNoLoggingT $ do
_<-withSqlitePool sqlite_database 1 $ runSqlPool f
#if WITH_POSTGRESQL
_<-withPostgresqlPool "host=localhost port=5432 user=test dbname=test password=test" 1 $ runSqlPool f
@@ -174,7 +175,7 @@ runConn f = do
#endif
return ()
-db :: SqlPersist (ResourceT IO) () -> Assertion
+db :: SqlPersist (NoLoggingT (ResourceT IO)) () -> Assertion
db actions = do
runResourceT $ runConn $ actions >> rollback
View
3  persistent-test/PersistentTest.hs
@@ -38,6 +38,7 @@ import qualified Control.Monad.IO.Control
# endif
import Database.Persist.Store (PersistValue( PersistInt64 ))
+import Control.Monad.Logger
import Database.Persist.TH (mkDeleteCascade)
import Database.Persist.EntityDef (EntityDef(..), DBName(..))
import Database.Persist.Store ( DeleteCascade (..) )
@@ -771,7 +772,7 @@ catch' a handler = Control.Monad.Trans.Control.control $ \runInIO ->
#endif
caseAfterException :: Assertion
-caseAfterException = runResourceT $ withSqlitePool sqlite_database 1 $ runSqlPool $ do
+caseAfterException = runNoLoggingT $ runResourceT $ withSqlitePool sqlite_database 1 $ runSqlPool $ do
_ <- insert $ Person "A" 0 Nothing
_ <- (insert (Person "A" 1 Nothing) >> return ()) `Control.Exception.Lifted.catch` catcher
_ <- insert $ Person "B" 0 Nothing

0 comments on commit f52a5a4

Please sign in to comment.
Something went wrong with that request. Please try again.