Skip to content

Commit e436260

Browse files
hir-def tests: sort results before comparing, since FxHashSet iteration order isn't guaranteed
(And, in fact, it failed on i686)
1 parent 1bb63df commit e436260

File tree

1 file changed

+28
-25
lines changed

1 file changed

+28
-25
lines changed

src/tools/rust-analyzer/crates/hir-def/src/import_map.rs

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,9 @@ mod tests {
516516
mark
517517
))
518518
})
519+
// HashSet iteration order isn't defined - it's different on
520+
// x86_64 and i686 at the very least
521+
.sorted()
519522
.collect::<String>();
520523
expect.assert_eq(&actual)
521524
}
@@ -831,10 +834,10 @@ mod tests {
831834
Query::new("fmt".to_string()).search_mode(SearchMode::Fuzzy),
832835
expect![[r#"
833836
dep::fmt (t)
834-
dep::fmt::Display::format_method (a)
835837
dep::fmt::Display (t)
836838
dep::fmt::Display::FMT_CONST (a)
837839
dep::fmt::Display::format_function (a)
840+
dep::fmt::Display::format_method (a)
838841
"#]],
839842
);
840843
}
@@ -860,10 +863,10 @@ mod tests {
860863
"main",
861864
Query::new("fmt".to_string()).search_mode(SearchMode::Fuzzy).assoc_items_only(),
862865
expect![[r#"
863-
dep::fmt::Display::format_method (a)
864-
dep::fmt::Display::FMT_CONST (a)
865-
dep::fmt::Display::format_function (a)
866-
"#]],
866+
dep::fmt::Display::FMT_CONST (a)
867+
dep::fmt::Display::format_function (a)
868+
dep::fmt::Display::format_method (a)
869+
"#]],
867870
);
868871

869872
check_search(
@@ -920,13 +923,13 @@ mod tests {
920923
"main",
921924
Query::new("fmt".to_string()).search_mode(SearchMode::Fuzzy),
922925
expect![[r#"
923-
dep::fmt (t)
924-
dep::format (f)
925-
dep::Fmt (v)
926926
dep::Fmt (m)
927927
dep::Fmt (t)
928-
dep::fmt::Display::fmt (a)
928+
dep::Fmt (v)
929+
dep::fmt (t)
929930
dep::fmt::Display (t)
931+
dep::fmt::Display::fmt (a)
932+
dep::format (f)
930933
"#]],
931934
);
932935

@@ -935,10 +938,10 @@ mod tests {
935938
"main",
936939
Query::new("fmt".to_string()).search_mode(SearchMode::Equals),
937940
expect![[r#"
938-
dep::fmt (t)
939-
dep::Fmt (v)
940941
dep::Fmt (m)
941942
dep::Fmt (t)
943+
dep::Fmt (v)
944+
dep::fmt (t)
942945
dep::fmt::Display::fmt (a)
943946
"#]],
944947
);
@@ -948,12 +951,12 @@ mod tests {
948951
"main",
949952
Query::new("fmt".to_string()).search_mode(SearchMode::Contains),
950953
expect![[r#"
951-
dep::fmt (t)
952-
dep::Fmt (v)
953954
dep::Fmt (m)
954955
dep::Fmt (t)
955-
dep::fmt::Display::fmt (a)
956+
dep::Fmt (v)
957+
dep::fmt (t)
956958
dep::fmt::Display (t)
959+
dep::fmt::Display::fmt (a)
957960
"#]],
958961
);
959962
}
@@ -989,12 +992,12 @@ mod tests {
989992
"main",
990993
Query::new("fmt".to_string()),
991994
expect![[r#"
992-
dep::fmt (t)
993-
dep::Fmt (v)
994995
dep::Fmt (m)
995996
dep::Fmt (t)
996-
dep::fmt::Display::fmt (a)
997+
dep::Fmt (v)
998+
dep::fmt (t)
997999
dep::fmt::Display (t)
1000+
dep::fmt::Display::fmt (a)
9981001
"#]],
9991002
);
10001003

@@ -1003,10 +1006,10 @@ mod tests {
10031006
"main",
10041007
Query::new("fmt".to_string()).name_only(),
10051008
expect![[r#"
1006-
dep::fmt (t)
1007-
dep::Fmt (v)
10081009
dep::Fmt (m)
10091010
dep::Fmt (t)
1011+
dep::Fmt (v)
1012+
dep::fmt (t)
10101013
dep::fmt::Display::fmt (a)
10111014
"#]],
10121015
);
@@ -1027,10 +1030,10 @@ mod tests {
10271030
"main",
10281031
Query::new("FMT".to_string()),
10291032
expect![[r#"
1030-
dep::fmt (t)
1033+
dep::FMT (t)
10311034
dep::FMT (v)
1035+
dep::fmt (t)
10321036
dep::fmt (v)
1033-
dep::FMT (t)
10341037
"#]],
10351038
);
10361039

@@ -1068,10 +1071,10 @@ mod tests {
10681071
"main",
10691072
Query::new("".to_string()).limit(2),
10701073
expect![[r#"
1071-
dep::fmt (t)
1074+
dep::Fmt (m)
10721075
dep::Fmt (t)
10731076
dep::Fmt (v)
1074-
dep::Fmt (m)
1077+
dep::fmt (t)
10751078
"#]],
10761079
);
10771080
}
@@ -1091,10 +1094,10 @@ mod tests {
10911094
"main",
10921095
Query::new("FMT".to_string()),
10931096
expect![[r#"
1094-
dep::fmt (t)
1097+
dep::FMT (t)
10951098
dep::FMT (v)
1099+
dep::fmt (t)
10961100
dep::fmt (v)
1097-
dep::FMT (t)
10981101
"#]],
10991102
);
11001103

0 commit comments

Comments
 (0)