From 2711ddb28fc994397bebf4eaa83e9d976c3ad976 Mon Sep 17 00:00:00 2001 From: progrm_jarvis Date: Sat, 16 May 2020 11:50:37 +0000 Subject: [PATCH] test(parser): add `basic_math_with_indents` test --- --- a/crates/jsonnet-parser/src/lib.rs +++ b/crates/jsonnet-parser/src/lib.rs @@ -208,4 +208,20 @@ ) ); } + + #[test] + fn basic_math_with_indents() { + assert_eq!( + parse("2 + 2 * 2 ").unwrap(), + Expr::BinaryOp( + Box::new(Expr::Num(2.0)), + BinaryOp::Add, + Box::new(Expr::BinaryOp( + Box::new(Expr::Num(2.0)), + BinaryOp::Mul, + Box::new(Expr::Num(2.0)), + )), + ) + ); + } } -- gitstuff