mirror of
https://github.com/CrowCpp/Crow.git
synced 2024-06-07 21:10:44 +00:00
Merge pull request #588 from queenstdev/master
fix #587 Render true and false Mustache tags
This commit is contained in:
commit
4eea4eb4c1
@ -233,6 +233,8 @@ namespace crow
|
||||
auto& ctx = optional_ctx.second;
|
||||
switch (ctx.t())
|
||||
{
|
||||
case json::type::False:
|
||||
case json::type::True:
|
||||
case json::type::Number:
|
||||
out += ctx.dump();
|
||||
break;
|
||||
|
@ -1243,6 +1243,24 @@ TEST_CASE("template_basic")
|
||||
CHECK("attack of killer tomatoes" == result);
|
||||
} // template_basic
|
||||
|
||||
TEST_CASE("template_true_tag")
|
||||
{
|
||||
auto t = crow::mustache::compile(R"---({{true_value}})---");
|
||||
crow::mustache::context ctx;
|
||||
ctx["true_value"] = true;
|
||||
auto result = t.render_string(ctx);
|
||||
CHECK("true" == result);
|
||||
} // template_true_tag
|
||||
|
||||
TEST_CASE("template_false_tag")
|
||||
{
|
||||
auto t = crow::mustache::compile(R"---({{false_value}})---");
|
||||
crow::mustache::context ctx;
|
||||
ctx["false_value"] = false;d
|
||||
auto result = t.render_string(ctx);
|
||||
CHECK("false" == result);
|
||||
} // template_false_tag
|
||||
|
||||
TEST_CASE("template_function")
|
||||
{
|
||||
auto t = crow::mustache::compile("attack of {{func}}");
|
||||
|
Loading…
Reference in New Issue
Block a user