Improved readability of testsuite output when ASSERT_EQUALS_MSG fails.
Fixed another true positive in checkbufferoverrun.cpp AStyle
This commit is contained in:
parent
e8c7a723f5
commit
9b307cf8e0
|
@ -1423,7 +1423,7 @@ bool CheckBufferOverrun::isArrayOfStruct(const Token* tok, int &position)
|
||||||
|
|
||||||
void CheckBufferOverrun::checkReadlinkBufferUsage(const Token* ftok, const Token *scope_begin, const unsigned int varid, const MathLib::bigint total_size)
|
void CheckBufferOverrun::checkReadlinkBufferUsage(const Token* ftok, const Token *scope_begin, const unsigned int varid, const MathLib::bigint total_size)
|
||||||
{
|
{
|
||||||
const std::string funcname = ftok->str();
|
const std::string& funcname = ftok->str();
|
||||||
|
|
||||||
const Token* bufParam = ftok->tokAt(2)->nextArgument();
|
const Token* bufParam = ftok->tokAt(2)->nextArgument();
|
||||||
if (funcname == "readlinkat")
|
if (funcname == "readlinkat")
|
||||||
|
|
|
@ -135,15 +135,17 @@ void TestFixture::assertEquals(const char *filename, unsigned int linenr, const
|
||||||
<< writestr(actual, true)
|
<< writestr(actual, true)
|
||||||
<< '.'
|
<< '.'
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
if (!msg.empty())
|
||||||
|
errmsg << msg << std::endl;
|
||||||
} else {
|
} else {
|
||||||
errmsg << "Assertion failed in " << filename << " at line " << linenr << std::endl
|
errmsg << "Assertion failed in " << filename << " at line " << linenr << std::endl
|
||||||
<< "Expected:" << std::endl
|
<< "Expected:" << std::endl
|
||||||
<< writestr(expected) << std::endl
|
<< writestr(expected) << std::endl
|
||||||
<< "Actual:" << std::endl
|
<< "Actual:" << std::endl
|
||||||
<< writestr(actual) << std::endl << "_____" << std::endl;
|
<< writestr(actual) << std::endl;
|
||||||
}
|
if (!msg.empty())
|
||||||
if (!msg.empty()) {
|
errmsg << "Hint:" << std::endl << msg << std::endl;
|
||||||
errmsg << msg << std::endl;
|
errmsg << "_____" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -891,15 +891,14 @@ private:
|
||||||
" )\n"
|
" )\n"
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
tokenizeAndStringify(code);
|
tokenizeAndStringify(code);
|
||||||
assertThrowFail(__FILE__, __LINE__);
|
assertThrowFail(__FILE__, __LINE__);
|
||||||
}
|
} catch (InternalError& e) {
|
||||||
catch (InternalError& e) {
|
ASSERT_EQUALS("Analysis failed. If the code is valid then please report this failure.", e.errorMessage);
|
||||||
ASSERT_EQUALS("Analysis failed. If the code is valid then please report this failure.", e.errorMessage);
|
ASSERT_EQUALS("cppcheckError", e.id);
|
||||||
ASSERT_EQUALS("cppcheckError", e.id);
|
ASSERT_EQUALS(5, e.token->linenr());
|
||||||
ASSERT_EQUALS(5, e.token->linenr());
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wrong_syntax4() { // #3618
|
void wrong_syntax4() { // #3618
|
||||||
|
|
Loading…
Reference in New Issue