aboutsummaryrefslogtreecommitdiffstats
path: root/testing/tests/rust_macro.rs
blob: c6e97ce857002b9728ad7e21e8cf117d62b8d746 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#[macro_use]
extern crate askama;

use askama::Template;

macro_rules! hello {
    ($name:expr) => {
        "world"
    }
}

#[derive(Template)]
#[template(path = "rust-macros.html")]
struct RustMacrosTemplate<'a> {
    name: &'a str,
}

#[test]
fn main() {
    let template = RustMacrosTemplate { name: "foo" };
    assert_eq!("Hello, world!", template.render().unwrap());
}