Don't strip error numbers from lines because the numbers are constants of the public API

This commit is contained in:
Sam Harwell 2012-03-27 21:52:34 -05:00
parent 8d16912fb9
commit cc7e9c1b0c
1 changed files with 0 additions and 19 deletions

View File

@ -639,29 +639,10 @@ public abstract class BaseTest {
msg = msg.replaceAll("\r","\\\\r");
msg = msg.replaceAll("\t","\\\\t");
// ignore error number
if ( expect!=null ) expect = stripErrorNum(expect);
actual = stripErrorNum(actual);
assertEquals("error in: "+msg,expect,actual);
}
}
// can be multi-line
//error(29): A.g:2:11: unknown attribute reference a in $a
//error(29): A.g:2:11: unknown attribute reference a in $a
String stripErrorNum(String errs) {
String[] lines = errs.split("\n");
for (int i=0; i<lines.length; i++) {
String s = lines[i];
int lp = s.indexOf("error(");
int rp = s.indexOf(')', lp);
if ( lp>=0 && rp>=0 ) {
lines[i] = s.substring(0, lp) + s.substring(rp+1, s.length());
}
}
return Utils.join(lines, "\n");
}
public String getFilenameFromFirstLineOfGrammar(String line) {
String fileName = "<string>";
int grIndex = line.lastIndexOf("grammar");