Skip to content

Commit ccb7548

Browse files
kianenigmabkchr
andauthored
Thread-local parameter_types for testing. (#7542)
* Thread-local parameter_types for testing. * Better docs. * Some minors * Merge'em * Update frame/support/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Align more to basti's trick * Update frame/support/src/lib.rs * Update frame/support/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Bastian Köcher <git@kchr.de>
1 parent 46a4072 commit ccb7548

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/lib.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ impl<T: Trait<I>, I: Instance> Contains<T::AccountId> for Module<T, I> {
278278
mod tests {
279279
use super::*;
280280

281-
use std::cell::RefCell;
282281
use frame_support::{
283282
assert_ok, assert_noop, impl_outer_origin, parameter_types, weights::Weight,
284283
ord_parameter_types
@@ -298,6 +297,8 @@ mod tests {
298297
pub const MaximumBlockWeight: Weight = 1024;
299298
pub const MaximumBlockLength: u32 = 2 * 1024;
300299
pub const AvailableBlockRatio: Perbill = Perbill::one();
300+
pub static Members: Vec<u64> = vec![];
301+
pub static Prime: Option<u64> = None;
301302
}
302303
impl frame_system::Trait for Test {
303304
type BaseCallFilter = ();
@@ -334,11 +335,6 @@ mod tests {
334335
pub const Five: u64 = 5;
335336
}
336337

337-
thread_local! {
338-
static MEMBERS: RefCell<Vec<u64>> = RefCell::new(vec![]);
339-
static PRIME: RefCell<Option<u64>> = RefCell::new(None);
340-
}
341-
342338
pub struct TestChangeMembers;
343339
impl ChangeMembers<u64> for TestChangeMembers {
344340
fn change_members_sorted(incoming: &[u64], outgoing: &[u64], new: &[u64]) {

0 commit comments

Comments
 (0)