aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--testing/templates/match-opt-bool.html8
-rw-r--r--testing/tests/matches.rs18
2 files changed, 26 insertions, 0 deletions
diff --git a/testing/templates/match-opt-bool.html b/testing/templates/match-opt-bool.html
new file mode 100644
index 0000000..d2e4454
--- /dev/null
+++ b/testing/templates/match-opt-bool.html
@@ -0,0 +1,8 @@
+{% match item %}
+{% when Some with (true) %}
+Found Some(true)
+{% when Some with (false) %}
+Found Some(false)
+{% when None %}
+Not Found
+{% endmatch %}
diff --git a/testing/tests/matches.rs b/testing/tests/matches.rs
index c328e39..206cd1d 100644
--- a/testing/tests/matches.rs
+++ b/testing/tests/matches.rs
@@ -26,6 +26,24 @@ fn test_match_option() {
assert_eq!(s.render().unwrap(), "\nNot Found\n");
}
+#[derive(Template)]
+#[template(path = "match-opt-bool.html")]
+struct MatchOptBoolTemplate {
+ item: Option<bool>,
+}
+
+#[test]
+fn test_match_option_bool() {
+ let s = MatchOptBoolTemplate { item: Some(true) };
+ assert_eq!(s.render().unwrap(), "\nFound Some(true)\n");
+
+ let s = MatchOptBoolTemplate { item: Some(false) };
+ assert_eq!(s.render().unwrap(), "\nFound Some(false)\n");
+
+ let s = MatchOptBoolTemplate { item: None };
+ assert_eq!(s.render().unwrap(), "\nNot Found\n");
+}
+
#[test]
fn test_match_ref_deref() {
let s = MatchOptRefTemplate { item: &Some("foo") };