MCPcopy Create free account
hub / github.com/adam-mcdaniel/sage / assert_parse_expr

Function assert_parse_expr

src/frontend/parse.rs:4422–4442  ·  view source on GitHub ↗
(input: &str, expr: Option<Expr>)

Source from the content-addressed store, hash-verified

4420 }
4421
4422 fn assert_parse_expr(input: &str, expr: Option<Expr>) {
4423 let result = parse_expr::<nom::error::VerboseError<&str>>(input);
4424 match result.clone() {
4425 Err(nom::Err::Error(e)) => trace!("Error: {}", nom::error::convert_error(input, e)),
4426 Err(nom::Err::Failure(e)) => trace!("Error: {}", nom::error::convert_error(input, e)),
4427 Err(nom::Err::Incomplete(e)) => unreachable!("Incomplete: {:?}", e),
4428 _ => {}
4429 }
4430 let result = result
4431 .map_err(|e| match e {
4432 nom::Err::Error(e) => nom::error::convert_error(input, e),
4433 nom::Err::Failure(e) => nom::error::convert_error(input, e),
4434 nom::Err::Incomplete(_) => unreachable!("Incomplete: {:?}", e),
4435 })
4436 .unwrap();
4437 trace!("{:?}", result);
4438
4439 if let Some(expr) = expr {
4440 assert_eq!(result.1, expr);
4441 }
4442 }
4443
4444 #[test]
4445 fn test_parse_const() {

Callers 2

test_parse_exprFunction · 0.85

Calls 1

cloneMethod · 0.80

Tested by 2

test_parse_exprFunction · 0.68