(t *testing.T)
| 681 | } |
| 682 | |
| 683 | func TestScalarExpressionErrors(t *testing.T) { |
| 684 | tests := []struct { |
| 685 | in string |
| 686 | err error |
| 687 | }{ |
| 688 | {in: "(avg(.foo) > count()) + sum(.bar)", err: newParseError("syntax error: unexpected +, expecting with", 1, 23)}, |
| 689 | {in: "count(", err: newParseError("syntax error: unexpected $end, expecting )", 1, 7)}, |
| 690 | {in: "count(avg)", err: newParseError("syntax error: unexpected avg, expecting )", 1, 7)}, |
| 691 | {in: "count(.thing)", err: newParseError("syntax error: unexpected ., expecting )", 1, 7)}, |
| 692 | } |
| 693 | |
| 694 | for _, tc := range tests { |
| 695 | t.Run(tc.in, func(t *testing.T) { |
| 696 | _, err := Parse(tc.in) |
| 697 | |
| 698 | require.Equal(t, tc.err, err) |
| 699 | }) |
| 700 | } |
| 701 | } |
| 702 | |
| 703 | func TestScalarExpressionPrecedence(t *testing.T) { |
| 704 | tests := []struct { |
nothing calls this directly
no test coverage detected