aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-12-19 13:19:53 +0000
committerAleksey Kladov <[email protected]>2018-12-20 09:15:38 +0000
commit2fe41574a1695a6608d738f40ec51bc61fc7604a (patch)
tree5388654b8938fdf90c4a2a1c1f77fac168b46f8b /crates/ra_hir/src
parente6465e7e2a7e136edd652d5f4c93b961dd652cbc (diff)
fix tests
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/mock.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/crates/ra_hir/src/mock.rs b/crates/ra_hir/src/mock.rs
index 54260101c..9423e6571 100644
--- a/crates/ra_hir/src/mock.rs
+++ b/crates/ra_hir/src/mock.rs
@@ -2,12 +2,14 @@ use std::sync::Arc;
2 2
3use parking_lot::Mutex; 3use parking_lot::Mutex;
4use salsa::{self, Database}; 4use salsa::{self, Database};
5use ra_db::{LocationIntener, BaseDatabase, FilePosition, FileId, WORKSPACE, CrateGraph, SourceRoot}; 5use ra_db::{LocationIntener, BaseDatabase, FilePosition, FileId, CrateGraph, SourceRoot, SourceRootId};
6use relative_path::RelativePathBuf; 6use relative_path::RelativePathBuf;
7use test_utils::{parse_fixture, CURSOR_MARKER, extract_offset}; 7use test_utils::{parse_fixture, CURSOR_MARKER, extract_offset};
8 8
9use crate::{db, DefId, DefLoc}; 9use crate::{db, DefId, DefLoc};
10 10
11const WORKSPACE: SourceRootId = SourceRootId(0);
12
11#[derive(Debug)] 13#[derive(Debug)]
12pub(crate) struct MockDatabase { 14pub(crate) struct MockDatabase {
13 events: Mutex<Option<Vec<salsa::Event<MockDatabase>>>>, 15 events: Mutex<Option<Vec<salsa::Event<MockDatabase>>>>,
@@ -106,11 +108,11 @@ impl Default for MockDatabase {
106 runtime: salsa::Runtime::default(), 108 runtime: salsa::Runtime::default(),
107 id_maps: Default::default(), 109 id_maps: Default::default(),
108 }; 110 };
109 db.query_mut(ra_db::SourceRootQuery)
110 .set(ra_db::WORKSPACE, Default::default());
111 db.query_mut(ra_db::CrateGraphQuery) 111 db.query_mut(ra_db::CrateGraphQuery)
112 .set((), Default::default()); 112 .set((), Default::default());
113 db.query_mut(ra_db::LibrariesQuery) 113 db.query_mut(ra_db::LocalRootsQuery)
114 .set((), Default::default());
115 db.query_mut(ra_db::LibraryRootsQuery)
114 .set((), Default::default()); 116 .set((), Default::default());
115 db 117 db
116 } 118 }
@@ -163,7 +165,8 @@ salsa::database_storage! {
163 fn file_relative_path() for ra_db::FileRelativePathQuery; 165 fn file_relative_path() for ra_db::FileRelativePathQuery;
164 fn file_source_root() for ra_db::FileSourceRootQuery; 166 fn file_source_root() for ra_db::FileSourceRootQuery;
165 fn source_root() for ra_db::SourceRootQuery; 167 fn source_root() for ra_db::SourceRootQuery;
166 fn libraries() for ra_db::LibrariesQuery; 168 fn local_roots() for ra_db::LocalRootsQuery;
169 fn library_roots() for ra_db::LibraryRootsQuery;
167 fn crate_graph() for ra_db::CrateGraphQuery; 170 fn crate_graph() for ra_db::CrateGraphQuery;
168 } 171 }
169 impl ra_db::SyntaxDatabase { 172 impl ra_db::SyntaxDatabase {