Add testing infrastructure for type inference

- move dir_tests to test_utils for that.
This commit is contained in:
Florian Diebold 2018-12-23 12:05:54 +01:00
parent 3899898d75
commit 7348f7883f
9 changed files with 223 additions and 125 deletions

View file

@ -24,6 +24,15 @@ impl MockDatabase {
(db, source_root)
}
pub(crate) fn with_single_file(text: &str) -> (MockDatabase, SourceRoot, FileId) {
let mut db = MockDatabase::default();
let mut source_root = SourceRoot::default();
let file_id = db.add_file(&mut source_root, "/main.rs", text);
db.query_mut(ra_db::SourceRootQuery)
.set(WORKSPACE, Arc::new(source_root.clone()));
(db, source_root, file_id)
}
pub(crate) fn with_position(fixture: &str) -> (MockDatabase, FilePosition) {
let (db, _, position) = MockDatabase::from_fixture(fixture);
let position = position.expect("expected a marker ( <|> )");