aboutsummaryrefslogtreecommitdiffstats
path: root/testing/tests/simple.rs
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-08-10 07:38:00 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-08-10 09:51:48 +0200
commitcece25b0be1f09f6ab9d53d099bb244858928f57 (patch)
tree85425e3f6251eebcd6fdd5b3327119926cd9f4d2 /testing/tests/simple.rs
parent1e0ee705a8e295ebddd31a472990133d34ad3465 (diff)
downloadaskama-cece25b0be1f09f6ab9d53d099bb244858928f57.tar.gz
askama-cece25b0be1f09f6ab9d53d099bb244858928f57.tar.bz2
askama-cece25b0be1f09f6ab9d53d099bb244858928f57.zip
Implement Display for all Templates
Diffstat (limited to 'testing/tests/simple.rs')
-rw-r--r--testing/tests/simple.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs
index b9b7a7c..896e082 100644
--- a/testing/tests/simple.rs
+++ b/testing/tests/simple.rs
@@ -154,3 +154,16 @@ fn test_json() {
let t = JsonTemplate { foo: "a", bar: "b" };
assert_eq!(t.render().unwrap(), "{\"foo\": \"a\", \"bar\": \"b\"}");
}
+
+
+#[derive(Template)]
+#[template(path = "composition.html")]
+struct CompositionTemplate {
+ foo: IfTemplate,
+}
+
+#[test]
+fn test_composition() {
+ let t = CompositionTemplate { foo: IfTemplate { cond: true } };
+ assert_eq!(t.render().unwrap(), "composed: true");
+}