give more information (at most 35 chars before and after) for too long lines

add tests for giving more informations for too long lines

add edge tests for giving more informations for too long lines

avoid printing out tailing white space

update test case after avoiding printing out trailing whitespace

update test case for removing the pre-release warning from reference

refactor the code to if-else flavor

rename folder to cmdlineErrorReports under test

rename folder to cmdlineErrorReports under test

ignore whitespace for reference files

avoiding to modify the file stderr_path by call sed without -i option

print ' ...' instead of ' ... ' at the end of a line
This commit is contained in:
liangdzou
2018-09-13 09:55:54 +08:00
parent 9214c7c34f
commit 558a4ac49c
14 changed files with 90 additions and 4 deletions
@@ -55,8 +55,14 @@ void SourceReferenceFormatter::printSourceLocation(SourceLocation const* _locati
}
if (line.length() > 150)
{
line = " ... " + line.substr(startColumn, locationLength) + " ... ";
startColumn = 5;
int len = line.length();
line = line.substr(max(0, startColumn - 35), min(startColumn, 35) + min(locationLength + 35, len - startColumn));
if (startColumn + locationLength + 35 < len)
line += " ...";
if (startColumn > 35) {
line = " ... " + line;
startColumn = 40;
}
endColumn = startColumn + locationLength;
}