From c2102d4d1f33fda499bccb09f77ea9cbd72f2018 Mon Sep 17 00:00:00 2001 From: vallentin Date: Tue, 5 Jan 2021 14:52:58 +0100 Subject: Added numbers parser test --- askama_shared/src/parser.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'askama_shared/src') 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 @@ -1165,6 +1165,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!( -- cgit