Skip to content

Commit

Permalink
Add formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
sofinico committed Sep 4, 2023
1 parent 91a7a5b commit f0da5f7
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions test-cases/set_contract_storage/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ mod set_contract_storage {

/// Stores an array that is JUST big enough to be validly allocated.
#[ink(message)]
pub fn set_storage_big(&self){
pub fn set_storage_big(&self) {
set_contract_storage(&42, &[42u8; SIZE_LIMIT]);
}

/// Tries to store the smallest array that is too big to be validly
/// allocated. This function should always fail.
#[ink(message)]
pub fn set_storage_very_big(&self){
pub fn set_storage_very_big(&self) {
set_contract_storage(&42, &[42u8; SIZE_LIMIT + 1]);
}
}
Expand Down Expand Up @@ -67,17 +67,20 @@ mod set_contract_storage {

#[ink_e2e::test]
async fn contract_storage_big_e2e(mut client: ink_e2e::Client<C, E>) -> E2EResult<()> {
// Given
let constructor = SetContractStorageRef::new();

// When
let contract_acc_id = client
.instantiate("set-contract-storage", &ink_e2e::alice(), constructor, 0, None)
.instantiate(
"set-contract-storage",
&ink_e2e::alice(),
constructor,
0,
None,
)
.await
.expect("instantiate failed")
.account_id;

// Then
let message = build_message::<SetContractStorageRef>(contract_acc_id.clone())
.call(|contract| contract.set_storage_big());

Expand All @@ -91,18 +94,21 @@ mod set_contract_storage {

#[ink_e2e::test]
#[should_panic]
async fn contract_storage_too_big_e2e(mut client: ink_e2e::Client<C, E>){
// Given
async fn contract_storage_too_big_e2e(mut client: ink_e2e::Client<C, E>) {
let constructor = SetContractStorageRef::new();

// When
let contract_acc_id = client
.instantiate("set-contract-storage", &ink_e2e::bob(), constructor, 0, None)
.instantiate(
"set-contract-storage",
&ink_e2e::bob(),
constructor,
0,
None,
)
.await
.expect("instantiate failed")
.account_id;

// Then
let message = build_message::<SetContractStorageRef>(contract_acc_id.clone())
.call(|contract| contract.set_storage_very_big());

Expand All @@ -111,6 +117,5 @@ mod set_contract_storage {
.await
.expect("set_storage_very_big failed");
}

}
}

0 comments on commit f0da5f7

Please sign in to comment.