mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 15:47:58 +00:00
Metadata V15: Expose pallet documentation (#13452)
* frame/proc: Helpers to parse pallet documentation attributes Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * frame/proc: Expand pallet with runtime metadata documentation Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * frame/dispatch: Implement doc function getter for dispatch Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * frame/tests: Check exposed runtime metadata documentation Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * frame/tests: Add UI tests for `pallet_doc` attribute Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * frame/proc: Document pallet_doc attribute Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * frame/support: Use `derive_syn_parse` Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Update frame/support/procedural/src/lib.rs Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com> * frame/support: Improve documentation Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> --------- Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> Co-authored-by: parity-processbot <> Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
This commit is contained in:
@@ -101,6 +101,10 @@ impl SomeAssociation2 for u64 {
|
||||
}
|
||||
|
||||
#[frame_support::pallet]
|
||||
/// Pallet documentation
|
||||
// Comments should not be included in the pallet documentation
|
||||
#[pallet_doc("../../README.md")]
|
||||
#[doc = include_str!("../../README.md")]
|
||||
pub mod pallet {
|
||||
use super::*;
|
||||
use frame_support::pallet_prelude::*;
|
||||
@@ -1589,6 +1593,14 @@ fn metadata() {
|
||||
pretty_assertions::assert_eq!(actual_metadata.pallets, expected_metadata.pallets);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_pallet_runtime_docs() {
|
||||
let docs = crate::pallet::Pallet::<Runtime>::pallet_documentation_metadata();
|
||||
let readme = "Support code for the runtime.\n\nLicense: Apache-2.0";
|
||||
let expected = vec![" Pallet documentation", readme, readme];
|
||||
assert_eq!(docs, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_pallet_info_access() {
|
||||
assert_eq!(<System as frame_support::traits::PalletInfoAccess>::name(), "System");
|
||||
|
||||
Reference in New Issue
Block a user