-
Notifications
You must be signed in to change notification settings - Fork 45
Closed
Labels
comp-codegenIssue is related to code generatorIssue is related to code generatorctg-bugIssue is a bugIssue is a bugspec-release-tailingsFailed to include in the current release, let's include it in the next oneFailed to include in the current release, let's include it in the next one
Milestone
Description
Description
Try to generate tests for the following class, set timeout at least to 60s.
import org.antlr.runtime.tree.TreeVisitor;
import org.antlr.runtime.tree.TreeVisitorAction;
import org.antlr.v4.parse.GrammarASTAdaptor;
import org.antlr.v4.tool.ast.GrammarAST;
public class Grammarin {
public void setGrammarPtr(final org.antlr.v4.tool.Grammar g, GrammarAST tree) {
if (tree != null) {
TreeVisitor v = new TreeVisitor(new GrammarASTAdaptor());
v.visit(tree, new TreeVisitorAction() {
public Object pre(Object t) {
((GrammarAST) t).g = g;
return t;
}
public Object post(Object t) {
return t;
}
});
}
}
}
The following code i generated:
@Test
@DisplayName("setGrammarPtr: -> tree != null : True")
public void testSetGrammarPtr_TreeNotEqualsNull_2() throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
Grammarin grammarin = new Grammarin();
GrammarRootAST tree = new GrammarRootAST(null);
tree.token = null;
Class baseTreeClazz = Class.forName("org.antlr.runtime.tree.BaseTree");
Field childrenField = baseTreeClazz.getDeclaredField("children");
childrenField.setAccessible(true);
childrenField.get(tree) = new ArrayList();
grammarin.setGrammarPtr(null, tree);
}
Line with getter leads to the compilation error
childrenField.get(tree) = new ArrayList(); - variable expected
Metadata
Metadata
Assignees
Labels
comp-codegenIssue is related to code generatorIssue is related to code generatorctg-bugIssue is a bugIssue is a bugspec-release-tailingsFailed to include in the current release, let's include it in the next oneFailed to include in the current release, let's include it in the next one
Type
Projects
Status
Done