From b28c54a2c239acd73f2eea80fda9ee3960d2c046 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 13 Aug 2020 16:28:27 +0200 Subject: Rename ra_hir_def -> hir_def --- crates/ra_hir_def/src/nameres/tests/globs.rs | 338 --------------------------- 1 file changed, 338 deletions(-) delete mode 100644 crates/ra_hir_def/src/nameres/tests/globs.rs (limited to 'crates/ra_hir_def/src/nameres/tests/globs.rs') diff --git a/crates/ra_hir_def/src/nameres/tests/globs.rs b/crates/ra_hir_def/src/nameres/tests/globs.rs deleted file mode 100644 index 2ae836e3c..000000000 --- a/crates/ra_hir_def/src/nameres/tests/globs.rs +++ /dev/null @@ -1,338 +0,0 @@ -use super::*; - -#[test] -fn glob_1() { - check( - r#" -//- /lib.rs -mod foo; -use foo::*; - -//- /foo/mod.rs -pub mod bar; -pub use self::bar::Baz; -pub struct Foo; - -//- /foo/bar.rs -pub struct Baz; -"#, - expect![[r#" - crate - Baz: t v - Foo: t v - bar: t - foo: t - - crate::foo - Baz: t v - Foo: t v - bar: t - - crate::foo::bar - Baz: t v - "#]], - ); -} - -#[test] -fn glob_2() { - check( - r#" -//- /lib.rs -mod foo; -use foo::*; - -//- /foo/mod.rs -pub mod bar; -pub use self::bar::*; -pub struct Foo; - -//- /foo/bar.rs -pub struct Baz; -pub use super::*; -"#, - expect![[r#" - crate - Baz: t v - Foo: t v - bar: t - foo: t - - crate::foo - Baz: t v - Foo: t v - bar: t - - crate::foo::bar - Baz: t v - Foo: t v - bar: t - "#]], - ); -} - -#[test] -fn glob_privacy_1() { - check( - r" -//- /lib.rs -mod foo; -use foo::*; - -//- /foo/mod.rs -pub mod bar; -pub use self::bar::*; -struct PrivateStructFoo; - -//- /foo/bar.rs -pub struct Baz; -struct PrivateStructBar; -pub use super::*; -", - expect![[r#" - crate - Baz: t v - bar: t - foo: t - - crate::foo - Baz: t v - PrivateStructFoo: t v - bar: t - - crate::foo::bar - Baz: t v - PrivateStructBar: t v - PrivateStructFoo: t v - bar: t - "#]], - ); -} - -#[test] -fn glob_privacy_2() { - check( - r" -//- /lib.rs -mod foo; -use foo::*; -use foo::bar::*; - -//- /foo/mod.rs -mod bar; -fn Foo() {}; -pub struct Foo {}; - -//- /foo/bar.rs -pub(super) struct PrivateBaz; -struct PrivateBar; -pub(crate) struct PubCrateStruct; -", - expect![[r#" - crate - Foo: t - PubCrateStruct: t v - foo: t - - crate::foo - Foo: t v - bar: t - - crate::foo::bar - PrivateBar: t v - PrivateBaz: t v - PubCrateStruct: t v - "#]], - ); -} - -#[test] -fn glob_across_crates() { - mark::check!(glob_across_crates); - check( - r#" -//- /main.rs crate:main deps:test_crate -use test_crate::*; - -//- /lib.rs crate:test_crate -pub struct Baz; -"#, - expect![[r#" - crate - Baz: t v - "#]], - ); -} - -#[test] -fn glob_privacy_across_crates() { - check( - r#" -//- /main.rs crate:main deps:test_crate -use test_crate::*; - -//- /lib.rs crate:test_crate -pub struct Baz; -struct Foo; -"#, - expect![[r#" - crate - Baz: t v - "#]], - ); -} - -#[test] -fn glob_enum() { - mark::check!(glob_enum); - check( - r#" -enum Foo { Bar, Baz } -use self::Foo::*; -"#, - expect![[r#" - crate - Bar: t v - Baz: t v - Foo: t - "#]], - ); -} - -#[test] -fn glob_enum_group() { - mark::check!(glob_enum_group); - check( - r#" -enum Foo { Bar, Baz } -use self::Foo::{*}; -"#, - expect![[r#" - crate - Bar: t v - Baz: t v - Foo: t - "#]], - ); -} - -#[test] -fn glob_shadowed_def() { - mark::check!(import_shadowed); - check( - r#" -//- /lib.rs -mod foo; -mod bar; -use foo::*; -use bar::baz; -use baz::Bar; - -//- /foo.rs -pub mod baz { pub struct Foo; } - -//- /bar.rs -pub mod baz { pub struct Bar; } -"#, - expect![[r#" - crate - Bar: t v - bar: t - baz: t - foo: t - - crate::bar - baz: t - - crate::bar::baz - Bar: t v - - crate::foo - baz: t - - crate::foo::baz - Foo: t v - "#]], - ); -} - -#[test] -fn glob_shadowed_def_reversed() { - check( - r#" -//- /lib.rs -mod foo; -mod bar; -use bar::baz; -use foo::*; -use baz::Bar; - -//- /foo.rs -pub mod baz { pub struct Foo; } - -//- /bar.rs -pub mod baz { pub struct Bar; } -"#, - expect![[r#" - crate - Bar: t v - bar: t - baz: t - foo: t - - crate::bar - baz: t - - crate::bar::baz - Bar: t v - - crate::foo - baz: t - - crate::foo::baz - Foo: t v - "#]], - ); -} - -#[test] -fn glob_shadowed_def_dependencies() { - check( - r#" -mod a { pub mod foo { pub struct X; } } -mod b { pub use super::a::foo; } -mod c { pub mod foo { pub struct Y; } } -mod d { - use super::c::foo; - use super::b::*; - use foo::Y; -} -"#, - expect![[r#" - crate - a: t - b: t - c: t - d: t - - crate::d - Y: t v - foo: t - - crate::c - foo: t - - crate::c::foo - Y: t v - - crate::b - foo: t - - crate::a - foo: t - - crate::a::foo - X: t v - "#]], - ); -} -- cgit v1.2.3