MCPcopy
hub / github.com/grafana/tempo / TestScalarExpressionErrors

Function TestScalarExpressionErrors

pkg/traceql/parse_test.go:683–701  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

681}
682
683func 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
703func TestScalarExpressionPrecedence(t *testing.T) {
704 tests := []struct {

Callers

nothing calls this directly

Calls 4

newParseErrorFunction · 0.85
ParseFunction · 0.85
RunMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected