Skip to content

Commit

Permalink
testrunner: fixed suppression of valueflow messages
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave committed Apr 6, 2024
1 parent 6409f1f commit 2903b09
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 24 deletions.
15 changes: 11 additions & 4 deletions test/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,22 @@ struct make_default_obj
};

inline std::string filter_valueflow(const std::string& s) {
bool filtered = false;
std::istringstream istr(s);
std::ostringstream ostr;
std::string ostr;
std::string errline;
while (std::getline(istr, errline)) {
if (errline.find("valueflow.cpp") == std::string::npos) {
ostr << errline << '\n'; // TODO: last line might not contain a newline
if (errline.find("valueflow.cpp") != std::string::npos)
{
filtered = true;
continue;
}
ostr += errline;
ostr += '\n'; // TODO: last line might not contain a newline
}
return ostr.str();
if (!filtered)
throw std::runtime_error("no valueflow.cpp messages were filtered");
return ostr;
}

#endif // helpersH
Loading

0 comments on commit 2903b09

Please sign in to comment.