MCPcopy Index your code
hub / github.com/endbasic/endbasic / do_expr_ok_test

Function do_expr_ok_test

core/src/parser.rs:2958–2978  ·  view source on GitHub ↗

Wrapper around `do_ok_test` to parse an expression. Given that expressions alone are not valid statements, we have to put them in a statement to parse them. In doing so, we can also put an extra statement after them to ensure we detect their end properly.

(input: &str, expr: Expr)

Source from the content-addressed store, hash-verified

2956 /// valid statements, we have to put them in a statement to parse them. In doing so, we can
2957 /// also put an extra statement after them to ensure we detect their end properly.
2958 fn do_expr_ok_test(input: &str, expr: Expr) {
2959 do_ok_test(
2960 &format!("PRINT {}, 1", input),
2961 &[Statement::Call(CallSpan {
2962 vref: VarRef::new("PRINT", None),
2963 vref_pos: lc(1, 1),
2964 args: vec![
2965 ArgSpan {
2966 expr: Some(expr),
2967 sep: ArgSep::Long,
2968 sep_pos: lc(1, 7 + input.len()),
2969 },
2970 ArgSpan {
2971 expr: Some(expr_integer(1, 1, 6 + input.len() + 3)),
2972 sep: ArgSep::End,
2973 sep_pos: lc(1, 10 + input.len()),
2974 },
2975 ],
2976 })],
2977 );
2978 }
2979
2980 /// Wrapper around `do_error_test` to parse an expression. Given that expressions alone are not
2981 /// valid statements, we have to put them in a statement to parse them. In doing so, we can

Callers 15

test_expr_literalsFunction · 0.85
test_expr_symbolsFunction · 0.85
test_expr_parensFunction · 0.85
test_expr_arith_opsFunction · 0.85
test_expr_rel_opsFunction · 0.85
test_expr_logical_opsFunction · 0.85
test_expr_bitwise_opsFunction · 0.85
test_expr_op_prioritiesFunction · 0.85
test_expr_numeric_signsFunction · 0.85

Calls 2

lcFunction · 0.85
do_ok_testFunction · 0.70

Tested by 15

test_expr_literalsFunction · 0.68
test_expr_symbolsFunction · 0.68
test_expr_parensFunction · 0.68
test_expr_arith_opsFunction · 0.68
test_expr_rel_opsFunction · 0.68
test_expr_logical_opsFunction · 0.68
test_expr_bitwise_opsFunction · 0.68
test_expr_op_prioritiesFunction · 0.68
test_expr_numeric_signsFunction · 0.68