mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 05:38:00 +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:
@@ -19,7 +19,6 @@
|
||||
|
||||
use super::*;
|
||||
use crate as pallet_timestamp;
|
||||
use sp_std::cell::RefCell;
|
||||
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
@@ -78,14 +77,14 @@ impl frame_system::Config for Test {
|
||||
type MaxConsumers = ConstU32<16>;
|
||||
}
|
||||
|
||||
thread_local! {
|
||||
pub static CAPTURED_MOMENT: RefCell<Option<Moment>> = RefCell::new(None);
|
||||
parameter_types! {
|
||||
pub static CapturedMoment: Option<Moment> = None;
|
||||
}
|
||||
|
||||
pub struct MockOnTimestampSet;
|
||||
impl OnTimestampSet<Moment> for MockOnTimestampSet {
|
||||
fn on_timestamp_set(moment: Moment) {
|
||||
CAPTURED_MOMENT.with(|x| *x.borrow_mut() = Some(moment));
|
||||
CapturedMoment::mutate(|x| *x = Some(moment));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,11 +96,11 @@ impl Config for Test {
|
||||
}
|
||||
|
||||
pub(crate) fn clear_captured_moment() {
|
||||
CAPTURED_MOMENT.with(|x| *x.borrow_mut() = None);
|
||||
CapturedMoment::mutate(|x| *x = None);
|
||||
}
|
||||
|
||||
pub(crate) fn get_captured_moment() -> Option<Moment> {
|
||||
CAPTURED_MOMENT.with(|x| *x.borrow())
|
||||
CapturedMoment::get()
|
||||
}
|
||||
|
||||
pub(crate) fn new_test_ext() -> TestExternalities {
|
||||
|
||||
Reference in New Issue
Block a user