From 0c6f0e2ba5d8ce4ec41b38486ac4212a08805332 Mon Sep 17 00:00:00 2001 From: Travis Date: Wed, 11 Mar 2020 22:34:32 -0500 Subject: [PATCH] fix Call stringer for range conditional --- pql/ast.go | 2 +- pql/ast_test.go | 2 +- pql/pqlpeg_test.go | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pql/ast.go b/pql/ast.go index 1f87a170d..995f661cf 100644 --- a/pql/ast.go +++ b/pql/ast.go @@ -729,7 +729,7 @@ func (c *Call) String() string { // the equal sign in the string representation. switch v := c.Args[key].(type) { case *Condition: - fmt.Fprintf(&buf, "%v %s", key, v.String()) + fmt.Fprintf(&buf, "%s", v.StringWithSubj(key)) default: fmt.Fprintf(&buf, "%v=%s", key, formatValue(v)) } diff --git a/pql/ast_test.go b/pql/ast_test.go index e9bda934e..d5fdc2788 100644 --- a/pql/ast_test.go +++ b/pql/ast_test.go @@ -37,7 +37,7 @@ func TestCall_String(t *testing.T) { "field0": &pql.Condition{Op: pql.GTE, Value: 10}, }, } - if s := c.String(); s != `Range(field0 >= 10, other="f")` { + if s := c.String(); s != `Range(field0>= 10, other="f")` { t.Fatalf("unexpected string: %s", s) } }) diff --git a/pql/pqlpeg_test.go b/pql/pqlpeg_test.go index 186aa4c92..48643ec2f 100644 --- a/pql/pqlpeg_test.go +++ b/pql/pqlpeg_test.go @@ -42,7 +42,7 @@ SetBit(Union(Zitmap(row==4), Intersect(Qitmap(blah>4), Ritmap(field="http://zoo9 if err != nil { t.Fatalf("should have parsed: %v", err) } - if q.String() != `TopN(Bitmap(id == "other"), _field="blah", field="f", n=0)` { + if q.String() != `TopN(Bitmap(id== "other"), _field="blah", field="f", n=0)` { t.Fatalf("Failed, got: %s", q) } @@ -55,8 +55,7 @@ SetBit(Union(Zitmap(row==4), Intersect(Qitmap(blah>4), Ritmap(field="http://zoo9 if err != nil { t.Fatalf("should have parsed: %v", err) } - - if q.String() != `Bitmap(did == "other", row=4)` { + if q.String() != `Bitmap(did== "other", row=4)` { t.Fatalf("got %s", q) }