Removes */ in block doc comments
This commit is contained in:
@@ -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>) {
|
||||
|
||||
Reference in New Issue
Block a user