mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Adding crate_root_path to crate_graph
This commit is contained in:
parent
8e687f7afb
commit
a3081a6774
10 changed files with 74 additions and 37 deletions
|
@ -102,6 +102,11 @@ fn replace_root(s: &mut String, direction: bool) {
|
|||
}
|
||||
}
|
||||
|
||||
fn replace_fake_sys_root(s: &mut String) {
|
||||
let root = get_test_path("fake-sysroot");
|
||||
*s = s.replace(root.to_str().expect("expected str"), "$FAKESYSROOT$")
|
||||
}
|
||||
|
||||
fn get_test_path(file: &str) -> PathBuf {
|
||||
let base = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
base.join("test_data").join(file)
|
||||
|
@ -140,6 +145,7 @@ fn to_crate_graph(project_workspace: ProjectWorkspace) -> (CrateGraph, ProcMacro
|
|||
fn check_crate_graph(crate_graph: CrateGraph, expect: ExpectFile) {
|
||||
let mut crate_graph = format!("{crate_graph:#?}");
|
||||
replace_root(&mut crate_graph, false);
|
||||
replace_fake_sys_root(&mut crate_graph);
|
||||
expect.assert_eq(&crate_graph);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue