Add explicit newline preserving tests
This commit is contained in:
parent
4a6cfa1aa7
commit
4fccad9b2c
@ -48,4 +48,10 @@ mod tests {
|
||||
let comment = " # stay1\n# stay2\n#stay3\nstay4\n#\n #\n # \n #\tstay5\n\t#\t";
|
||||
assert_eq!(format_docs(comment), comment);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_format_docs_preserves_newlines() {
|
||||
let comment = "this\nis\nultiline";
|
||||
assert_eq!(format_docs(comment), comment);
|
||||
}
|
||||
}
|
||||
|
@ -121,6 +121,23 @@ fn test_doc_comment_preserves_indents() {
|
||||
assert_eq!("doc1\n```\nfn foo() {\n // ...\n}\n```", module.doc_comment_text().unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_doc_comment_preserves_newlines() {
|
||||
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\nis\nmod\nfoo", module.doc_comment_text().unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_where_predicates() {
|
||||
fn assert_bound(text: &str, bound: Option<TypeBound>) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user