diff options
Diffstat (limited to 'crates/ra_hir/src/nameres/tests')
-rw-r--r-- | crates/ra_hir/src/nameres/tests/incremental.rs | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/crates/ra_hir/src/nameres/tests/incremental.rs b/crates/ra_hir/src/nameres/tests/incremental.rs index a059634e2..001f76ac3 100644 --- a/crates/ra_hir/src/nameres/tests/incremental.rs +++ b/crates/ra_hir/src/nameres/tests/incremental.rs | |||
@@ -92,12 +92,14 @@ fn adding_inner_items_should_not_invalidate_def_map() { | |||
92 | 92 | ||
93 | #[test] | 93 | #[test] |
94 | fn typing_inside_a_macro_should_not_invalidate_def_map() { | 94 | fn typing_inside_a_macro_should_not_invalidate_def_map() { |
95 | check_def_map_is_not_recomputed( | 95 | let (mut db, pos) = MockDatabase::with_position( |
96 | " | 96 | " |
97 | //- /lib.rs | 97 | //- /lib.rs |
98 | macro_rules! m { | 98 | macro_rules! m { |
99 | ($ident:ident) => { | 99 | ($ident:ident) => { |
100 | struct Foo; | 100 | fn f() { |
101 | $ident + $ident; | ||
102 | }; | ||
101 | } | 103 | } |
102 | } | 104 | } |
103 | mod foo; | 105 | mod foo; |
@@ -109,8 +111,23 @@ fn typing_inside_a_macro_should_not_invalidate_def_map() { | |||
109 | <|> | 111 | <|> |
110 | m!(X); | 112 | m!(X); |
111 | ", | 113 | ", |
112 | " | ||
113 | m!(Y); | ||
114 | ", | ||
115 | ); | 114 | ); |
115 | { | ||
116 | let events = db.log_executed(|| { | ||
117 | let module = crate::source_binder::module_from_file_id(&db, pos.file_id).unwrap(); | ||
118 | let decls = module.declarations(&db); | ||
119 | assert_eq!(decls.len(), 1); | ||
120 | }); | ||
121 | assert!(format!("{:?}", events).contains("crate_def_map"), "{:#?}", events) | ||
122 | } | ||
123 | db.set_file_text(pos.file_id, Arc::new("m!(Y);".to_string())); | ||
124 | |||
125 | { | ||
126 | let events = db.log_executed(|| { | ||
127 | let module = crate::source_binder::module_from_file_id(&db, pos.file_id).unwrap(); | ||
128 | let decls = module.declarations(&db); | ||
129 | assert_eq!(decls.len(), 1); | ||
130 | }); | ||
131 | assert!(!format!("{:?}", events).contains("crate_def_map"), "{:#?}", events) | ||
132 | } | ||
116 | } | 133 | } |