@@ -2,6 +2,7 @@ package parser
22
33import (
44 "testing"
5+ "unicode"
56
67 "github.com/stretchr/testify/assert"
78)
@@ -39,13 +40,24 @@ func TestSkipWhitespace(t *testing.T) {
3940}
4041
4142func TestParseExpr (t * testing.T ) {
43+ // Widen RangeTables to every script so non-ASCII names are allowed.
44+ // The grammar must still recognize '|', '\n', '=', etc. as special characters depending on context.
45+ orig := RangeTables
46+ defer func () { RangeTables = orig }()
47+ for _ , t := range unicode .Scripts {
48+ RangeTables = append (RangeTables , t )
49+ }
50+
4251 tests := []struct {
4352 s string
4453 e * expr
4554 }{
4655 {"metric=" ,
4756 & expr {target : "metric=" },
4857 },
58+ {"métric.ñame" ,
59+ & expr {target : "métric.ñame" },
60+ },
4961 {"metric" ,
5062 & expr {target : "metric" },
5163 },
@@ -181,6 +193,18 @@ func TestParseExpr(t *testing.T) {
181193 argString : "metric, key='value'" ,
182194 },
183195 },
196+ {
197+ "func(metric, true\n )" ,
198+ & expr {
199+ target : "func" ,
200+ etype : EtFunc ,
201+ args : []* expr {
202+ {target : "metric" },
203+ {etype : EtBool , target : "true" , valStr : "true" },
204+ },
205+ argString : "metric, true\n " ,
206+ },
207+ },
184208 {
185209 "func(metric, key=true)" ,
186210 & expr {
0 commit comments