diff options
Diffstat (limited to 'testing/tests/matches.rs')
-rw-r--r-- | testing/tests/matches.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/testing/tests/matches.rs b/testing/tests/matches.rs index 206cd1d..35c1204 100644 --- a/testing/tests/matches.rs +++ b/testing/tests/matches.rs @@ -172,3 +172,28 @@ fn test_match_option_result_option() { }; assert_eq!(s.render().unwrap(), "num=4711"); } + +#[derive(Template)] +#[template( + ext = "txt", + source = r#" +{%- match good -%} + {#- when good, then good -#} + {%- when true -%} + good + {%- when _ -%} + bad +{%- endmatch -%}"# +)] +struct MatchWithComment { + good: bool, +} + +#[test] +fn test_match_with_comment() { + let s = MatchWithComment { good: true }; + assert_eq!(s.render().unwrap(), "good"); + + let s = MatchWithComment { good: false }; + assert_eq!(s.render().unwrap(), "bad"); +} |