Add --gtest_list_tests_brief to omit GetParam/TypeParam annotations#4971
Open
dokson wants to merge 1 commit into
Open
Add --gtest_list_tests_brief to omit GetParam/TypeParam annotations#4971dokson wants to merge 1 commit into
dokson wants to merge 1 commit into
Conversation
When listing parameterized tests, googletest appends "# GetParam() = <printed value>" after each test name (and "# TypeParam = ..." after each typed-test suite). For parameter types with custom test-name generators (the 4th argument of INSTANTIATE_TEST_SUITE_P), the annotation is redundant; for large parameter values, it dominates the output. Add a boolean flag --gtest_list_tests_brief (and matching GTEST_LIST_TESTS_BRIEF env var) that suppresses both annotations during --gtest_list_tests. Default is false, preserving existing behavior. Extends googletest-list-tests-unittest.py with a regression test. Fixes google#4937
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--gtest_list_tests_brief(and matchingGTEST_LIST_TESTS_BRIEFenv var) that suppresses# GetParam() = ...and# TypeParam = ...annotations when listing tests via--gtest_list_tests.false, so existing behavior is preserved.INSTANTIATE_TEST_SUITE_Pfind the trailing annotation redundant; for large/binary parameter values it dominates the output and makes listings hard to read or pipe.Why a flag and not a
PrintToworkaroundThe reporter of #4937 already tried supplying a
PrintTothat returns an empty string. googletest still emits the literal prefix# GetParam() =before calling into the printer, so the noise can only be suppressed at the listing layer.Test plan
googletest/test/googletest-list-tests-unittest.pywithtestListTestsBriefOmitsParamAnnotations, asserting both regex match and absence ofGetParam()/TypeParam =strings.ctestsuite: 45/45 tests pass on Windows / MinGW (gcc 13.2).--helpshows the new flag; flag works via both CLI and env var.Fixes #4937