diff options
Diffstat (limited to 'testing/tests/simple.rs')
-rw-r--r-- | testing/tests/simple.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs index 980321f..c924e85 100644 --- a/testing/tests/simple.rs +++ b/testing/tests/simple.rs @@ -140,3 +140,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\"}"); +} |