diff options
author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2022-04-21 18:06:15 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2022-04-26 10:15:34 +0200 |
commit | 1119be008a540e0759b6de95f4a1720855a809d4 (patch) | |
tree | aead1c92e3d28ffce3ad645395be91e623a01da8 | |
parent | 07cee10876a9b299a586bbb50f7029f0f1bba6fc (diff) | |
download | askama-1119be008a540e0759b6de95f4a1720855a809d4.tar.gz askama-1119be008a540e0759b6de95f4a1720855a809d4.tar.bz2 askama-1119be008a540e0759b6de95f4a1720855a809d4.zip |
Add tests for Whitespace::Minize parsing
-rw-r--r-- | askama_shared/src/parser.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs index 3725681..624fbc6 100644 --- a/askama_shared/src/parser.rs +++ b/askama_shared/src/parser.rs @@ -1725,6 +1725,35 @@ mod tests { Some(Whitespace::Preserve) ))], ); + assert_eq!( + super::parse("{#~ #}", s).unwrap(), + vec![Node::Comment(Ws(Some(Whitespace::Minimize), None))], + ); + assert_eq!( + super::parse("{# ~#}", s).unwrap(), + vec![Node::Comment(Ws(None, Some(Whitespace::Minimize)))], + ); + assert_eq!( + super::parse("{#~~#}", s).unwrap(), + vec![Node::Comment(Ws( + Some(Whitespace::Minimize), + Some(Whitespace::Minimize) + ))], + ); + assert_eq!( + super::parse("{#~ foo\n bar ~#}", s).unwrap(), + vec![Node::Comment(Ws( + Some(Whitespace::Minimize), + Some(Whitespace::Minimize) + ))], + ); + assert_eq!( + super::parse("{#~ foo\n {#~ bar\n ~#} baz -~#}", s).unwrap(), + vec![Node::Comment(Ws( + Some(Whitespace::Minimize), + Some(Whitespace::Minimize) + ))], + ); assert_eq!( super::parse("{# foo {# bar #} {# {# baz #} qux #} #}", s).unwrap(), |