Add doc-comments on plugin modules to Module::doc field.

This commit is contained in:
Stephen Chung
2022-12-01 23:29:42 +08:00
parent ed423740c9
commit fcc363af60
5 changed files with 36 additions and 2 deletions

View File

@@ -403,6 +403,12 @@ mod generate_tests {
#[test]
fn one_factory_fn_with_comments_module() {
let input_tokens: TokenStream = quote! {
/// This is the one_fn module!
/** block doc-comment
* multi-line
*/
/// Another line!
/// Final line!
pub mod one_fn {
/// This is a doc-comment.
/// Another line.
@@ -419,6 +425,12 @@ mod generate_tests {
};
let expected_tokens = quote! {
/// This is the one_fn module!
/** block doc-comment
* multi-line
*/
/// Another line!
/// Final line!
pub mod one_fn {
/// This is a doc-comment.
/// Another line.
@@ -437,6 +449,7 @@ mod generate_tests {
#[doc(hidden)]
pub fn rhai_module_generate() -> Module {
let mut m = Module::new();
m.set_doc("/// This is the one_fn module!\n/** block doc-comment\n * multi-line\n */\n/// Another line!\n/// Final line!");
rhai_generate_into_module(&mut m, false);
m.build_index();
m