From 977a990b64692cec17ab5d10dac751fc7bd91388 Mon Sep 17 00:00:00 2001 From: Gilad Chase Date: Tue, 9 Jul 2024 21:03:45 +0200 Subject: [PATCH] feat: improve mempool_test debug print Previous assertion wasn't informative enough on fail. commit-id:4b2c49c7 --- crates/mempool/src/mempool_test.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/crates/mempool/src/mempool_test.rs b/crates/mempool/src/mempool_test.rs index 4204d82b6..cc83bfbb4 100644 --- a/crates/mempool/src/mempool_test.rs +++ b/crates/mempool/src/mempool_test.rs @@ -1,5 +1,5 @@ use assert_matches::assert_matches; -use itertools::zip_eq; +use itertools::{enumerate, zip_eq}; use pretty_assertions::assert_eq; use rstest::{fixture, rstest}; use starknet_api::core::{ContractAddress, Nonce, PatriciaKey}; @@ -81,11 +81,9 @@ fn verify_mempool_queue_eq(mempool: &Mempool, expected_queue: &[ThinTransaction] let mempool_txs = mempool.iter(); let expected_queue = expected_queue.iter().map(TransactionReference::new); - assert!( - zip_eq(expected_queue, mempool_txs) - // Deref the inner mempool tx type. - .all(|(expected_tx, mempool_tx)| expected_tx == *mempool_tx) - ); + for (i, (expected_tx, mempool_tx)) in enumerate(zip_eq(expected_queue, mempool_txs)) { + assert_eq!(expected_tx, *mempool_tx, "Transaction {i} in the queue is not as expected"); + } } #[rstest]