mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07:58 +00:00
Use parameter_types instead of thread_local for test-setup (#12036)
* Edit to Assets. parameter_types * fixes * Test Fixes. WIP * Edits to pallet-aura * Camel Case Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Implementation of mutate fn * update to pallet-aura * Update to frame-system. Fixes * Update to frame-support-test. CamelCases * Updates to frame- contracts, offences, staking, bounties, child bounties * Edit to mutate fn. Changes to frame-contracts. CamelCase pallet-aura * Edits to frame-contracts & executive * cargo +nightly fmt * unused import removed * unused import removed * cargo +nightly fmt * minor adjustment * updates * updates * cargo +nightly fmt * cargo +nightly fmt * take fn implemented * update * update * Fixes to CallFilter * cargo +nightly fmt * final fixes * Default changed to $value * Update frame/support/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -22,7 +22,10 @@
|
||||
#![recursion_limit = "128"]
|
||||
|
||||
use codec::MaxEncodedLen;
|
||||
use frame_support::traits::{CrateVersion, PalletInfo as _};
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
traits::{CrateVersion, PalletInfo as _},
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_core::{sr25519, H256};
|
||||
use sp_runtime::{
|
||||
@@ -30,14 +33,13 @@ use sp_runtime::{
|
||||
traits::{BlakeTwo256, Verify},
|
||||
DispatchError, ModuleError,
|
||||
};
|
||||
use sp_std::cell::RefCell;
|
||||
|
||||
mod system;
|
||||
|
||||
pub trait Currency {}
|
||||
|
||||
thread_local! {
|
||||
pub static INTEGRITY_TEST_EXEC: RefCell<u32> = RefCell::new(0);
|
||||
parameter_types! {
|
||||
pub static IntegrityTestExec: u32 = 0;
|
||||
}
|
||||
|
||||
mod module1 {
|
||||
@@ -95,7 +97,7 @@ mod module2 {
|
||||
}
|
||||
|
||||
fn integrity_test() {
|
||||
INTEGRITY_TEST_EXEC.with(|i| *i.borrow_mut() += 1);
|
||||
IntegrityTestExec::mutate(|i| *i += 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -140,7 +142,7 @@ mod nested {
|
||||
}
|
||||
|
||||
fn integrity_test() {
|
||||
INTEGRITY_TEST_EXEC.with(|i| *i.borrow_mut() += 1);
|
||||
IntegrityTestExec::mutate(|i| *i += 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -377,7 +379,7 @@ fn check_modules_error_type() {
|
||||
#[test]
|
||||
fn integrity_test_works() {
|
||||
__construct_runtime_integrity_test::runtime_integrity_tests();
|
||||
assert_eq!(INTEGRITY_TEST_EXEC.with(|i| *i.borrow()), 2);
|
||||
assert_eq!(IntegrityTestExec::get(), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user