diff --git a/substrate/frame/membership/src/benchmark.rs b/substrate/frame/membership/src/benchmarking.rs similarity index 94% rename from substrate/frame/membership/src/benchmark.rs rename to substrate/frame/membership/src/benchmarking.rs index 0e1ebeb4fe456..0810a7e46ef0d 100644 --- a/substrate/frame/membership/src/benchmark.rs +++ b/substrate/frame/membership/src/benchmarking.rs @@ -56,7 +56,7 @@ benchmarks_instance_pallet! { )); } verify { assert!(>::get().contains(&new_member)); - #[cfg(test)] crate::tests::clean(); + #[cfg(test)] crate::mock::clean(); } // the case of no prime or the prime being removed is surely cheaper than the case of @@ -78,7 +78,7 @@ benchmarks_instance_pallet! { assert!(!>::get().contains(&to_remove)); // prime is rejigged assert!(>::get().is_some() && T::MembershipChanged::get_prime().is_some()); - #[cfg(test)] crate::tests::clean(); + #[cfg(test)] crate::mock::clean(); } // we remove a non-prime to make sure it needs to be set again. @@ -102,7 +102,7 @@ benchmarks_instance_pallet! { assert!(>::get().contains(&add)); // prime is rejigged assert!(>::get().is_some() && T::MembershipChanged::get_prime().is_some()); - #[cfg(test)] crate::tests::clean(); + #[cfg(test)] crate::mock::clean(); } // er keep the prime common between incoming and outgoing to make sure it is rejigged. @@ -122,7 +122,7 @@ benchmarks_instance_pallet! { assert_eq!(>::get(), new_members); // prime is rejigged assert!(>::get().is_some() && T::MembershipChanged::get_prime().is_some()); - #[cfg(test)] crate::tests::clean(); + #[cfg(test)] crate::mock::clean(); } change_key { @@ -143,7 +143,7 @@ benchmarks_instance_pallet! { assert!(>::get().contains(&add)); // prime is rejigged assert_eq!(>::get().unwrap(), add); - #[cfg(test)] crate::tests::clean(); + #[cfg(test)] crate::mock::clean(); } set_prime { @@ -160,7 +160,7 @@ benchmarks_instance_pallet! { } verify { assert!(>::get().is_some()); assert!(::get_prime().is_some()); - #[cfg(test)] crate::tests::clean(); + #[cfg(test)] crate::mock::clean(); } clear_prime { @@ -174,8 +174,8 @@ benchmarks_instance_pallet! { } verify { assert!(>::get().is_none()); assert!(::get_prime().is_none()); - #[cfg(test)] crate::tests::clean(); + #[cfg(test)] crate::mock::clean(); } - impl_benchmark_test_suite!(Membership, crate::tests::new_bench_ext(), crate::tests::Test); + impl_benchmark_test_suite!(Membership, crate::mock::new_bench_ext(), crate::mock::Test); } diff --git a/substrate/frame/membership/src/lib.rs b/substrate/frame/membership/src/lib.rs index 12686ae890d28..0bd562144d1c2 100644 --- a/substrate/frame/membership/src/lib.rs +++ b/substrate/frame/membership/src/lib.rs @@ -33,6 +33,15 @@ use sp_std::prelude::*; pub mod migrations; pub mod weights; +#[cfg(any(feature = "mock", test))] +pub mod mock; + +#[cfg(feature = "runtime-benchmarks")] +pub mod benchmarking; + +#[cfg(test)] +mod tests; + pub use pallet::*; pub use weights::WeightInfo;