From 251bff4c2dbac03454fe0ad3eff250dd56b12743 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Tue, 9 Apr 2024 23:14:36 +0300 Subject: [PATCH] result handler cleanup in examples --- .../examples/adder/interact/src/basic_interact.rs | 9 --------- contracts/examples/adder/tests/adder_blackbox_test.rs | 11 ++++------- .../panic-message-features/tests/pmf_blackbox_test.rs | 8 ++++---- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/contracts/examples/adder/interact/src/basic_interact.rs b/contracts/examples/adder/interact/src/basic_interact.rs index 4fc748c95e..83d3e609ca 100644 --- a/contracts/examples/adder/interact/src/basic_interact.rs +++ b/contracts/examples/adder/interact/src/basic_interact.rs @@ -92,15 +92,6 @@ impl AdderInteract { .typed(adder_proxy::AdderProxy) .init(0u32) .code(&self.adder_code) - .with_result(WithRawTxResponse(|response| { - let err = &response.tx_error; - assert!( - err.is_success(), - "deploy failed: status: {}, message: {}", - err.status, - err.message - ); - })) .returns(ReturnsNewAddress) .prepare_async() .run() diff --git a/contracts/examples/adder/tests/adder_blackbox_test.rs b/contracts/examples/adder/tests/adder_blackbox_test.rs index 6a3142a207..e52c8c3ddb 100644 --- a/contracts/examples/adder/tests/adder_blackbox_test.rs +++ b/contracts/examples/adder/tests/adder_blackbox_test.rs @@ -31,17 +31,17 @@ fn adder_blackbox() { .new_address(owner_address, 1, "sc:adder"), ); - world + let new_address = world .tx() .from(OWNER) .typed(adder_proxy::AdderProxy) .init(5u32) .code(CODE_EXPR) - .with_result(WithNewAddress::new(|new_address| { - assert_eq!(new_address.to_address(), adder_contract.to_address()); - })) + .returns(ReturnsNewAddress) .run(); + assert_eq!(new_address, adder_contract.to_address()); + let value = world .query() .to(SC_ADDER) @@ -57,9 +57,6 @@ fn adder_blackbox() { .to(SC_ADDER) .typed(adder_proxy::AdderProxy) .add(1u32) - .with_result(WithRawTxResponse(|response| { - assert!(response.tx_error.is_success()); - })) .run(); world.check_state_step( diff --git a/contracts/feature-tests/panic-message-features/tests/pmf_blackbox_test.rs b/contracts/feature-tests/panic-message-features/tests/pmf_blackbox_test.rs index 66b2d9527e..3d13175c09 100644 --- a/contracts/feature-tests/panic-message-features/tests/pmf_blackbox_test.rs +++ b/contracts/feature-tests/panic-message-features/tests/pmf_blackbox_test.rs @@ -73,8 +73,8 @@ fn tx_expect_error_test() { .to(SC_PMF) .typed(pmf_proxy::PanicMessageFeaturesProxy) .sc_panic() - .returns(ExpectStatus(4)) - .returns(ExpectMessage("sc_panic! test")) + .with_result(ExpectStatus(4)) + .with_result(ExpectMessage("sc_panic! test")) .run(); } @@ -87,7 +87,7 @@ fn query_expect_error_test() { .to(SC_PMF) .typed(pmf_proxy::PanicMessageFeaturesProxy) .sc_panic() - .returns(ExpectStatus(4)) - .returns(ExpectMessage("sc_panic! test")) + .with_result(ExpectStatus(4)) + .with_result(ExpectMessage("sc_panic! test")) .run(); }