From ef00aa15f8eef283dadc28aba7f36ea918d61b15 Mon Sep 17 00:00:00 2001 From: Danny van Kooten Date: Fri, 20 Mar 2020 14:52:20 +0100 Subject: add filter: wordcount --- tests/test_template.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/test_template.c') diff --git a/tests/test_template.c b/tests/test_template.c index 51c8fad..6b2ca12 100644 --- a/tests/test_template.c +++ b/tests/test_template.c @@ -472,4 +472,16 @@ TEST(filter_lower) { free(output); } +TEST(filter_wordcount) { + char *input = "{{ \"Hello World. How are we?\" | wordcount }}"; + char *output = template_string(input, NULL); + assert_str(output, "5"); + free(output); + + input = "{% if \"Hello World. How are we?\" | wordcount > 4 %}1{% endif %}"; + output = template_string(input, NULL); + assert_str(output, "1"); + free(output); +} + END_TESTS \ No newline at end of file -- cgit v1.2.3