From 28d76964080f5c6c36d5f6ed72828b679fe352b4 Mon Sep 17 00:00:00 2001 From: bott Date: Sun, 7 Oct 2018 17:13:52 +0200 Subject: Add Rust macro support at templates --- testing/tests/rust_macro.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 testing/tests/rust_macro.rs (limited to 'testing/tests') diff --git a/testing/tests/rust_macro.rs b/testing/tests/rust_macro.rs new file mode 100644 index 0000000..c6e97ce --- /dev/null +++ b/testing/tests/rust_macro.rs @@ -0,0 +1,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()); +} -- cgit