aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/data/01/base.tmpl9
-rw-r--r--tests/data/01/child.tmpl5
-rw-r--r--tests/test_template.c8
3 files changed, 22 insertions, 0 deletions
diff --git a/tests/data/01/base.tmpl b/tests/data/01/base.tmpl
new file mode 100644
index 0000000..6ca89cb
--- /dev/null
+++ b/tests/data/01/base.tmpl
@@ -0,0 +1,9 @@
+Header
+
+{% block content %}
+Content
+{% endblock %}
+
+{% block footer %}
+Footer
+{% endblock %} \ No newline at end of file
diff --git a/tests/data/01/child.tmpl b/tests/data/01/child.tmpl
new file mode 100644
index 0000000..05467a6
--- /dev/null
+++ b/tests/data/01/child.tmpl
@@ -0,0 +1,5 @@
+{% extends "base.tmpl" %}
+
+{% block content %}
+Child content
+{% endblock %} \ No newline at end of file
diff --git a/tests/test_template.c b/tests/test_template.c
index c13ef4c..cc57ba5 100644
--- a/tests/test_template.c
+++ b/tests/test_template.c
@@ -215,6 +215,14 @@ TEST(buffer_alloc) {
free(output);
}
+TEST(directory) {
+ struct env *env = env_new("./tests/data/01/");
+ char *output = render(env, "child.tmpl", NULL);
+ assert_str(output, "Header\n\nChild content\n\nFooter");
+ free(output);
+ env_free(env);
+}
+
END_TESTS \ No newline at end of file