From cc8c498ebbd6dc5eb9acbb1bdfa0b39116d874d6 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Thu, 4 Feb 2016 09:10:20 +0100 Subject: [PATCH] Moved a few tests to testgarbage.cpp --- test/testgarbage.cpp | 29 +++++++++++++++++++++++++++-- test/testother.cpp | 2 -- test/testsimplifytokens.cpp | 15 --------------- test/teststring.cpp | 6 ------ 4 files changed, 27 insertions(+), 25 deletions(-) diff --git a/test/testgarbage.cpp b/test/testgarbage.cpp index f73cf01c6..e89f3cce2 100644 --- a/test/testgarbage.cpp +++ b/test/testgarbage.cpp @@ -224,8 +224,12 @@ private: TEST_CASE(garbageCode173); // #6781 TEST_CASE(garbageCode174); // #7356 TEST_CASE(garbageCode175); - TEST_CASE(garbageCode176); - TEST_CASE(garbageCode177); + TEST_CASE(garbageCode176); // #7527 + TEST_CASE(garbageCode177); // #7321 + TEST_CASE(garbageCode178); // #3441 + TEST_CASE(garbageCode179); // #3533 + TEST_CASE(garbageCode180); + TEST_CASE(garbageCode181); TEST_CASE(garbageValueFlow); TEST_CASE(garbageSymbolDatabase); TEST_CASE(garbageAST); @@ -1484,6 +1488,27 @@ private: void garbageCode177() { // #7321 checkCode("{(){(())}}r&const"); } + + void garbageCode178() { // #3441 + checkCode("%: return ; ()"); + } + + void garbageCode179() { // #3533 + checkCode("\n" + "{\n" + " struct {\n" + " typename D4:typename Base\n" + " };\n" + "};"); + } + + void garbageCode180() { + checkCode("int"); + } + + void garbageCode181() { + checkCode("int test() { int +; }"); + } }; REGISTER_TEST(TestGarbage) diff --git a/test/testother.cpp b/test/testother.cpp index 894f79c49..eabb8dfc7 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -2694,8 +2694,6 @@ private: "}"); ASSERT_EQUALS("", errout.str()); // #3457 - check("%: return ; ()"); // Don't crash. #3441. - // #3383. TODO: Use preprocessor check("int foo() {\n" "\n" // #ifdef A diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index 58c5d4ac0..62cc20ef8 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -232,7 +232,6 @@ private: TEST_CASE(simplifyStructDecl2); // ticket #2579 TEST_CASE(simplifyStructDecl3); TEST_CASE(simplifyStructDecl4); - TEST_CASE(simplifyStructDecl5); // ticket #3533 (segmentation fault) TEST_CASE(simplifyStructDecl6); // ticket #3732 TEST_CASE(simplifyStructDecl7); // ticket #476 (static anonymous struct array) @@ -3819,17 +3818,6 @@ private: ASSERT_EQUALS(expected, tok(code, false)); } - void simplifyStructDecl5() { - const char code[] = "\n" - "{\n" - " struct {\n" - " typename D4:typename Base\n" - " };\n" - "};\n"; - //don't crash - tok(code, false); - } - void simplifyStructDecl6() { ASSERT_EQUALS("struct A { " "char integers [ X ] ; " @@ -4058,9 +4046,6 @@ private: " int a [ 10 ] ;" " memset ( a + 4 , 0 , 80 ) ;" " }", tok(code, true)); - - // Don't crash - tok("int", true); } void simplifyCharAt() { // ticket #4481 diff --git a/test/teststring.cpp b/test/teststring.cpp index 91dba207e..767770356 100644 --- a/test/teststring.cpp +++ b/test/teststring.cpp @@ -44,7 +44,6 @@ private: TEST_CASE(strPlusChar1); // "/usr" + '/' TEST_CASE(strPlusChar2); // "/usr" + ch TEST_CASE(strPlusChar3); // ok: path + "/sub" + '/' - TEST_CASE(strPlusChar4); // ast TEST_CASE(sprintf1); // Dangerous usage of sprintf TEST_CASE(sprintf2); @@ -484,11 +483,6 @@ private: ASSERT_EQUALS("", errout.str()); } - void strPlusChar4() { - // don't crash - check("int test() { int +; }"); - } - void incorrectStringCompare() { check("int f() {\n"