mpl_testing_utils/
lib.rs

1pub mod solana;
2pub mod utils;
3
4#[macro_export]
5macro_rules! assert_transport_error {
6    ($error:expr, $matcher:pat) => {
7        match $error {
8            $matcher => {
9                assert!(true)
10            }
11            _ => assert!(false),
12        }
13    };
14}
15
16#[macro_export]
17macro_rules! assert_error {
18    ($error:expr, $matcher:expr) => {
19        match $error {
20            TransportError::TransactionError(TransactionError::InstructionError(
21                0,
22                InstructionError::Custom(x),
23            )) => assert_eq!(x, $matcher),
24            _ => assert!(false),
25        };
26    };
27}
28
29#[macro_export]
30macro_rules! assert_custom_error {
31    ($error:expr, $matcher:pat) => {
32        match $error {
33            TransportError::TransactionError(TransactionError::InstructionError(
34                0,
35                InstructionError::Custom(x),
36            )) => match FromPrimitive::from_i32(x as i32) {
37                Some($matcher) => assert!(true),
38                _ => assert!(false),
39            },
40            _ => assert!(false),
41        };
42    };
43}