Unnamed repository; edit this file 'description' to name the repository.
internal: Add tests for rust-lang/rust#146972
| -rw-r--r-- | crates/hir-def/src/nameres/tests.rs | 2 | ||||
| -rw-r--r-- | crates/hir-def/src/nameres/tests/imports.rs | 63 | ||||
| -rw-r--r-- | crates/hir-def/src/nameres/tests/primitives.rs | 23 |
3 files changed, 64 insertions, 24 deletions
diff --git a/crates/hir-def/src/nameres/tests.rs b/crates/hir-def/src/nameres/tests.rs index 23d60d58f0..fe55252e25 100644 --- a/crates/hir-def/src/nameres/tests.rs +++ b/crates/hir-def/src/nameres/tests.rs @@ -1,8 +1,8 @@ mod globs; +mod imports; mod incremental; mod macros; mod mod_resolution; -mod primitives; use base_db::RootQueryDb; use expect_test::{Expect, expect}; diff --git a/crates/hir-def/src/nameres/tests/imports.rs b/crates/hir-def/src/nameres/tests/imports.rs new file mode 100644 index 0000000000..b1960b785a --- /dev/null +++ b/crates/hir-def/src/nameres/tests/imports.rs @@ -0,0 +1,63 @@ +use super::*;
+
+#[test]
+fn kw_path_renames() {
+ check(
+ r#"
+macro_rules! m {
+ () => {
+ pub use $crate as dollar_crate;
+ pub use $crate::{self as self_dollar_crate};
+ };
+}
+
+pub use self as this;
+pub use crate as krate;
+
+pub use crate::{self as self_krate};
+m!();
+
+mod foo {
+ pub use super as zuper;
+ pub use super::{self as self_zuper};
+}
+"#,
+ expect![[r#"
+ crate
+ - dollar_crate : type (import)
+ - foo : type
+ - krate : type (import)
+ - self_dollar_crate : type (import)
+ - self_krate : type (import)
+ - this : type (import)
+ - (legacy) m : macro!
+
+ crate::foo
+ - self_zuper : type (import)
+ - zuper : type (import)
+ - (legacy) m : macro!
+ "#]],
+ );
+}
+
+#[test]
+fn primitive_reexport() {
+ check(
+ r#"
+//- /lib.rs
+mod foo;
+use foo::int;
+
+//- /foo.rs
+pub use i32 as int;
+"#,
+ expect![[r#"
+ crate
+ - foo : type
+ - int : type (import)
+
+ crate::foo
+ - int : type (import)
+ "#]],
+ );
+}
diff --git a/crates/hir-def/src/nameres/tests/primitives.rs b/crates/hir-def/src/nameres/tests/primitives.rs deleted file mode 100644 index 861690238d..0000000000 --- a/crates/hir-def/src/nameres/tests/primitives.rs +++ /dev/null @@ -1,23 +0,0 @@ -use super::*; - -#[test] -fn primitive_reexport() { - check( - r#" -//- /lib.rs -mod foo; -use foo::int; - -//- /foo.rs -pub use i32 as int; -"#, - expect![[r#" - crate - - foo : type - - int : type (import) - - crate::foo - - int : type (import) - "#]], - ); -} |