diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/inheritance-depth-1/base.tmpl (renamed from tests/data/01/base.tmpl) | 0 | ||||
-rw-r--r-- | tests/data/inheritance-depth-1/one.tmpl (renamed from tests/data/01/child.tmpl) | 0 | ||||
-rw-r--r-- | tests/data/inheritance-depth-2/base.tmpl | 9 | ||||
-rw-r--r-- | tests/data/inheritance-depth-2/one.tmpl | 9 | ||||
-rw-r--r-- | tests/data/inheritance-depth-2/two.tmpl | 5 | ||||
-rw-r--r-- | tests/test_template.c | 16 |
6 files changed, 36 insertions, 3 deletions
diff --git a/tests/data/01/base.tmpl b/tests/data/inheritance-depth-1/base.tmpl index 241c78c..241c78c 100644 --- a/tests/data/01/base.tmpl +++ b/tests/data/inheritance-depth-1/base.tmpl diff --git a/tests/data/01/child.tmpl b/tests/data/inheritance-depth-1/one.tmpl index 05467a6..05467a6 100644 --- a/tests/data/01/child.tmpl +++ b/tests/data/inheritance-depth-1/one.tmpl diff --git a/tests/data/inheritance-depth-2/base.tmpl b/tests/data/inheritance-depth-2/base.tmpl new file mode 100644 index 0000000..2f5157c --- /dev/null +++ b/tests/data/inheritance-depth-2/base.tmpl @@ -0,0 +1,9 @@ +0 + +{%- block content %} +0 +{%- endblock %} + +{%- block footer %} +0 +{%- endblock -%}
\ No newline at end of file diff --git a/tests/data/inheritance-depth-2/one.tmpl b/tests/data/inheritance-depth-2/one.tmpl new file mode 100644 index 0000000..1e93d11 --- /dev/null +++ b/tests/data/inheritance-depth-2/one.tmpl @@ -0,0 +1,9 @@ +{% extends "base.tmpl" %} + +{% block content %} +1 +{% endblock %} + +{% block footer %} +1 +{% endblock %}
\ No newline at end of file diff --git a/tests/data/inheritance-depth-2/two.tmpl b/tests/data/inheritance-depth-2/two.tmpl new file mode 100644 index 0000000..cbdbe34 --- /dev/null +++ b/tests/data/inheritance-depth-2/two.tmpl @@ -0,0 +1,5 @@ +{% extends "one.tmpl" %} + +{% block footer %} +2 +{% endblock %}
\ No newline at end of file diff --git a/tests/test_template.c b/tests/test_template.c index b427f7c..9e23ca2 100644 --- a/tests/test_template.c +++ b/tests/test_template.c @@ -276,12 +276,22 @@ TEST(buffer_alloc) { free(output); } -TEST(inheritance) { - struct env *env = env_new("./tests/data/01/"); - char *output = template(env, "child.tmpl", NULL); +TEST(inheritance_depth_1) { + /* TODO: Check why this fails with files names 1.tmpl */ + struct env *env = env_new("./tests/data/inheritance-depth-1/"); + char *output = template(env, "one.tmpl", NULL); assert_str(output, "Header\nChild content\nFooter\n"); free(output); env_free(env); } + +TEST(inheritance_depth_2) { + struct env *env = env_new("./tests/data/inheritance-depth-2/"); + char *output = template(env, "two.tmpl", NULL); + assert_str(output, "0\n1\n2\n"); + free(output); + env_free(env); +} + END_TESTS
\ No newline at end of file |