Add tests for all width variants.

This commit is contained in:
Piotr Wilkin 2026-02-12 01:19:22 +01:00
parent 121556f2ed
commit 32d33c7abe
1 changed files with 22 additions and 10 deletions

View File

@ -692,21 +692,33 @@ static void test_filters(testing & t) {
);
test_template(t, "indent",
"{{ data|indent(4) }}",
"{{ data|indent(2) }}",
{{ "data", "foo\nbar" }},
"foo\n bar"
);
test_template(t, "indent first only",
"{{ data|indent(width=3,first=true) }}",
{{ "data", "foo\nbar" }},
" foo\n bar"
);
test_template(t, "indent blank lines and first line",
"{{ data|indent(width=5,blank=true,first=true) }}",
{{ "data", "foo\n\nbar" }},
" foo\n \n bar"
);
test_template(t, "indent with default width",
"{{ data|indent() }}",
{{ "data", "foo\nbar" }},
"foo\n bar"
);
test_template(t, "indent first only",
"{{ data|indent(width=4,first=true) }}",
test_template(t, "indent with string",
"{{ data|indent(width='>>>>') }}",
{{ "data", "foo\nbar" }},
" foo\n bar"
);
test_template(t, "indent blank lines and first line",
"{{ data|indent(width=4,blank=true,first=true) }}",
{{ "data", "foo\n\nbar" }},
" foo\n \n bar"
"foo\n>>>>bar"
);
test_template(t, "chained filters",