TEST_F is defined as just string concatenation: <define name="TEST_F(A,B)" value="void __ ## A ## _ ## B ( )"/>
So there is no relation to the data type anymore.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No, we were not and that looks to make a nice difference and I added in other libraries too.
I was unsure if you could put multiple libraries on the same line or not and what that format would be. It isn't shown in the user's manual, so I did each library on a separate line.
I went back to a large repo that was already clean and by adding the libraries change it found many more warnings so thanks for this suggestion.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
2.14
style: unusedStructMember - class member 'ExampleTestFixture::MODE_OFF' is never used
class ExampleTestFixture: public ::Test
{
public:
static constexpr bool MODE_OFF = false;
};
TEST_F(ExampleTestFixture, ShowFalsePositive)
{
EXPECT_FALSE(MODE_OFF);
}
if you change to
TEST_F(ExampleTestFixture, ShowFalsePositive)
{
EXPECT_FALSE(ExampleTestFixture::MODE_OFF);
}
it works so maybe some scope confusion.
Last edit: Steve Albright 2024-04-29
So, what is going on with this one, I am having to add way too many suppression for it.
TEST_F is defined as just string concatenation:
<define name="TEST_F(A,B)" value="void __ ## A ## _ ## B ( )"/>
So there is no relation to the data type anymore.
It's a lot of new failures we didn't have before and I'd rather not globally turn the check off.
Surely the gtest framework could/should be accomidated?
Maybe you are just pointing out the concern related on how to fix?
Note, TEST() is another construct.
You are using
--library=googletest
, right? That is all the accomodation we have (in googletest.cfg).No, we were not and that looks to make a nice difference and I added in other libraries too.
I was unsure if you could put multiple libraries on the same line or not and what that format would be. It isn't shown in the user's manual, so I did each library on a separate line.
I went back to a large repo that was already clean and by adding the libraries change it found many more warnings so thanks for this suggestion.