Rename pallet trait Trait to Config (#7599)

* rename Trait to Config

* add test asserting using Trait is still valid.

* fix ui tests
This commit is contained in:
Guillaume Thiolliere
2020-11-30 15:34:54 +01:00
committed by GitHub
parent dd3c84c362
commit 1cbfc9257f
200 changed files with 1767 additions and 1607 deletions
@@ -24,13 +24,13 @@ mod tests {
use std::marker::PhantomData;
frame_support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin, system=frame_support_test {}
pub struct Module<T: Config> for enum Call where origin: T::Origin, system=frame_support_test {}
}
pub trait Trait: frame_support_test::Trait {}
pub trait Config: frame_support_test::Config {}
frame_support::decl_storage! {
trait Store for Module<T: Trait> as TestStorage {
trait Store for Module<T: Config> as TestStorage {
// non-getters: pub / $default
/// Hello, this is doc!
@@ -81,14 +81,14 @@ mod tests {
struct TraitImpl {}
impl frame_support_test::Trait for TraitImpl {
impl frame_support_test::Config for TraitImpl {
type Origin = u32;
type BlockNumber = u32;
type PalletInfo = ();
type DbWeight = ();
}
impl Trait for TraitImpl {}
impl Config for TraitImpl {}
const EXPECTED_METADATA: StorageMetadata = StorageMetadata {
prefix: DecodeDifferent::Encode("TestStorage"),
@@ -414,16 +414,16 @@ mod tests {
#[cfg(test)]
#[allow(dead_code)]
mod test2 {
pub trait Trait: frame_support_test::Trait {}
pub trait Config: frame_support_test::Config {}
frame_support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin, system=frame_support_test {}
pub struct Module<T: Config> for enum Call where origin: T::Origin, system=frame_support_test {}
}
type PairOf<T> = (T, T);
frame_support::decl_storage! {
trait Store for Module<T: Trait> as TestStorage {
trait Store for Module<T: Config> as TestStorage {
SingleDef : u32;
PairDef : PairOf<u32>;
Single : Option<u32>;
@@ -438,26 +438,26 @@ mod test2 {
struct TraitImpl {}
impl frame_support_test::Trait for TraitImpl {
impl frame_support_test::Config for TraitImpl {
type Origin = u32;
type BlockNumber = u32;
type PalletInfo = ();
type DbWeight = ();
}
impl Trait for TraitImpl {}
impl Config for TraitImpl {}
}
#[cfg(test)]
#[allow(dead_code)]
mod test3 {
pub trait Trait: frame_support_test::Trait {}
pub trait Config: frame_support_test::Config {}
frame_support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin, system=frame_support_test {}
pub struct Module<T: Config> for enum Call where origin: T::Origin, system=frame_support_test {}
}
frame_support::decl_storage! {
trait Store for Module<T: Trait> as Test {
trait Store for Module<T: Config> as Test {
Foo get(fn foo) config(initial_foo): u32;
}
}
@@ -466,14 +466,14 @@ mod test3 {
struct TraitImpl {}
impl frame_support_test::Trait for TraitImpl {
impl frame_support_test::Config for TraitImpl {
type Origin = u32;
type BlockNumber = u32;
type PalletInfo = ();
type DbWeight = ();
}
impl Trait for TraitImpl {}
impl Config for TraitImpl {}
}
#[cfg(test)]
@@ -482,17 +482,17 @@ mod test_append_and_len {
use sp_io::TestExternalities;
use codec::{Encode, Decode};
pub trait Trait: frame_support_test::Trait {}
pub trait Config: frame_support_test::Config {}
frame_support::decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin, system=frame_support_test {}
pub struct Module<T: Config> for enum Call where origin: T::Origin, system=frame_support_test {}
}
#[derive(PartialEq, Eq, Clone, Encode, Decode)]
struct NoDef(u32);
frame_support::decl_storage! {
trait Store for Module<T: Trait> as Test {
trait Store for Module<T: Config> as Test {
NoDefault: Option<NoDef>;
JustVec: Vec<u32>;
@@ -511,14 +511,14 @@ mod test_append_and_len {
struct Test {}
impl frame_support_test::Trait for Test {
impl frame_support_test::Config for Test {
type Origin = u32;
type BlockNumber = u32;
type PalletInfo = ();
type DbWeight = ();
}
impl Trait for Test {}
impl Config for Test {}
#[test]
fn default_for_option() {