mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 19:47:59 +00:00
Impl integrity test for runtime (#6356)
* impl integrity test for runtime * Update frame/support/src/traits.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update frame/support/procedural/src/construct_runtime/mod.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * use thread local * update doc * Apply suggestions from code review Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Gavin Wood <gavin@parity.io>
This commit is contained in:
committed by
GitHub
parent
34f496eb3d
commit
622dff9ca7
@@ -89,6 +89,7 @@ fn construct_runtime_parsed(definition: RuntimeDefinition) -> Result<TokenStream
|
||||
let outer_config = decl_outer_config(&name, modules.iter(), &scrate);
|
||||
let inherent = decl_outer_inherent(&block, &unchecked_extrinsic, modules.iter(), &scrate);
|
||||
let validate_unsigned = decl_validate_unsigned(&name, modules.iter(), &scrate);
|
||||
let integrity_test = decl_integrity_test(&scrate);
|
||||
|
||||
let res = quote!(
|
||||
#scrate_decl
|
||||
@@ -120,6 +121,8 @@ fn construct_runtime_parsed(definition: RuntimeDefinition) -> Result<TokenStream
|
||||
#inherent
|
||||
|
||||
#validate_unsigned
|
||||
|
||||
#integrity_test
|
||||
);
|
||||
|
||||
Ok(res.into())
|
||||
@@ -406,3 +409,17 @@ fn find_system_module<'a>(
|
||||
.find(|decl| decl.name == SYSTEM_MODULE_NAME)
|
||||
.map(|decl| &decl.module)
|
||||
}
|
||||
|
||||
fn decl_integrity_test(scrate: &TokenStream2) -> TokenStream2 {
|
||||
quote!(
|
||||
#[cfg(test)]
|
||||
mod __construct_runtime_integrity_test {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
pub fn runtime_integrity_tests() {
|
||||
<AllModules as #scrate::traits::IntegrityTest>::integrity_test();
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user