bool TestDependGraph::VerifyDependency(DependencyGraph::KindOf kindOf,
                                       const char *input1,
                                       const char *input2 /* = NULL */,
                                       const char *parent /* = "f2" */,
                                       const char *child /* = "f1" */,
                                       const char *file /* = "" */,
                                       int line /* = 0 */) {
  ASSERT(input1);

  Option::IncludeRoots["$_SERVER['PHP_ROOT']"] = "";
  AnalysisResultPtr ar(new AnalysisResult());
  BuiltinSymbols::Load(ar);
  Parser::ParseString(input1, ar, "f1");
  if (input2) Parser::ParseString(input2, ar, "f2");
  ar->analyzeProgram();
  ar->inferTypes();
  DependencyGraphPtr dg = ar->getDependencyGraph();
  const StringToConstructPtrMap &children = dg->getAllChildren(kindOf, parent);
  if ((*child && children.find(child) == children.end()) ||
      (!*child && !children.empty())) {
    ostringstream graph;
    JSON::OutputStream(graph) << ar->getDependencyGraph();
    printf("%s:%d: dependency missing\n%s\n", file, line,
           graph.str().c_str());
    return false;
  }
  return true;
}