GoogleTestRunner icon indicating copy to clipboard operation
GoogleTestRunner copied to clipboard

Fixed parameterized tests with non trivial Param type

Open katkevich opened this issue 9 years ago • 0 comments

There is an issue with non trivial Parameters type in. Here is an example: enum class MyEnum { One, Two }; struct TestCaseParam { const char* name; MyEnum enumVal; }; class TestCase : public testing::TestWithParam<TestCaseParam>

INSTANTIATE_TEST_CASE_P(Prefix, TestCase, testing::Values( TestCaseParam{ "Name", MyEnum::One } ));

TEST_P(TestCase, test) { ... }

First issue: Test Explorer cannot deal with test\0 #GetParam() = <structure binary> in this case. So my fix just removes the #GetParam ... part.

Second issue: In this example testSuite will be Prefix\TestCase and testMethod will be test\0 #GetParam() = bla-bla-bla and adapter will be trying to find Prefix\TestCase_test\0_Test::TestBody() method and of course cannot find it. So we need transform this path to TestCase_test_Test::TestBody() one.

katkevich avatar Mar 11 '16 12:03 katkevich