red-knot: Add a method to resolve a file for an arbitrary VfsPath (#11826)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Micha Reiser 2024-06-18 13:03:30 +01:00 committed by GitHub
parent 13ad24b13e
commit 98b13b9844
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 75 additions and 59 deletions

View file

@ -63,7 +63,7 @@ mod tests {
use crate::file_system::FileSystemPath;
use crate::source::{line_index, source_text};
use crate::tests::TestDb;
use crate::Db;
use crate::vfs::system_path_to_file;
#[test]
fn re_runs_query_when_file_revision_changes() -> crate::file_system::Result<()> {
@ -73,7 +73,7 @@ mod tests {
db.file_system_mut()
.write_file(path, "x = 10".to_string())?;
let file = db.file(path);
let file = system_path_to_file(&db, path).unwrap();
assert_eq!(&*source_text(&db, file), "x = 10");
@ -95,7 +95,7 @@ mod tests {
db.file_system_mut()
.write_file(path, "x = 10".to_string())?;
let file = db.file(path);
let file = system_path_to_file(&db, path).unwrap();
assert_eq!(&*source_text(&db, file), "x = 10");
@ -122,7 +122,7 @@ mod tests {
db.file_system_mut()
.write_file(path, "x = 10\ny = 20".to_string())?;
let file = db.file(path);
let file = system_path_to_file(&db, path).unwrap();
let index = line_index(&db, file);
let text = source_text(&db, file);