================ @@ -16,12 +16,36 @@ std::string Render(std::vector<DiagnosticDetail> details) { } // namespace TEST_F(ErrorDisplayTest, RenderStatus) { - DiagnosticDetail::SourceLocation inline_loc; - inline_loc.in_user_input = true; { + DiagnosticDetail::SourceLocation inline_loc; + inline_loc.in_user_input = true; std::string result = Render({DiagnosticDetail{inline_loc, eSeverityError, "foo", ""}}); ASSERT_TRUE(StringRef(result).contains("error:")); ASSERT_TRUE(StringRef(result).contains("foo")); } + + { + DiagnosticDetail::SourceLocation loc1 = {FileSpec{"a.c"}, 13, 11, 0, + false, true}; + DiagnosticDetail::SourceLocation loc2 = {FileSpec{"a.c"}, 13, 13, 0, + false, true}; + std::string result = + Render({DiagnosticDetail{loc1, eSeverityError, "1", "1"}, + DiagnosticDetail{loc1, eSeverityError, "2", "3"}, + DiagnosticDetail{loc2, eSeverityError, "3", "3"}}); + ASSERT_TRUE(StringRef(result).contains("error: 1")); + ASSERT_TRUE(StringRef(result).contains("error: 3")); + ASSERT_TRUE(StringRef(result).contains("error: 2")); ---------------- JDevlieghere wrote:
I don't understand what this test is testing. Also, this could definitely benefit from either inline comments or named variables. I had to look at the `DiagnosticDetail` definition to remember what the 3rd and 4th argument are (`message` and `rendered` respectively. This patch sorts stuff but the test doesn't check that. It just checks that everything is present, which thread me off at first. Would it make more sense to have `loc2` between the two `loc1`s and then check that they're printed in order? https://github.com/llvm/llvm-project/pull/112451 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits