use of org.drools.drl.parser.lang.ExpanderException in project drools by kiegroup.
the class DefaultExpanderTest method testANTLRLineNumberError.
@Test
public void testANTLRLineNumberError() throws Exception {
DSLTokenizedMappingFile file = new DSLTokenizedMappingFile();
String dsl = "[when]foo=Foo()" + NL + "[then]bar {num}=baz({num});";
file.parseAndLoad(new StringReader(dsl));
DefaultExpander ex = new DefaultExpander();
ex.addDSLMapping(file.getMapping());
String source = "rule 'q'" + NL + "agenda-group 'x'" + NL + "when" + NL + " __ " + NL + "then" + NL + " bar 42" + NL + "\tgoober" + NL + "end";
ex.expand(source);
assertTrue(ex.hasErrors());
assertEquals(2, ex.getErrors().size());
ExpanderException err = (ExpanderException) ex.getErrors().get(0);
assertEquals(4, err.getLine());
err = (ExpanderException) ex.getErrors().get(1);
assertEquals(7, err.getLine());
}
Aggregations