From 0b034a6811d4e7130981d11b1dc1d3fb924a45ec Mon Sep 17 00:00:00 2001 From: "kyle.cao" Date: Thu, 23 Dec 2021 13:55:27 +0800 Subject: [PATCH] add simple test --- client_test.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/client_test.go b/client_test.go index 89017222..77b07599 100644 --- a/client_test.go +++ b/client_test.go @@ -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.AsNode() + if err != nil { + t.Fatalf(err.Error()) + return + } + assert.Equal(t, + "true", + node.String()) + } // 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)