Updated Whiskers for checking invalid tags

For Example, raise an error if it contains invalid tags like
<?ba<!b</b
This commit is contained in:
Rajkumar gaur
2022-09-29 07:36:29 +05:30
parent 1c77d30cea
commit bfd83c966a
3 changed files with 41 additions and 2 deletions
+28 -2
View File
@@ -88,8 +88,34 @@ BOOST_AUTO_TEST_CASE(conditional_with_else)
BOOST_AUTO_TEST_CASE(broken_conditional_with_else)
{
string templ = "<?b>X<!bY</b>";
BOOST_CHECK_EQUAL(Whiskers(templ)("b", true).render(), "X<!bY");
BOOST_CHECK_EQUAL(Whiskers(templ)("b", false).render(), "");
BOOST_CHECK_THROW(Whiskers{templ}, WhiskersError);
templ = "<?bX<!b>Y</b>";
BOOST_CHECK_THROW(Whiskers{templ}, WhiskersError);
templ = "<?b>X<!b>Y</b";
BOOST_CHECK_THROW(Whiskers{templ}, WhiskersError);
}
BOOST_AUTO_TEST_CASE(broken_conditional_value_with_else)
{
string templ = "<?+b>X<!+bY</+b>";
BOOST_CHECK_THROW(Whiskers{templ}, WhiskersError);
templ = "<?+bX<!+b>Y</+b>";
BOOST_CHECK_THROW(Whiskers{templ}, WhiskersError);
templ = "<?+b>X<!+b>Y</+b";
BOOST_CHECK_THROW(Whiskers{templ}, WhiskersError);
}
BOOST_AUTO_TEST_CASE(broken_list_parameter)
{
string templ = "<#b><a></b";
BOOST_CHECK_THROW(Whiskers{templ}, WhiskersError);
templ = "<#b<a></b>";
BOOST_CHECK_THROW(Whiskers{templ}, WhiskersError);
}
BOOST_AUTO_TEST_CASE(conditional_plus_params)