Skip to content

Commit cc0e3ac

Browse files
committed
add doc link test for hover
Signed-off-by: Hayashi Mikihiro <[email protected]>
1 parent 3181857 commit cc0e3ac

File tree

1 file changed

+122
-0
lines changed

1 file changed

+122
-0
lines changed

crates/ide/src/hover/tests.rs

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7374,6 +7374,128 @@ pub struct Foo(i32);
73747374
);
73757375
}
73767376

7377+
#[test]
7378+
fn hover_intra_inner_attr() {
7379+
check(
7380+
r#"
7381+
/// outer comment for [`Foo`]
7382+
#[doc = "Doc outer comment for [`Foo`]"]
7383+
pub fn Foo {
7384+
//! inner comment for [`Foo$0`]
7385+
#![doc = "Doc inner comment for [`Foo`]"]
7386+
}
7387+
"#,
7388+
expect![[r#"
7389+
*[`Foo`]*
7390+
7391+
```rust
7392+
ra_test_fixture
7393+
```
7394+
7395+
```rust
7396+
pub fn Foo()
7397+
```
7398+
7399+
---
7400+
7401+
outer comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/fn.Foo.html)
7402+
Doc outer comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/fn.Foo.html)
7403+
inner comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/fn.Foo.html)
7404+
Doc inner comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/fn.Foo.html)
7405+
"#]],
7406+
);
7407+
7408+
check(
7409+
r#"
7410+
/// outer comment for [`Foo`]
7411+
#[doc = "Doc outer comment for [`Foo`]"]
7412+
pub mod Foo {
7413+
//! inner comment for [`super::Foo$0`]
7414+
#![doc = "Doc inner comment for [`super::Foo`]"]
7415+
}
7416+
"#,
7417+
expect![[r#"
7418+
*[`super::Foo`]*
7419+
7420+
```rust
7421+
ra_test_fixture
7422+
```
7423+
7424+
```rust
7425+
pub mod Foo
7426+
```
7427+
7428+
---
7429+
7430+
outer comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/Foo/index.html)
7431+
Doc outer comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/Foo/index.html)
7432+
inner comment for [`super::Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/Foo/index.html)
7433+
Doc inner comment for [`super::Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/Foo/index.html)
7434+
"#]],
7435+
);
7436+
}
7437+
7438+
#[test]
7439+
fn hover_intra_outer_attr() {
7440+
check(
7441+
r#"
7442+
/// outer comment for [`Foo$0`]
7443+
#[doc = "Doc outer comment for [`Foo`]"]
7444+
pub fn Foo() {
7445+
//! inner comment for [`Foo`]
7446+
#![doc = "Doc inner comment for [`Foo`]"]
7447+
}
7448+
"#,
7449+
expect![[r#"
7450+
*[`Foo`]*
7451+
7452+
```rust
7453+
ra_test_fixture
7454+
```
7455+
7456+
```rust
7457+
pub fn Foo()
7458+
```
7459+
7460+
---
7461+
7462+
outer comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/fn.Foo.html)
7463+
Doc outer comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/fn.Foo.html)
7464+
inner comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/fn.Foo.html)
7465+
Doc inner comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/fn.Foo.html)
7466+
"#]],
7467+
);
7468+
7469+
check(
7470+
r#"
7471+
/// outer comment for [`Foo$0`]
7472+
#[doc = "Doc outer comment for [`Foo`]"]
7473+
pub mod Foo {
7474+
//! inner comment for [`super::Foo`]
7475+
#![doc = "Doc inner comment for [`super::Foo`]"]
7476+
}
7477+
"#,
7478+
expect![[r#"
7479+
*[`Foo`]*
7480+
7481+
```rust
7482+
ra_test_fixture
7483+
```
7484+
7485+
```rust
7486+
pub mod Foo
7487+
```
7488+
7489+
---
7490+
7491+
outer comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/Foo/index.html)
7492+
Doc outer comment for [`Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/Foo/index.html)
7493+
inner comment for [`super::Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/Foo/index.html)
7494+
Doc inner comment for [`super::Foo`](https://docs.rs/ra_test_fixture/*/ra_test_fixture/Foo/index.html)
7495+
"#]],
7496+
);
7497+
}
7498+
73777499
#[test]
73787500
fn hover_intra_generics() {
73797501
check(

0 commit comments

Comments
 (0)