Merge branch 'pr/64'

* pr/64:
  Fix the test
  Failing composite test.
This commit is contained in:
Nikita Volkov 2016-12-09 11:34:45 +03:00
commit b41ca069d7

View File

@ -75,6 +75,31 @@ tree =
x <- Connection.with (Session.run session) x <- Connection.with (Session.run session)
assertEqual (show x) (Right (Right (1, True))) x assertEqual (show x) (Right (Right (1, True))) x
, ,
testCase "Complex composite decoding" $
let
query =
Query.statement sql encoder decoder True
where
sql =
"select (1, true) as entity1, ('hello', 3) as entity2"
encoder =
Encoders.unit
decoder =
Decoders.singleRow $
(,) <$> Decoders.value entity1 <*> Decoders.value entity2
where
entity1 =
Decoders.composite $
(,) <$> Decoders.compositeValue Decoders.int8 <*> Decoders.compositeValue Decoders.bool
entity2 =
Decoders.composite $
(,) <$> Decoders.compositeValue Decoders.text <*> Decoders.compositeValue Decoders.int8
session =
Session.query () query
in do
x <- Connection.with (Session.run session)
assertEqual (show x) (Right (Right ((1, True), ("hello", 3)))) x
,
testCase "Empty array" $ testCase "Empty array" $
let let
io = io =