-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add wrappers for
live_until_ledger
getters. (#1267)
### What Add wrappers for `live_until_ledger` getters. Also cover the emulation of state expiration with some tests. ### Why Improving test utilities: #1162 ### Known limitations N/A
- Loading branch information
Showing
11 changed files
with
752 additions
and
25 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,41 @@ | ||
use crate::{Map, Val}; | ||
use crate::{Env, IntoVal, Map, Val}; | ||
|
||
/// Test utilities for [`Persistent`][crate::storage::Persistent]. | ||
pub trait Persistent { | ||
/// Returns all data stored in persistent storage for the contract. | ||
fn all(&self) -> Map<Val, Val>; | ||
|
||
/// Gets the TTL for the persistent storage entry corresponding to the provided key. | ||
/// | ||
/// TTL is the number of ledgers left until the persistent entry is considered | ||
/// expired, including the current ledger. | ||
/// | ||
/// Panics if there is no entry corresponding to the key, or if the entry has expired. | ||
fn get_ttl<K: IntoVal<Env, Val>>(&self, key: &K) -> u32; | ||
} | ||
|
||
/// Test utilities for [`Temporary`][crate::storage::Temporary]. | ||
pub trait Temporary { | ||
/// Returns all data stored in temporary storage for the contract. | ||
fn all(&self) -> Map<Val, Val>; | ||
|
||
/// Gets the TTL for the temporary storage entry corresponding to the provided key. | ||
/// | ||
/// TTL is the number of ledgers left until the temporary entry is considered | ||
/// non-existent, including the current ledger. | ||
/// | ||
/// Panics if there is no entry corresponding to the key. | ||
fn get_ttl<K: IntoVal<Env, Val>>(&self, key: &K) -> u32; | ||
} | ||
|
||
/// Test utilities for [`Instance`][crate::storage::Instance]. | ||
pub trait Instance { | ||
/// Returns all data stored in Instance storage for the contract. | ||
fn all(&self) -> Map<Val, Val>; | ||
|
||
/// Gets the TTL for the current contract's instance entry. | ||
/// | ||
/// TTL is the number of ledgers left until the instance entry is considered | ||
/// expired, including the current ledger. | ||
fn get_ttl(&self) -> u32; | ||
} |
Oops, something went wrong.