mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Removes */
in block doc comments
This commit is contained in:
parent
7c0a9718aa
commit
d65dc40348
2 changed files with 62 additions and 2 deletions
|
@ -138,6 +138,55 @@ fn test_doc_comment_preserves_newlines() {
|
|||
assert_eq!("this\nis\nmod\nfoo", module.doc_comment_text().unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_doc_comment_single_line_block_strips_suffix() {
|
||||
let file = SourceFile::parse(
|
||||
r#"
|
||||
/** this is mod foo*/
|
||||
mod foo {}
|
||||
"#,
|
||||
)
|
||||
.ok()
|
||||
.unwrap();
|
||||
let module = file.syntax().descendants().find_map(Module::cast).unwrap();
|
||||
assert_eq!("this is mod foo", module.doc_comment_text().unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_doc_comment_single_line_block_strips_suffix_whitespace() {
|
||||
let file = SourceFile::parse(
|
||||
r#"
|
||||
/** this is mod foo */
|
||||
mod foo {}
|
||||
"#,
|
||||
)
|
||||
.ok()
|
||||
.unwrap();
|
||||
let module = file.syntax().descendants().find_map(Module::cast).unwrap();
|
||||
assert_eq!("this is mod foo", module.doc_comment_text().unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_doc_comment_multi_line_block_strips_suffix() {
|
||||
let file = SourceFile::parse(
|
||||
r#"
|
||||
/**
|
||||
this
|
||||
is
|
||||
mod foo
|
||||
*/
|
||||
mod foo {}
|
||||
"#,
|
||||
)
|
||||
.ok()
|
||||
.unwrap();
|
||||
let module = file.syntax().descendants().find_map(Module::cast).unwrap();
|
||||
assert_eq!(
|
||||
" this\n is\n mod foo\n ",
|
||||
module.doc_comment_text().unwrap()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_where_predicates() {
|
||||
fn assert_bound(text: &str, bound: Option<TypeBound>) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue