mirror of
https://github.com/askama-rs/askama.git
synced 2025-10-02 15:25:19 +00:00
29 lines
504 B
Rust
29 lines
504 B
Rust
#[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");
|
|
}
|