diff options
author | Danny van Kooten <dannyvankooten@users.noreply.github.com> | 2020-03-15 13:59:52 +0100 |
---|---|---|
committer | Danny van Kooten <dannyvankooten@users.noreply.github.com> | 2020-03-15 13:59:52 +0100 |
commit | 6aee631ac1afe14bd8130df311472d3c552d8bfa (patch) | |
tree | 1098a6962f2036baccbeff16ecc72695f8c602fc /tests | |
parent | 8f48266d0b428fb627a67092105091b29a0ce038 (diff) | |
download | unja-6aee631ac1afe14bd8130df311472d3c552d8bfa.tar.gz unja-6aee631ac1afe14bd8130df311472d3c552d8bfa.zip |
add number & string literals
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_template.c | 16 |
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"); |