diff options
author | Restioson <restiosondev@gmail.com> | 2021-08-24 23:51:05 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2021-08-25 19:03:19 +0200 |
commit | ed2e640dbdff88fe118d943fa0ea9ae00eb11555 (patch) | |
tree | 853003e3c57f412f27400a7458d55961a843259f /testing/tests | |
parent | 35cf03cf794b515afdb24a989e07b6acd0e2fc19 (diff) | |
download | askama-ed2e640dbdff88fe118d943fa0ea9ae00eb11555.tar.gz askama-ed2e640dbdff88fe118d943fa0ea9ae00eb11555.tar.bz2 askama-ed2e640dbdff88fe118d943fa0ea9ae00eb11555.zip |
Add test case for matching on Option<bool>
Diffstat (limited to '')
-rw-r--r-- | testing/tests/matches.rs | 18 |
1 files changed, 18 insertions, 0 deletions
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") }; |