Tree tt = r2.expand1();
for(int i=0; i<tt.size(); i++) {
Tree t = tt.child(i);
- String[] expect = new String[t.child(2).size()];
- for(int j=0; j<t.child(2).size(); j++)
- expect[j] = stringifyChildren(t.child(2).child(j));
+ String[] expect = !"ignore output;".equals(t.child(2).head()) ? new String[t.child(2).size()] : null;
+ if (expect != null)
+ for(int j=0; j<t.child(2).size(); j++)
+ expect[j] = stringifyChildren(t.child(2).child(j));
cases.add(new TestCase(stringifyChildren(t.child(0)),
stringifyChildren(t.child(1)),
expect,
this.name = name;
this.jav = jav;
this.input = input;
- this.output = output==null ? new String[0] : output;
+ this.output = output;
this.grammar = grammar;
}
public String toString() {
String ret = "testcase {\n" + " input \""+input+"\";\n";
- for(String s : output) ret += " output \""+s+"\";\n";
+ if (output != null)
+ for(String s : output) ret += " output \""+s+"\";\n";
ret += grammar +"\n}\n";
return ret;
}
System.out.println(parser);
}
+ if (output==null) {
+ System.out.println("\r\033[32mDONE\033[0m "+name);
+ return true;
+ }
Iterable<Tree<String>> results =
res==null ? new HashSet<Tree<String>>() : res.expand();