Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-marinica committed Oct 10, 2024
1 parent 7e9d1e9 commit 8e41744
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
4 changes: 2 additions & 2 deletions framework/scenario/src/facade/result_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ mod expect_error;
mod expect_message;
mod expect_status;
mod expect_value;
mod returns_handled_or_err;
mod returns_logs;
mod returns_message;
mod returns_new_bech32_address;
mod returns_new_token_identifier;
mod returns_handled_or_err;
mod returns_status;
mod returns_tx_hash;
mod with_tx_raw_response;
Expand All @@ -15,11 +15,11 @@ pub use expect_error::ExpectError;
pub use expect_message::ExpectMessage;
pub use expect_status::ExpectStatus;
pub use expect_value::ExpectValue;
pub use returns_handled_or_err::ReturnsHandledOrError;
pub use returns_logs::ReturnsLogs;
pub use returns_message::ReturnsMessage;
pub use returns_new_bech32_address::ReturnsNewBech32Address;
pub use returns_new_token_identifier::ReturnsNewTokenIdentifier;
pub use returns_handled_or_err::ReturnsHandledOrError;
pub use returns_status::ReturnsStatus;
pub use returns_tx_hash::ReturnsTxHash;
pub use with_tx_raw_response::WithRawTxResponse;
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ use multiversx_sc::{
use crate::scenario_model::{CheckValue, TxExpect, TxResponse, TxResponseStatus};

/// Indicates that a `Result` will be returned, either with the handled result,
/// according to the inner result handlers, or with an error in case of a failed transaction.
pub struct ReturnsHandledOrError<Env, Original, Ok>
/// according to the nested result handlers, or with an error in case of a failed transaction.
pub struct ReturnsHandledOrError<Env, Original, NHList>
where
Env: TxEnv,
Ok: RHList<Env>,
NHList: RHList<Env>,
{
_phantom_env: PhantomData<Env>,
_phantom_original: PhantomData<Original>,
pub nested_handlers: Ok,
pub nested_handlers: NHList,
}

impl<Env, Original> Default for ReturnsHandledOrError<Env, Original, OriginalResultMarker<Original>>
Expand All @@ -44,15 +44,15 @@ where
}
}

impl<Env, Original, Ok> ReturnsHandledOrError<Env, Original, Ok>
impl<Env, Original, NHList> ReturnsHandledOrError<Env, Original, NHList>
where
Env: TxEnv,
Ok: RHListExec<TxResponse, Env>,
NHList: RHListExec<TxResponse, Env>,
{
pub fn returns<RH>(self, item: RH) -> ReturnsHandledOrError<Env, Original, Ok::RetOutput>
pub fn returns<RH>(self, item: RH) -> ReturnsHandledOrError<Env, Original, NHList::RetOutput>
where
RH: RHListItem<Env, Ok::OriginalResult>,
Ok: RHListAppendRet<Env, RH>,
RH: RHListItem<Env, NHList::OriginalResult>,
NHList: RHListAppendRet<Env, RH>,
{
ReturnsHandledOrError {
_phantom_env: PhantomData,
Expand All @@ -62,21 +62,22 @@ where
}
}

impl<Env, Original, Ok> RHListItem<Env, Original> for ReturnsHandledOrError<Env, Original, Ok>
impl<Env, Original, NHList> RHListItem<Env, Original>
for ReturnsHandledOrError<Env, Original, NHList>
where
Env: TxEnv,
Ok: RHListExec<TxResponse, Env>,
Ok::ListReturns: NestedTupleFlatten,
NHList: RHListExec<TxResponse, Env>,
NHList::ListReturns: NestedTupleFlatten,
{
type Returns = Result<<Ok::ListReturns as NestedTupleFlatten>::Unpacked, TxResponseStatus>;
type Returns = Result<<NHList::ListReturns as NestedTupleFlatten>::Unpacked, TxResponseStatus>;
}

impl<Env, Original, Ok> RHListItemExec<TxResponse, Env, Original>
for ReturnsHandledOrError<Env, Original, Ok>
impl<Env, Original, NHList> RHListItemExec<TxResponse, Env, Original>
for ReturnsHandledOrError<Env, Original, NHList>
where
Env: TxEnv<RHExpect = TxExpect>,
Ok: RHListExec<TxResponse, Env>,
Ok::ListReturns: NestedTupleFlatten,
NHList: RHListExec<TxResponse, Env>,
NHList::ListReturns: NestedTupleFlatten,
{
fn item_tx_expect(&self, mut prev: TxExpect) -> TxExpect {
prev.status = CheckValue::Star;
Expand Down

0 comments on commit 8e41744

Please sign in to comment.