Skip to content

Commit

Permalink
Make macros test order-resistant
Browse files Browse the repository at this point in the history
  • Loading branch information
fasterthanlime committed Jul 24, 2022
1 parent 18ea0c0 commit 3e45c72
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions crates/hir-def/src/nameres/tests/macros.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use super::*;
use itertools::Itertools;

#[test]
fn macro_rules_are_globally_visible() {
Expand Down Expand Up @@ -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::<String>();
let actual = root
.legacy_macros()
.sorted_by(|a, b| std::cmp::Ord::cmp(&a.0, &b.0))
.map(|(name, _)| format!("{name}\n"))
.collect::<String>();

expect![[r#"
macro20
legacy
macro20
proc_attr
"#]]
.assert_eq(&actual);
Expand Down

0 comments on commit 3e45c72

Please sign in to comment.