Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/hover/tests.rs')
-rw-r--r--crates/ide/src/hover/tests.rs45
1 files changed, 44 insertions, 1 deletions
diff --git a/crates/ide/src/hover/tests.rs b/crates/ide/src/hover/tests.rs
index 541cce8c5b..d0f9f7b0e1 100644
--- a/crates/ide/src/hover/tests.rs
+++ b/crates/ide/src/hover/tests.rs
@@ -3335,7 +3335,50 @@ struct S$0T<const C: usize = 1, T = Foo>(T);
```
```rust
- struct ST<const C: usize, T = Foo>
+ struct ST<const C: usize = 1, T = Foo>
+ ```
+ "#]],
+ );
+}
+
+#[test]
+fn const_generic_default_value() {
+ check(
+ r#"
+struct Foo;
+struct S$0T<const C: usize = {40 + 2}, T = Foo>(T);
+"#,
+ expect![[r#"
+ *ST*
+
+ ```rust
+ test
+ ```
+
+ ```rust
+ struct ST<const C: usize = {const}, T = Foo>
+ ```
+ "#]],
+ );
+}
+
+#[test]
+fn const_generic_default_value_2() {
+ check(
+ r#"
+struct Foo;
+const VAL = 1;
+struct S$0T<const C: usize = VAL, T = Foo>(T);
+"#,
+ expect![[r#"
+ *ST*
+
+ ```rust
+ test
+ ```
+
+ ```rust
+ struct ST<const C: usize = VAL, T = Foo>
```
"#]],
);