From daaa4fd9cac860f74f0a6637aa6fd92b24851995 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 6 Nov 2018 18:17:46 +0100 Subject: [PATCH] Make assert!() output more verbose By printing the actual `Result<>` object that failed the assertion. Signed-off-by: Matthias Beyer --- lib/core/libimagstore/src/store.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/core/libimagstore/src/store.rs b/lib/core/libimagstore/src/store.rs index e4bb1a6b..91cee863 100644 --- a/lib/core/libimagstore/src/store.rs +++ b/lib/core/libimagstore/src/store.rs @@ -1220,10 +1220,13 @@ mod store_tests { assert!(store.entries.read().unwrap().get(&id_mv_with_base).is_some()); } - assert!(match store.get(id.clone()) { Ok(None) => true, _ => false }, - "Moved id ({:?}) is still there", id); - assert!(match store.get(id_mv.clone()) { Ok(Some(_)) => true, _ => false }, - "New id ({:?}) is not in store...", id_mv); + let res = store.get(id.clone()); + assert!(match res { Ok(None) => true, _ => false }, + "Moved id ({:?}) is still there: {:?}", id, res); + + let res = store.get(id_mv.clone()); + assert!(match res { Ok(Some(_)) => true, _ => false }, + "New id ({:?}) is not in store: {:?}", id_mv, res); } } }