mirror of
https://github.com/pantor/inja.git
synced 2026-03-15 21:45:58 +00:00
added is_last == false test
This commit is contained in:
@@ -55,6 +55,7 @@ TEST_CASE("types") {
|
||||
CHECK( env.render("{% for type, name in relatives %}{{ type }}: {{ name }}, {% endfor %}", data) == "brother: Chris, mother: Maria, sister: Jenny, " );
|
||||
CHECK( env.render("{% for v in vars %}{% if v > 0 %}+{% endif %}{% endfor %}", data) == "+++" );
|
||||
CHECK( env.render("{% for name in names %}{{ index }}: {{ name }}{% if not is_last %}, {% endif %}{% endfor %}!", data) == "0: Jeff, 1: Seb!" );
|
||||
CHECK( env.render("{% for name in names %}{{ index }}: {{ name }}{% if is_last == false %}, {% endif %}{% endfor %}!", data) == "0: Jeff, 1: Seb!" );
|
||||
|
||||
data["empty_loop"] = {};
|
||||
CHECK( env.render("{% for name in empty_loop %}a{% endfor %}", data) == "" );
|
||||
|
||||
Reference in New Issue
Block a user