diff options
Diffstat (limited to 'crates/hir_def/src/nameres/tests')
-rw-r--r-- | crates/hir_def/src/nameres/tests/mod_resolution.rs | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/crates/hir_def/src/nameres/tests/mod_resolution.rs b/crates/hir_def/src/nameres/tests/mod_resolution.rs index f93337a6e..ba295fd9e 100644 --- a/crates/hir_def/src/nameres/tests/mod_resolution.rs +++ b/crates/hir_def/src/nameres/tests/mod_resolution.rs | |||
@@ -323,13 +323,26 @@ pub struct Baz; | |||
323 | fn module_resolution_relative_path_outside_root() { | 323 | fn module_resolution_relative_path_outside_root() { |
324 | check( | 324 | check( |
325 | r#" | 325 | r#" |
326 | //- /main.rs | 326 | //- /a/b/c/d/e/main.rs crate:main |
327 | #[path="../../../../../outside.rs"] | 327 | #[path="../../../../../outside.rs"] |
328 | mod foo; | 328 | mod foo; |
329 | |||
330 | //- /outside.rs | ||
331 | mod bar; | ||
332 | |||
333 | //- /bar.rs | ||
334 | pub struct Baz; | ||
329 | "#, | 335 | "#, |
330 | expect![[r#" | 336 | expect![[r#" |
331 | crate | 337 | crate |
332 | "#]], | 338 | foo: t |
339 | |||
340 | crate::foo | ||
341 | bar: t | ||
342 | |||
343 | crate::foo::bar | ||
344 | Baz: t v | ||
345 | "#]], | ||
333 | ); | 346 | ); |
334 | } | 347 | } |
335 | 348 | ||
@@ -758,3 +771,30 @@ struct X; | |||
758 | "#]], | 771 | "#]], |
759 | ); | 772 | ); |
760 | } | 773 | } |
774 | |||
775 | #[test] | ||
776 | fn circular_mods() { | ||
777 | mark::check!(circular_mods); | ||
778 | compute_crate_def_map( | ||
779 | r#" | ||
780 | //- /lib.rs | ||
781 | mod foo; | ||
782 | //- /foo.rs | ||
783 | #[path = "./foo.rs"] | ||
784 | mod foo; | ||
785 | "#, | ||
786 | ); | ||
787 | |||
788 | compute_crate_def_map( | ||
789 | r#" | ||
790 | //- /lib.rs | ||
791 | mod foo; | ||
792 | //- /foo.rs | ||
793 | #[path = "./bar.rs"] | ||
794 | mod bar; | ||
795 | //- /bar.rs | ||
796 | #[path = "./foo.rs"] | ||
797 | mod foo; | ||
798 | "#, | ||
799 | ); | ||
800 | } | ||