TestPreprocessor: Fix output

This commit is contained in:
Daniel Marjamäki 2016-08-06 13:28:24 +02:00
parent d1406d51e5
commit b86c2689b3
3 changed files with 7 additions and 18 deletions

View File

@ -578,7 +578,7 @@ std::string Preprocessor::getcode(const std::string &filedata, const std::string
setDirectives(tokens1);
reportOutput(outputList, true);
if (hasErrors(outputList))
return "";

View File

@ -184,8 +184,9 @@ public:
*/
void dump(std::ostream &out) const;
private:
void reportOutput(const simplecpp::OutputList &outputList, bool showerror);
private:
void missingInclude(const std::string &filename, unsigned int linenr, const std::string &header, HeaderTypes headerType);
void error(const std::string &filename, unsigned int linenr, const std::string &msg);

View File

@ -53,21 +53,9 @@ public:
simplecpp::preprocess(tokens2, tokens1, files, filedata, simplecpp::DUI(), &outputList);
if (errorLogger) {
for (simplecpp::OutputList::const_iterator it = outputList.begin(); it != outputList.end(); ++it) {
const simplecpp::Output &msg = *it;
if (msg.type == simplecpp::Output::ERROR) {
std::list<ErrorLogger::ErrorMessage::FileLocation> locationList;
ErrorLogger::ErrorMessage::FileLocation loc(msg.location.file(), msg.location.line);
locationList.push_back(loc);
errorLogger->reportErr(ErrorLogger::ErrorMessage(locationList,
emptyString,
Severity::error,
msg.msg,
"preprocessorError",
false));
}
}
Settings settings;
Preprocessor p(settings, errorLogger);
p.reportOutput(outputList, true);
}
return tokens2.stringify();
@ -1661,7 +1649,7 @@ private:
// Compare results..
ASSERT_EQUALS(1, static_cast<unsigned int>(actual.size()));
ASSERT_EQUALS("", actual[""]);
ASSERT_EQUALS("[file.c:6]: (error) Syntax error. Wrong number of parameters for macro 'BC'.\n", errout.str());
ASSERT_EQUALS("[file.c:6]: (error) Wrong number of parameters for macro 'BC'.\n", errout.str());
}
void newline_in_macro() {