Fix sorted output flakiness by using stable_sort (#2301)

Visible with bazel test //toolchain/parser/testdata:if/fail_errors.carbon.test --runs_per_test=20 (produces 2 errors on the same line)
This commit is contained in:
Jon Ross-Perkins
2022-10-17 18:07:08 -07:00
committed by GitHub
parent 1e866347e0
commit 8ee0ecec94
2 changed files with 6 additions and 1 deletions
@@ -37,6 +37,7 @@ TEST(SortedDiagnosticEmitterTest, SortErrors) {
emitter.Emit({"f", 1, 3}, TestDiagnostic, "M3");
emitter.Emit({"f", 3, 4}, TestDiagnostic, "M4");
emitter.Emit({"f", 3, 2}, TestDiagnostic, "M5");
emitter.Emit({"f", 3, 2}, TestDiagnostic, "M6");
InSequence s;
EXPECT_CALL(consumer, HandleDiagnostic(
@@ -51,6 +52,9 @@ TEST(SortedDiagnosticEmitterTest, SortErrors) {
EXPECT_CALL(consumer, HandleDiagnostic(
IsDiagnostic(DiagnosticKind::TestDiagnostic,
DiagnosticLevel::Error, 3, 2, "M5")));
EXPECT_CALL(consumer, HandleDiagnostic(
IsDiagnostic(DiagnosticKind::TestDiagnostic,
DiagnosticLevel::Error, 3, 2, "M6")));
EXPECT_CALL(consumer, HandleDiagnostic(
IsDiagnostic(DiagnosticKind::TestDiagnostic,
DiagnosticLevel::Error, 3, 4, "M4")));