Skip to content

Commit

Permalink
Make some UI test expectations crisper (paritytech#10791)
Browse files Browse the repository at this point in the history
* Make some UI test expectations crisper

* Update frame/support/test/tests/construct_runtime_ui/undefined_genesis_config_part.rs

* Update UI test expectations

* Missing newlines

* More whitespace issues
  • Loading branch information
KiChjang authored and grishasobol committed Mar 28, 2022
1 parent 3becb08 commit 9d2bbbf
Show file tree
Hide file tree
Showing 14 changed files with 465 additions and 489 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,47 @@ use sp_runtime::{generic, traits::BlakeTwo256};
use sp_core::sr25519;

pub type Signature = sr25519::Signature;
pub type BlockNumber = u64;
pub type BlockNumber = u32;
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, Call, Signature, ()>;

impl test_pallet::Config for Runtime {}

impl frame_system::Config for Runtime {
type BaseCallFilter = frame_support::traits::Everything;
type Origin = Origin;
type Index = u64;
type BlockNumber = u32;
type Call = Call;
type Hash = sp_runtime::testing::H256;
type Hashing = sp_runtime::traits::BlakeTwo256;
type AccountId = u64;
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type BlockHashCount = frame_support::traits::ConstU32<250>;
type BlockWeights = ();
type BlockLength = ();
type DbWeight = ();
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
}

construct_runtime! {
pub enum Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: system::{Pallet, Call, Storage, Config, Event<T>},
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
Pallet: test_pallet::{Pallet, Config},
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,73 +1,27 @@
error: `Pallet` does not have the std feature enabled, this will cause the `test_pallet::GenesisConfig` type to be undefined.
--> $DIR/no_std_genesis_config.rs:13:1
--> tests/construct_runtime_ui/no_std_genesis_config.rs:40:1
|
13 | / construct_runtime! {
14 | | pub enum Runtime where
15 | | Block = Block,
16 | | NodeBlock = Block,
40 | / construct_runtime! {
41 | | pub enum Runtime where
42 | | Block = Block,
43 | | NodeBlock = Block,
... |
21 | | }
22 | | }
48 | | }
49 | | }
| |_^
|
= note: this error originates in the macro `test_pallet::__substrate_genesis_config_check::is_std_enabled_for_genesis` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: use of undeclared crate or module `system`
--> $DIR/no_std_genesis_config.rs:19:11
|
19 | System: system::{Pallet, Call, Storage, Config, Event<T>},
| ^^^^^^ use of undeclared crate or module `system`

error[E0433]: failed to resolve: use of undeclared crate or module `system`
--> $DIR/no_std_genesis_config.rs:13:1
|
13 | / construct_runtime! {
14 | | pub enum Runtime where
15 | | Block = Block,
16 | | NodeBlock = Block,
... |
21 | | }
22 | | }
| |_^ not found in `system`
|
= note: this error originates in the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing this enum
|
1 | use frame_system::RawOrigin;
|

error[E0433]: failed to resolve: use of undeclared crate or module `system`
--> $DIR/no_std_genesis_config.rs:13:1
|
13 | / construct_runtime! {
14 | | pub enum Runtime where
15 | | Block = Block,
16 | | NodeBlock = Block,
... |
21 | | }
22 | | }
| |_^ not found in `system`
|
= note: this error originates in the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
|
1 | use frame_support_test::Pallet;
|
1 | use frame_system::Pallet;
|
1 | use test_pallet::Pallet;
|

error[E0412]: cannot find type `GenesisConfig` in crate `test_pallet`
--> $DIR/no_std_genesis_config.rs:13:1
--> tests/construct_runtime_ui/no_std_genesis_config.rs:40:1
|
13 | / construct_runtime! {
14 | | pub enum Runtime where
15 | | Block = Block,
16 | | NodeBlock = Block,
40 | / construct_runtime! {
41 | | pub enum Runtime where
42 | | Block = Block,
43 | | NodeBlock = Block,
... |
21 | | }
22 | | }
48 | | }
49 | | }
| |_^ not found in `test_pallet`
|
= note: this error originates in the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
Expand All @@ -76,14 +30,22 @@ help: consider importing this struct
1 | use frame_system::GenesisConfig;
|

error[E0277]: the trait bound `Runtime: frame_system::pallet::Config` is not satisfied
--> $DIR/no_std_genesis_config.rs:11:6
|
11 | impl test_pallet::Config for Runtime {}
| ^^^^^^^^^^^^^^^^^^^ the trait `frame_system::pallet::Config` is not implemented for `Runtime`
|
note: required by a bound in `Config`
--> $DIR/lib.rs:30:20
|
30 | pub trait Config: frame_system::Config {}
| ^^^^^^^^^^^^^^^^^^^^ required by this bound in `Config`
error[E0283]: type annotations needed
--> tests/construct_runtime_ui/no_std_genesis_config.rs:40:1
|
40 | / construct_runtime! {
41 | | pub enum Runtime where
42 | | Block = Block,
43 | | NodeBlock = Block,
... |
48 | | }
49 | | }
| |_^ cannot infer type
|
= note: cannot satisfy `_: std::default::Default`
note: required by `std::default::Default::default`
--> $RUST/core/src/default.rs
|
| fn default() -> Self;
| ^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,47 @@ mod pallet {
}

