Skip to content

Commit ee584c1

Browse files
Make macros test order-resistant
1 parent 6c07c71 commit ee584c1

File tree

1 file changed

+7
-2
lines changed
  • src/tools/rust-analyzer/crates/hir-def/src/nameres/tests

1 file changed

+7
-2
lines changed

Diff for: src/tools/rust-analyzer/crates/hir-def/src/nameres/tests/macros.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use super::*;
2+
use itertools::Itertools;
23

34
#[test]
45
fn macro_rules_are_globally_visible() {
@@ -1171,11 +1172,15 @@ fn proc_attr(a: TokenStream, b: TokenStream) -> TokenStream { a }
11711172
);
11721173

11731174
let root = &def_map[def_map.root()].scope;
1174-
let actual = root.legacy_macros().map(|(name, _)| format!("{name}\n")).collect::<String>();
1175+
let actual = root
1176+
.legacy_macros()
1177+
.sorted_by(|a, b| std::cmp::Ord::cmp(&a.0, &b.0))
1178+
.map(|(name, _)| format!("{name}\n"))
1179+
.collect::<String>();
11751180

11761181
expect![[r#"
1177-
macro20
11781182
legacy
1183+
macro20
11791184
proc_attr
11801185
"#]]
11811186
.assert_eq(&actual);

0 commit comments

Comments
 (0)