Fix #9964 (false positive: compareBoolExpressionWithInt with ASSERT_FALSE() and --library=googletest) (#2876)
This commit is contained in:
parent
e053066d8b
commit
98946143f6
|
@ -3,7 +3,7 @@
|
|||
<!-- see https://github.com/google/googletest/blob/master/googletest/docs/primer.md -->
|
||||
<define name="ASSERT_TRUE(cond)" value="assert(cond)"/>
|
||||
<define name="EXPECT_TRUE(cond)" value="(void)(cond)"/>
|
||||
<define name="ASSERT_FALSE(cond)" value="assert(!cond)"/>
|
||||
<define name="ASSERT_FALSE(cond)" value="assert(!(cond))"/>
|
||||
<define name="EXPECT_FALSE(cond)" value="(void)(cond)"/>
|
||||
<define name="ASSERT_EQ(val1,val2)" value="assert((val1)==(val2))"/>
|
||||
<define name="EXPECT_EQ(val1,val2)" value="(void)((val1)==(val2))"/>
|
||||
|
|
|
@ -44,3 +44,9 @@ TEST(test_cppcheck, cppcheck)
|
|||
ASSERT_THROW(it.operator->(), std::out_of_range);
|
||||
}
|
||||
|
||||
// #9964 - avoid compareBoolExpressionWithInt false positive
|
||||
TEST(Test, assert_false_fp)
|
||||
{
|
||||
// cppcheck-suppress checkLibraryNoReturn
|
||||
ASSERT_FALSE(errno < 0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue