Program: 160764
Project: 160764
Buggy source:
/** 
 * AST_CLOSURE nodes are function-declaring nodes for closures (anonymous functions). We always give them the artificial name "{closure}". Any AST_CLOSURE node has exactly four children: 1) AST_PARAM_LIST 2) AST_CLOSURE_USES or NULL 3) AST_STMT_LIST 4) AST_NAME or NULL, indicating the return type This test checks a closure's pseudo-name and children in the following PHP code: $a = function() use ($foo) : int {}; It also checks that a ClosureExpression holding the Closure is created.
 */
@Test public void testClosureCreation() throws IOException, InvalidCSVFile {
  String nodeStr=CSVASTSamples.closureNodeStr;
  String edgeStr=CSVASTSamples.closureEdgeStr;
  handle(nodeStr,edgeStr);
  ASTNode node=ast.getNodeById((long)6);
  assertThat(node,instanceOf(Closure.class));
  assertEquals("String_Node_Str",((Closure)node).getName());
  assertEquals(4,node.getChildCount());
  assertEquals(ast.getNodeById((long)7),((Closure)node).getParameterList());
  assertEquals(ast.getNodeById((long)8),((Closure)node).getClosureUses());
  assertEquals(ast.getNodeById((long)11),((Closure)node).getContent());
  assertEquals(ast.getNodeById((long)12),((Closure)node).getReturnType());
  assertEquals(ast.getNodeById((long)13),((Closure)node).getReturnType().getNameChild());
  assertEquals("String_Node_Str",((Closure)node).getReturnType().getNameChild().getEscapedCodeStr());
  ASTNode node2=ast.getNodeById((long)3);
  assertThat(node2,instanceOf(AssignmentExpression.class));
  ASTNode node3=((AssignmentExpression)node2).getRight();
  assertThat(node3,instanceOf(ClosureExpression.class));
  assertEquals(node,((ClosureExpression)node3).getClosure());
}

Fixed version (ground truth):
/** 
 * AST_CLOSURE nodes are function-declaring nodes for closures (anonymous functions). We always give them the artificial name "{closure}". Any AST_CLOSURE node has exactly four children: 1) AST_PARAM_LIST 2) AST_CLOSURE_USES or NULL 3) AST_STMT_LIST 4) AST_NAME or NULL, indicating the return type This test checks a closure's pseudo-name and children in the following PHP code: $a = function() use ($foo) : int {}; It also checks that a ClosureExpression holding the Closure is created.
 */
@Test public void testClosureCreation() throws IOException, InvalidCSVFile {
  String nodeStr=CSVASTSamples.closureNodeStr;
  String edgeStr=CSVASTSamples.closureEdgeStr;
  handle(nodeStr,edgeStr);
  ASTNode node=ast.getNodeById((long)6);
  assertThat(node,instanceOf(Closure.class));
  assertEquals("String_Node_Str",((Closure)node).getName());
  assertEquals(4,node.getChildCount());
  assertEquals(ast.getNodeById((long)7),((Closure)node).getParameterList());
  assertEquals(ast.getNodeById((long)8),((Closure)node).getClosureUses());
  assertEquals(ast.getNodeById((long)11),((Closure)node).getContent());
  assertEquals(ast.getNodeById((long)12),((Closure)node).getReturnType());
  assertEquals(ast.getNodeById((long)13),((Closure)node).getReturnType().getNameChild());
  assertEquals("String_Node_Str",((Closure)node).getReturnType().getNameChild().getEscapedCodeStr());
  ASTNode node2=ast.getNodeById((long)3);
  assertThat(node2,instanceOf(AssignmentExpression.class));
  ASTNode node3=((AssignmentExpression)node2).getRight();
  assertThat(node3,instanceOf(ClosureExpression.class));
  assertEquals(node,((ClosureExpression)node3).getClosure());
  assertEquals(node.getNodeId(),node3.getNodeId());
}