aboutsummaryrefslogtreecommitdiff
path: root/tests/test_template.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_template.c')
-rw-r--r--tests/test_template.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_template.c b/tests/test_template.c
index 039e993..d94ddd6 100644
--- a/tests/test_template.c
+++ b/tests/test_template.c
@@ -309,6 +309,22 @@ TEST(expr_eq) {
}
}
+TEST(expr_string_eq) {
+ struct {
+ char *input;
+ char *expected_output;
+ } tests[] = {
+ {"{% if \"foo\" == \"bar\" %}1{% endif %}", ""},
+ {"{% if \"foo\" == \"foo\" %}1{% endif %}", "1"},
+ };
+
+ for (int i=0; i < ARRAY_SIZE(tests); i++) {
+ char *output = template_string(tests[i].input, NULL);
+ assert_str(output, tests[i].expected_output);
+ free(output);
+ }
+}
+
TEST(expr_not_eq) {
struct {
char *input;
@@ -325,6 +341,22 @@ TEST(expr_not_eq) {
}
}
+TEST(expr_string_not_eq) {
+ struct {
+ char *input;
+ char *expected_output;
+ } tests[] = {
+ {"{% if \"foo\" != \"bar\" %}1{% endif %}", "1"},
+ {"{% if \"foo\" != \"foo\" %}1{% endif %}", ""},
+ };
+
+ for (int i=0; i < ARRAY_SIZE(tests); i++) {
+ char *output = template_string(tests[i].input, NULL);
+ assert_str(output, tests[i].expected_output);
+ free(output);
+ }
+}
+
TEST(if_block_whitespace) {
char *input = "\n{%- if 10 > 5 -%}\nOK\n{%- endif -%}\n";
char *output = template_string(input, NULL);