Merge pull request #165 from travisturner/range-ast-fix

fix Call stringer for range conditional
This commit is contained in:
Travis Turner 2020-03-12 08:29:38 -05:00 committed by GitHub
commit 93a804f7ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 5 deletions

View file

@ -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))
}

View file

@ -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)
}
})

View file

@ -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)
}