@@ -397,8 +397,8 @@ func TestParseSuccess(t *testing.T) {
397397 another (`group_left / (sum(1, 2))` , `group_left / sum(1, 2)` )
398398
399399 // parensExpr
400- another (`(-foo + ((bar) / (baz))) + ((23))` , `(( 0 - foo) + ( bar / baz)) + 23` )
401- another (`(FOO + ((Bar) / (baZ))) + ((23))` , `( FOO + ( Bar / baZ)) + 23` )
400+ another (`(-foo + ((bar) / (baz))) + ((23))` , `0 - foo + bar / baz + 23` )
401+ another (`(FOO + ((Bar) / (baZ))) + ((23))` , `FOO + Bar / baZ + 23` )
402402 same (`(foo, bar)` )
403403 another (`((foo, bar),(baz))` , `((foo, bar), baz)` )
404404 same (`(foo, (bar, baz), ((x, y), (z, y), xx))` )
@@ -479,16 +479,16 @@ func TestParseSuccess(t *testing.T) {
479479 another (`with (foo = bar) baz` , `baz` )
480480 another (`with (foo = bar) foo + foo{a="b"}` , `bar + bar{a="b"}` )
481481 another (`with (foo = bar, bar=baz + f()) test` , `test` )
482- another (`with (ct={job="test"}) a{ct} + ct() + ceil({ct="x"})` , `( a{job="test"} + {job="test"}) + ceil({ct="x"})` )
482+ another (`with (ct={job="test"}) a{ct} + ct() + ceil({ct="x"})` , `a{job="test"} + {job="test"} + ceil({ct="x"})` )
483483 another (`with (ct={job="test", i="bar"}) ct + {ct, x="d"} + foo{ct, ct} + count(1)` ,
484- `(( {job="test",i="bar"} + {job="test",i="bar",x="d"}) + foo{job="test",i="bar"}) + count(1)` )
484+ `{job="test",i="bar"} + {job="test",i="bar",x="d"} + foo{job="test",i="bar"} + count(1)` )
485485 another (`with (foo = bar) {__name__=~"foo"}` , `{__name__=~"foo"}` )
486486 another (`with (foo = bar) foo{__name__="foo"}` , `bar` )
487487 another (`with (foo = bar) {__name__="foo", x="y"}` , `bar{x="y"}` )
488488 another (`with (foo(bar) = {__name__!="bar"}) foo(x)` , `{__name__!="bar"}` )
489489 another (`with (foo(bar) = bar{__name__="bar"}) foo(x)` , `x` )
490490 another (`with (foo\-bar(baz) = baz + baz) foo\-bar((x,y))` , `(x, y) + (x, y)` )
491- another (`with (foo\-bar(baz) = baz + baz) foo\-bar(x*y)` , `( x * y) + ( x * y) ` )
491+ another (`with (foo\-bar(baz) = baz + baz) foo\-bar(x*y)` , `x * y + x * y` )
492492 another (`with (foo\-bar(baz) = baz + baz) foo\-bar(x\*y)` , `x\*y + x\*y` )
493493 another (`with (foo\-bar(b\ az) = b\ az + b\ az) foo\-bar(x\*y)` , `x\*y + x\*y` )
494494
@@ -521,7 +521,7 @@ func TestParseSuccess(t *testing.T) {
521521 another (`with (ttf = ru(m, n)) ttf` , `(clamp_min(n - clamp_min(m, 0), 0) / clamp_min(n, 0)) * 100` )
522522
523523 // Verify withExpr recursion and forward reference
524- another (`with (x = x+y, y = x+x) y ^ 2` , `(( x + y) + ( x + y) ) ^ 2` )
524+ another (`with (x = x+y, y = x+x) y ^ 2` , `(x + y + x + y) ^ 2` )
525525 another (`with (f1(x)=ceil(x), ceil(x)=f1(x)^2) f1(foobar)` , `ceil(foobar)` )
526526 another (`with (f1(x)=ceil(x), ceil(x)=f1(x)^2) ceil(foobar)` , `ceil(foobar) ^ 2` )
527527
@@ -533,7 +533,7 @@ func TestParseSuccess(t *testing.T) {
533533 another (`with (x(a) = sum(a) by (b)) x(xx) / x(y)` , `sum(xx) by(b) / sum(y) by(b)` )
534534 another (`with (f(a,f,x)=clamp(x,f,a)) f(f(x,y,z),1,2)` , `clamp(2, 1, clamp(z, y, x))` )
535535 another (`with (f(x)=1+sum(x)) f(foo{bar="baz"})` , `1 + sum(foo{bar="baz"})` )
536- another (`with (a=foo, y=bar, f(a)= a+a+y) f(x)` , `( x + x) + bar` )
536+ another (`with (a=foo, y=bar, f(a)= a+a+y) f(x)` , `x + x + bar` )
537537 another (`with (f(a, b) = m{a, b}) f({a="x", b="y"}, {c="d"})` , `m{a="x",b="y",c="d"}` )
538538 another (`with (xx={a="x"}, f(a, b) = m{a, b}) f({xx, b="y"}, {c="d"})` , `m{a="x",b="y",c="d"}` )
539539 another (`with (x() = {b="c"}) foo{x}` , `foo{b="c"}` )
@@ -572,7 +572,7 @@ func TestParseSuccess(t *testing.T) {
572572 // Verify nested with exprs
573573 another (`with (f(x) = (with(x=y) x) + x) f(z)` , `y + z` )
574574 another (`with (x=foo) clamp_min(a, with (y=x) y)` , `clamp_min(a, foo)` )
575- another (`with (x=foo) a * x + (with (y=x) y) / y` , `( a * foo) + ( foo / y) ` )
575+ another (`with (x=foo) a * x + (with (y=x) y) / y` , `a * foo + foo / y` )
576576 another (`with (x = with (y = foo) y + x) x/x` , `(foo + x) / (foo + x)` )
577577 another (`with (
578578 x = {foo="bar"},
@@ -583,7 +583,7 @@ func TestParseSuccess(t *testing.T) {
583583 )
584584 z(foo) / changes(x)
585585 )
586- f(a)` , `(a + ( foo * m{foo="bar",y="1"}) ) / changes(a)` )
586+ f(a)` , `(a + foo * m{foo="bar",y="1"}) / changes(a)` )
587587
588588 // complex withExpr
589589 another (`WITH (
@@ -601,7 +601,7 @@ func TestParseSuccess(t *testing.T) {
601601 f(x, y) = x2(x) + x*y + x2(y)
602602 )
603603 f(a, 3)
604- ` , `(( a ^ 2) + ( a * 3)) + 9` )
604+ ` , `a ^ 2 + a * 3 + 9` )
605605 another (`WITH (
606606 x2(x) = x^2,
607607 f(x, y) = x2(x) + x*y + x2(y)
@@ -633,7 +633,7 @@ func TestParseSuccess(t *testing.T) {
633633 another (`with (rate(a,b)=a+b) rate(1,2)` , `3` )
634634 another (`with (now=now(), sum=sum()) x` , `x` )
635635 another (`with (rate(a) = b) c` , `c` )
636- another (`rate(x) + with (rate(a,b)=a*b) rate(2,b)` , `rate(x) + ( 2 * b) ` )
636+ another (`rate(x) + with (rate(a,b)=a*b) rate(2,b)` , `rate(x) + 2 * b` )
637637 another (`with (sum(a,b)=a+b) sum(c,d)` , `c + d` )
638638
639639 // $__interval and $__rate_interval must be replaced with 1i
0 commit comments