mirror of
https://github.com/pantor/inja.git
synced 2026-02-17 09:03:58 +00:00
add replace function (#306)
Co-authored-by: Felix Maier <fm41@mailbox.org>
This commit is contained in:
@@ -108,6 +108,11 @@ TEST_CASE("functions") {
|
||||
// [json.exception.type_error.302] type must be array, but is number" );
|
||||
}
|
||||
|
||||
SUBCASE("replace") {
|
||||
CHECK(env.render("{{ replace(name, \"e\", \"3\") }}", data) == "P3t3r");
|
||||
CHECK(env.render("{{ replace(city, \" \", \"_\") }}", data) == "New_York");
|
||||
}
|
||||
|
||||
SUBCASE("round") {
|
||||
CHECK(env.render("{{ round(4, 0) }}", data) == "4");
|
||||
CHECK(env.render("{{ round(temperature, 2) }}", data) == "25.68");
|
||||
|
||||
Reference in New Issue
Block a user