aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/ast.rs')
-rw-r--r--crates/ra_syntax/src/ast.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs
index 4a38197f6..c5746d98d 100644
--- a/crates/ra_syntax/src/ast.rs
+++ b/crates/ra_syntax/src/ast.rs
@@ -122,6 +122,23 @@ fn test_doc_comment_preserves_indents() {
122} 122}
123 123
124#[test] 124#[test]
125fn test_doc_comment_preserves_newlines() {
126 let file = SourceFile::parse(
127 r#"
128 /// this
129 /// is
130 /// mod
131 /// foo
132 mod foo {}
133 "#,
134 )
135 .ok()
136 .unwrap();
137 let module = file.syntax().descendants().find_map(Module::cast).unwrap();
138 assert_eq!("this\nis\nmod\nfoo", module.doc_comment_text().unwrap());
139}
140
141#[test]
125fn test_where_predicates() { 142fn test_where_predicates() {
126 fn assert_bound(text: &str, bound: Option<TypeBound>) { 143 fn assert_bound(text: &str, bound: Option<TypeBound>) {
127 assert_eq!(text, bound.unwrap().syntax().text().to_string()); 144 assert_eq!(text, bound.unwrap().syntax().text().to_string());