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