googletest icon indicating copy to clipboard operation
googletest copied to clipboard

[Bug]: Skipped tests' messages are displayed in brief mode

Open hsaunders1904 opened this issue 1 year ago • 0 comments
trafficstars

Describe the issue

When running tests using --gtest_brief=1, the messages produced by skipped tests are printed.

The help for gtest_brief suggests that only test failures should be displayed:

$ ./tests --help | grep gtest_brief -A1
  --gtest_brief=1
      Only print test failures. 

I expected that the output from the skipped tests would be hidden.

Steps to reproduce the problem

Add a skipped test and run the test using the --gtest_brief=1 option.

For example:

// test.cpp
#include <gtest/gtest.h>

TEST(Test, TwoAndTwoIsFour) { 
  GTEST_SKIP();
  EXPECT_EQ(2 + 2, 4); 
}

TEST(Test, FiveAndFiveIsTen) {
  GTEST_SKIP() << "user message";
  EXPECT_EQ(5 + 5, 10);
}

Running this test outputs:

$ ./test --gtest_brief=1
Running main() from /tmp/googletest-20230913-4615-1t6szd0/googletest-1.14.0/googletest/src/gtest_main.cc
/test.cpp:5: Skipped


/test.cpp:10: Skipped
user message

[==========] 2 tests from 1 test suite ran. (0 ms total)
[  PASSED  ] 0 tests.
[  SKIPPED ] 2 tests.

What version of GoogleTest are you using?

1.14.0

What operating system and version are you using?

OSX

What compiler and version are you using?

Apple clang version 15.0.0 (clang-1500.3.9.4)

What build system are you using?

cmake version 3.29.2

Additional context

I have a patch that resolves this issue. I'm happy to open a PR if you're open to the change.

hsaunders1904 avatar May 26 '24 22:05 hsaunders1904