tests(utf8): confirm that other quote marks are handled correctly in promql

Signed-off-by: Owen Williams <owen.williams@grafana.com>
This commit is contained in:
Owen Williams 2024-02-27 15:47:47 -05:00
parent 0474b0bc39
commit ac51a8024c

View file

@ -1731,6 +1731,34 @@ var testExpr = []struct {
},
},
},
{
input: `{'foo\'bar', 'a\\dos\\path'='boo\\urns'}`,
expected: &VectorSelector{
// When a metric is named inside the braces, the Name field is not set.
LabelMatchers: []*labels.Matcher{
MustLabelMatcher(labels.MatchEqual, model.MetricNameLabel, `foo'bar`),
MustLabelMatcher(labels.MatchEqual, `a\dos\path`, `boo\urns`),
},
PosRange: posrange.PositionRange{
Start: 0,
End: 40,
},
},
},
{
input: `{'foo\'bar', ` + "`" + `a\dos\path` + "`" + `="boo"}`,
expected: &VectorSelector{
// When a metric is named inside the braces, the Name field is not set.
LabelMatchers: []*labels.Matcher{
MustLabelMatcher(labels.MatchEqual, model.MetricNameLabel, `foo'bar`),
MustLabelMatcher(labels.MatchEqual, `a\dos\path`, "boo"),
},
PosRange: posrange.PositionRange{
Start: 0,
End: 32,
},
},
},
{
input: `{"foo", a="bc"}`,
expected: &VectorSelector{