Unnamed repository; edit this file 'description' to name the repository.
add doc link test for hover
Signed-off-by: Hayashi Mikihiro <[email protected]>
Hayashi Mikihiro 12 months ago
parent 3181857 · commit cc0e3ac
-rw-r--r--crates/ide/src/hover/tests.rs122
1 files changed, 122 insertions, 0 deletions
diff --git a/crates/ide/src/hover/tests.rs b/crates/ide/src/hover/tests.rs
index 7b7eef9d57..06ca24c3ec 100644
--- a/crates/ide/src/hover/tests.rs
+++ b/crates/ide/src/hover/tests.rs
@@ -7375,6 +7375,128 @@ pub struct Foo(i32);
}
#[test]
+fn hover_intra_inner_attr() {
+ check(
+ r#"
+/// outer comment for [`Foo`]
+#[doc = "Doc outer comment for [`Foo`]"]
+pub fn Foo {
+ //! inner comment for [`Foo$0`]
+ #![doc = "Doc inner comment for [`Foo`]"]
+}
+"#,
+ expect![[r#"
+ *[`Foo`]*
+
+ ```rust
+ ra_test_fixture
+ ```
+
+ ```rust
+ pub fn Foo()
+ ```
+
+ ---
+
+ outer comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/fn.Foo.html)
+ Doc outer comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/fn.Foo.html)
+ inner comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/fn.Foo.html)
+ Doc inner comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/fn.Foo.html)
+ "#]],
+ );
+
+ check(
+ r#"
+/// outer comment for [`Foo`]
+#[doc = "Doc outer comment for [`Foo`]"]
+pub mod Foo {
+ //! inner comment for [`super::Foo$0`]
+ #![doc = "Doc inner comment for [`super::Foo`]"]
+}
+"#,
+ expect![[r#"
+ *[`super::Foo`]*
+
+ ```rust
+ ra_test_fixture
+ ```
+
+ ```rust
+ pub mod Foo
+ ```
+
+ ---
+
+ outer comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/Foo/index.html)
+ Doc outer comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/Foo/index.html)
+ inner comment for [`super::Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/Foo/index.html)
+ Doc inner comment for [`super::Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/Foo/index.html)
+ "#]],
+ );
+}
+
+#[test]
+fn hover_intra_outer_attr() {
+ check(
+ r#"
+/// outer comment for [`Foo$0`]
+#[doc = "Doc outer comment for [`Foo`]"]
+pub fn Foo() {
+ //! inner comment for [`Foo`]
+ #![doc = "Doc inner comment for [`Foo`]"]
+}
+"#,
+ expect![[r#"
+ *[`Foo`]*
+
+ ```rust
+ ra_test_fixture
+ ```
+
+ ```rust
+ pub fn Foo()
+ ```
+
+ ---
+
+ outer comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/fn.Foo.html)
+ Doc outer comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/fn.Foo.html)
+ inner comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/fn.Foo.html)
+ Doc inner comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/fn.Foo.html)
+ "#]],
+ );
+
+ check(
+ r#"
+/// outer comment for [`Foo$0`]
+#[doc = "Doc outer comment for [`Foo`]"]
+pub mod Foo {
+ //! inner comment for [`super::Foo`]
+ #![doc = "Doc inner comment for [`super::Foo`]"]
+}
+"#,
+ expect![[r#"
+ *[`Foo`]*
+
+ ```rust
+ ra_test_fixture
+ ```
+
+ ```rust
+ pub mod Foo
+ ```
+
+ ---
+
+ outer comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/Foo/index.html)
+ Doc outer comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/Foo/index.html)
+ inner comment for [`super::Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/Foo/index.html)
+ Doc inner comment for [`super::Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/Foo/index.html)
+ "#]],
+ );
+}
+
+#[test]
fn hover_intra_generics() {
check(
r#"