Fixed unit tests
This commit is contained in:
parent
1f48b082d1
commit
dc79f9630f
|
@ -78,12 +78,13 @@
|
||||||
/*static*/ FILE* CppCheckExecutor::exceptionOutput = stdout;
|
/*static*/ FILE* CppCheckExecutor::exceptionOutput = stdout;
|
||||||
|
|
||||||
CppCheckExecutor::CppCheckExecutor()
|
CppCheckExecutor::CppCheckExecutor()
|
||||||
: _settings(0), time1(0), errorOutput(stderr), errorlist(false)
|
: _settings(0), time1(0), errorOutput(nullptr), errorlist(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CppCheckExecutor::~CppCheckExecutor()
|
CppCheckExecutor::~CppCheckExecutor()
|
||||||
{
|
{
|
||||||
|
delete errorOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* const argv[])
|
bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* const argv[])
|
||||||
|
@ -809,7 +810,7 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck, int /*argc*/, const cha
|
||||||
time1 = std::time(0);
|
time1 = std::time(0);
|
||||||
|
|
||||||
if (!settings.outputFile.empty()) {
|
if (!settings.outputFile.empty()) {
|
||||||
errorOutput = fopen(settings.outputFile.c_str(), "wt");
|
errorOutput = new std::ofstream(settings.outputFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.xml) {
|
if (settings.xml) {
|
||||||
|
@ -927,7 +928,10 @@ void CppCheckExecutor::reportErr(const std::string &errmsg)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_errorList.insert(errmsg);
|
_errorList.insert(errmsg);
|
||||||
std::fprintf(errorOutput, "%s\n", errmsg.c_str());
|
if (errorOutput)
|
||||||
|
*errorOutput << errmsg << std::endl;
|
||||||
|
else
|
||||||
|
std::cerr << errmsg << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppCheckExecutor::reportOut(const std::string &outmsg)
|
void CppCheckExecutor::reportOut(const std::string &outmsg)
|
||||||
|
|
|
@ -177,9 +177,9 @@ private:
|
||||||
static FILE* exceptionOutput;
|
static FILE* exceptionOutput;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error output (default stderr)
|
* Error output
|
||||||
*/
|
*/
|
||||||
FILE* errorOutput;
|
std::ofstream *errorOutput;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Has --errorlist been given?
|
* Has --errorlist been given?
|
||||||
|
|
Loading…
Reference in New Issue