mirror of
https://github.com/pantor/inja.git
synced 2026-04-05 23:58:53 +00:00
fix round() function, tests for syntax change, smaller readme fixes
This commit is contained in:
@@ -216,6 +216,7 @@ TEST_CASE("Parse functions") {
|
||||
data["name"] = "Peter";
|
||||
data["city"] = "New York";
|
||||
data["names"] = {"Jeff", "Seb", "Peter", "Tom"};
|
||||
data["temperature"] = 25.6789;
|
||||
|
||||
SECTION("Upper") {
|
||||
CHECK( env.eval_variable("upper(name)", data) == "PETER" );
|
||||
@@ -238,4 +239,10 @@ TEST_CASE("Parse functions") {
|
||||
CHECK( env.eval_variable("length(names)", data) == 4 );
|
||||
CHECK_THROWS_WITH( env.eval_variable("length(5)", data), "Argument in length function is not a list." );
|
||||
}
|
||||
|
||||
SECTION("Round") {
|
||||
CHECK( env.eval_variable("round(4, 0)", data) == 4 );
|
||||
CHECK( env.eval_variable("round(temperature, 2)", data) == 25.68 );
|
||||
CHECK_THROWS_WITH( env.eval_variable("round(name, 2)", data), "Argument in round function is not a number." );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user