aboutsummaryrefslogtreecommitdiffstats
path: root/askama_shared
diff options
context:
space:
mode:
authorLibravatar vallentin <mail@vallentin.dev>2021-01-05 14:52:58 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2021-01-05 16:17:14 +0100
commitc2102d4d1f33fda499bccb09f77ea9cbd72f2018 (patch)
treedf55359cd21b437273c35b34902d32c93099d526 /askama_shared
parentc1f627d4dd99e945c45f44c0a470564398bd4573 (diff)
downloadaskama-c2102d4d1f33fda499bccb09f77ea9cbd72f2018.tar.gz
askama-c2102d4d1f33fda499bccb09f77ea9cbd72f2018.tar.bz2
askama-c2102d4d1f33fda499bccb09f77ea9cbd72f2018.zip
Added numbers parser test
Diffstat (limited to 'askama_shared')
-rw-r--r--askama_shared/src/parser.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs
index 72c6b82..43377a6 100644
--- a/askama_shared/src/parser.rs
+++ b/askama_shared/src/parser.rs
@@ -1166,6 +1166,19 @@ mod tests {
}
#[test]
+ fn test_parse_numbers() {
+ let syntax = Syntax::default();
+ assert_eq!(
+ super::parse("{{ 2 }}", &syntax).unwrap(),
+ vec![Node::Expr(WS(false, false), Expr::NumLit("2"),)],
+ );
+ assert_eq!(
+ super::parse("{{ 2.5 }}", &syntax).unwrap(),
+ vec![Node::Expr(WS(false, false), Expr::NumLit("2.5"),)],
+ );
+ }
+
+ #[test]
fn test_parse_var_call() {
assert_eq!(
super::parse("{{ function(\"123\", 3) }}", &Syntax::default()).unwrap(),