aboutsummaryrefslogtreecommitdiff
path: root/crates/base_db/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-10-02 15:13:48 +0100
committerAleksey Kladov <[email protected]>2020-10-02 16:31:20 +0100
commit09348b247465864c6462a39055803bcbb0156cfe (patch)
treed57122ddcaa21d6f4ea50204afc3e3bc341583fc /crates/base_db/src
parenteeb27f95f1025128f8a1d24a515eb009498a1d44 (diff)
Get rid of MockAnalysis
Diffstat (limited to 'crates/base_db/src')
-rw-r--r--crates/base_db/src/fixture.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/crates/base_db/src/fixture.rs b/crates/base_db/src/fixture.rs
index 48fa73bf0..b7286fc7d 100644
--- a/crates/base_db/src/fixture.rs
+++ b/crates/base_db/src/fixture.rs
@@ -117,13 +117,13 @@ pub trait WithFixture: Default + SourceDatabaseExt + 'static {
117impl<DB: SourceDatabaseExt + Default + 'static> WithFixture for DB {} 117impl<DB: SourceDatabaseExt + Default + 'static> WithFixture for DB {}
118 118
119pub struct ChangeFixture { 119pub struct ChangeFixture {
120 file_position: Option<(FileId, RangeOrOffset)>, 120 pub file_position: Option<(FileId, RangeOrOffset)>,
121 files: Vec<FileId>, 121 pub files: Vec<FileId>,
122 change: Change, 122 pub change: Change,
123} 123}
124 124
125impl ChangeFixture { 125impl ChangeFixture {
126 fn parse(ra_fixture: &str) -> ChangeFixture { 126 pub fn parse(ra_fixture: &str) -> ChangeFixture {
127 let fixture = Fixture::parse(ra_fixture); 127 let fixture = Fixture::parse(ra_fixture);
128 let mut change = Change::new(); 128 let mut change = Change::new();
129 129
@@ -132,6 +132,7 @@ impl ChangeFixture {
132 let mut crates = FxHashMap::default(); 132 let mut crates = FxHashMap::default();
133 let mut crate_deps = Vec::new(); 133 let mut crate_deps = Vec::new();
134 let mut default_crate_root: Option<FileId> = None; 134 let mut default_crate_root: Option<FileId> = None;
135 let mut default_cfg = CfgOptions::default();
135 136
136 let mut file_set = FileSet::default(); 137 let mut file_set = FileSet::default();
137 let source_root_prefix = "/".to_string(); 138 let source_root_prefix = "/".to_string();
@@ -171,6 +172,7 @@ impl ChangeFixture {
171 } else if meta.path == "/main.rs" || meta.path == "/lib.rs" { 172 } else if meta.path == "/main.rs" || meta.path == "/lib.rs" {
172 assert!(default_crate_root.is_none()); 173 assert!(default_crate_root.is_none());
173 default_crate_root = Some(file_id); 174 default_crate_root = Some(file_id);
175 default_cfg = meta.cfg;
174 } 176 }
175 177
176 change.change_file(file_id, Some(Arc::new(text))); 178 change.change_file(file_id, Some(Arc::new(text)));
@@ -185,8 +187,8 @@ impl ChangeFixture {
185 crate_graph.add_crate_root( 187 crate_graph.add_crate_root(
186 crate_root, 188 crate_root,
187 Edition::Edition2018, 189 Edition::Edition2018,
188 None, 190 Some("test".to_string()),
189 CfgOptions::default(), 191 default_cfg,
190 Env::default(), 192 Env::default(),
191 Default::default(), 193 Default::default(),
192 ); 194 );