Skip to content

Commit

Permalink
some renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Foivos committed Nov 20, 2024
1 parent 3c041ab commit b77670a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions move/its/sources/events.move
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ fun test_interchain_transfer_empty_data() {
amount,
&data,
);
let event = utils::single_event<InterchainTransfer<COIN>>();
let event = utils::assert_single_event<InterchainTransfer<COIN>>();

assert!(event.data_hash == data_hash);
assert!(event.source_address == source_address);
Expand Down Expand Up @@ -230,7 +230,7 @@ fun test_interchain_transfer_nonempty_data() {
amount,
&data,
);
let event = utils::single_event<InterchainTransfer<COIN>>();
let event = utils::assert_single_event<InterchainTransfer<COIN>>();

assert!(event.data_hash == data_hash);
assert!(event.source_address == source_address);
Expand Down
14 changes: 7 additions & 7 deletions move/its/sources/its.move
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ fun test_register_coin() {
let coin_management = its::coin_management::new_locked();

register_coin(&mut its, coin_info, coin_management);
utils::single_event<its::events::CoinRegistered<COIN>>();
utils::assert_single_event<its::events::CoinRegistered<COIN>>();

sui::test_utils::destroy(its);
}
Expand Down Expand Up @@ -463,7 +463,7 @@ fun test_deploy_remote_interchain_token() {
destination_chain,
);

utils::single_event<its::events::InterchainTokenDeploymentStarted<COIN>>();
utils::assert_single_event<its::events::InterchainTokenDeploymentStarted<COIN>>();

let mut writer = abi::new_writer(6);

Expand Down Expand Up @@ -503,7 +503,7 @@ fun test_deploy_interchain_token() {

let token_id = register_coin(&mut its, coin_info, coin_management);

utils::single_event<its::events::CoinRegistered<COIN>>();
utils::assert_single_event<its::events::CoinRegistered<COIN>>();

let amount = 1234;
let coin = sui::coin::mint_for_testing<COIN>(amount, ctx);
Expand All @@ -527,7 +527,7 @@ fun test_deploy_interchain_token() {
&clock,
);

utils::single_event<its::events::InterchainTransfer<COIN>>();
utils::assert_single_event<its::events::InterchainTransfer<COIN>>();

let mut writer = abi::new_writer(6);

Expand Down Expand Up @@ -599,7 +599,7 @@ fun test_receive_interchain_transfer() {

receive_interchain_transfer<COIN>(&mut its, approved_message, &clock, ctx);

utils::single_event<its::events::InterchainTransferReceived<COIN>>();
utils::assert_single_event<its::events::InterchainTransferReceived<COIN>>();

clock.destroy_for_testing();
sui::test_utils::destroy(its);
Expand Down Expand Up @@ -661,7 +661,7 @@ fun test_receive_interchain_transfer_with_data() {
ctx,
);

utils::single_event<its::events::InterchainTransferReceived<COIN>>();
utils::assert_single_event<its::events::InterchainTransferReceived<COIN>>();

assert!(received_source_chain == source_chain);
assert!(received_source_address == its_source_address);
Expand Down Expand Up @@ -710,7 +710,7 @@ fun test_receive_deploy_interchain_token() {

receive_deploy_interchain_token<COIN>(&mut its, approved_message);

utils::single_event<its::events::CoinRegistered<COIN>>();
utils::assert_single_event<its::events::CoinRegistered<COIN>>();

clock.destroy_for_testing();
sui::test_utils::destroy(its);
Expand Down
6 changes: 3 additions & 3 deletions move/utils/sources/utils/utils.move
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ public macro fun peel<$T>($data: vector<u8>, $peel_fn: |&mut BCS| -> $T): $T {
use sui::event;

#[test_only]
public fun multiple_events<T: copy + drop>(n: u64): vector<T> {
public fun assert_events<T: copy + drop>(n: u64): vector<T> {
let events = event::events_by_type<T>();
assert!(events.length() == n);
events
}

#[test_only]
public fun single_event<T: copy + drop>(): T {
let events = multiple_events<T>(1);
public fun assert_single_event<T: copy + drop>(): T {
let events = assert_events<T>(1);
events[0]
}

Expand Down

0 comments on commit b77670a

Please sign in to comment.