@@ -19,7 +19,7 @@ TEST_P(ErrorsGenericTest, Test)
1919
2020 Template tpl;
2121 auto parseResult = tpl.Load (source);
22- EXPECT_FALSE (parseResult.has_value ());
22+ ASSERT_FALSE (parseResult.has_value ());
2323
2424 std::ostringstream errorDescr;
2525 errorDescr << parseResult.error ();
@@ -39,7 +39,7 @@ TEST_P(ErrorsGenericExtensionsTest, Test)
3939
4040 Template tpl (&env);
4141 auto parseResult = tpl.Load (source);
42- EXPECT_FALSE (parseResult.has_value ());
42+ ASSERT_FALSE (parseResult.has_value ());
4343
4444 std::ostringstream errorDescr;
4545 errorDescr << parseResult.error ();
@@ -213,6 +213,7 @@ INSTANTIATE_TEST_CASE_P(StatementsTest_1, ErrorsGenericTest, ::testing::Values(
213213 InputOutputPair{" {% from 'foo' import bar with context, %}" ,
214214 " noname.j2tpl:1:38: error: Expected end of statement, got: ','\n {% from 'foo' import bar with context, %}\n ---^-------" }
215215 ));
216+
216217INSTANTIATE_TEST_CASE_P (StatementsTest_2, ErrorsGenericTest, ::testing::Values(
217218 InputOutputPair{" {% block %}" ,
218219 " noname.j2tpl:1:10: error: Identifier expected\n {% block %}\n ---^-------" },
@@ -260,6 +261,24 @@ INSTANTIATE_TEST_CASE_P(StatementsTest_2, ErrorsGenericTest, ::testing::Values(
260261 " noname.j2tpl:1:17: error: Unexpected statement: 'endcall'\n {% block b %}{% endcall %}\n ---^-------" },
261262 InputOutputPair{" {% do 'Hello World' %}" ,
262263 " noname.j2tpl:1:4: error: Extension disabled\n {% do 'Hello World' %}\n ---^-------" },
264+ InputOutputPair{" {% with %}{% endif }" ,
265+ " noname.j2tpl:1:9: error: Identifier expected\n {% with %}{% endif }\n ---^-------" },
266+ InputOutputPair{" {% with a %}{% endif }" ,
267+ " noname.j2tpl:1:11: error: Unexpected token '<<End of block>>'. Expected: '='\n {% with a %}{% endif }\n ---^-------" },
268+ InputOutputPair{" {% with a 42 %}{% endif }" ,
269+ " noname.j2tpl:1:11: error: Unexpected token '42'. Expected: '='\n {% with a 42 %}{% endif }\n ---^-------" },
270+ InputOutputPair{" {% with a = %}{% endif }" ,
271+ " noname.j2tpl:1:13: error: Unexpected token: '<<End of block>>'\n {% with a = %}{% endif }\n ---^-------" },
272+ InputOutputPair{" {% with a = 42 b = 30 %}{% endif }" ,
273+ " noname.j2tpl:1:16: error: Unexpected token 'b'. Expected: '<<End of block>>', ','\n {% with a = 42 b = 30 %}{% endif }\n ---^-------" },
274+ InputOutputPair{" {% with a = 42, %}{% endif }" ,
275+ " noname.j2tpl:1:22: error: Unexpected statement: 'endif'\n {% with a = 42, %}{% endif }\n ---^-------" },
276+ // FIXME: InputOutputPair{"{% with a = 42 %}",
277+ // "noname.j2tpl:1:4: error: Extension disabled\n{% do 'Hello World' %}\n---^-------"},
278+ InputOutputPair{" {% with a = 42 %}{% endfor %}" ,
279+ " noname.j2tpl:1:21: error: Unexpected statement: 'endfor'\n {% with a = 42 %}{% endfor %}\n ---^-------" },
280+ InputOutputPair{" {% set a = 42 %}{% endwith %}" ,
281+ " noname.j2tpl:1:20: error: Unexpected statement: 'endwith'\n {% set a = 42 %}{% endwith %}\n ---^-------" },
263282 InputOutputPair{" {{}}" ,
264283 " noname.j2tpl:1:3: error: Unexpected token: '<<End of block>>'\n {{}}\n --^-------" }
265284 ));
0 commit comments