Skip to content

Commit

Permalink
don't use runtime ascription
Browse files Browse the repository at this point in the history
  • Loading branch information
pmikolajczyk41 committed Jan 22, 2024
1 parent 812ad95 commit c7d947d
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 19 deletions.
4 changes: 1 addition & 3 deletions examples/chain-extension/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ mod tests {

/// Test that we can call chain extension from ink! contract and get a correct result.
#[drink::test(runtime = RuntimeWithCE)]
fn we_can_test_chain_extension(
mut session: Session<RuntimeWithCE>,
) -> Result<(), Box<dyn std::error::Error>> {
fn we_can_test_chain_extension(mut session: Session) -> Result<(), Box<dyn std::error::Error>> {
let result: u32 = session
.deploy_bundle_and(
BundleProvider::local()?,
Expand Down
4 changes: 1 addition & 3 deletions examples/contract-events/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ mod tests {
enum BundleProvider {}

#[drink::test]
fn we_can_inspect_emitted_events(
mut session: Session<MinimalRuntime>,
) -> Result<(), Box<dyn Error>> {
fn we_can_inspect_emitted_events(mut session: Session) -> Result<(), Box<dyn Error>> {
let bundle = BundleProvider::local()?;

// Firstly, we deploy the contract and call its `flip` method.
Expand Down
2 changes: 1 addition & 1 deletion examples/cross-contract-call-tracing/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ mod tests {
}

#[drink::test]
fn test(mut session: Session<MinimalRuntime>) -> Result<(), Box<dyn Error>> {
fn test(mut session: Session) -> Result<(), Box<dyn Error>> {
session.set_tracing_extension(TracingExt(Box::new(TestDebugger {})));

let outer_address = session.deploy_bundle(
Expand Down
4 changes: 2 additions & 2 deletions examples/flipper/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ mod tests {
enum BundleProvider {}

#[drink::test]
fn initialization(mut session: Session<MinimalRuntime>) -> Result<(), Box<dyn Error>> {
fn initialization(mut session: Session) -> Result<(), Box<dyn Error>> {
let contract = BundleProvider::local()?;
let init_value: bool = session
.deploy_bundle_and(contract, "new", &["true"], NO_SALT, NO_ENDOWMENT)?
Expand All @@ -55,7 +55,7 @@ mod tests {
}

#[drink::test]
fn flipping(mut session: Session<MinimalRuntime>) -> Result<(), Box<dyn Error>> {
fn flipping(mut session: Session) -> Result<(), Box<dyn Error>> {
let contract = BundleProvider::Flipper.bundle()?;
let init_value: bool = session
.deploy_bundle_and(contract, "new", &["true"], NO_SALT, NO_ENDOWMENT)?
Expand Down
2 changes: 1 addition & 1 deletion examples/mocking/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ mod tests {
enum BundleProvider {}

#[drink::test]
fn call_mocked_message(mut session: Session<MinimalRuntime>) -> Result<(), Box<dyn Error>> {
fn call_mocked_message(mut session: Session) -> Result<(), Box<dyn Error>> {
// Firstly, we create the mocked contract.
const RETURN_VALUE: (u8, u8) = (4, 1);
let mocked_contract =
Expand Down
14 changes: 5 additions & 9 deletions examples/quick-start-with-drink/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,10 @@ mod tests {
/// For convenience of using `?` operator, we mark the test function as returning a `Result`.
///
/// `drink::test` will already provide us with a `Session` object. It is a wrapper around a runtime and it exposes
/// a broad API for interacting with it. It is generic over the runtime type, but usually, it is sufficient to use
/// `MinimalRuntime`, which is a minimalistic runtime that allows using smart contracts.
/// a broad API for interacting with it. Session is generic over the runtime type, but usually and by default, we
/// use `MinimalRuntime`, which is a minimalistic runtime that allows using smart contracts.
#[drink::test]
fn deploy_and_call_a_contract(
mut session: Session<MinimalRuntime>,
) -> Result<(), Box<dyn std::error::Error>> {
fn deploy_and_call_a_contract(mut session: Session) -> Result<(), Box<dyn std::error::Error>> {
// Now we get the contract bundle from the `BundleProvider` enum. Since the current crate
// comes with a contract, we can use the `local` method to get the bundle for it.
let contract_bundle = BundleProvider::local()?;
Expand Down Expand Up @@ -120,9 +118,7 @@ mod tests {

/// In this testcase we will see how to get and read debug logs from the contract.
#[drink::test]
fn get_debug_logs(
mut session: Session<MinimalRuntime>,
) -> Result<(), Box<dyn std::error::Error>> {
fn get_debug_logs(mut session: Session) -> Result<(), Box<dyn std::error::Error>> {
session.deploy_bundle(
BundleProvider::local()?,
"new",
Expand All @@ -149,7 +145,7 @@ mod tests {
/// In this testcase we will see how to work with multiple contracts.
#[drink::test]
fn work_with_multiple_contracts(
mut session: Session<MinimalRuntime>,
mut session: Session,
) -> Result<(), Box<dyn std::error::Error>> {
let bundle = BundleProvider::local()?;

Expand Down

0 comments on commit c7d947d

Please sign in to comment.