Allow index in nested loops

This commit is contained in:
pantor
2018-03-19 11:09:23 +01:00
parent 776af96b0b
commit 1766793fd5
2 changed files with 8 additions and 0 deletions

View File

@@ -59,6 +59,7 @@ TEST_CASE("types") {
data["empty_loop"] = {};
CHECK( env.render("{% for name in empty_loop %}a{% endfor %}", data) == "" );
CHECK( env.render("{% for name in {} %}a{% endfor %}", data) == "" );
CHECK_THROWS_WITH( env.render("{% for name ins names %}a{% endfor %}", data), "[inja.exception.parser_error] unknown loop statement: for name ins names" );
// CHECK_THROWS_WITH( env.render("{% for name in relatives %}{{ name }}{% endfor %}", data), "[inja.exception.json_error] [json.exception.type_error.302] type must be array, but is object" );