-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'rc/v0.53' into managed-decimal-var-tests
- Loading branch information
Showing
16 changed files
with
309 additions
and
19 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
permissions: | ||
checks: write | ||
pull-requests: write | ||
|
||
jobs: | ||
template_test_current: | ||
name: Plotter tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install rust | ||
uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
toolchain: stable | ||
target: wasm32-unknown-unknown | ||
|
||
- name: Run plotter tests | ||
run: | | ||
cd tools/plotter | ||
cargo test |
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
41 changes: 41 additions & 0 deletions
41
contracts/feature-tests/basic-features/tests/basic_features_managed_option_test.rs
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use imports::{MxscPath, ReturnsResult, TestAddress, TestSCAddress}; | ||
use multiversx_sc::types::{BigUint, ManagedOption}; | ||
use multiversx_sc_scenario::{api::StaticApi, imports, ScenarioTxRun, ScenarioWorld}; | ||
|
||
const OWNER_ADDRESS: TestAddress = TestAddress::new("owner"); | ||
const BASIC_FEATURES_ADDRESS: TestSCAddress = TestSCAddress::new("basic-features"); | ||
const BASIC_FEATURES_PATH: MxscPath = MxscPath::new("output/basic-features.mxsc.json"); | ||
|
||
fn world() -> ScenarioWorld { | ||
let mut blockchain = ScenarioWorld::new(); | ||
|
||
blockchain.register_contract(BASIC_FEATURES_PATH, basic_features::ContractBuilder); | ||
|
||
blockchain.account(OWNER_ADDRESS).nonce(1); | ||
blockchain | ||
.account(BASIC_FEATURES_ADDRESS) | ||
.nonce(1) | ||
.code(BASIC_FEATURES_PATH); | ||
|
||
blockchain | ||
} | ||
|
||
#[test] | ||
fn managed_option_test() { | ||
let mut world = world(); | ||
|
||
let type_number: BigUint<StaticApi> = BigUint::zero(); | ||
let expected_type_managed_option: ManagedOption<StaticApi, BigUint<StaticApi>> = | ||
ManagedOption::some(type_number); | ||
|
||
let output = world | ||
.tx() | ||
.from(OWNER_ADDRESS) | ||
.to(BASIC_FEATURES_ADDRESS) | ||
.typed(basic_features::basic_features_proxy::BasicFeaturesProxy) | ||
.echo_managed_option(expected_type_managed_option.clone()) | ||
.returns(ReturnsResult) | ||
.run(); | ||
|
||
assert_eq!(output, expected_type_managed_option); | ||
} |
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
24 changes: 24 additions & 0 deletions
24
framework/scenario/src/facade/result_handlers/returns_logs.rs
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use multiversx_sc::types::RHListItemExec; | ||
|
||
use crate::{ | ||
multiversx_sc::types::{RHListItem, TxEnv}, | ||
scenario_model::{Log, TxResponse}, | ||
}; | ||
|
||
pub struct ReturnsLogs; | ||
|
||
impl<Env, Original> RHListItem<Env, Original> for ReturnsLogs | ||
where | ||
Env: TxEnv, | ||
{ | ||
type Returns = Vec<Log>; | ||
} | ||
|
||
impl<Env, Original> RHListItemExec<TxResponse, Env, Original> for ReturnsLogs | ||
where | ||
Env: TxEnv, | ||
{ | ||
fn item_process_result(self, raw_result: &TxResponse) -> Self::Returns { | ||
raw_result.logs.clone() | ||
} | ||
} |
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,9 +1,9 @@ | ||
use crate::scenario_model::BytesValue; | ||
use multiversx_sc::types::Address; | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct Log { | ||
pub address: BytesValue, | ||
pub endpoint: BytesValue, | ||
pub topics: Vec<BytesValue>, | ||
pub data: BytesValue, | ||
pub address: Address, | ||
pub endpoint: String, | ||
pub topics: Vec<Vec<u8>>, | ||
pub data: Vec<Vec<u8>>, | ||
} |
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
Oops, something went wrong.