Fix googletest.cfg macros ASSERT_THROW and EXPECT_THROW to avoid syntax errors
This commit is contained in:
parent
63917bc3c3
commit
1548bf2267
|
@ -25,8 +25,8 @@
|
|||
<define name="EXPECT_STRCASEEQ(str1,str2)" value="(void)(*(str1)==*(str2))"/>
|
||||
<define name="ASSERT_STRCASENE(str1,str2)" value="assert(stricmp(str1, str2) != 0)"/>
|
||||
<define name="EXPECT_STRCASENE(str1,str2)" value="(void)(*(str1)!=*(str2))"/>
|
||||
<define name="ASSERT_THROW(code, e)" value="try{code}catch(e){}"/>
|
||||
<define name="EXPECT_THROW(code, e)" value="try{code}catch(e){}"/>
|
||||
<define name="ASSERT_THROW(code, e)" value="try{code;}catch(e){}"/>
|
||||
<define name="EXPECT_THROW(code, e)" value="try{code;}catch(e){}"/>
|
||||
<define name="TEST(A,B)" value="void __ ## A ## _ ## B ( )"/>
|
||||
<define name="TEST_F(A,B)" value="void __ ## A ## _ ## B ( )"/>
|
||||
<define name="TEST_P(A,B)" value="void __ ## A ## _ ## B ( )"/>
|
||||
|
|
|
@ -36,3 +36,11 @@ TEST(ASSERT, ASSERT)
|
|||
|
||||
free(a);
|
||||
}
|
||||
|
||||
// Avoid syntax error: https://sourceforge.net/p/cppcheck/discussion/general/thread/6ccc7283e2/
|
||||
TEST(test_cppcheck, cppcheck)
|
||||
{
|
||||
TestStruct<int> it;
|
||||
ASSERT_THROW(it.operator->(), std::out_of_range);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue