restore test and fix initialization bug

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
This commit is contained in:
György Krajcsovits 2025-08-04 17:04:00 +02:00
parent e13bce8448
commit a946bf1e82
No known key found for this signature in database
GPG Key ID: 47A8F9CE80FD7C7F
2 changed files with 6 additions and 0 deletions

View File

@ -82,6 +82,7 @@ func NewParser(input string, opts ...Opt) *parser { //nolint:revive // unexporte
p.injecting = false
p.parseErrors = nil
p.generatedParserResult = nil
p.lastClosing = posrange.Pos(0)
// Clear lexer struct before reusing.
p.lex = Lexer{

View File

@ -4823,6 +4823,11 @@ var testExpr = []struct {
PosRange: posrange.PositionRange{Start: 0, End: 20},
},
},
{
input: "sum(rate(",
fail: true,
errMsg: "unclosed left parenthesis",
},
{
input: "foo[5s x 5s]",
fail: true,