From 908c9589a83a28737bdefe1e665a1fdf0fc70827 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 21 May 2019 14:51:52 +0300 Subject: fix odrer-of-iteration bug in tests --- crates/ra_hir/src/mock.rs | 6 +++--- crates/ra_hir/src/nameres/tests.rs | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) (limited to 'crates') diff --git a/crates/ra_hir/src/mock.rs b/crates/ra_hir/src/mock.rs index fa5882dea..b84cb7503 100644 --- a/crates/ra_hir/src/mock.rs +++ b/crates/ra_hir/src/mock.rs @@ -236,7 +236,7 @@ impl MockDatabase { } #[derive(Default)] -pub struct CrateGraphFixture(pub FxHashMap)>); +pub struct CrateGraphFixture(pub Vec<(String, (String, Edition, Vec))>); #[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 }} diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs index 958871b17..14c8ee50b 100644 --- a/crates/ra_hir/src/nameres/tests.rs +++ b/crates/ra_hir/src/nameres/tests.rs @@ -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) } @@ -423,8 +423,12 @@ fn extern_crate_rename() { ); assert_snapshot_matches!(map, @r###" - ⋮crate - ⋮Arc: t v + ⋮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 "### ); -- cgit v1.2.3