mirror of
https://github.com/nikita-volkov/hasql.git
synced 2024-12-25 11:11:36 +03:00
Test Unknown
This commit is contained in:
parent
239b2b4b92
commit
4e596bd8f4
@ -74,6 +74,37 @@ tree =
|
||||
in DSL.query (10 :: DiffTime) query
|
||||
in actualIO >>= \x -> assertEqual (show x) (Right (10 :: DiffTime)) x
|
||||
,
|
||||
testCase "Unknown" $
|
||||
let
|
||||
actualIO =
|
||||
DSL.session $ do
|
||||
let
|
||||
query =
|
||||
Query.statement sql mempty Decoders.unit True
|
||||
where
|
||||
sql =
|
||||
"drop type if exists mood"
|
||||
in DSL.query () query
|
||||
let
|
||||
query =
|
||||
Query.statement sql mempty Decoders.unit True
|
||||
where
|
||||
sql =
|
||||
"create type mood as enum ('sad', 'ok', 'happy')"
|
||||
in DSL.query () query
|
||||
let
|
||||
query =
|
||||
Query.statement sql encoder decoder True
|
||||
where
|
||||
sql =
|
||||
"select $1 = ('ok' :: mood)"
|
||||
decoder =
|
||||
(Decoders.singleRow (Decoders.value (Decoders.bool)))
|
||||
encoder =
|
||||
Encoders.value (Encoders.unknown)
|
||||
in DSL.query "ok" query
|
||||
in actualIO >>= assertEqual "" (Right True)
|
||||
,
|
||||
testCase "Enum" $
|
||||
let
|
||||
actualIO =
|
||||
|
Loading…
Reference in New Issue
Block a user