pub type Signature = sr25519::Signature;
pub type BlockNumber = u64;
pub type BlockNumber = u32;
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, Call, Signature, ()>;

impl pallet::Config for Runtime {}

impl frame_system::Config for Runtime {
type BaseCallFilter = frame_support::traits::Everything;
type Origin = Origin;
type Index = u64;
type BlockNumber = u32;
type Call = Call;
type Hash = sp_runtime::testing::H256;
type Hashing = sp_runtime::traits::BlakeTwo256;
type AccountId = u64;
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type BlockHashCount = frame_support::traits::ConstU32<250>;
type BlockWeights = ();
type BlockLength = ();
type DbWeight = ();
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
}

construct_runtime! {
pub enum Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: system::{Pallet, Call, Storage, Config, Event<T>},
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
Pallet: pallet::{Pallet, Call},
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,76 +1,16 @@
error: `Pallet` does not have #[pallet::call] defined, perhaps you should remove `Call` from construct_runtime?
--> $DIR/undefined_call_part.rs:5:1
--> tests/construct_runtime_ui/undefined_call_part.rs:5:1
|
5 | #[frame_support::pallet]
| ^^^^^^^^^^^^^^^^^^^^^^^^
...
22 | / construct_runtime! {
23 | | pub enum Runtime where
24 | | Block = Block,
25 | | NodeBlock = Block,
49 | / construct_runtime! {
50 | | pub enum Runtime where
51 | | Block = Block,
52 | | NodeBlock = Block,
... |
30 | | }
31 | | }
57 | | }
58 | | }
| |_- in this macro invocation
|
= note: this error originates in the macro `pallet::__substrate_call_check::is_call_part_defined` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0433]: failed to resolve: use of undeclared crate or module `system`
--> $DIR/undefined_call_part.rs:28:11
|
28 | System: system::{Pallet, Call, Storage, Config, Event<T>},
| ^^^^^^ use of undeclared crate or module `system`

error[E0433]: failed to resolve: use of undeclared crate or module `system`
--> $DIR/undefined_call_part.rs:22:1
|
22 | / construct_runtime! {
23 | | pub enum Runtime where
24 | | Block = Block,
25 | | NodeBlock = Block,
... |
30 | | }
31 | | }
| |_^ not found in `system`
|
= note: this error originates in the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing this enum
|
1 | use frame_system::RawOrigin;
|

error[E0433]: failed to resolve: use of undeclared crate or module `system`
--> $DIR/undefined_call_part.rs:22:1
|
22 | / construct_runtime! {
23 | | pub enum Runtime where
24 | | Block = Block,
25 | | NodeBlock = Block,
... |
30 | | }
31 | | }
| |_^ not found in `system`
|
= note: this error originates in the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
|
1 | use crate::pallet::Pallet;
|
1 | use frame_support_test::Pallet;
|
1 | use frame_system::Pallet;
|
1 | use test_pallet::Pallet;
|

error[E0277]: the trait bound `Runtime: frame_system::Config` is not satisfied
--> $DIR/undefined_call_part.rs:20:6
|
20 | impl pallet::Config for Runtime {}
| ^^^^^^^^^^^^^^ the trait `frame_system::Config` is not implemented for `Runtime`
|
note: required by a bound in `pallet::Config`
--> $DIR/undefined_call_part.rs:8:20
|
8 | pub trait Config: frame_system::Config {}
| ^^^^^^^^^^^^^^^^^^^^ required by this bound in `pallet::Config`
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,47 @@ mod pallet {
}

pub type Signature = sr25519::Signature;
pub type BlockNumber = u64;
pub type BlockNumber = u32;
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, Call, Signature, ()>;

impl pallet::Config for Runtime {}

impl frame_system::Config for Runtime {
type BaseCallFilter = frame_support::traits::Everything;
type Origin = Origin;
type Index = u64;
type BlockNumber = u32;
type Call = Call;
type Hash = sp_runtime::testing::H256;
type Hashing = sp_runtime::traits::BlakeTwo256;
type AccountId = u64;
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type BlockHashCount = frame_support::traits::ConstU32<250>;
type BlockWeights = ();
type BlockLength = ();
type DbWeight = ();
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
}

construct_runtime! {
pub enum Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: system::{Pallet, Call, Storage, Config, Event<T>},
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
Pallet: pallet::{Pallet, Event},
}
}
Expand Down
Loading

0 comments on commit 9d2bbbf

Please sign in to comment.