aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_template.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/test_template.c b/tests/test_template.c
index 90190cc..5c17dd4 100644
--- a/tests/test_template.c
+++ b/tests/test_template.c
@@ -10,7 +10,21 @@ TEST(text_only) {
free(output);
}
-TEST(var) {
+TEST(expr_number) {
+ char *input = "Hello {{ 5 }}.";
+ char *output = template(input, NULL);
+ assert_str(output, "Hello 5.");
+ free(output);
+}
+
+TEST(expr_string) {
+ char *input = "Hello {{ \"world\" }}.";
+ char *output = template(input, NULL);
+ assert_str(output, "Hello world.");
+ free(output);
+}
+
+TEST(expr_symbol) {
char *input = "Hello {{name}}.";
struct hashmap *ctx = hashmap_new();
hashmap_insert(ctx, "name", "world");