frame-support: migrate some tests from decl_* macros to the new pallet macros (#12401)

* frame-support: migrate some tests from decl macros to new pallet attribute macros

* Remove useless type alias

* Remove useless type alias

* Work around for rust issue 52234

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Use polkadot-compatible paste version

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix crate access and add tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Typo

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: parity-processbot <>
This commit is contained in:
Qinxuan Chen
2023-04-25 19:58:21 +08:00
committed by GitHub
parent c11cb1b274
commit b06748e2ab
10 changed files with 496 additions and 322 deletions
+20
View File
@@ -1054,3 +1054,23 @@ mod tests {
});
}
}
// NOTE: we have to test the sp_core stuff also from a different crate to check that the macro
// can access the sp_core crate.
#[cfg(test)]
mod sp_core_tests {
use super::*;
#[test]
#[should_panic]
fn generate_feature_enabled_macro_panics() {
sp_core::generate_feature_enabled_macro!(if_test, test, $);
if_test!(panic!("This should panic"));
}
#[test]
fn generate_feature_enabled_macro_works() {
sp_core::generate_feature_enabled_macro!(if_not_test, not(test), $);
if_not_test!(panic!("This should not panic"));
}
}