Added unit test for #4290

This commit is contained in:
Alexander Mai 2012-10-19 20:04:43 +02:00 committed by PKEuS
parent d459b6acb1
commit 1881898e67
1 changed files with 18 additions and 0 deletions

View File

@ -161,6 +161,8 @@ private:
TEST_CASE(initializerListOrder);
TEST_CASE(initializerListUsage);
TEST_CASE(forwardDeclaration); // ticket #4290/#3190
}
void checkCopyConstructor(const char code[]) {
@ -5398,6 +5400,22 @@ private:
"};");
ASSERT_EQUALS("[test.cpp:3]: (performance) Variable 'a' is assigned in constructor body. Consider performing initialization in initialization list.\n", errout.str());
}
// ticket #4290 "False Positive: style (noConstructor): The class 'foo' does not have a constructor."
// ticket #3190 "SymbolDatabase: Parse of sub class constructor fails"
void forwardDeclaration() {
checkConst("class foo;\n"
"int bar;\n");
ASSERT_EQUALS("", errout.str());
checkConst("class foo;\n"
"class foo;\n");
ASSERT_EQUALS("", errout.str());
checkConst("class foo{};\n"
"class foo;\n");
ASSERT_EQUALS("", errout.str());
}
};
REGISTER_TEST(TestClass)