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

Function TestPipelineErrors

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

Source from the content-addressed store, hash-verified

11)
12
13func TestPipelineErrors(t *testing.T) {
14 tests := []struct {
15 in string
16 err error
17 }{
18 {in: "", err: newParseError("syntax error: unexpected $end", 0, 0)},
19 {in: "{ .a } | { .b", err: newParseError("syntax error: unexpected $end", 1, 14)},
20 {in: "{ .a | .b }", err: newParseError("syntax error: unexpected |", 1, 6)},
21 {in: "({ .a } | { .b }", err: newParseError("syntax error: unexpected $end, expecting ) or |", 1, 17)},
22 {in: "({ .a } | { .b }) + ({ .a } | { .b })", err: newParseError("syntax error: unexpected +, expecting with", 1, 19)},
23 }
24
25 for _, tc := range tests {
26 t.Run(tc.in, func(t *testing.T) {
27 _, err := Parse(tc.in)
28
29 require.Equal(t, tc.err, err)
30 })
31 }
32}
33
34func TestPipelineOperatorPrecedence(t *testing.T) {
35 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