From 7da2d6309cf6a95fdc840f55d3737dfc2b2ff509 Mon Sep 17 00:00:00 2001 From: Elin Date: Thu, 19 Sep 2024 16:23:11 +0300 Subject: [PATCH] test: use assert_eq!(X, Ok(())) where possible for better error message (#883) --- crates/mempool/src/mempool_test.rs | 2 +- crates/mempool_node/src/config/config_test.rs | 2 +- crates/papyrus_storage/src/mmap_file/mmap_file_test.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/mempool/src/mempool_test.rs b/crates/mempool/src/mempool_test.rs index 44b6db0447..e3971da515 100644 --- a/crates/mempool/src/mempool_test.rs +++ b/crates/mempool/src/mempool_test.rs @@ -148,7 +148,7 @@ fn commit_block( (contract_address!(address), AccountState { nonce: Nonce(felt!(nonce)) }) })); - assert!(mempool.commit_block(state_changes).is_ok()); + assert_eq!(mempool.commit_block(state_changes), Ok(())); } /// Creates a valid input for mempool's `add_tx` with optional default values. diff --git a/crates/mempool_node/src/config/config_test.rs b/crates/mempool_node/src/config/config_test.rs index ffe84e1cb6..ff4c6ceaec 100644 --- a/crates/mempool_node/src/config/config_test.rs +++ b/crates/mempool_node/src/config/config_test.rs @@ -116,7 +116,7 @@ fn test_valid_component_execution_config(#[case] location: LocationType) { remote_config, ..ComponentExecutionConfig::default() }; - assert!(component_exe_config.validate().is_ok()); + assert_eq!(component_exe_config.validate(), Ok(())); } #[test] diff --git a/crates/papyrus_storage/src/mmap_file/mmap_file_test.rs b/crates/papyrus_storage/src/mmap_file/mmap_file_test.rs index 01cc34f5fc..cab23312c3 100644 --- a/crates/papyrus_storage/src/mmap_file/mmap_file_test.rs +++ b/crates/papyrus_storage/src/mmap_file/mmap_file_test.rs @@ -16,12 +16,12 @@ fn config_validation() { config.max_size = config.growth_step - 1; assert!(config.validate().is_err()); config.max_size = 1 << 27; - assert!(config.validate().is_ok()); + assert_eq!(config.validate(), Ok(())); config.growth_step = config.max_object_size - 1; assert!(config.validate().is_err()); config.growth_step = 1 << 20; - assert!(config.validate().is_ok()); + assert_eq!(config.validate(), Ok(())); } #[test]