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.rs65
1 files changed, 65 insertions, 0 deletions
diff --git a/crates/ide/src/hover/tests.rs b/crates/ide/src/hover/tests.rs
index 8b60e562d7..fc59307806 100644
--- a/crates/ide/src/hover/tests.rs
+++ b/crates/ide/src/hover/tests.rs
@@ -8702,3 +8702,68 @@ fn foo() {
"#]],
);
}
+
+#[test]
+fn module_path_macro() {
+ check(
+ r##"
+//- minicore: module_path
+
+const C$0: &'static str = module_path!();
+"##,
+ expect![[r#"
+ *C*
+
+ ```rust
+ test
+ ```
+
+ ```rust
+ const C: &'static str = "test"
+ ```
+ "#]],
+ );
+ check(
+ r##"
+//- minicore: module_path
+
+mod foo {
+ const C$0: &'static str = module_path!();
+}
+"##,
+ expect![[r#"
+ *C*
+
+ ```rust
+ test::foo
+ ```
+
+ ```rust
+ const C: &'static str = "test::foo"
+ ```
+ "#]],
+ );
+ check(
+ r##"
+//- minicore: module_path
+mod baz {
+ const _: () = {
+ mod bar {
+ const C$0: &'static str = module_path!();
+ }
+ }
+}
+"##,
+ expect![[r#"
+ *C*
+
+ ```rust
+ test::bar
+ ```
+
+ ```rust
+ const C: &'static str = "test::baz::bar"
+ ```
+ "#]],
+ );
+}