aboutsummaryrefslogtreecommitdiffstats
path: root/testing/tests
diff options
context:
space:
mode:
authorLibravatar bott <mhpoin@gmail.com>2018-10-07 17:13:52 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-10-07 17:26:08 +0200
commit28d76964080f5c6c36d5f6ed72828b679fe352b4 (patch)
tree7056ea52905791893fd1681fd2297aac13389851 /testing/tests
parent9edf27d9446da0b6c00550544d37b6da633bd2b6 (diff)
downloadaskama-28d76964080f5c6c36d5f6ed72828b679fe352b4.tar.gz
askama-28d76964080f5c6c36d5f6ed72828b679fe352b4.tar.bz2
askama-28d76964080f5c6c36d5f6ed72828b679fe352b4.zip
Add Rust macro support at templates
Diffstat (limited to 'testing/tests')
-rw-r--r--testing/tests/rust_macro.rs22
1 files changed, 22 insertions, 0 deletions
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());
+}