diff options
Diffstat (limited to '')
-rw-r--r-- | testing/templates/base.html | 2 | ||||
-rw-r--r-- | testing/templates/child.html | 2 | ||||
-rw-r--r-- | testing/tests/inheritance.rs | 19 |
3 files changed, 23 insertions, 0 deletions
diff --git a/testing/templates/base.html b/testing/templates/base.html new file mode 100644 index 0000000..f40d867 --- /dev/null +++ b/testing/templates/base.html @@ -0,0 +1,2 @@ +{% block content %}{% endblock %} +Copyright 2017 diff --git a/testing/templates/child.html b/testing/templates/child.html new file mode 100644 index 0000000..23aed37 --- /dev/null +++ b/testing/templates/child.html @@ -0,0 +1,2 @@ +{% extends "base.html" %} +{% block content %}Content goes here{% endblock %} diff --git a/testing/tests/inheritance.rs b/testing/tests/inheritance.rs new file mode 100644 index 0000000..ebcca70 --- /dev/null +++ b/testing/tests/inheritance.rs @@ -0,0 +1,19 @@ +extern crate askama; +#[macro_use] +extern crate askama_derive; + +use askama::Template; + +#[derive(Template)] +#[template(path = "base.html")] +struct BaseTemplate { } + +#[derive(Template)] +#[template(path = "child.html")] +struct ChildTemplate { } + +#[test] +fn test_simple_extends() { + let t = ChildTemplate { }; + assert_eq!(t.render(), "Content goes here\nCopyright 2017\n"); +} |