Function ink_env::test::assert_contract_termination
source · pub fn assert_contract_termination<T, F>(
should_terminate: F,
expected_beneficiary: T::AccountId,
expected_value_transferred_to_beneficiary: T::Balance
)where
T: Environment,
F: FnMut() + UnwindSafe,
<T as Environment>::AccountId: Debug,
<T as Environment>::Balance: Debug,
Expand description
Tests if a contract terminates successfully after self.env().terminate()
has been called.
The arguments denote:
should_terminate
: A closure in which the function supposed to terminate is called.expected_beneficiary
: The beneficiary account who should have received the remaining value in the contractexpected_value_transferred_to_beneficiary
: The value which should have been transferred to theexpected_beneficiary
.
Usage
let should_terminate = move || your_contract.fn_which_should_terminate();
ink_env::test::assert_contract_termination::<ink_env::DefaultEnvironment, _>(
should_terminate,
expected_beneficiary,
expected_value_transferred_to_beneficiary
);
See integration-tests/contract-terminate
for a complete usage example.