Skip to content

gmock: improve readability of ElementsAre mismatch diagnostics (#4934) - #5138

Open
jay-2611 wants to merge 1 commit into
google:mainfrom
jay-2611:improve-container-matcher-diagnostics
Open

jay-2611 wants to merge 1 commit into
google:mainfrom
jay-2611:improve-container-matcher-diagnostics

Conversation

@jay-2611

Copy link
Copy Markdown

Fixes #4934

Summary

Improves failure diagnostics for ElementsAre matchers when element values or struct fields fail to match.

Problem

Previously, mismatch explanations for ElementsAre printed actual and expected values in a single dense paragraph:
whose element #1 (ActualVal) isn't equal to ExpectedVal

For complex structures or large arrays, this required manual editing and visual scanning to isolate mismatched fields.

Solution

Formats the mismatch explanation with clear, structured LHS/RHS lines:

element mismatch at index 1:
  Actual   #1: <actual_value>
  Expected #1: <expected_matcher_description>
  Detail: <optional_explanation>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FR]: Making EXPECT_THAT of (Unordered)ElementsAreArray human/AI readable

1 participant