mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
fix odrer-of-iteration bug in tests
This commit is contained in:
parent
772311392f
commit
908c9589a8
2 changed files with 15 additions and 7 deletions
|
@ -236,7 +236,7 @@ impl MockDatabase {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct CrateGraphFixture(pub FxHashMap<String, (String, Edition, Vec<String>)>);
|
pub struct CrateGraphFixture(pub Vec<(String, (String, Edition, Vec<String>))>);
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! crate_graph {
|
macro_rules! crate_graph {
|
||||||
|
@ -246,10 +246,10 @@ macro_rules! crate_graph {
|
||||||
#[allow(unused_mut, unused_assignments)]
|
#[allow(unused_mut, unused_assignments)]
|
||||||
let mut edition = ra_db::Edition::Edition2018;
|
let mut edition = ra_db::Edition::Edition2018;
|
||||||
$(edition = ra_db::Edition::from_string($edition);)?
|
$(edition = ra_db::Edition::from_string($edition);)?
|
||||||
res.0.insert(
|
res.0.push((
|
||||||
$crate_name.to_string(),
|
$crate_name.to_string(),
|
||||||
($crate_path.to_string(), edition, vec![$($dep.to_string()),*])
|
($crate_path.to_string(), edition, vec![$($dep.to_string()),*])
|
||||||
);
|
));
|
||||||
)*
|
)*
|
||||||
res
|
res
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -61,8 +61,8 @@ fn def_map(fixtute: &str) -> String {
|
||||||
render_crate_def_map(&dm)
|
render_crate_def_map(&dm)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn def_map_with_crate_graph(fixtute: &str, graph: CrateGraphFixture) -> String {
|
fn def_map_with_crate_graph(fixture: &str, graph: CrateGraphFixture) -> String {
|
||||||
let dm = compute_crate_def_map(fixtute, Some(graph));
|
let dm = compute_crate_def_map(fixture, Some(graph));
|
||||||
render_crate_def_map(&dm)
|
render_crate_def_map(&dm)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,8 +423,12 @@ fn extern_crate_rename() {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_snapshot_matches!(map, @r###"
|
assert_snapshot_matches!(map, @r###"
|
||||||
⋮crate
|
⋮crate
|
||||||
⋮Arc: t v
|
⋮alloc_crate: t
|
||||||
|
⋮sync: t
|
||||||
|
⋮
|
||||||
|
⋮crate::sync
|
||||||
|
⋮Arc: t v
|
||||||
"###);
|
"###);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,6 +457,10 @@ fn extern_crate_rename_2015_edition() {
|
||||||
assert_snapshot_matches!(map,
|
assert_snapshot_matches!(map,
|
||||||
@r###"
|
@r###"
|
||||||
⋮crate
|
⋮crate
|
||||||
|
⋮alloc_crate: t
|
||||||
|
⋮sync: t
|
||||||
|
⋮
|
||||||
|
⋮crate::sync
|
||||||
⋮Arc: t v
|
⋮Arc: t v
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue