aboutsummaryrefslogtreecommitdiffstats
path: root/askama_shared/src
diff options
context:
space:
mode:
authorLibravatar vallentin <mail@vallentin.dev>2021-01-06 22:26:09 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2021-01-06 23:03:49 +0100
commitb90dc8cd2dcd259a4d0d8798d276bf28fc90931c (patch)
tree0546fc2fe3ae1850f9120175447809000ad0edbe /askama_shared/src
parentf709bf7ffb24847d70a9f7ec1349888a17c98146 (diff)
downloadaskama-b90dc8cd2dcd259a4d0d8798d276bf28fc90931c.tar.gz
askama-b90dc8cd2dcd259a4d0d8798d276bf28fc90931c.tar.bz2
askama-b90dc8cd2dcd259a4d0d8798d276bf28fc90931c.zip
Improved comment parsing test
Diffstat (limited to '')
-rw-r--r--askama_shared/src/parser.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs
index 0b42b13..2b8e8f0 100644
--- a/askama_shared/src/parser.rs
+++ b/askama_shared/src/parser.rs
@@ -1415,6 +1415,24 @@ mod tests {
#[test]
fn test_parse_comments() {
let s = &Syntax::default();
+
+ assert_eq!(
+ super::parse("{##}", s).unwrap(),
+ vec![Node::Comment(WS(false, false))],
+ );
+ assert_eq!(
+ super::parse("{#- #}", s).unwrap(),
+ vec![Node::Comment(WS(true, false))],
+ );
+ assert_eq!(
+ super::parse("{# -#}", s).unwrap(),
+ vec![Node::Comment(WS(false, true))],
+ );
+ assert_eq!(
+ super::parse("{#--#}", s).unwrap(),
+ vec![Node::Comment(WS(true, true))],
+ );
+
assert_eq!(
super::parse("{#- foo\n bar -#}", s).unwrap(),
vec![Node::Comment(WS(true, true))],