From dfe84494c142356a53f12279698f7bfc3b056481 Mon Sep 17 00:00:00 2001 From: Amos Wenger Date: Sun, 24 Jul 2022 16:48:06 +0200 Subject: [PATCH] Make macros test order-resistant --- crates/hir-def/src/nameres/tests/macros.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/hir-def/src/nameres/tests/macros.rs b/crates/hir-def/src/nameres/tests/macros.rs index 7b7f94c533..3ece1379ad 100644 --- a/crates/hir-def/src/nameres/tests/macros.rs +++ b/crates/hir-def/src/nameres/tests/macros.rs @@ -1,4 +1,5 @@ use super::*; +use itertools::Itertools; #[test] fn macro_rules_are_globally_visible() { @@ -1171,11 +1172,15 @@ fn proc_attr(a: TokenStream, b: TokenStream) -> TokenStream { a } ); let root = &def_map[def_map.root()].scope; - let actual = root.legacy_macros().map(|(name, _)| format!("{name}\n")).collect::(); + let actual = root + .legacy_macros() + .sorted_by(|a, b| std::cmp::Ord::cmp(&a.0, &b.0)) + .map(|(name, _)| format!("{name}\n")) + .collect::(); expect![[r#" - macro20 legacy + macro20 proc_attr "#]] .assert_eq(&actual);