Fixed testing of #7615. The code is not garbage so move it from TestGarbage to TestSymbolDatabase

This commit is contained in:
Daniel Marjamäki 2016-07-26 09:10:10 +02:00
parent fd19ab4ed1
commit 9082c097c8
2 changed files with 13 additions and 9 deletions

View File

@ -232,7 +232,6 @@ private:
TEST_CASE(garbageCode181);
TEST_CASE(garbageCode182); // #4195
TEST_CASE(garbageCode183); // #7505
TEST_CASE(garbageCode184); // #7615
TEST_CASE(garbageValueFlow);
TEST_CASE(garbageSymbolDatabase);
TEST_CASE(garbageAST);
@ -1522,14 +1521,6 @@ private:
ASSERT_THROW(checkCode("= { int } enum return { r = f() f(); }"), InternalError);
}
// #7615 - crash in Symboldatabase::sizeOfType
void garbageCode184() {
checkCode("enum bar;"
"void foo() {\n"
" bar cats[] = {A, B, C}\n"
" int *bla = cats[ARRAY_SIZE(cats)];\n"
" };\n");
}
};
REGISTER_TEST(TestGarbage)

View File

@ -253,6 +253,8 @@ private:
TEST_CASE(enum6);
TEST_CASE(enum7);
TEST_CASE(sizeOfType);
TEST_CASE(isImplicitlyVirtual);
TEST_CASE(isPure);
@ -2605,6 +2607,17 @@ private:
TEST(settings.sizeof_long_long);
}
void sizeOfType() {
// #7615 - crash in Symboldatabase::sizeOfType()
GET_SYMBOL_DB("enum e;\n"
"void foo() {\n"
" e abc[] = {A,B,C};\n"
" int i = abc[ARRAY_SIZE(cats)];\n"
"}");
const Token *e = Token::findsimplematch(tokenizer.tokens(), "e abc");
db->sizeOfType(e); // <- don't crash
}
void isImplicitlyVirtual() {
{
GET_SYMBOL_DB("class Base {\n"