cleanup tests

This commit is contained in:
Daniel Marjamäki 2016-07-18 10:42:03 +02:00
parent 4f051bf9dd
commit b9443771fb
2 changed files with 202 additions and 382 deletions

View File

@ -992,7 +992,7 @@ std::string Token::stringifyList(bool varid, bool attributes, bool linenumbers,
std::ostringstream ret;
unsigned int lineNumber = _linenr;
unsigned int lineNumber = _linenr - (linenumbers ? 1U : 0U);
unsigned int fileInd = files ? ~0U : _fileIndex;
std::map<int, unsigned int> lineNumbers;
for (const Token *tok = this; tok != end; tok = tok->next()) {
@ -1009,6 +1009,7 @@ std::string Token::stringifyList(bool varid, bool attributes, bool linenumbers,
ret << fileNames->at(tok->_fileIndex);
else
ret << fileInd;
ret << '\n';
}
lineNumber = lineNumbers[fileInd];
@ -1020,6 +1021,8 @@ std::string Token::stringifyList(bool varid, bool attributes, bool linenumbers,
ret << '\n' << lineNumber+1 << ":\n|\n";
ret << tok->linenr()-1 << ":\n";
ret << tok->linenr() << ": ";
} else if (this == tok && linenumbers) {
ret << tok->linenr() << ": ";
} else {
while (lineNumber < tok->linenr()) {
++lineNumber;
@ -1038,7 +1041,7 @@ std::string Token::stringifyList(bool varid, bool attributes, bool linenumbers,
if (tok->next() != end && (!linebreaks || (tok->next()->linenr() <= tok->linenr() && tok->next()->fileIndex() == tok->fileIndex())))
ret << ' ';
}
if (linebreaks && files)
if (linebreaks && (files || linenumbers))
ret << '\n';
return ret.str();
}

File diff suppressed because it is too large Load Diff