Skip to content

Commit

Permalink
Merge pull request #1639 from multiversx/remove-set-current-dir
Browse files Browse the repository at this point in the history
Removed set_current_dir_from_workspace from tests
  • Loading branch information
andrei-marinica authored May 22, 2024
2 parents 9872070 + 6623019 commit 27635af
Show file tree
Hide file tree
Showing 68 changed files with 7 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/benchmarks/large-storage");
blockchain.register_contract(
"mxsc:output/large-storage.mxsc.json",
large_storage::ContractBuilder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const WASM_PATH_EXPR: &str = "mxsc:output/linked-list-repeat.mxsc.json";

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/benchmarks/mappers/linked-list-repeat");

blockchain.register_contract(WASM_PATH_EXPR, linked_list_repeat::ContractBuilder);
blockchain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/benchmarks/mappers/linked-list-repeat");

blockchain.register_contract(
"mxsc:output/linked-list-repeat.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/benchmarks/mappers/map-repeat");

blockchain.register_contract(
"mxsc:output/map-repeat.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/benchmarks/mappers/queue-repeat");

blockchain.register_contract(
"mxsc:output/queue-repeat.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/benchmarks/mappers/set-repeat");

blockchain.register_contract(
"mxsc:output/set-repeat.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/benchmarks/mappers/single-value-repeat");

blockchain.register_contract(
"mxsc:output/single-value-repeat.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/benchmarks/mappers/vec-repeat");

blockchain.register_contract(
"mxsc:output/vec-repeat.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const PRICE_AGGREGATOR_PATH: MxscPath =
fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();

blockchain.set_current_dir_from_workspace("contracts/core/price-aggregator");
blockchain.register_contract(
PRICE_AGGREGATOR_PATH,
multiversx_price_aggregator_sc::ContractBuilder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const PRICE_AGGREGATOR_PATH_EXPR: &str = "mxsc:output/multiversx-price-aggregato
fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();

blockchain.set_current_dir_from_workspace("contracts/core/price-aggregator");
blockchain.register_contract(
PRICE_AGGREGATOR_PATH_EXPR,
multiversx_price_aggregator_sc::ContractBuilder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/core/wegld-swap");

blockchain.register_contract(
"mxsc:output/multiversx-wegld-swap-sc.mxsc.json",
Expand Down
1 change: 0 additions & 1 deletion contracts/examples/adder/tests/adder_blackbox_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const CODE_PATH: MxscPath = MxscPath::new("output/adder.mxsc.json");

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/examples/adder");

blockchain.register_contract(CODE_PATH, adder::ContractBuilder);
blockchain
Expand Down
1 change: 0 additions & 1 deletion contracts/examples/adder/tests/adder_scenario_rs_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/examples/adder");

blockchain.register_contract("mxsc:output/adder.mxsc.json", adder::ContractBuilder);
blockchain
Expand Down
1 change: 0 additions & 1 deletion contracts/examples/adder/tests/adder_whitebox_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const ADDER_PATH_EXPR: &str = "mxsc:output/adder.mxsc.json";

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/examples/adder");

blockchain.register_contract("mxsc:output/adder.mxsc.json", adder::ContractBuilder);
blockchain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/examples/crowdfunding-esdt");

blockchain.register_contract(
"mxsc:output/crowdfunding-esdt.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/examples/crypto-bubbles");

blockchain.register_contract(
"mxsc:output/crypto-bubbles.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/examples/digital-cash");

blockchain.register_contract(
"mxsc:output/digital-cash.mxsc.json",
Expand Down
1 change: 0 additions & 1 deletion contracts/examples/empty/tests/empty_scenario_rs_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/examples/empty");

blockchain.register_contract("mxsc:output/empty.mxsc.json", empty::ContractBuilder);
blockchain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/examples/esdt-transfer-with-fee");

blockchain.register_contract(
"mxsc:output/esdt-transfer-with-fee.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/examples/factorial");

blockchain.register_contract(
"mxsc:output/factorial.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/examples/lottery-esdt");

blockchain.register_contract(
"mxsc:output/lottery-esdt.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const QUORUM_SIZE: usize = 1;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/examples/multisig");

blockchain.register_contract(MULTISIG_CODE_PATH, multisig::ContractBuilder);
blockchain.register_contract(ADDER_CODE_PATH, adder::ContractBuilder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const WEGLD_SWAP_EXPR: &str = "0x0061736d0100000001661160000060017f0060027f7f017

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/examples/multisig");

blockchain.register_partial_contract::<multisig::AbiProvider, _>(
"mxsc:output/multisig.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ pub struct CallActionDataRaw {

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/examples/multisig");

blockchain.register_contract(MULTISIG_PATH_EXPR, multisig::ContractBuilder);
blockchain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/examples/nft-minter");

blockchain.register_contract(
"mxsc:output/nft-minter.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/examples/nft-subscription");

blockchain.register_contract(
"mxsc:output/nft-subscription.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/examples/order-book/pair");

blockchain.register_contract(
"mxsc:output/order-book-pair.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/examples/ping-pong-egld");

blockchain.register_contract(
"mxsc:output/ping-pong-egld.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/examples/proxy-pause");

blockchain.register_contract(
"mxsc:output/proxy-pause.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/examples/token-release");

blockchain.register_contract(
"mxsc:output/token-release.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ use multiversx_sc_scenario::ScenarioWorld;

#[test]
fn abi_tester_abi_generated_ok() {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/feature-tests/abi-tester");
let blockchain = ScenarioWorld::new();

// generate ABI
let multi_contract_config = multiversx_sc_meta::multi_contract_config::<abi_tester::AbiProvider>(
Expand Down Expand Up @@ -72,7 +71,6 @@ fn abi_tester_esdt_attr_abi_generated_ok() {
#[test]
fn check_multi_contract_config() {
let mut blockchain = ScenarioWorld::new();

Check warning on line 73 in contracts/feature-tests/abi-tester/tests/abi_tester_abi_test.rs

View workflow job for this annotation

GitHub Actions / Contracts (nightly) / Test Coverage

variable does not need to be mutable

Check warning on line 73 in contracts/feature-tests/abi-tester/tests/abi_tester_abi_test.rs

View workflow job for this annotation

GitHub Actions / Contracts (nightly) / Wasm tests

variable does not need to be mutable

Check warning on line 73 in contracts/feature-tests/abi-tester/tests/abi_tester_abi_test.rs

View workflow job for this annotation

GitHub Actions / Contracts / Rust tests

variable does not need to be mutable

Check warning on line 73 in contracts/feature-tests/abi-tester/tests/abi_tester_abi_test.rs

View workflow job for this annotation

GitHub Actions / Contracts / Test Coverage

variable does not need to be mutable

Check warning on line 73 in contracts/feature-tests/abi-tester/tests/abi_tester_abi_test.rs

View workflow job for this annotation

GitHub Actions / Contracts (nightly) / Rust tests

variable does not need to be mutable

Check warning on line 73 in contracts/feature-tests/abi-tester/tests/abi_tester_abi_test.rs

View workflow job for this annotation

GitHub Actions / Contracts / Wasm tests

variable does not need to be mutable
blockchain.set_current_dir_from_workspace("contracts/feature-tests/abi-tester");

let multi_contract_config = multiversx_sc_meta::multi_contract_config::<abi_tester::AbiProvider>(
blockchain.current_dir().as_path(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/feature-tests/alloc-features");

blockchain.register_partial_contract::<alloc_features::AbiProvider, _>(
"mxsc:output/alloc-features.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/feature-tests/basic-features");

blockchain.register_contract(
"mxsc:output/basic-features.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/feature-tests/basic-features");

blockchain.register_contract(
"mxsc:output/basic-features.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/feature-tests/big-float-features");

blockchain.register_contract(
"mxsc:output/big-float-features.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/feature-tests/composability");

blockchain.register_contract(
"mxsc:builtin-func-features/output/builtin-func-features.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ type ForwarderContract = ContractInfo<forwarder_legacy::Proxy<StaticApi>>;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/composability/");

blockchain.register_contract(FORWARDER_PATH_EXPR, forwarder_legacy::ContractBuilder);
blockchain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const NFT_TOKEN_ID: &[u8] = b"COOL-123456";

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/composability/forwarder_legacy");

blockchain.register_contract(FORWARDER_PATH_EXPR, forwarder_legacy::ContractBuilder);
blockchain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const NFT_TOKEN_ID: &[u8] = b"COOL-123456";

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/composability/forwarder");

blockchain.register_contract(FORWARDER_PATH_EXPR, forwarder::ContractBuilder);
blockchain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ type VaultContract = ContractInfo<vault::Proxy<StaticApi>>;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/feature-tests/composability");

blockchain.register_contract(
PROMISES_FEATURES_PATH_EXPR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ const REJECT_FUNDS_FUNC_NAME: &[u8] = b"reject_funds";

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace(
"contracts/composability/feature-tests/transfer-role-features",
);

blockchain.register_contract(
TRANSFER_ROLE_FEATURES_PATH_EXPR,
transfer_role_features::ContractBuilder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace(
"contracts/feature-tests/erc-style-contracts/crowdfunding-erc20",
);

blockchain.register_contract(
"mxsc:output/crowdfunding-erc20.mxsc.json",
crowdfunding_erc20::ContractBuilder,
);

blockchain.register_contract(
"mxsc:../erc20/output/erc20.mxsc.json",
erc20::ContractBuilder,
);

blockchain
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/feature-tests/erc-style-contracts/erc20");

blockchain.register_contract("mxsc:output/erc20.mxsc.json", erc20::ContractBuilder);
blockchain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace(
"contracts/feature-tests/erc-style-contracts/lottery-erc20",
);

blockchain.register_contract(
"mxsc:output/lottery-erc20.mxsc.json",
lottery_erc20::ContractBuilder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use multiversx_sc_scenario::*;

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/feature-tests/esdt-system-sc-mock");

blockchain.register_contract(
"mxsc:output/esdt-system-sc-mock.mxsc.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const EXCHANGE_FEATURES_PATH_EXPR: &str = "mxsc:output/exchange-features.mxsc.js

fn world() -> ScenarioWorld {
let mut blockchain = ScenarioWorld::new();
blockchain.set_current_dir_from_workspace("contracts/feature-tests/exchange-features");

blockchain.register_contract(
EXCHANGE_FEATURES_PATH_EXPR,
Expand Down
Loading

0 comments on commit 27635af

Please sign in to comment.