Skip to content

Pretty-print conformance TestResults in gtest failure output. - #30256

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_989404897
Oct 3, 2026
Merged

copybara-service[bot] merged 1 commit into
mainfrom
test_989404897

Conversation

@copybara-service

Copy link
Copy Markdown

Pretty-print conformance TestResults in gtest failure output.

When a matcher on a TestResult fails, gtest prints the value it was given, which without a PrintTo() is an opaque byte dump. Print the test's priority and name (which spells out its input and output formats) and the response instead, truncating long payloads and decoding binary ones as the test's message type where possible, so that a failing conformance test can be read straight off the gtest output.

The printer lives in the matcher library rather than with TestResult: matcher failures are the only place results get printed, and every test that checks a result includes matchers.h, which is all gtest needs to find PrintTo() through ADL. Its helpers (truncating a response, instantiating the test's message type, single-line printing) are file-local; the payload matchers that follow share them from the same file.

@copybara-service
copybara-service Bot force-pushed the test_989404897 branch 4 times, most recently from b0f2307 to f95f1e0 Compare October 3, 2026 00:06
When a matcher on a TestResult fails, gtest prints the value it was given, which without a PrintTo() is an opaque byte dump. Print the test's priority and name (which spells out its input and output formats) and the response instead, truncating long payloads and decoding binary ones as the test's message type where possible, so that a failing conformance test can be read straight off the gtest output.

The printer lives in the matcher library rather than with TestResult: matcher failures are the only place results get printed, and every test that checks a result includes matchers.h, which is all gtest needs to find PrintTo() through ADL. Its helpers (truncating a response, instantiating the test's message type, single-line printing) are file-local; the payload matchers that follow share them from the same file.

PiperOrigin-RevId: 992625604
@copybara-service
copybara-service Bot merged commit 1c1899e into main Oct 3, 2026
4 checks passed
@copybara-service
copybara-service Bot deleted the test_989404897 branch October 3, 2026 00:30

This branch was successfully deployed

1 active deployment
github-pages — 1c1899e4 Deployed Oct 3, 2026 by github-pages[bot] via deploy #11145
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.

1 participant