aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDanny van Kooten <dannyvankooten@users.noreply.github.com>2020-03-20 14:52:20 +0100
committerDanny van Kooten <dannyvankooten@users.noreply.github.com>2020-03-20 14:52:20 +0100
commitef00aa15f8eef283dadc28aba7f36ea918d61b15 (patch)
treef7e94a0fd4c91690e405dab619839aaef10f8b83 /tests
parentf64c97341cedf668c6e7ae7cad818bae6fdb90bd (diff)
downloadunja-ef00aa15f8eef283dadc28aba7f36ea918d61b15.tar.gz
unja-ef00aa15f8eef283dadc28aba7f36ea918d61b15.zip
add filter: wordcount
Diffstat (limited to 'tests')
-rw-r--r--tests/test_template.c12
1 files changed, 12 insertions, 0 deletions
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