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

Function TestAttributeNameErrors

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

Source from the content-addressed store, hash-verified

1025}
1026
1027func TestAttributeNameErrors(t *testing.T) {
1028 tests := []struct {
1029 in string
1030 err error
1031 }{
1032 {in: "{ . foo }", err: newParseError("syntax error: unexpected END_ATTRIBUTE, expecting IDENTIFIER", 1, 3)},
1033 {in: `{ . "foo" }`, err: newParseError("syntax error: unexpected END_ATTRIBUTE, expecting IDENTIFIER", 1, 3)},
1034 {in: "{ .foo .bar }", err: newParseError("syntax error: unexpected .", 1, 8)},
1035 {in: "{ parent. }", err: newParseError("syntax error: unexpected END_ATTRIBUTE, expecting IDENTIFIER or resource. or span.", 0, 3)},
1036 {in: ".3foo", err: newParseError("syntax error: unexpected IDENTIFIER", 1, 3)},
1037 {in: `{ ."foo }`, err: newParseError(`unexpected EOF, expecting "`, 0, 3)},
1038 }
1039
1040 for _, tc := range tests {
1041 t.Run(tc.in, func(t *testing.T) {
1042 _, err := Parse(tc.in)
1043
1044 require.Equal(t, tc.err, err)
1045 })
1046 }
1047}
1048
1049// TestBinaryAndUnaryOperationsRewrites tests code in the newBinaryOperation and newUnaryOperation functions
1050// that attempts to simplify combinations of static values where possible.

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