it passed?
This commit is contained in:
parent
4388cccbce
commit
56e0d7afe7
@ -898,21 +898,26 @@ testConcatenationOperator =
|
|||||||
|
|
||||||
testMinusOperator :: Spec
|
testMinusOperator :: Spec
|
||||||
testMinusOperator =
|
testMinusOperator =
|
||||||
describe "Minus Operator" $ do
|
fdescribe "Minus Operator" $ do
|
||||||
it "creates sane SQL" $
|
it "creates sane SQL" $ do
|
||||||
|
let obj = object ["a" .= False, "b" .= True]
|
||||||
|
encoded = BSL.toStrict $ encode obj
|
||||||
createSaneSQL @JSONValue
|
createSaneSQL @JSONValue
|
||||||
(jsonbVal (object ["a" .= False, "b" .= True]) JSON.-. "a")
|
(jsonbVal obj JSON.-. "a")
|
||||||
"SELECT (? - ?)\nFROM \"Json\"\n"
|
"SELECT (? - ?)\nFROM \"Json\"\n"
|
||||||
[ PersistLiteralEscaped "{\"a\":false,\"b\":true}"
|
[ PersistLiteralEscaped encoded
|
||||||
, PersistText "a" ]
|
, PersistText "a"
|
||||||
|
]
|
||||||
it "creates sane SQL (chained)" $ do
|
it "creates sane SQL (chained)" $ do
|
||||||
let obj = object ["a" .= [object ["b" .= True]]]
|
let obj = object ["a" .= [object ["b" .= True]]]
|
||||||
|
encoded = BSL.toStrict $ encode obj
|
||||||
createSaneSQL @JSONValue
|
createSaneSQL @JSONValue
|
||||||
(jsonbVal obj ->. "a" JSON.-. 0)
|
(jsonbVal obj ->. "a" JSON.-. 0)
|
||||||
"SELECT ((? -> ?) - ?)\nFROM \"Json\"\n"
|
"SELECT ((? -> ?) - ?)\nFROM \"Json\"\n"
|
||||||
[ PersistLiteralEscaped "{\"a\":[{\"b\":true}]}"
|
[ PersistLiteralEscaped encoded
|
||||||
, PersistText "a"
|
, PersistText "a"
|
||||||
, PersistInt64 0 ]
|
, PersistInt64 0
|
||||||
|
]
|
||||||
it "works as expected" $ run $ do
|
it "works as expected" $ run $ do
|
||||||
x <- selectJSON $ \v -> do
|
x <- selectJSON $ \v -> do
|
||||||
where_ $ v @>. jsonbVal (toJSON ([] :: [Int]))
|
where_ $ v @>. jsonbVal (toJSON ([] :: [Int]))
|
||||||
@ -929,8 +934,10 @@ testMinusOperator =
|
|||||||
liftIO $ length w `shouldBe` 0
|
liftIO $ length w `shouldBe` 0
|
||||||
sqlFailWith "22023" $ selectJSONwhere $ \v ->
|
sqlFailWith "22023" $ selectJSONwhere $ \v ->
|
||||||
v JSON.-. 0 @>. jsonbVal (toJSON ([] :: [Int]))
|
v JSON.-. 0 @>. jsonbVal (toJSON ([] :: [Int]))
|
||||||
where selectJSON_ f = selectJSON $ \v -> do
|
where
|
||||||
where_ $ v @>. jsonbVal (object [])
|
selectJSON_ f = selectJSON $ \v -> do
|
||||||
|
where_
|
||||||
|
$ v @>. jsonbVal (object [])
|
||||||
||. v @>. jsonbVal (toJSON ([] :: [Int]))
|
||. v @>. jsonbVal (toJSON ([] :: [Int]))
|
||||||
where_ $ f v
|
where_ $ f v
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user