From da3b5e35a69fd71ba061169e2fe719e36dbc3ef4 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Wed, 9 Dec 2020 09:22:57 +0100 Subject: Test inner and outer doc comments in hover --- crates/ide/src/hover.rs | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) (limited to 'crates/ide/src/hover.rs') diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 1b6ff6d21..cf04c3de0 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs @@ -3357,4 +3357,66 @@ impl 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 + "#]], + ); + } } -- cgit v1.2.3