aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-03-26 16:55:19 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-03-26 16:55:19 +0000
commit1011e37f3a260b0565f88c84d3c49fac1ec7b879 (patch)
treeccd3e767355f86f8b3867ad7a0dc8d205d401665 /crates
parenta82755e24102bea85be450e0b210d45b05b9f246 (diff)
parenta3fee2bda04be27a63d9298f6e97555c904df4da (diff)
Merge #1060
1060: more realistic test for incrementality r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/nameres/tests/incremental.rs27
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]
94fn typing_inside_a_macro_should_not_invalidate_def_map() { 94fn 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}