aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDanny van Kooten <dannyvankooten@users.noreply.github.com>2020-03-20 14:38:18 +0100
committerDanny van Kooten <dannyvankooten@users.noreply.github.com>2020-03-20 14:38:18 +0100
commitd38575d2b97f7a86cfe6dd93df7de31612e19890 (patch)
treec2040791e14ace117fb3ada5df2a522f0273b51a /tests
parentfbfe506e2e7e2c86763997057d7e10c691c61b32 (diff)
downloadunja-d38575d2b97f7a86cfe6dd93df7de31612e19890.tar.gz
unja-d38575d2b97f7a86cfe6dd93df7de31612e19890.zip
add first filter: trim
Diffstat (limited to 'tests')
-rw-r--r--tests/test_template.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_template.c b/tests/test_template.c
index 758f7fb..b0f03ff 100644
--- a/tests/test_template.c
+++ b/tests/test_template.c
@@ -454,4 +454,15 @@ TEST(inheritance_depth_2) {
env_free(env);
}
+TEST(filter) {
+ char *input = "{{ text | trim }}";
+ struct hashmap *ctx = hashmap_new();
+ char *text = "\nHello world\n";
+ hashmap_insert(ctx, "text", text);
+ char *output = template_string(input, ctx);
+ assert_str(output, "Hello world");
+ hashmap_free(ctx);
+ free(output);
+}
+
END_TESTS \ No newline at end of file