GoogleTest: Add gtest-filter for TYPED_TEST_P
Looks like there is a bug: I add TYPED_TEST_P but CMake recognizes it as TEST_P (according to regex) and applies wrong gtest-filter for it.
Detailed info below:
# add test
TYPED_TEST_P(TestName, TestCase) {...}
using OneArgTypes = Types<
IDummyMethodWithArgs<int>,
IDummyConstMethodWithArgs<int>,
IDummyMethodWithArgs<const int&>,
IDummyConstMethodWithArgs<const int&>>;
INSTANTIATE_TYPED_TEST_SUITE_P(OneArg, TestName, OneArgTypes);
# check built test-binary
./my_test --gtest_list_tests
Running main() from gmock_main.cc
OneArg/TestName/0. # TypeParam = IDummyMethodWithArgs<int>
TestCase
OneArg/TestName/1. # TypeParam = IDummyConstMethodWithArgs<int>
TestCase
OneArg/TestName/2. # TypeParam = IDummyMethodWithArgs<int const&>
TestCase
OneArg/TestName/3. # TypeParam = IDummyConstMethodWithArgs<int const&>
TestCase
You can see that test-cases names format is next OneArg/TestName/<N>
.
But gtest-filter is not suitable: */TestName.TestCase/*
43: Note: Google Test filter = */TestName.TestCase/*
43: [==========] Running 0 tests from 0 test suites.
43: [==========] 0 tests from 0 test suites ran. (0 ms total)
43: [ PASSED ] 0 tests.
So after proposed fix tests running correctly
43: Note: Google Test filter = */TestName/*.TestCase
43: [==========] Running 4 tests from 4 test suites.
43: [----------] Global test environment set-up.
43: [----------] 1 test from OneArg/TestName/0, where TypeParam = IDummyMethodWithArgs<int>
43: [ RUN ] OneArg/TestName/0.TestCase
43: [ OK ] OneArg/TestName/0.TestCase (0 ms)
43: [----------] 1 test from OneArg/TestName/0 (0 ms total)
43: ...
43: [----------] 1 test from OneArg/TestName/3, where TypeParam = IDummyConstMethodWithArgs<int const&>
43: [ RUN ] OneArg/TestName/3.TestCase
43: [ OK ] OneArg/TestName/3.TestCase (0 ms)
43: [----------] 1 test from OneArg/TestName/3 (0 ms total)
43:
43: [----------] Global test environment tear-down
43: [==========] 4 tests from 4 test suites ran. (0 ms total)
43: [ PASSED ] 4 tests.
GTest version: 1.12.1
ldd bin/test_unit_Space1_Utility_Synchronization
linux-vdso.so.1 (0x00007ffc7a8b6000)
libgmock.so.1.12.1 => /opt/gtest/lib/libgmock.so.1.12.1 (0x00007f599ea0b000)
libgmock_main.so.1.12.1 => /opt/gtest/lib/libgmock_main.so.1.12.1 (0x00007f599ea06000)
libgtest.so.1.12.1 => /opt/gtest/lib/libgtest.so.1.12.1 (0x00007f599e98f000)
...
Backport: release
Topic-rename: GoogleTest-TYPED_TEST_P
Edited by Brad King