From 6aee631ac1afe14bd8130df311472d3c552d8bfa Mon Sep 17 00:00:00 2001 From: Danny van Kooten Date: Sun, 15 Mar 2020 13:59:52 +0100 Subject: add number & string literals --- tests/test_template.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'tests') 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"); -- cgit v1.2.3