aboutsummaryrefslogtreecommitdiffstats
path: root/testing/tests
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--testing/tests/matches.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/testing/tests/matches.rs b/testing/tests/matches.rs
index d75a6c4..380a69c 100644
--- a/testing/tests/matches.rs
+++ b/testing/tests/matches.rs
@@ -113,3 +113,20 @@ fn test_match_no_whitespace() {
let s = MatchNoWhitespace { foo: Some(1) };
assert_eq!(s.render().unwrap(), "1");
}
+
+#[derive(Template)]
+#[template(
+ source = "{% match foo %}{% when Some(bar) %}{{ bar }}{% when None %}{% endmatch %}",
+ ext = "txt"
+)]
+struct MatchWithoutWithKeyword {
+ foo: Option<usize>,
+}
+
+#[test]
+fn test_match_without_with_keyword() {
+ let s = MatchWithoutWithKeyword { foo: Some(1) };
+ assert_eq!(s.render().unwrap(), "1");
+ let s = MatchWithoutWithKeyword { foo: None };
+ assert_eq!(s.render().unwrap(), "");
+}