aboutsummaryrefslogblamecommitdiffstats
path: root/testing/tests/macro.rs
blob: fb54f88bbc9c579bf375cd7a1f6e28059d4f84dd (plain) (tree)
1
2
3
4
5
6
7





                     
                                






                                       
                                                      
 











                                                   
#[macro_use]
extern crate askama;

use askama::Template;

#[derive(Template)]
#[template(path = "macro.html")]
struct MacroTemplate<'a> {
    s: &'a str,
}

#[test]
fn test_macro() {
    let t = MacroTemplate { s: "foo" };
    assert_eq!(t.render().unwrap(), "12foo foo foo3");
}

#[derive(Template)]
#[template(path = "import.html")]
struct ImportTemplate<'a> {
    s: &'a str,
}

#[test]
fn test_import() {
    let t = ImportTemplate { s: "foo" };
    assert_eq!(t.render().unwrap(), "foo foo foo");
}