From 0612a28c5030b2cb353ce7526d4604d2fdd9d7db Mon Sep 17 00:00:00 2001 From: Kogia-sima Date: Thu, 11 Jun 2020 19:18:51 +0900 Subject: [PATCH] Add rust_macro test --- integration-tests/templates/rust_macro.out | 2 ++ integration-tests/templates/rust_macro.stpl | 5 +++++ integration-tests/tests/template_once.rs | 11 +++++++++++ 3 files changed, 18 insertions(+) create mode 100644 integration-tests/templates/rust_macro.out create mode 100644 integration-tests/templates/rust_macro.stpl diff --git a/integration-tests/templates/rust_macro.out b/integration-tests/templates/rust_macro.out new file mode 100644 index 0000000..9a8c75e --- /dev/null +++ b/integration-tests/templates/rust_macro.out @@ -0,0 +1,2 @@ + +Some diff --git a/integration-tests/templates/rust_macro.stpl b/integration-tests/templates/rust_macro.stpl new file mode 100644 index 0000000..0530bf2 --- /dev/null +++ b/integration-tests/templates/rust_macro.stpl @@ -0,0 +1,5 @@ +<% if matches!(value, Some(_)) { %> + Some +<% } else { %> + None +<% } %> diff --git a/integration-tests/tests/template_once.rs b/integration-tests/tests/template_once.rs index 83a3e7a..298e4c8 100644 --- a/integration-tests/tests/template_once.rs +++ b/integration-tests/tests/template_once.rs @@ -173,6 +173,17 @@ fn test_comment() { assert_render("comment", Comment{}) } +#[derive(TemplateOnce)] +#[template(path = "rust_macro.stpl", rm_whitespace = true)] +struct RustMacro { + value: Option, +} + +#[test] +fn test_rust_macro() { + assert_render("rust_macro", RustMacro { value: Some(10) }); +} + #[cfg(unix)] mod unix { use super::*;