blob: ab40665e2586d4b931d19c825b7a0896b07787ad (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#[macro_use]
extern crate askama;
use askama::Template;
#[derive(Template)]
#[template(path = "let.html")]
struct LetTemplate<'a> {
s: &'a str,
}
#[test]
fn test_let() {
let t = LetTemplate { s: "foo" };
assert_eq!(t.render().unwrap(), "foo");
}
#[derive(Template)]
#[template(path = "let-decl.html")]
struct LetDeclTemplate<'a> {
cond: bool,
s: &'a str,
}
#[test]
fn test_let_decl() {
let t = LetDeclTemplate { cond: false, s: "bar" };
assert_eq!(t.render().unwrap(), "bar");
}
|