1301: fix odrer-of-iteration bug in tests r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2019-05-21 11:53:27 +00:00
commit 9fe8e56177
2 changed files with 15 additions and 7 deletions

View file

@ -236,7 +236,7 @@ impl MockDatabase {
}
#[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_rules! crate_graph {
@ -246,10 +246,10 @@ macro_rules! crate_graph {
#[allow(unused_mut, unused_assignments)]
let mut edition = ra_db::Edition::Edition2018;
$(edition = ra_db::Edition::from_string($edition);)?
res.0.insert(
res.0.push((
$crate_name.to_string(),
($crate_path.to_string(), edition, vec![$($dep.to_string()),*])
);
));
)*
res
}}

View file

@ -61,8 +61,8 @@ fn def_map(fixtute: &str) -> String {
render_crate_def_map(&dm)
}
fn def_map_with_crate_graph(fixtute: &str, graph: CrateGraphFixture) -> String {
let dm = compute_crate_def_map(fixtute, Some(graph));
fn def_map_with_crate_graph(fixture: &str, graph: CrateGraphFixture) -> String {
let dm = compute_crate_def_map(fixture, Some(graph));
render_crate_def_map(&dm)
}
@ -424,6 +424,10 @@ fn extern_crate_rename() {
assert_snapshot_matches!(map, @r###"
crate
alloc_crate: t
sync: t
crate::sync
Arc: t v
"###);
}
@ -453,6 +457,10 @@ fn extern_crate_rename_2015_edition() {
assert_snapshot_matches!(map,
@r###"
crate
alloc_crate: t
sync: t
crate::sync
Arc: t v
"###
);