From b9b42e867066288f2cd1fc835c77a31e27439496 Mon Sep 17 00:00:00 2001 From: Artur Sinila Date: Thu, 14 Jul 2022 00:32:25 +0300 Subject: [PATCH] tests: add hover tests for const generics --- crates/ide/src/hover/tests.rs | 100 ++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/crates/ide/src/hover/tests.rs b/crates/ide/src/hover/tests.rs index a1484fa19fc..867d1f54d4f 100644 --- a/crates/ide/src/hover/tests.rs +++ b/crates/ide/src/hover/tests.rs @@ -2958,6 +2958,106 @@ struct ST ); } +#[test] +fn const_generic_positive_i8_literal() { + check( + r#" +struct Const; + +fn main() { + let v$0alue = Const::<1>; +} +"#, + expect![[r#" + *value* + + ```rust + let value: Const<1> + ``` + "#]], + ); +} + +#[test] +fn const_generic_zero_i8_literal() { + check( + r#" +struct Const; + +fn main() { + let v$0alue = Const::<0>; +} +"#, + expect![[r#" + *value* + + ```rust + let value: Const<0> + ``` + "#]], + ); +} + +#[test] +fn const_generic_negative_i8_literal() { + check( + r#" +struct Const; + +fn main() { + let v$0alue = Const::<-1>; +} +"#, + expect![[r#" + *value* + + ```rust + let value: Const<-1> + ``` + "#]], + ); +} + +#[test] +fn const_generic_bool_literal() { + check( + r#" +struct Const; + +fn main() { + let v$0alue = Const::; +} +"#, + expect![[r#" + *value* + + ```rust + let value: Const + ``` + "#]], + ); +} + +#[test] +fn const_generic_char_literal() { + check( + r#" +struct Const; + +fn main() { + let v$0alue = Const::<'🦀'>; +} +"#, + expect![[r#" + *value* + + ```rust + let value: Const<'🦀'> + ``` + "#]], + ); +} + #[test] fn hover_self_param_shows_type() { check(