ibc_testkit/fixtures/
mod.rs1pub mod applications;
2pub mod clients;
3pub mod core;
4use alloc::fmt::Debug;
5
6use ibc::core::handler::types::error::HandlerError;
7use ibc::core::primitives::prelude::*;
8
9use crate::testapp::ibc::core::types::DefaultIbcStore;
10pub enum Expect {
11 Success,
12 Failure(Option<HandlerError>),
13}
14
15#[derive(Debug)]
16pub struct Fixture<M: Debug> {
17 pub ctx: DefaultIbcStore,
18 pub msg: M,
19}
20
21impl<M: Debug> Fixture<M> {
22 pub fn generate_error_msg(
23 &self,
24 expect: &Expect,
25 process: &str,
26 res: &Result<(), HandlerError>,
27 ) -> String {
28 let base_error = match expect {
29 Expect::Success => "step failed!",
30 Expect::Failure(_) => "step passed but was supposed to fail!",
31 };
32 format!(
33 "{process} {base_error} /n {res:?} /n {:?} /n {:?}",
34 &self.msg, &self.ctx
35 )
36 }
37}