]> git.lizzy.rs Git - rust.git/blobdiff - crates/ide/src/hover/tests.rs
more complicated const test
[rust.git] / crates / ide / src / hover / tests.rs
index 463cd58e48bd890cb8d5d6cc5f308cb11b06e63c..897f8d7b8312a3454aebdedd72bc386285b61ff6 100644 (file)
@@ -503,17 +503,39 @@ fn hover_const_static() {
     check(
         r#"const foo$0: u32 = 123;"#,
         expect![[r#"
-                *foo*
+            *foo*
 
-                ```rust
-                test
-                ```
+            ```rust
+            test
+            ```
 
-                ```rust
-                const foo: u32
-                ```
-            "#]],
+            ```rust
+            const foo: u32 = 123
+            ```
+        "#]],
+    );
+    check(
+        r#"
+const foo$0: u32 = {
+    let x = foo();
+    x + 100
+};"#,
+        expect![[r#"
+            *foo*
+
+            ```rust
+            test
+            ```
+
+            ```rust
+            const foo: u32 = {
+                let x = foo();
+                x + 100
+            }
+            ```
+        "#]],
     );
+
     check(
         r#"static foo$0: u32 = 456;"#,
         expect![[r#"
@@ -788,16 +810,16 @@ fn main() {
 }
 "#,
         expect![[r#"
-                *C*
+            *C*
 
-                ```rust
-                test
-                ```
+            ```rust
+            test
+            ```
 
-                ```rust
-                const C: u32
-                ```
-            "#]],
+            ```rust
+            const C: u32 = 1
+            ```
+        "#]],
     )
 }
 
@@ -2268,8 +2290,8 @@ fn foo() {
                                     file_id: FileId(
                                         1,
                                     ),
-                                    full_range: 254..436,
-                                    focus_range: 293..299,
+                                    full_range: 276..458,
+                                    focus_range: 315..321,
                                     name: "Future",
                                     kind: Trait,
                                     description: "pub trait Future",
@@ -3176,20 +3198,20 @@ fn foo() {
 }
 "#,
         expect![[r#"
-                *FOO*
+            *FOO*
 
-                ```rust
-                test
-                ```
+            ```rust
+            test
+            ```
 
-                ```rust
-                const FOO: usize
-                ```
+            ```rust
+            const FOO: usize = 3
+            ```
 
-                ---
+            ---
 
-                This is a doc
-            "#]],
+            This is a doc
+        "#]],
     );
 }
 
@@ -3651,6 +3673,7 @@ mod bar {
 fn hover_attribute_in_macro() {
     check(
         r#"
+//- minicore:derive
 macro_rules! identity {
     ($struct:item) => {
         $struct
@@ -3681,6 +3704,7 @@ macro_rules! identity {
 fn hover_derive_input() {
     check(
         r#"
+//- minicore:derive
 #[rustc_builtin_macro]
 pub macro Copy {}
 #[derive(Copy$0)]
@@ -3700,6 +3724,7 @@ fn hover_derive_input() {
     );
     check(
         r#"
+//- minicore:derive
 mod foo {
     #[rustc_builtin_macro]
     pub macro Copy {}
@@ -4125,20 +4150,20 @@ macro_rules! foo_macro {
 );
 "#,
         expect![[r#"
-                *[`Foo`]*
+            *[`Foo`]*
 
-                ```rust
-                test
-                ```
+            ```rust
+            test
+            ```
 
-                ```rust
-                pub struct Foo
-                ```
+            ```rust
+            pub struct Foo
+            ```
 
-                ---
+            ---
 
-                Doc comment for [`Foo`](https://docs.rs/test/*/test/struct.Foo.html)
-            "#]],
+            Doc comment for [`Foo`](https://doc.rust-lang.org/nightly/test/struct.Foo.html)
+        "#]],
     );
 }
 
@@ -4150,19 +4175,19 @@ fn hover_intra_in_attr() {
 pub struct Foo;
 "#,
         expect![[r#"
-                *[`Foo`]*
+            *[`Foo`]*
 
-                ```rust
-                test
-                ```
+            ```rust
+            test
+            ```
 
-                ```rust
-                pub struct Foo
-                ```
+            ```rust
+            pub struct Foo
+            ```
 
-                ---
+            ---
 
-                Doc comment for [`Foo`](https://docs.rs/test/*/test/struct.Foo.html)
-            "#]],
+            Doc comment for [`Foo`](https://doc.rust-lang.org/nightly/test/struct.Foo.html)
+        "#]],
     );
 }