aboutsummaryrefslogtreecommitdiffstats
path: root/askama_shared/src
diff options
context:
space:
mode:
authorLibravatar Guillaume Gomez <guillaume1.gomez@gmail.com>2022-04-21 18:06:15 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2022-04-26 10:15:34 +0200
commit1119be008a540e0759b6de95f4a1720855a809d4 (patch)
treeaead1c92e3d28ffce3ad645395be91e623a01da8 /askama_shared/src
parent07cee10876a9b299a586bbb50f7029f0f1bba6fc (diff)
downloadaskama-1119be008a540e0759b6de95f4a1720855a809d4.tar.gz
askama-1119be008a540e0759b6de95f4a1720855a809d4.tar.bz2
askama-1119be008a540e0759b6de95f4a1720855a809d4.zip
Add tests for Whitespace::Minize parsing
Diffstat (limited to '')
-rw-r--r--askama_shared/src/parser.rs29
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(),