mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-08-15 13:27:36 +00:00
Merged branch ignoring trailing whitespace in reference files. Closes !4
This commit is contained in:
@@ -47,7 +47,7 @@ abstract class ReferenceHelper {
|
|||||||
String outLine = outLines.get(i);
|
String outLine = outLines.get(i);
|
||||||
if(refLines.size()>i) {
|
if(refLines.size()>i) {
|
||||||
String refLine = refLines.get(i);
|
String refLine = refLines.get(i);
|
||||||
if(!outLine.equals(refLine)) {
|
if(!trimTrailing(outLine).equals(trimTrailing(refLine))) {
|
||||||
writeOutputFile(fileName, extension, outputString);
|
writeOutputFile(fileName, extension, outputString);
|
||||||
System.out.println(
|
System.out.println(
|
||||||
"Output does not match reference on line "+i+"\n"+
|
"Output does not match reference on line "+i+"\n"+
|
||||||
@@ -69,6 +69,21 @@ abstract class ReferenceHelper {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trim trailing whitespace from a string
|
||||||
|
* @param str The string
|
||||||
|
* @return a copy of the string with any trailing whitespace removed.
|
||||||
|
*/
|
||||||
|
public String trimTrailing(String str) {
|
||||||
|
int len = str.length();
|
||||||
|
int st = 0;
|
||||||
|
char[] val = str.toCharArray();
|
||||||
|
while ((st < len) && (val[len - 1] <= ' ')) {
|
||||||
|
len--;
|
||||||
|
}
|
||||||
|
return str.substring(st, len);
|
||||||
|
}
|
||||||
|
|
||||||
private List<String> getOutLines(String outputString) throws IOException {
|
private List<String> getOutLines(String outputString) throws IOException {
|
||||||
BufferedReader rdr = new BufferedReader(new StringReader(outputString));
|
BufferedReader rdr = new BufferedReader(new StringReader(outputString));
|
||||||
List<String> outLines = new ArrayList<>();
|
List<String> outLines = new ArrayList<>();
|
||||||
|
Reference in New Issue
Block a user