MCPcopy
hub / github.com/expr-lang/expr / TestLex_error

Function TestLex_error

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

Source from the content-addressed store, hash-verified

439`
440
441func TestLex_error(t *testing.T) {
442 tests := strings.Split(strings.Trim(errorTests, "\n"), "\n\n")
443
444 for _, test := range tests {
445 input := strings.SplitN(test, "\n", 2)
446 if len(input) != 2 {
447 t.Errorf("syntax error in test: %q", test)
448 break
449 }
450
451 _, err := Lex(file.NewSource(input[0]))
452 if err == nil {
453 err = fmt.Errorf("<nil>")
454 }
455
456 assert.Equal(t, input[1], err.Error(), input[0])
457 }
458}

Callers

nothing calls this directly

Calls 6

NewSourceFunction · 0.92
EqualFunction · 0.92
LexFunction · 0.85
SplitMethod · 0.80
ErrorfMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…