mirror of
https://github.com/pantor/inja.git
synced 2026-02-17 09:03:58 +00:00
Fixed an issue with round (#207)
* Fix the problem that the result has a decimal point when the round function, when the precision is 0. * fix tests/test-functions.cpp:91 for round check
This commit is contained in:
@@ -88,7 +88,7 @@ TEST_CASE("functions") {
|
||||
}
|
||||
|
||||
SUBCASE("round") {
|
||||
CHECK(env.render("{{ round(4, 0) }}", data) == "4.0");
|
||||
CHECK(env.render("{{ round(4, 0) }}", data) == "4");
|
||||
CHECK(env.render("{{ round(temperature, 2) }}", data) == "25.68");
|
||||
// CHECK_THROWS_WITH( env.render("{{ round(name, 2) }}", data), "[inja.exception.json_error]
|
||||
// [json.exception.type_error.302] type must be number, but is string" );
|
||||
|
||||
Reference in New Issue
Block a user