Skip to content

Commit e00b6b9

Browse files
refactor(test_utils): print errors in assert_panic_with_felt_error (#143)
1 parent 1b37730 commit e00b6b9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/testing/src/test_utils.cairo

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use snforge_std::{
77
start_cheat_block_number_global,
88
};
99
use starknet::{ContractAddress, Store};
10+
use starkware_utils::byte_array::short_string_to_byte_array;
1011
use starkware_utils::components::roles::interface::{IRolesDispatcher, IRolesDispatcherTrait};
1112
use starkware_utils::interfaces::identity::{IdentityDispatcher, IdentityDispatcherTrait};
1213
use starkware_utils_testing::constants as testing_constants;
@@ -156,7 +157,12 @@ pub fn assert_panic_with_felt_error<T, +Drop<T>>(
156157
) {
157158
match result {
158159
Result::Ok(_) => panic!("Expected to fail with: {}", expected_error),
159-
Result::Err(error_data) => assert!(*error_data[0] == expected_error),
160+
Result::Err(error_data) => assert!(
161+
*error_data[0] == expected_error,
162+
"Expected error: {}\nActual error: {}",
163+
short_string_to_byte_array(expected_error),
164+
short_string_to_byte_array(*error_data[0]),
165+
),
160166
};
161167
}
162168

0 commit comments

Comments
 (0)