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,
)
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 contract
  • expected_value_transferred_to_beneficiary: The value which should have been transferred to the expected_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.