From 2dc85619beaa3cd9fc47bb8ac1791820691e1205 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 9 Jan 2019 00:54:06 +0300 Subject: one more invalidation test --- crates/ra_hir/src/nameres/tests.rs | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs index 0e9026a01..a19a6fe51 100644 --- a/crates/ra_hir/src/nameres/tests.rs +++ b/crates/ra_hir/src/nameres/tests.rs @@ -368,12 +368,43 @@ fn typing_inside_a_function_should_not_invalidate_item_map() { mod foo; use crate::foo::bar::Baz; - +{ fn foo() -> i32 { 92 } ", ); } +#[test] +fn adding_inner_items_should_not_invalidate_item_map() { + check_item_map_is_not_recomputed( + " + //- /lib.rs + struct S { a: i32} + mod foo;<|> + enum E { A } + use crate::foo::bar::Baz; + trait T { + fn a() {} + } + //- /foo/mod.rs + pub mod bar; + + //- /foo/bar.rs + pub struct Baz; + ", + " + struct S { a: i32, b: () } + mod foo;<|> + enum E { A, B } + use crate::foo::bar::Baz; + trait T { + fn a() {} + fn b() {} + } + ", + ); +} + #[test] fn typing_inside_a_function_inside_a_macro_should_not_invalidate_item_map() { check_item_map_is_not_recomputed( -- cgit v1.2.3