From e46e2d6b02394eea8ffe7ac723469b9b114e234c Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Thu, 12 Apr 2018 19:49:16 +0200 Subject: Handle a lack of whitespace after match block (fixes #76) --- testing/templates/match-no-ws.html | 1 + testing/tests/matches.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 testing/templates/match-no-ws.html (limited to 'testing') diff --git a/testing/templates/match-no-ws.html b/testing/templates/match-no-ws.html new file mode 100644 index 0000000..2ab0bf3 --- /dev/null +++ b/testing/templates/match-no-ws.html @@ -0,0 +1 @@ +{% match foo %}{% when Some with (bar) %}{{ bar }}{% when None %}{% endmatch %} diff --git a/testing/tests/matches.rs b/testing/tests/matches.rs index 8f4b05c..9fae70c 100644 --- a/testing/tests/matches.rs +++ b/testing/tests/matches.rs @@ -82,3 +82,15 @@ fn test_match_custom_enum() { let s = MatchCustomEnumTemplate { color: Color::Rgb(160, 0, 255) }; assert_eq!(s.render().unwrap(), "\n\nColorful: #A000FF\n"); } + +#[derive(Template)] +#[template(path = "match-no-ws.html")] +struct MatchNoWhitespace { + foo: Option, +} + +#[test] +fn test_match_no_whitespace() { + let s = MatchNoWhitespace { foo: Some(1) }; + assert_eq!(s.render().unwrap(), "1"); +} -- cgit