add join function (#204)

* add join function

* fix formatting to match single include

* add join test

* add join to documentation

* fix MSVC warning: signed/unsigned mismatch

Co-authored-by: Wim Leflere <wleflere@cochlear.com>
This commit is contained in:
Wim Leflere
2021-06-17 20:54:22 +02:00
committed by GitHub
parent 9cf7db8a06
commit 91c93bfb77
5 changed files with 49 additions and 0 deletions

View File

@@ -174,6 +174,11 @@ TEST_CASE("functions") {
"[inja.exception.render_error] (at 1:22) variable 'sister' not found");
}
SUBCASE("join") {
CHECK(env.render("{{ join(names, \" | \") }}", data) == "Jeff | Seb | Peter | Tom");
CHECK(env.render("{{ join(vars, \", \") }}", data) == "2, 3, 4, 0, -1, -2, -3");
}
SUBCASE("isType") {
CHECK(env.render("{{ isBoolean(is_happy) }}", data) == "true");
CHECK(env.render("{{ isBoolean(vars) }}", data) == "false");