Refactoring: Changed 'possible style' to 'style'
This commit is contained in:
parent
d19dd2c61d
commit
bd22a18dc1
|
@ -3602,12 +3602,12 @@ void CheckOther::emptyStringTestError(const Token *tok, const std::string &var_n
|
|||
{
|
||||
if (isTestForEmpty)
|
||||
{
|
||||
reportError(tok, Severity::possibleStyle,
|
||||
reportError(tok, Severity::style,
|
||||
"emptyStringTest", "Empty string test can be simplified to \"*" + var_name + " == '\\0'\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
reportError(tok, Severity::possibleStyle,
|
||||
reportError(tok, Severity::style,
|
||||
"emptyStringTest", "Non-empty string test can be simplified to \"*" + var_name + " != '\\0'\"");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2448,31 +2448,31 @@ private:
|
|||
" std::cout << str;\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (possible style) Empty string test can be simplified to \"*str == '\\0'\"\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:3]: (style) Empty string test can be simplified to \"*str == '\\0'\"\n", errout.str());
|
||||
|
||||
check("if (!strlen(str)) { }");
|
||||
ASSERT_EQUALS("[test.cpp:1]: (possible style) Empty string test can be simplified to \"*str == '\\0'\"\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:1]: (style) Empty string test can be simplified to \"*str == '\\0'\"\n", errout.str());
|
||||
|
||||
check("if (strlen(str) == 0) { }");
|
||||
ASSERT_EQUALS("[test.cpp:1]: (possible style) Empty string test can be simplified to \"*str == '\\0'\"\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:1]: (style) Empty string test can be simplified to \"*str == '\\0'\"\n", errout.str());
|
||||
|
||||
check("if (strlen(str)) { }");
|
||||
ASSERT_EQUALS("[test.cpp:1]: (possible style) Non-empty string test can be simplified to \"*str != '\\0'\"\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:1]: (style) Non-empty string test can be simplified to \"*str != '\\0'\"\n", errout.str());
|
||||
|
||||
check("if (strlen(str) > 0) { }");
|
||||
ASSERT_EQUALS("[test.cpp:1]: (possible style) Non-empty string test can be simplified to \"*str != '\\0'\"\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:1]: (style) Non-empty string test can be simplified to \"*str != '\\0'\"\n", errout.str());
|
||||
|
||||
check("if (strlen(str) != 0) { }");
|
||||
ASSERT_EQUALS("[test.cpp:1]: (possible style) Non-empty string test can be simplified to \"*str != '\\0'\"\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:1]: (style) Non-empty string test can be simplified to \"*str != '\\0'\"\n", errout.str());
|
||||
|
||||
check("if (0 != strlen(str)) { }");
|
||||
ASSERT_EQUALS("[test.cpp:1]: (possible style) Non-empty string test can be simplified to \"*str != '\\0'\"\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:1]: (style) Non-empty string test can be simplified to \"*str != '\\0'\"\n", errout.str());
|
||||
|
||||
check("if (0 == strlen(str)) { }");
|
||||
ASSERT_EQUALS("[test.cpp:1]: (possible style) Empty string test can be simplified to \"*str == '\\0'\"\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:1]: (style) Empty string test can be simplified to \"*str == '\\0'\"\n", errout.str());
|
||||
|
||||
check("if (0 < strlen(str)) { }");
|
||||
ASSERT_EQUALS("[test.cpp:1]: (possible style) Non-empty string test can be simplified to \"*str != '\\0'\"\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:1]: (style) Non-empty string test can be simplified to \"*str != '\\0'\"\n", errout.str());
|
||||
}
|
||||
|
||||
void fflushOnInputStreamTest()
|
||||
|
|
Loading…
Reference in New Issue