pub fn assert_contract_termination<T, F>(
should_terminate: F,
expected_beneficiary: Address,
expected_value_transferred_to_beneficiary: U256,
)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 our contract-terminate
example for a complete usage exemplification.