aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-08-02 20:49:08 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-08-02 20:49:08 +0200
commit85ed0253684f34e0f66bb1678d52e605b483c7e1 (patch)
tree833bfff5670dfe391609259fc95f6d538d03e5e4 /testing
parent82d85bbc20ec4c525d65c4e12e157a934ac2719e (diff)
downloadaskama-85ed0253684f34e0f66bb1678d52e605b483c7e1.tar.gz
askama-85ed0253684f34e0f66bb1678d52e605b483c7e1.tar.bz2
askama-85ed0253684f34e0f66bb1678d52e605b483c7e1.zip
Add test that starts with a single brace (see #24)
Diffstat (limited to 'testing')
-rw-r--r--testing/templates/json.html1
-rw-r--r--testing/tests/simple.rs14
2 files changed, 15 insertions, 0 deletions
diff --git a/testing/templates/json.html b/testing/templates/json.html
new file mode 100644
index 0000000..e711c10
--- /dev/null
+++ b/testing/templates/json.html
@@ -0,0 +1 @@
+{"foo": "{{ foo }}", "bar": "{{ bar }}"}
diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs
index a04b3fa..6d8afa3 100644
--- a/testing/tests/simple.rs
+++ b/testing/tests/simple.rs
@@ -121,3 +121,17 @@ fn test_generics() {
let t = GenericsTemplate { t: "a", u: 42 };
assert_eq!(t.render(), "a42");
}
+
+
+#[derive(Template)]
+#[template(path = "json.html")]
+struct JsonTemplate<'a> {
+ foo: &'a str,
+ bar: &'a str,
+}
+
+#[test]
+fn test_json() {
+ let t = JsonTemplate { foo: "a", bar: "b" };
+ assert_eq!(t.render(), "{\"foo\": \"a\", \"bar\": \"b\"}");
+}