]> git.lizzy.rs Git - rust.git/commitdiff
Test inner and outer doc comments in hover
authorLukas Wirth <lukastw97@gmail.com>
Wed, 9 Dec 2020 08:22:57 +0000 (09:22 +0100)
committerLukas Wirth <lukastw97@gmail.com>
Wed, 9 Dec 2020 08:42:15 +0000 (09:42 +0100)
crates/ide/src/hover.rs

index 1b6ff6d2109f3f0ad3f848ec47dc0521fdcdc7d9..cf04c3de08a053f4fada16e4ebf4c55a7b201a66 100644 (file)
@@ -3357,4 +3357,66 @@ fn bar(sel<|>f: Arc<Foo>) {}
             "#]],
         );
     }
+
+    #[test]
+    fn hover_doc_outer_inner() {
+        check(
+            r#"
+/// Be quick;
+mod Foo<|> {
+    //! time is mana
+
+    /// This comment belongs to the function
+    fn foo() {}
+}
+"#,
+            expect![[r#"
+                *Foo*
+
+                ```rust
+                test
+                ```
+
+                ```rust
+                mod Foo
+                ```
+
+                ---
+
+                Be quick;
+                time is mana
+            "#]],
+        );
+    }
+
+    #[test]
+    fn hover_doc_outer_inner_attribue() {
+        check(
+            r#"
+#[doc = "Be quick;"]
+mod Foo<|> {
+    #![doc = "time is mana"]
+
+    #[doc = "This comment belongs to the function"]
+    fn foo() {}
+}
+"#,
+            expect![[r#"
+                *Foo*
+
+                ```rust
+                test
+                ```
+
+                ```rust
+                mod Foo
+                ```
+
+                ---
+
+                Be quick;
+                time is mana
+            "#]],
+        );
+    }
 }