mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-22 11:24:24 +00:00
Fix attachment of inner doc comments
This commit is contained in:
parent
81ac99f60a
commit
a27186636d
3 changed files with 33 additions and 19 deletions
|
@ -115,7 +115,22 @@ fn test_doc_comment_none() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_doc_comment_of_items() {
|
||||
fn test_outer_doc_comment_of_items() {
|
||||
let file = SourceFile::parse(
|
||||
r#"
|
||||
/// doc
|
||||
// non-doc
|
||||
mod foo {}
|
||||
"#,
|
||||
)
|
||||
.ok()
|
||||
.unwrap();
|
||||
let module = file.syntax().descendants().find_map(Module::cast).unwrap();
|
||||
assert_eq!("doc", module.doc_comment_text().unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_inner_doc_comment_of_items() {
|
||||
let file = SourceFile::parse(
|
||||
r#"
|
||||
//! doc
|
||||
|
@ -126,7 +141,7 @@ fn test_doc_comment_of_items() {
|
|||
.ok()
|
||||
.unwrap();
|
||||
let module = file.syntax().descendants().find_map(Module::cast).unwrap();
|
||||
assert_eq!("doc", module.doc_comment_text().unwrap());
|
||||
assert!(module.doc_comment_text().is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue