X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=crates%2Fide%2Fsrc%2Fhover%2Ftests.rs;h=c5c531c30b1a4896ed4e0c392c12457f5c0be30b;hb=842ffde43d2c4e4dff94b9f07675708f1ac4ca8c;hp=ed76c84ab47e8e379953c11678edbe86320b161b;hpb=2e33bf23c94e7053eb657d1a318bd1b66cabec95;p=rust.git diff --git a/crates/ide/src/hover/tests.rs b/crates/ide/src/hover/tests.rs index ed76c84ab47..c5c531c30b1 100644 --- a/crates/ide/src/hover/tests.rs +++ b/crates/ide/src/hover/tests.rs @@ -1310,6 +1310,60 @@ async fn foo() ); } +#[test] +fn test_hover_function_show_types() { + check( + r#"fn foo$0(a: i32, b:i32) -> i32 { 0 }"#, + expect![[r#" + *foo* + + ```rust + test + ``` + + ```rust + fn foo(a: i32, b: i32) -> i32 + ``` + "#]], + ); +} + +#[test] +fn test_hover_function_pointer_show_identifiers() { + check( + r#"type foo$0 = fn(a: i32, b: i32) -> i32;"#, + expect![[r#" + *foo* + + ```rust + test + ``` + + ```rust + type foo = fn(a: i32, b: i32) -> i32 + ``` + "#]], + ); +} + +#[test] +fn test_hover_function_pointer_no_identifier() { + check( + r#"type foo$0 = fn(i32, _: i32) -> i32;"#, + expect![[r#" + *foo* + + ```rust + test + ``` + + ```rust + type foo = fn(i32, i32) -> i32 + ``` + "#]], + ); +} + #[test] fn test_hover_trait_show_qualifiers() { check_actions(