diff --git a/tests/typeset.rs b/tests/typeset.rs index 620e11a6..cd58bdab 100644 --- a/tests/typeset.rs +++ b/tests/typeset.rs @@ -184,8 +184,9 @@ fn test_part(src: &str, i: usize, lines: u32, env: &mut Env) -> (bool, Vec (bool, Vec (bool, SpanVec) { (compare_ref, diags) } -fn register_helpers(scope: &mut Scope, panicked: Rc>) { +struct Panic { + pos: Pos, + lhs: Option, + rhs: Option, +} + +fn register_helpers(scope: &mut Scope, panics: Rc>>) { pub fn f(_: &mut EvalContext, args: &mut Args) -> Value { let (array, dict) = args.drain(); let iter = array @@ -294,10 +310,7 @@ fn register_helpers(scope: &mut Scope, panicked: Rc>) { let lhs = args.require::(ctx, "left-hand side"); let rhs = args.require::(ctx, "right-hand side"); if lhs != rhs { - *panicked.borrow_mut() = true; - println!(" Assertion failed ❌"); - println!(" left: {:?}", lhs); - println!(" right: {:?}", rhs); + panics.borrow_mut().push(Panic { pos: args.span.start, lhs, rhs }); Value::Str(format!("(panic)")) } else { Value::None