From ca464650eeaca6195891199a93f4f76cf3e7e697 Mon Sep 17 00:00:00 2001 From: Zac Pullar-Strecker Date: Mon, 24 Aug 2020 20:47:10 +1200 Subject: Add a test to document unimplemented case --- crates/ra_ide/src/hover.rs | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) (limited to 'crates/ra_ide/src/hover.rs') diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index 5aacb4c14..1c3dfd491 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs @@ -1357,6 +1357,36 @@ fn foo() { let bar = Ba<|>r; } ); } + #[ignore = "path based links currently only support documentation on ModuleDef items"] + #[test] + fn test_hover_path_link_field() { + check( + r" + //- /lib.rs + pub struct Foo; + pub struct Bar { + /// [Foo](struct.Foo.html) + fie<|>ld: () + } + ", + expect![[r#" + *field* + + ```rust + test::Bar + ``` + + ```rust + field: () + ``` + + --- + + [Foo](https://docs.rs/test/*/test/struct.Foo.html) + "#]], + ); + } + #[test] fn test_hover_intra_link() { check( @@ -1386,6 +1416,38 @@ fn foo() { let bar = Ba<|>r; } ); } + #[test] + fn test_hover_intra_link_html_root_url() { + check( + r#" + //- /lib.rs + + #![doc(arbitrary_attribute = "test", html_root_url = "https:/example.com", arbitrary_attribute2)] + + pub mod foo { + pub struct Foo; + } + /// [Foo](foo::Foo) + pub struct B<|>ar + "#, + expect![[r#" + *Bar* + + ```rust + test + ``` + + ```rust + pub struct Bar + ``` + + --- + + [Foo](https://example.com/test/foo/struct.Foo.html) + "#]], + ); + } + #[test] fn test_hover_intra_link_shortlink() { check( -- cgit v1.2.3