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.rs112
1 files changed, 112 insertions, 0 deletions
diff --git a/crates/ide/src/hover/tests.rs b/crates/ide/src/hover/tests.rs
index d3d492f3fd..d5ec336fc7 100644
--- a/crates/ide/src/hover/tests.rs
+++ b/crates/ide/src/hover/tests.rs
@@ -6613,3 +6613,115 @@ fn test() {
"#]],
);
}
+
+#[test]
+fn format_args_implicit() {
+ check(
+ r#"
+//- minicore: fmt
+fn test() {
+let aaaaa = "foo";
+format_args!("{aaaaa$0}");
+}
+"#,
+ expect![[r#"
+ *aaaaa*
+
+ ```rust
+ let aaaaa: &str // size = 16 (0x10), align = 8, niches = 1
+ ```
+ "#]],
+ );
+}
+
+#[test]
+fn format_args_implicit2() {
+ check(
+ r#"
+//- minicore: fmt
+fn test() {
+let aaaaa = "foo";
+format_args!("{$0aaaaa}");
+}
+"#,
+ expect![[r#"
+ *aaaaa*
+
+ ```rust
+ let aaaaa: &str // size = 16 (0x10), align = 8, niches = 1
+ ```
+ "#]],
+ );
+}
+
+#[test]
+fn format_args_implicit_raw() {
+ check(
+ r#"
+//- minicore: fmt
+fn test() {
+let aaaaa = "foo";
+format_args!(r"{$0aaaaa}");
+}
+"#,
+ expect![[r#"
+ *aaaaa*
+
+ ```rust
+ let aaaaa: &str // size = 16 (0x10), align = 8, niches = 1
+ ```
+ "#]],
+ );
+}
+
+#[test]
+fn format_args_implicit_nested() {
+ check(
+ r#"
+//- minicore: fmt
+macro_rules! foo {
+ ($($tt:tt)*) => {
+ format_args!($($tt)*)
+ }
+}
+fn test() {
+let aaaaa = "foo";
+foo!(r"{$0aaaaa}");
+}
+"#,
+ expect![[r#"
+ *aaaaa*
+
+ ```rust
+ let aaaaa: &str // size = 16 (0x10), align = 8, niches = 1
+ ```
+ "#]],
+ );
+}
+
+#[test]
+fn method_call_without_parens() {
+ check(
+ r#"
+struct S;
+impl S {
+ fn foo<T>(&self, t: T) {}
+}
+
+fn main() {
+ S.foo$0;
+}
+"#,
+ expect![[r#"
+ *foo*
+
+ ```rust
+ test::S
+ ```
+
+ ```rust
+ fn foo<T>(&self, t: T)
+ ```
+ "#]],
+ );
+}