From 85ed0253684f34e0f66bb1678d52e605b483c7e1 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 2 Aug 2017 20:49:08 +0200 Subject: Add test that starts with a single brace (see #24) --- testing/tests/simple.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'testing/tests/simple.rs') 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\"}"); +} -- cgit