From d38575d2b97f7a86cfe6dd93df7de31612e19890 Mon Sep 17 00:00:00 2001 From: Danny van Kooten Date: Fri, 20 Mar 2020 14:38:18 +0100 Subject: add first filter: trim --- tests/test_template.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests') 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 -- cgit v1.2.3