aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-05-21 12:51:52 +0100
committerAleksey Kladov <[email protected]>2019-05-21 12:51:52 +0100
commit908c9589a83a28737bdefe1e665a1fdf0fc70827 (patch)
treeae5627628b2430a78b13b654ddac39f036cc31d2 /crates/ra_hir
parent772311392ff45ef515d11715e925798c6ac7514b (diff)
fix odrer-of-iteration bug in tests
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/mock.rs6
-rw-r--r--crates/ra_hir/src/nameres/tests.rs16
2 files changed, 15 insertions, 7 deletions
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 {
236} 236}
237 237
238#[derive(Default)] 238#[derive(Default)]
239pub struct CrateGraphFixture(pub FxHashMap<String, (String, Edition, Vec<String>)>); 239pub struct CrateGraphFixture(pub Vec<(String, (String, Edition, Vec<String>))>);
240 240
241#[macro_export] 241#[macro_export]
242macro_rules! crate_graph { 242macro_rules! crate_graph {
@@ -246,10 +246,10 @@ macro_rules! crate_graph {
246 #[allow(unused_mut, unused_assignments)] 246 #[allow(unused_mut, unused_assignments)]
247 let mut edition = ra_db::Edition::Edition2018; 247 let mut edition = ra_db::Edition::Edition2018;
248 $(edition = ra_db::Edition::from_string($edition);)? 248 $(edition = ra_db::Edition::from_string($edition);)?
249 res.0.insert( 249 res.0.push((
250 $crate_name.to_string(), 250 $crate_name.to_string(),
251 ($crate_path.to_string(), edition, vec![$($dep.to_string()),*]) 251 ($crate_path.to_string(), edition, vec![$($dep.to_string()),*])
252 ); 252 ));
253 )* 253 )*
254 res 254 res
255 }} 255 }}
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 {
61 render_crate_def_map(&dm) 61 render_crate_def_map(&dm)
62} 62}
63 63
64fn def_map_with_crate_graph(fixtute: &str, graph: CrateGraphFixture) -> String { 64fn def_map_with_crate_graph(fixture: &str, graph: CrateGraphFixture) -> String {
65 let dm = compute_crate_def_map(fixtute, Some(graph)); 65 let dm = compute_crate_def_map(fixture, Some(graph));
66 render_crate_def_map(&dm) 66 render_crate_def_map(&dm)
67} 67}
68 68
@@ -423,8 +423,12 @@ fn extern_crate_rename() {
423 ); 423 );
424 424
425 assert_snapshot_matches!(map, @r###" 425 assert_snapshot_matches!(map, @r###"
426 ⋮crate 426 ⋮crate
427 ⋮Arc: t v 427 ⋮alloc_crate: t
428 ⋮sync: t
429
430 ⋮crate::sync
431 ⋮Arc: t v
428 "###); 432 "###);
429} 433}
430 434
@@ -453,6 +457,10 @@ fn extern_crate_rename_2015_edition() {
453 assert_snapshot_matches!(map, 457 assert_snapshot_matches!(map,
454 @r###" 458 @r###"
455 ⋮crate 459 ⋮crate
460 ⋮alloc_crate: t
461 ⋮sync: t
462
463 ⋮crate::sync
456 ⋮Arc: t v 464 ⋮Arc: t v
457 "### 465 "###
458 ); 466 );