jinja : fix negative step slice with start/stop values (#24580)

This commit is contained in:
Sigbjørn Skjæret authored and GitHub committed 2026-06-13 18:28:40 +02:00
1 parent e8067a8b36
commit f05cf4676a
3 files changed
+23 -5

No files matched your search

+18
View File
@@ -435,6 +435,24 @@ static void test_expressions(testing & t) {
"('c', 'b', 'a')"
);
test_template(t, "string slice negative step",
"{{ 'abcdef'[::-2] }}",
json::object(),
"fdb"
);
test_template(t, "string slice negative start and step",
"{{ 'abcdef'[-1:1:-1] }}",
json::object(),
"fedc"
);
test_template(t, "string slice negative start, stop and step",
"{{ 'abcdef'[-1:-5:-1] }}",
json::object(),
"fedc"
);
test_template(t, "arithmetic",
"{{ (a + b) * c }}",
{{"a", 2}, {"b", 3}, {"c", 4}},