Skip to content

Commit

Permalink
add simple test
Browse files Browse the repository at this point in the history
  • Loading branch information
czpmango committed Dec 23, 2021
1 parent 36f62ba commit f4031e5
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,33 @@ func TestExecuteWithParameter(t *testing.T) {
loadTestData(t, session)
// p1:true p2:3 p3:[true,3] p4:{"a":true,"b":"Bob"}
prepareParameter()
// Simple result
{
resp, err := tryToExecuteWithParameter(session, "RETURN toBoolean($p1) and false, $p2+3, $p3[1]>3, $p3.b+1", params)
if err != nil {
t.Fatalf(err.Error())
return
}
assert.Equal(t, 1, resp.GetRowSize())
record, err := resp.GetRowValuesByIndex(0)
if err != nil {
t.Fatalf(err.Error())
return
}
valWrap, err := record.GetValueByIndex(0)
if err != nil {
t.Fatalf(err.Error())
return
}
node, err := valWrap.AsBool()
if err != nil {
t.Fatalf(err.Error())
return
}
assert.Equal(t,
true,
node)
}
// Complex result
{
resp, err := tryToExecuteWithParameter(session, "MATCH (v:person {name: $p4.b}) WHERE v.age>$p2-3 and $p1==true RETURN v ORDER BY $p3[0] LIMIT $p2", params)
Expand Down

0 comments on commit f4031e5

Please sign in to comment.