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

Function testLexer

pkg/traceql/lexer_test.go:210–232  ·  view source on GitHub ↗
(t *testing.T, tcs []lexerTestCase)

Source from the content-addressed store, hash-verified

208}
209
210func testLexer(t *testing.T, tcs []lexerTestCase) {
211 for _, tc := range tcs {
212 t.Run(tc.input, func(t *testing.T) {
213 actual := []int{}
214 l := lexer{
215 Scanner: scanner.Scanner{
216 Mode: scanner.SkipComments | scanner.ScanStrings,
217 },
218 }
219 l.Init(strings.NewReader(tc.input))
220 var lval yySymType
221 for {
222 tok := l.Lex(&lval)
223 if tok == 0 {
224 break
225 }
226 actual = append(actual, tok)
227 }
228
229 require.Equal(t, tc.expected, actual)
230 })
231 }
232}
233
234func TestContainsNonAttributeRune(t *testing.T) {
235 tests := []struct {

Callers 6

TestLexerAttributesFunction · 0.85
TestLexerScopedIntrinsicFunction · 0.85
TestLexerIntrinsicsFunction · 0.85
TestLexerMultitokensFunction · 0.85
TestLexerDurationFunction · 0.85
TestLexerScopingFunction · 0.85

Calls 3

LexMethod · 0.95
RunMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected