MCPcopy Index your code
hub / github.com/expr-lang/expr / TestLex_location

Function TestLex_location

parser/lexer/lexer_test.go:379–392  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

377}
378
379func TestLex_location(t *testing.T) {
380 source := file.NewSource("1..2\n3..4")
381 tokens, err := Lex(source)
382 require.NoError(t, err)
383 require.Equal(t, []Token{
384 {Location: file.Location{From: 0, To: 1}, Kind: Number, Value: "1"},
385 {Location: file.Location{From: 1, To: 3}, Kind: Operator, Value: ".."},
386 {Location: file.Location{From: 3, To: 4}, Kind: Number, Value: "2"},
387 {Location: file.Location{From: 5, To: 6}, Kind: Number, Value: "3"},
388 {Location: file.Location{From: 6, To: 8}, Kind: Operator, Value: ".."},
389 {Location: file.Location{From: 8, To: 9}, Kind: Number, Value: "4"},
390 {Location: file.Location{From: 8, To: 9}, Kind: EOF, Value: ""},
391 }, tokens)
392}
393
394const errorTests = `
395"\xQA"

Callers

nothing calls this directly

Calls 4

NewSourceFunction · 0.92
NoErrorFunction · 0.92
EqualFunction · 0.92
LexFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…