mirror of
https://github.com/pantor/inja.git
synced 2026-02-17 09:03:58 +00:00
add void callbacks
This commit is contained in:
@@ -228,10 +228,15 @@ TEST_CASE("callbacks") {
|
||||
return number1.length();
|
||||
});
|
||||
|
||||
env.add_void_callback("log", 1, [](inja::Arguments args) {
|
||||
int a = 2;
|
||||
});
|
||||
|
||||
env.add_callback("multiply", 0, [](inja::Arguments args) { return 1.0; });
|
||||
|
||||
CHECK(env.render("{{ double(age) }}", data) == "56");
|
||||
CHECK(env.render("{{ half(age) }}", data) == "14");
|
||||
CHECK(env.render("{{ log(age) }}", data) == "");
|
||||
CHECK(env.render("{{ double-greetings }}", data) == "Hello Hello!");
|
||||
CHECK(env.render("{{ double-greetings() }}", data) == "Hello Hello!");
|
||||
CHECK(env.render("{{ multiply(4, 5) }}", data) == "20.0");
|
||||
|
||||
Reference in New Issue
Block a user