mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-28 05:53:45 +00:00
tests: add hover tests for const generics
This commit is contained in:
parent
4cbf23c192
commit
b9b42e8670
1 changed files with 100 additions and 0 deletions
|
@ -2958,6 +2958,106 @@ struct S$0T<const C: usize = 1, T = Foo>(T);
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn const_generic_positive_i8_literal() {
|
||||
check(
|
||||
r#"
|
||||
struct Const<const N: i8>;
|
||||
|
||||
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<const N: i8>;
|
||||
|
||||
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<const N: i8>;
|
||||
|
||||
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<const F: bool>;
|
||||
|
||||
fn main() {
|
||||
let v$0alue = Const::<true>;
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
*value*
|
||||
|
||||
```rust
|
||||
let value: Const<true>
|
||||
```
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn const_generic_char_literal() {
|
||||
check(
|
||||
r#"
|
||||
struct Const<const C: char>;
|
||||
|
||||
fn main() {
|
||||
let v$0alue = Const::<'🦀'>;
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
*value*
|
||||
|
||||
```rust
|
||||
let value: Const<'🦀'>
|
||||
```
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hover_self_param_shows_type() {
|
||||
check(
|
||||
|
|
Loading…
Reference in a new issue