• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TestErrorReporter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.javascript.rhino.testing.TestErrorReporter的典型用法代码示例。如果您正苦于以下问题:Java TestErrorReporter类的具体用法?Java TestErrorReporter怎么用?Java TestErrorReporter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TestErrorReporter类属于com.google.javascript.rhino.testing包,在下文中一共展示了TestErrorReporter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: parse

import com.google.javascript.rhino.testing.TestErrorReporter; //导入依赖的package包/类
private Node parse(String source, String... warnings) {
  TestErrorReporter testErrorReporter = new TestErrorReporter(null, warnings);
  Config config =
      ParserRunner.createConfig(
          mode,
          Config.JsDocParsing.INCLUDE_DESCRIPTIONS_NO_WHITESPACE,
          Config.RunMode.KEEP_GOING,
          null,
          true,
          StrictMode.SLOPPY);
  Node script = ParserRunner.parse(
      new SimpleSourceFile("input", false),
      source,
      config,
      testErrorReporter).ast;

  // verifying that all warnings were seen
  testErrorReporter.assertHasEncounteredAllErrors();
  testErrorReporter.assertHasEncounteredAllWarnings();

  return script;
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:23,代码来源:AttachJsdocsTest.java


示例2: parseFull

import com.google.javascript.rhino.testing.TestErrorReporter; //导入依赖的package包/类
private Node parseFull(String code, String... warnings) {
  TestErrorReporter testErrorReporter = new TestErrorReporter(null, warnings);
  Config config =
      Config.builder()
          .setExtraAnnotationNames(extraAnnotations)
          .setJsDocParsingMode(JsDocParsing.INCLUDE_DESCRIPTIONS_NO_WHITESPACE)
          .setRunMode(RunMode.KEEP_GOING)
          .setSuppressionNames(extraSuppressions)
          .setLanguageMode(LanguageMode.ECMASCRIPT3)
          .setParseInlineSourceMaps(true)
          .setStrictMode(StrictMode.SLOPPY)
          .build();

  ParseResult result = ParserRunner.parse(
      new SimpleSourceFile("source", false), code, config, testErrorReporter);

  testErrorReporter.assertHasEncounteredAllWarnings();
  return result.ast;
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:20,代码来源:JsDocInfoParserTest.java


示例3: parseError

import com.google.javascript.rhino.testing.TestErrorReporter; //导入依赖的package包/类
/**
 * Verify that the given code has the given parse errors.
 * @return If in IDE mode, returns a partial tree.
 */
private Node parseError(String source, String... errors) {
  TestErrorReporter testErrorReporter = new TestErrorReporter(errors, null);
  ParseResult result = ParserRunner.parse(
      new SimpleSourceFile("input", false),
      source,
      createConfig(),
      testErrorReporter);
  Node script = result.ast;

  // check expected features if specified
  assertFS(result.features).contains(expectedFeatures);

  // verifying that all errors were seen
  testErrorReporter.assertHasEncounteredAllErrors();
  testErrorReporter.assertHasEncounteredAllWarnings();

  return script;
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:23,代码来源:ParserTest.java


示例4: doParse

import com.google.javascript.rhino.testing.TestErrorReporter; //导入依赖的package包/类
private ParserRunner.ParseResult doParse(String string, String... warnings) {
  TestErrorReporter testErrorReporter = new TestErrorReporter(null, warnings);
  StaticSourceFile file = new SimpleSourceFile("input", false);
  ParserRunner.ParseResult result = ParserRunner.parse(
      file,
      string,
      createConfig(),
      testErrorReporter);

  // check expected features if specified
  assertFS(result.features).contains(expectedFeatures);

  // verifying that all warnings were seen
  testErrorReporter.assertHasEncounteredAllErrors();
  testErrorReporter.assertHasEncounteredAllWarnings();
  return result;
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:18,代码来源:ParserTest.java


示例5: testCheckTreeTypeAwareEqualsSame

import com.google.javascript.rhino.testing.TestErrorReporter; //导入依赖的package包/类
public void testCheckTreeTypeAwareEqualsSame() {
  TestErrorReporter testErrorReporter = new TestErrorReporter(null, null);
  JSTypeRegistry registry = new JSTypeRegistry(testErrorReporter);
  Node node1 = Node.newString(Token.NAME, "f");
  node1.setJSType(registry.getNativeType(JSTypeNative.NUMBER_TYPE));
  Node node2 = Node.newString(Token.NAME, "f");
  node2.setJSType(registry.getNativeType(JSTypeNative.NUMBER_TYPE));
  assertTrue(node1.checkTreeTypeAwareEqualsSilent(node2));
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:10,代码来源:NodeTest.java


示例6: testCheckTreeTypeAwareEqualsSameNull

import com.google.javascript.rhino.testing.TestErrorReporter; //导入依赖的package包/类
public void testCheckTreeTypeAwareEqualsSameNull() {
  TestErrorReporter testErrorReporter = new TestErrorReporter(null, null);
  JSTypeRegistry registry = new JSTypeRegistry(testErrorReporter);
  Node node1 = Node.newString(Token.NAME, "f");
  Node node2 = Node.newString(Token.NAME, "f");
  assertTrue(node1.checkTreeTypeAwareEqualsSilent(node2));
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:8,代码来源:NodeTest.java


示例7: testCheckTreeTypeAwareEqualsDifferent

import com.google.javascript.rhino.testing.TestErrorReporter; //导入依赖的package包/类
public void testCheckTreeTypeAwareEqualsDifferent() {
  TestErrorReporter testErrorReporter = new TestErrorReporter(null, null);
  JSTypeRegistry registry = new JSTypeRegistry(testErrorReporter);
  Node node1 = Node.newString(Token.NAME, "f");
  node1.setJSType(registry.getNativeType(JSTypeNative.NUMBER_TYPE));
  Node node2 = Node.newString(Token.NAME, "f");
  node2.setJSType(registry.getNativeType(JSTypeNative.STRING_TYPE));
  assertFalse(node1.checkTreeTypeAwareEqualsSilent(node2));
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:10,代码来源:NodeTest.java


示例8: testCheckTreeTypeAwareEqualsDifferentNull

import com.google.javascript.rhino.testing.TestErrorReporter; //导入依赖的package包/类
public void testCheckTreeTypeAwareEqualsDifferentNull() {
  TestErrorReporter testErrorReporter = new TestErrorReporter(null, null);
  JSTypeRegistry registry = new JSTypeRegistry(testErrorReporter);
  Node node1 = Node.newString(Token.NAME, "f");
  node1.setJSType(registry.getNativeType(JSTypeNative.NUMBER_TYPE));
  Node node2 = Node.newString(Token.NAME, "f");
  assertFalse(node1.checkTreeTypeAwareEqualsSilent(node2));
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:9,代码来源:NodeTest.java


示例9: parse

import com.google.javascript.rhino.testing.TestErrorReporter; //导入依赖的package包/类
private static Node parse(String string) {
  CompilerEnvirons environment = new CompilerEnvirons();
  TestErrorReporter testErrorReporter = new TestErrorReporter(null, null);
  environment.setErrorReporter(testErrorReporter);
  environment.setParseJSDoc(true);
  Parser p = new Parser(environment, testErrorReporter, null);
  return p.parse(string, null, 0);
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:9,代码来源:NodeTest.java


示例10: parse

import com.google.javascript.rhino.testing.TestErrorReporter; //导入依赖的package包/类
private Node parse(String string, String... warnings) {
  CompilerEnvirons environment = new CompilerEnvirons();
  TestErrorReporter testErrorReporter = new TestErrorReporter(null, warnings);
  environment.setErrorReporter(testErrorReporter);
  environment.setParseJSDoc(true);
  environment.setParseJSDocDocumentation(true);
  Parser p = new Parser(environment, testErrorReporter, registry);
  Node script = p.parse(string, null, 0);

  // verifying that all warnings were seen
  assertTrue(testErrorReporter.hasEncounteredAllErrors());
  assertTrue(testErrorReporter.hasEncounteredAllWarnings());

  return script;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:16,代码来源:ParserTest.java


示例11: runFindHighestTypeInChain

import com.google.javascript.rhino.testing.TestErrorReporter; //导入依赖的package包/类
public void runFindHighestTypeInChain() {
  // Check that this doesn't go into an infinite loop.
  DisambiguateProperties.forJSTypeSystem(new Compiler())
      .getTypeWithProperty("no",
          new JSTypeRegistry(new TestErrorReporter(null, null))
          .getNativeType(JSTypeNative.OBJECT_PROTOTYPE));
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:8,代码来源:DisambiguatePropertiesTest.java


示例12: parse

import com.google.javascript.rhino.testing.TestErrorReporter; //导入依赖的package包/类
private static Node parse(String string) {
  CompilerEnvirons environment = new CompilerEnvirons();
  TestErrorReporter testErrorReporter = new TestErrorReporter(null, null);
  environment.setErrorReporter(testErrorReporter);
  environment.setParseJSDoc(true);
  Parser p = new Parser(environment, testErrorReporter);
  return p.parse(string, null, 0);
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:9,代码来源:NodeTest.java


示例13: parse

import com.google.javascript.rhino.testing.TestErrorReporter; //导入依赖的package包/类
private Node parse(String string, String... warnings) {
  CompilerEnvirons environment = new CompilerEnvirons();
  TestErrorReporter testErrorReporter = new TestErrorReporter(null, warnings);
  environment.setErrorReporter(testErrorReporter);
  environment.setParseJSDoc(true);
  environment.setParseJSDocDocumentation(true);
  Parser p = new Parser(environment, testErrorReporter);
  Node script = p.parse(string, null, 0);

  // verifying that all warnings were seen
  assertTrue(testErrorReporter.hasEncounteredAllErrors());
  assertTrue(testErrorReporter.hasEncounteredAllWarnings());

  return script;
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:16,代码来源:ParserTest.java


示例14: testCheckTreeTypeAwareEqualsSame

import com.google.javascript.rhino.testing.TestErrorReporter; //导入依赖的package包/类
public void testCheckTreeTypeAwareEqualsSame() {
  TestErrorReporter testErrorReporter = new TestErrorReporter(null, null);
  JSTypeRegistry registry = new JSTypeRegistry(testErrorReporter);
  Node node1 = Node.newString(Token.NAME, "f");
  node1.setJSType(registry.getNativeType(JSTypeNative.NUMBER_TYPE));
  Node node2 = Node.newString(Token.NAME, "f");
  node2.setJSType(registry.getNativeType(JSTypeNative.NUMBER_TYPE));
  assertTrue(node1.isEquivalentToTyped(node2));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:10,代码来源:NodeTest.java


示例15: testCheckTreeTypeAwareEqualsSameNull

import com.google.javascript.rhino.testing.TestErrorReporter; //导入依赖的package包/类
public void testCheckTreeTypeAwareEqualsSameNull() {
  TestErrorReporter testErrorReporter = new TestErrorReporter(null, null);
  JSTypeRegistry registry = new JSTypeRegistry(testErrorReporter);
  Node node1 = Node.newString(Token.NAME, "f");
  Node node2 = Node.newString(Token.NAME, "f");
  assertTrue(node1.isEquivalentToTyped(node2));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:8,代码来源:NodeTest.java


示例16: testCheckTreeTypeAwareEqualsDifferent

import com.google.javascript.rhino.testing.TestErrorReporter; //导入依赖的package包/类
public void testCheckTreeTypeAwareEqualsDifferent() {
  TestErrorReporter testErrorReporter = new TestErrorReporter(null, null);
  JSTypeRegistry registry = new JSTypeRegistry(testErrorReporter);
  Node node1 = Node.newString(Token.NAME, "f");
  node1.setJSType(registry.getNativeType(JSTypeNative.NUMBER_TYPE));
  Node node2 = Node.newString(Token.NAME, "f");
  node2.setJSType(registry.getNativeType(JSTypeNative.STRING_TYPE));
  assertFalse(node1.isEquivalentToTyped(node2));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:10,代码来源:NodeTest.java


示例17: testCheckTreeTypeAwareEqualsDifferentNull

import com.google.javascript.rhino.testing.TestErrorReporter; //导入依赖的package包/类
public void testCheckTreeTypeAwareEqualsDifferentNull() {
  TestErrorReporter testErrorReporter = new TestErrorReporter(null, null);
  JSTypeRegistry registry = new JSTypeRegistry(testErrorReporter);
  Node node1 = Node.newString(Token.NAME, "f");
  node1.setJSType(registry.getNativeType(JSTypeNative.NUMBER_TYPE));
  Node node2 = Node.newString(Token.NAME, "f");
  assertFalse(node1.isEquivalentToTyped(node2));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:9,代码来源:NodeTest.java


示例18: runFindHighestTypeInChain

import com.google.javascript.rhino.testing.TestErrorReporter; //导入依赖的package包/类
public void runFindHighestTypeInChain() {
  // Check that this doesn't go into an infinite loop.
  DisambiguateProperties.forJSTypeSystem(new Compiler(),
      Maps.<String, CheckLevel>newHashMap())
      .getTypeWithProperty("no",
          new JSTypeRegistry(new TestErrorReporter(null, null))
          .getNativeType(JSTypeNative.OBJECT_PROTOTYPE));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:9,代码来源:DisambiguatePropertiesTest.java


示例19: setUp

import com.google.javascript.rhino.testing.TestErrorReporter; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
  super.setUp();
  errorReporter = new TestErrorReporter(null, null);
  initRecordTypeTests();
  typeVars = new ImmutableMap.Builder<String, JSType>()
      .put("S", STRING_TYPE)
      .put("N", NUMBER_TYPE)
      .put("B", BOOLEAN_TYPE)
      .put("BOT", NO_TYPE)
      .put("TOP", ALL_TYPE)
      .put("UNK", UNKNOWN_TYPE)
      .put("CHKUNK", CHECKED_UNKNOWN_TYPE)
      .put("SO", STRING_OBJECT_TYPE)
      .put("NO", NUMBER_OBJECT_TYPE)
      .put("BO", BOOLEAN_OBJECT_TYPE)
      .put("NULL", NULL_TYPE)
      .put("OBJ", OBJECT_TYPE)
      .put("UNDEF", VOID_TYPE)
      .put("ARR", ARRAY_TYPE)
      .put("ARRNUM", type(ARRAY_TYPE, NUMBER_TYPE))
      .put("REC", recordTypeTest)
      .put("NESTEDREC", nestedRecordTypeTest)
      .put("ASYNCH", asynchRecord)
      .build();
  nameVars = new ImmutableMap.Builder<String, String>()
      .put("s", "string")
      .put("n", "number")
      .put("b", "boolean")
      .build();
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:32,代码来源:TypeTransformationTest.java


示例20: parse

import com.google.javascript.rhino.testing.TestErrorReporter; //导入依赖的package包/类
private JSDocInfo parse(String comment, JsDocParsing parseDocumentation,
    boolean parseFileOverview, String... warnings) {
  TestErrorReporter errorReporter = new TestErrorReporter(null, warnings);

  Config config =
      Config.builder()
          .setExtraAnnotationNames(extraAnnotations)
          .setJsDocParsingMode(parseDocumentation)
          .setSuppressionNames(extraSuppressions)
          .setLanguageMode(LanguageMode.ECMASCRIPT3)
          .setParseInlineSourceMaps(true)
          .setStrictMode(Config.StrictMode.SLOPPY)
          .build();

  StaticSourceFile file = new SimpleSourceFile("testcode", false);
  Node templateNode = IR.script();
  templateNode.setStaticSourceFile(file);

  JsDocInfoParser jsdocParser = new JsDocInfoParser(
      stream(comment),
      comment,
      0,
      templateNode,
      config,
      errorReporter);

  if (fileLevelJsDocBuilder != null) {
    jsdocParser.setFileLevelJsDocBuilder(fileLevelJsDocBuilder);
  }

  jsdocParser.parse();

  errorReporter.assertHasEncounteredAllWarnings();

  if (parseFileOverview) {
    return jsdocParser.getFileOverviewJSDocInfo();
  } else {
    return jsdocParser.retrieveAndResetParsedJSDocInfo();
  }
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:41,代码来源:JsDocInfoParserTest.java



注:本文中的com.google.javascript.rhino.testing.TestErrorReporter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IamConfiguration类代码示例发布时间:2022-05-23
下一篇:
Java DirtyManager类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap