jinja : fix split and replace with empty first arg (#24574)

* fix split and replace with empty first arg

* fix reserve size
This commit is contained in:
Sigbjørn Skjæret
2026-06-13 16:56:59 +02:00
committed by GitHub
parent 1a7718b4c5
commit 341babcf73
2 changed files with 29 additions and 4 deletions

View File

@@ -1320,6 +1320,12 @@ static void test_string_methods(testing & t) {
"hello jinja"
);
test_template(t, "string.replace() empty",
"{{ s.replace('', '.') }}",
{{"s", "hello world"}},
".h.e.l.l.o. .w.o.r.l.d."
);
test_template(t, "string.replace() with count",
"{{ s.replace('a', 'X', 2) }}",
{{"s", "banana"}},