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)
|
||||
{
|
||||
const std::string funcname = ftok->str();
|
||||
const std::string& funcname = ftok->str();
|
||||
|
||||
const Token* bufParam = ftok->tokAt(2)->nextArgument();
|
||||
if (funcname == "readlinkat")
|
||||
|
|
|
@ -135,15 +135,17 @@ void TestFixture::assertEquals(const char *filename, unsigned int linenr, const
|
|||
<< writestr(actual, true)
|
||||
<< '.'
|
||||
<< std::endl;
|
||||
if (!msg.empty())
|
||||
errmsg << msg << std::endl;
|
||||
} else {
|
||||
errmsg << "Assertion failed in " << filename << " at line " << linenr << std::endl
|
||||
<< "Expected:" << std::endl
|
||||
<< writestr(expected) << std::endl
|
||||
<< "Actual:" << std::endl
|
||||
<< writestr(actual) << std::endl << "_____" << std::endl;
|
||||
}
|
||||
if (!msg.empty()) {
|
||||
errmsg << msg << std::endl;
|
||||
<< writestr(actual) << std::endl;
|
||||
if (!msg.empty())
|
||||
errmsg << "Hint:" << std::endl << msg << std::endl;
|
||||
errmsg << "_____" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -894,8 +894,7 @@ private:
|
|||
try {
|
||||
tokenizeAndStringify(code);
|
||||
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("cppcheckError", e.id);
|
||||
ASSERT_EQUALS(5, e.token->linenr());
|
||||
|
|
Loading…
Reference in New Issue