mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Add testing infrastructure for type inference
- move dir_tests to test_utils for that.
This commit is contained in:
parent
3899898d75
commit
7348f7883f
9 changed files with 223 additions and 125 deletions
|
@ -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 ( <|> )");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue