From 7670db9259a520f30a1de317f390d7c5f540c1eb Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 3 May 2020 13:07:27 -0400 Subject: [PATCH] Identified an issue where tags separated by only whitespace are breaking parsing. --- src/parser/parser.rs | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/parser/parser.rs b/src/parser/parser.rs index 968803b..c24fa7d 100644 --- a/src/parser/parser.rs +++ b/src/parser/parser.rs @@ -132,7 +132,7 @@ pub struct Body<'a> { pub elements: Vec>, } -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq)] pub struct Template<'a> { pub contents: Body<'a>, } @@ -976,4 +976,31 @@ mod tests { )) ); } + + #[test] + fn test_temp_full_document() { + assert_eq!( + super::template( + "- simple -{~n} +{#names}{.}{/names} +{~n}- new lines -{~n} +{#names} +{.} +{/names}" + ), + Ok::<_, nom::Err<(&str, ErrorKind)>>(( + "", + Template { + contents: Body { + elements: vec![ + TemplateElement::TESpan(Span { + contents: vec!["- simple -"] + }), + TemplateElement::TETag(DustTag::DTSpecial(Special::NewLine)) + ] + } + } + )) + ); + } }