diff --git a/hasql.cabal b/hasql.cabal index 7c030e4..4eba571 100644 --- a/hasql.cabal +++ b/hasql.cabal @@ -130,24 +130,10 @@ test-suite tasty tasty-hunit == 0.9.*, quickcheck-instances >= 0.3.11 && < 0.4, QuickCheck >= 2.8.1 && < 2.9, - -- data: - uuid, - time, - scientific, - bytestring, - text, - vector, - hashable, - dlist, -- general: data-default-class, - profunctors, - contravariant, - contravariant-extras, - either, - transformers, - base-prelude, - base + -- base, + rebase benchmark benchmark diff --git a/tasty/Main.hs b/tasty/Main.hs index f7ab46c..7880282 100644 --- a/tasty/Main.hs +++ b/tasty/Main.hs @@ -22,6 +22,31 @@ tree = localOption (NumThreads 1) $ testGroup "All tests" [ + testCase "Prepared statements after error" $ + let + io = + Connection.with (Session.run session) >>= + \x -> assertBool (show x) (either (const False) isRight x) + where + session = + try *> fail *> try + where + try = + Session.query 1 query + where + query = + Query.statement sql encoder decoder True + where + sql = + "select $1 :: int8" + encoder = + Encoders.value Encoders.int8 + decoder = + Decoders.singleRow $ Decoders.value Decoders.int8 + fail = + catchError (Session.sql "absurd") (const (pure ())) + in io + , testCase "\"in progress after error\" bugfix" $ let sumQuery :: Query.Query (Int64, Int64) Int64 diff --git a/tasty/Main/Prelude.hs b/tasty/Main/Prelude.hs index 06a5e4a..6bec4ad 100644 --- a/tasty/Main/Prelude.hs +++ b/tasty/Main/Prelude.hs @@ -7,67 +7,8 @@ where -- base-prelude ------------------------- -import BasePrelude as Exports hiding (assert, left, right, isLeft, isRight, error) - --- transformers -------------------------- -import Control.Monad.IO.Class as Exports -import Control.Monad.Trans.Class as Exports -import Control.Monad.Trans.Maybe as Exports hiding (liftListen, liftPass) -import Control.Monad.Trans.Reader as Exports hiding (liftCallCC, liftCatch) -import Control.Monad.Trans.State.Strict as Exports hiding (liftCallCC, liftCatch, liftListen, liftPass) -import Data.Functor.Identity as Exports +import Rebase.Prelude as Exports -- data-default-class ------------------------- import Data.Default.Class as Exports - --- profunctors -------------------------- -import Data.Profunctor.Unsafe as Exports - --- contravariant -------------------------- -import Data.Functor.Contravariant as Exports -import Data.Functor.Contravariant.Divisible as Exports - --- contravariant-extras -------------------------- -import Contravariant.Extras as Exports - --- either -------------------------- -import Control.Monad.Trans.Either as Exports -import Data.Either.Combinators as Exports - --- hashable -------------------------- -import Data.Hashable as Exports (Hashable(..)) - --- text -------------------------- -import Data.Text as Exports (Text) - --- bytestring -------------------------- -import Data.ByteString as Exports (ByteString) - --- scientific -------------------------- -import Data.Scientific as Exports (Scientific) - --- uuid -------------------------- -import Data.UUID as Exports (UUID) - --- time -------------------------- -import Data.Time as Exports - --- vector -------------------------- -import Data.Vector as Exports (Vector) - --- dlist -------------------------- -import Data.DList as Exports (DList)