From 064a612434300de2aa8b232ec3f6d279adfa3c9e Mon Sep 17 00:00:00 2001 From: anordal Date: Wed, 5 Feb 2020 22:57:14 +0100 Subject: [PATCH] Unittest: Make it less hard to debug --- src/testhelpers.rs | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/testhelpers.rs b/src/testhelpers.rs index 08e3f35..c6a9b8f 100644 --- a/src/testhelpers.rs +++ b/src/testhelpers.rs @@ -26,18 +26,39 @@ pub fn whatnow_eq(a: &WhatNow, b: &WhatNow) -> bool { fn transition_eq(a: &Transition, b: &Transition) -> bool { match (a, b) { (Flush, Flush) => true, + (Flush, _) => { + eprintln!("Transition mismatch; Lhs={}", "Flush"); + false + }, (FlushPopOnEof, FlushPopOnEof) => true, + (FlushPopOnEof, _) => { + eprintln!("Transition mismatch; Lhs={}", "FlushPopOnEof"); + false + }, (Replace(a), Replace(b)) => { sit_eq(a.as_ref(), b.as_ref()) }, + (Replace(_), _) => { + eprintln!("Transition mismatch; Lhs={}", "Replace"); + false + }, (Push(a), Push(b)) => { sit_eq(a.as_ref(), b.as_ref()) }, - (Pop, Pop) => true, - _ => { - eprintln!("Transition mismatch"); + (Push(_), _) => { + eprintln!("Transition mismatch; Lhs={}", "Push"); false - } + }, + (Pop, Pop) => true, + (Pop, _) => { + eprintln!("Transition mismatch; Lhs={}", "Pop"); + false + }, + (Transition::Err(_), Transition::Err(_)) => true, + (Transition::Err(_), _) => { + eprintln!("Transition mismatch; Lhs={}", "Err"); + false + }, } }