git.delta.rocks / jrsonnet / refs/commits / 3527065e268d

difftreelog

test(parser) move duplicate part of tests to submodule

progrm_jarvis2020-05-16parent: #1f0db62.patch.diff
in: master

1 file changed

modifiedcrates/jsonnet-parser/src/lib.rsdiffbeforeafterboth
188pub mod tests {188pub mod tests {
189 use super::{expr::*, parse};189 use super::{expr::*, parse};
190
191 mod expressions {
192 use super::*;
190193
191 fn basic_math_expression() -> Expr {194 pub fn basic_math() -> Expr {
192 Expr::BinaryOp(195 Expr::BinaryOp(
193 Box::new(Expr::Num(2.0)),196 Box::new(Expr::Num(2.0)),
194 BinaryOp::Add,197 BinaryOp::Add,
199 )),202 )),
200 )203 )
201 }204 }
205 }
202206
203 #[test]207 #[test]
204 fn empty_object() {208 fn empty_object() {
223227
224 #[test]228 #[test]
225 fn basic_math_with_indents() {229 fn basic_math_with_indents() {
226 assert_eq!(parse("2 + 2 * 2 ").unwrap(), basic_math_expression());230 assert_eq!(parse("2 + 2 * 2 ").unwrap(), expressions::basic_math());
227 }231 }
228232
229 #[test]233 #[test]
233 Expr::BinaryOp(237 Expr::BinaryOp(
234 Box::new(Expr::Num(2.0)),238 Box::new(Expr::Num(2.0)),
235 BinaryOp::Add,239 BinaryOp::Add,
236 Box::new(Expr::Parened(Box::new(basic_math_expression()))),240 Box::new(Expr::Parened(Box::new(expressions::basic_math()))),
237 )241 )
238 );242 );
239 }243 }