Cleanup hover links tests

This commit is contained in:
Aleksey Kladov 2020-08-26 18:36:16 +02:00
parent 84acd56e97
commit 1c0ac2b9b4

View file

@ -1407,12 +1407,11 @@ fn foo() { let bar = Ba<|>r; }
#[test] #[test]
fn test_hover_path_link() { fn test_hover_path_link() {
check( check(
r" r#"
//- /lib.rs pub struct Foo;
pub struct Foo; /// [Foo](struct.Foo.html)
/// [Foo](struct.Foo.html) pub struct B<|>ar
pub struct B<|>ar "#,
",
expect![[r#" expect![[r#"
*Bar* *Bar*
@ -1434,12 +1433,11 @@ fn foo() { let bar = Ba<|>r; }
#[test] #[test]
fn test_hover_path_link_no_strip() { fn test_hover_path_link_no_strip() {
check( check(
r" r#"
//- /lib.rs pub struct Foo;
pub struct Foo; /// [struct Foo](struct.Foo.html)
/// [struct Foo](struct.Foo.html) pub struct B<|>ar
pub struct B<|>ar "#,
",
expect![[r#" expect![[r#"
*Bar* *Bar*
@ -1462,14 +1460,13 @@ fn foo() { let bar = Ba<|>r; }
#[test] #[test]
fn test_hover_path_link_field() { fn test_hover_path_link_field() {
check( check(
r" r#"
//- /lib.rs pub struct Foo;
pub struct Foo; pub struct Bar {
pub struct Bar { /// [Foo](struct.Foo.html)
/// [Foo](struct.Foo.html) fie<|>ld: ()
fie<|>ld: () }
} "#,
",
expect![[r#" expect![[r#"
*field* *field*
@ -1491,14 +1488,13 @@ fn foo() { let bar = Ba<|>r; }
#[test] #[test]
fn test_hover_intra_link() { fn test_hover_intra_link() {
check( check(
r" r#"
//- /lib.rs pub mod foo {
pub mod foo { pub struct Foo;
pub struct Foo; }
} /// [Foo](foo::Foo)
/// [Foo](foo::Foo) pub struct B<|>ar
pub struct B<|>ar "#,
",
expect![[r#" expect![[r#"
*Bar* *Bar*
@ -1521,16 +1517,14 @@ fn foo() { let bar = Ba<|>r; }
fn test_hover_intra_link_html_root_url() { fn test_hover_intra_link_html_root_url() {
check( check(
r#" r#"
//- /lib.rs #![doc(arbitrary_attribute = "test", html_root_url = "https:/example.com", arbitrary_attribute2)]
#![doc(arbitrary_attribute = "test", html_root_url = "https:/example.com", arbitrary_attribute2)] pub mod foo {
pub struct Foo;
pub mod foo { }
pub struct Foo; /// [Foo](foo::Foo)
} pub struct B<|>ar
/// [Foo](foo::Foo) "#,
pub struct B<|>ar
"#,
expect![[r#" expect![[r#"
*Bar* *Bar*
@ -1552,12 +1546,11 @@ fn foo() { let bar = Ba<|>r; }
#[test] #[test]
fn test_hover_intra_link_shortlink() { fn test_hover_intra_link_shortlink() {
check( check(
r" r#"
//- /lib.rs pub struct Foo;
pub struct Foo; /// [Foo]
/// [Foo] pub struct B<|>ar
pub struct B<|>ar "#,
",
expect![[r#" expect![[r#"
*Bar* *Bar*
@ -1579,12 +1572,11 @@ fn foo() { let bar = Ba<|>r; }
#[test] #[test]
fn test_hover_intra_link_shortlink_code() { fn test_hover_intra_link_shortlink_code() {
check( check(
r" r#"
//- /lib.rs pub struct Foo;
pub struct Foo; /// [`Foo`]
/// [`Foo`] pub struct B<|>ar
pub struct B<|>ar "#,
",
expect![[r#" expect![[r#"
*Bar* *Bar*
@ -1606,13 +1598,12 @@ fn foo() { let bar = Ba<|>r; }
#[test] #[test]
fn test_hover_intra_link_namespaced() { fn test_hover_intra_link_namespaced() {
check( check(
r" r#"
//- /lib.rs pub struct Foo;
pub struct Foo; fn Foo() {}
fn Foo() {} /// [Foo()]
/// [Foo()] pub struct B<|>ar
pub struct B<|>ar "#,
",
expect![[r#" expect![[r#"
*Bar* *Bar*
@ -1634,12 +1625,11 @@ fn foo() { let bar = Ba<|>r; }
#[test] #[test]
fn test_hover_intra_link_shortlink_namspaced_code() { fn test_hover_intra_link_shortlink_namspaced_code() {
check( check(
r" r#"
//- /lib.rs pub struct Foo;
pub struct Foo; /// [`struct Foo`]
/// [`struct Foo`] pub struct B<|>ar
pub struct B<|>ar "#,
",
expect![[r#" expect![[r#"
*Bar* *Bar*
@ -1661,12 +1651,11 @@ fn foo() { let bar = Ba<|>r; }
#[test] #[test]
fn test_hover_intra_link_shortlink_namspaced_code_with_at() { fn test_hover_intra_link_shortlink_namspaced_code_with_at() {
check( check(
r" r#"
//- /lib.rs pub struct Foo;
pub struct Foo; /// [`struct@Foo`]
/// [`struct@Foo`] pub struct B<|>ar
pub struct B<|>ar "#,
",
expect![[r#" expect![[r#"
*Bar* *Bar*
@ -1688,14 +1677,13 @@ fn foo() { let bar = Ba<|>r; }
#[test] #[test]
fn test_hover_intra_link_reference() { fn test_hover_intra_link_reference() {
check( check(
r" r#"
//- /lib.rs pub struct Foo;
pub struct Foo; /// [my Foo][foo]
/// [my Foo][foo] ///
/// /// [foo]: Foo
/// [foo]: Foo pub struct B<|>ar
pub struct B<|>ar "#,
",
expect![[r#" expect![[r#"
*Bar* *Bar*
@ -1717,12 +1705,11 @@ fn foo() { let bar = Ba<|>r; }
#[test] #[test]
fn test_hover_external_url() { fn test_hover_external_url() {
check( check(
r" r#"
//- /lib.rs pub struct Foo;
pub struct Foo; /// [external](https://www.google.com)
/// [external](https://www.google.com) pub struct B<|>ar
pub struct B<|>ar "#,
",
expect![[r#" expect![[r#"
*Bar* *Bar*
@ -1745,12 +1732,11 @@ fn foo() { let bar = Ba<|>r; }
#[test] #[test]
fn test_hover_unknown_target() { fn test_hover_unknown_target() {
check( check(
r" r#"
//- /lib.rs pub struct Foo;
pub struct Foo; /// [baz](Baz)
/// [baz](Baz) pub struct B<|>ar
pub struct B<|>ar "#,
",
expect![[r#" expect![[r#"
*Bar* *Bar*