Fixes false positives in test suite, adds unit test for void-simplification
This commit is contained in:
parent
49fd057e17
commit
d6261debdf
|
@ -383,6 +383,9 @@ private:
|
|||
|
||||
TEST_CASE(simplifyFunctionReturn);
|
||||
|
||||
// void foo(void) -> void foo()
|
||||
TEST_CASE(removeVoidFromFunction);
|
||||
|
||||
TEST_CASE(removeUnnecessaryQualification1);
|
||||
TEST_CASE(removeUnnecessaryQualification2);
|
||||
TEST_CASE(removeUnnecessaryQualification3);
|
||||
|
@ -7346,6 +7349,10 @@ private:
|
|||
ASSERT_EQUALS(expected, tok(code, false));
|
||||
}
|
||||
|
||||
void removeVoidFromFunction() {
|
||||
ASSERT_EQUALS("void foo ( ) ;", tok("void foo(void);"));
|
||||
}
|
||||
|
||||
void removeUnnecessaryQualification1() {
|
||||
const char code[] = "class Fred { Fred::Fred() {} };";
|
||||
const char expected[] = "class Fred { Fred ( ) { } } ;";
|
||||
|
|
|
@ -5018,7 +5018,7 @@ private:
|
|||
|
||||
{
|
||||
const char code[] = "class S { int function(void); };";
|
||||
ASSERT_EQUALS("class S { int function ( void ) ; } ;", tokenizeAndStringify(code));
|
||||
ASSERT_EQUALS("class S { int function ( ) ; } ;", tokenizeAndStringify(code));
|
||||
checkSimplifyInitVar(code);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
@ -5032,7 +5032,7 @@ private:
|
|||
|
||||
{
|
||||
const char code[] = "int function(void);";
|
||||
ASSERT_EQUALS("int function ( void ) ;", tokenizeAndStringify(code));
|
||||
ASSERT_EQUALS("int function ( ) ;", tokenizeAndStringify(code));
|
||||
checkSimplifyInitVar(code);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
@ -5046,14 +5046,14 @@ private:
|
|||
|
||||
{
|
||||
const char code[] = "extern int function(void);";
|
||||
ASSERT_EQUALS("extern int function ( void ) ;", tokenizeAndStringify(code));
|
||||
ASSERT_EQUALS("extern int function ( ) ;", tokenizeAndStringify(code));
|
||||
checkSimplifyInitVar(code);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
{
|
||||
const char code[] = "int function1(void); int function2(void);";
|
||||
ASSERT_EQUALS("int function1 ( void ) ; int function2 ( void ) ;", tokenizeAndStringify(code));
|
||||
ASSERT_EQUALS("int function1 ( ) ; int function2 ( ) ;", tokenizeAndStringify(code));
|
||||
checkSimplifyInitVar(code);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue