aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast.rs
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-05-01 15:26:30 +0100
committerBenjamin Coenen <[email protected]>2020-05-01 15:26:30 +0100
commitdc34162450797f5756ce2b44f1a3fe73d8e2dce4 (patch)
tree0883abc2d87f8b9704b49f5662da04b73ffedbf6 /crates/ra_syntax/src/ast.rs
parentbbe22640b8d52354c3de3e126c9fcda5b1b174fd (diff)
parenta5f2b16366f027ad60c58266a66eb7fbdcbda9f9 (diff)
Merge branch 'master' of github.com:rust-analyzer/rust-analyzer
Diffstat (limited to 'crates/ra_syntax/src/ast.rs')
-rw-r--r--crates/ra_syntax/src/ast.rs19
1 files changed, 18 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs
index 7fca5661e..521ca8ab8 100644
--- a/crates/ra_syntax/src/ast.rs
+++ b/crates/ra_syntax/src/ast.rs
@@ -16,7 +16,9 @@ use crate::{
16}; 16};
17 17
18pub use self::{ 18pub use self::{
19 expr_extensions::{ArrayExprKind, BinOp, ElseBranch, LiteralKind, PrefixOp, RangeOp}, 19 expr_extensions::{
20 ArrayExprKind, BinOp, BlockModifier, ElseBranch, LiteralKind, PrefixOp, RangeOp,
21 },
20 extensions::{ 22 extensions::{
21 AttrKind, FieldKind, NameOrNameRef, PathSegmentKind, SelfParamKind, SlicePatComponents, 23 AttrKind, FieldKind, NameOrNameRef, PathSegmentKind, SelfParamKind, SlicePatComponents,
22 StructKind, TypeBoundKind, VisibilityKind, 24 StructKind, TypeBoundKind, VisibilityKind,
@@ -243,6 +245,21 @@ fn test_comments_preserve_trailing_whitespace() {
243} 245}
244 246
245#[test] 247#[test]
248fn test_four_slash_line_comment() {
249 let file = SourceFile::parse(
250 r#"
251 //// too many slashes to be a doc comment
252 /// doc comment
253 mod foo {}
254 "#,
255 )
256 .ok()
257 .unwrap();
258 let module = file.syntax().descendants().find_map(Module::cast).unwrap();
259 assert_eq!("doc comment", module.doc_comment_text().unwrap());
260}
261
262#[test]
246fn test_where_predicates() { 263fn test_where_predicates() {
247 fn assert_bound(text: &str, bound: Option<TypeBound>) { 264 fn assert_bound(text: &str, bound: Option<TypeBound>) {
248 assert_eq!(text, bound.unwrap().syntax().text().to_string()); 265 assert_eq!(text, bound.unwrap().syntax().text().to_string());