Expand description
The main testing prelude of FRAME.
A test setup typically starts with:
use polkadot_sdk_frame::testing_prelude::*;
// rest of your test setup.This automatically brings in polkadot_sdk_frame::prelude::* and
polkadot_sdk_frame::runtime::prelude::*.
Re-exports§
pub use frame_system;pub use crate::prelude::*;pub use crate::runtime::prelude::*;pub use super::runtime::testing_prelude::*;
Macros§
- assert_
err - Other helper macros from
frame_supportthat help with asserting in tests. Assert an expression returns an error specified. - assert_
err_ ignore_ postinfo - Other helper macros from
frame_supportthat help with asserting in tests. Assert an expression returns an error specified. - assert_
error_ encoded_ size - Other helper macros from
frame_supportthat help with asserting in tests. Assert that the maximum encoding size does not exceed the value defined inMAX_MODULE_ERROR_ENCODED_SIZEduring compilation. - assert_
noop - Other helper macros from
frame_supportthat help with asserting in tests. Evaluate an expression, assert it returns an expectedErrvalue and that runtime storage has not been mutated (i.e. expression is a no-operation). - assert_
ok - Other helper macros from
frame_supportthat help with asserting in tests. Panic if an expression doesn’t evaluate toOk. - assert_
storage_ noop - Other helper macros from
frame_supportthat help with asserting in tests. Evaluate any expression and assert that runtime storage has not been mutated (i.e. expression is a storage no-operation). - defensive
- Other helper macros from
frame_supportthat help with asserting in tests. Generic function to mark an execution path as ONLY defensive. - ensure
- Other helper macros from
frame_supportthat help with asserting in tests. Evaluate$x:exprand if not true returnErr($y:expr). - hypothetically
- Other helper macros from
frame_supportthat help with asserting in tests. Do something hypothetically by rolling back any changes afterwards. - hypothetically_
ok - Other helper macros from
frame_supportthat help with asserting in tests. Assert something to be hypotheticallyOk, without actually committing it.
Structs§
- BadOrigin
- Commonly used runtime traits for testing. An error type that indicates that the origin is invalid.
- RunTo
Block Hooks - Hooks for the
Pallet::run_to_block_withfunction. - Storage
Noop Guard - Other helper macros from
frame_supportthat help with asserting in tests. Asserts that no storage changes took place between con- and destruction ofSelf.
Enums§
- Everything
- A
Containsimplementation that contains every value. - State
Version - Commonly used runtime traits for testing. Different possible state version.
Type Aliases§
- Mock
Block - An implementation of
sp_runtime::traits::Blockto be used in tests. - Mock
Block U32 - An implementation of
sp_runtime::traits::Blockto be used in tests with u32 BlockNumber type. - Mock
Block U128 - An implementation of
sp_runtime::traits::Blockto be used in tests with u128 BlockNumber type. - Mock
Unchecked Extrinsic - An unchecked extrinsic type to be used in tests.
- Test
Externalities - Type alias for Externalities implementation used in tests.
- Test
State - Type alias for Externalities implementation used in tests.
Attribute Macros§
- storage_
alias - Other helper macros from
frame_supportthat help with asserting in tests.