当前位置: 首页>>代码示例>>Java>>正文


Java TagAttr类代码示例

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


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

示例1: testAssignExpr

import com.google.javascript.jscomp.jsonml.TagAttr; //导入依赖的package包/类
public void testAssignExpr() throws Exception {
  // correct statement
  testValidation("" +
      "['AssignExpr',{'op':'='}," +
          "['IdExpr',{'name':'x'}]," +
          "['LiteralExpr',{'type':'number','value':1}]]");
  // wrong number of children
  testNotEnoughChildrenValidation("" +
      "['AssignExpr',{'op':'='}," +
          "['IdExpr',{'name':'x'}]]",
      TagType.AssignExpr, 2, 1);
  testTooManyChildrenValidation("" +
      "['AssignExpr',{'op':'='}," +
          "['IdExpr',{'name':'x'}]," +
          "['IdExpr',{'name':'y'}]," +
          "['IdExpr',{'name':'z'}]]",
      TagType.AssignExpr, 2, 3);
  // missing attribute
  testMissingArgument("" +
      "['AssignExpr',{}," +
          "['IdExpr',{'name':'x'}]," +
          "['LiteralExpr',{'type':'number','value':1}]]",
      TagAttr.OP, TagType.AssignExpr);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:25,代码来源:JsonMLValidationTest.java

示例2: testBinaryExpr

import com.google.javascript.jscomp.jsonml.TagAttr; //导入依赖的package包/类
public void testBinaryExpr() throws Exception {
  // correct statement
  testValidation("" +
      "['BinaryExpr',{'op':'+'}," +
          "['IdExpr',{'name':'a'}]," +
          "['LiteralExpr',{'type':'number','value':1}]]");
  // wrong number of children
  testNotEnoughChildrenValidation("" +
      "['BinaryExpr',{'op':'+'}," +
          "['IdExpr',{'name':'a'}]]",
      TagType.BinaryExpr, 2, 1);
  testTooManyChildrenValidation("" +
      "['BinaryExpr',{'op':'&&'}," +
          "['IdExpr',{'name':'a'}]," +
          "['IdExpr',{'name':'b'}]," +
          "['IdExpr',{'name':'c'}]]",
      TagType.BinaryExpr, 2, 3);
  // missing attribute
  testMissingArgument("" +
      "['BinaryExpr',{}," +
          "['IdExpr',{'name':'a'}]," +
          "['LiteralExpr',{'type':'number','value':1}]]",
      TagAttr.OP, TagType.BinaryExpr);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:25,代码来源:JsonMLValidationTest.java

示例3: testCountExprValidation

import com.google.javascript.jscomp.jsonml.TagAttr; //导入依赖的package包/类
public void testCountExprValidation() throws Exception {
  // correct statement
  testValidation("" +
      "['CountExpr',{'isPrefix':false,'op':'++'}," +
          "['IdExpr',{'name':'x'}]]");
  // wrong number of children
  testTooManyChildrenValidation("" +
      "['CountExpr',{'isPrefix':false,'op':'++'}," +
          "['IdExpr',{'name':'x'}]," +
          "['IdExpr',{'name':'y'}]]",
      TagType.CountExpr, 1, 2);
  // missing attribute
  testMissingArgument("" +
      "['CountExpr',{'op':'++'}," +
          "['IdExpr',{'name':'x'}]]",
       TagAttr.IS_PREFIX, TagType.CountExpr);
  testMissingArgument("" +
      "['CountExpr',{'isPrefix':false}," +
          "['IdExpr',{'name':'x'}]]",
      TagAttr.OP, TagType.CountExpr);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:22,代码来源:JsonMLValidationTest.java

示例4: testInvokeExprValidation

import com.google.javascript.jscomp.jsonml.TagAttr; //导入依赖的package包/类
public void testInvokeExprValidation() throws Exception {
  // correct statement
  testValidation("" +
      "['InvokeExpr',{'op':'.'}," +
          "['IdExpr',{'name':'x'}]," +
          "['LiteralExpr',{'type':'string','value':'foo'}]]");
  // wrong number of children
  testNotEnoughChildrenValidation("" +
      "['InvokeExpr',{'op':'[]'}," +
          "['IdExpr',{'name':'x'}]]",
      TagType.InvokeExpr, 2, 1);
  // missing attribute
  testMissingArgument("" +
      "['InvokeExpr',{}," +
          "['IdExpr',{'name':'x'}]," +
          "['LiteralExpr',{'type':'string','value':'foo'}]]",
      TagAttr.OP, TagType.InvokeExpr);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:19,代码来源:JsonMLValidationTest.java

示例5: testLabelledStmtValidation

import com.google.javascript.jscomp.jsonml.TagAttr; //导入依赖的package包/类
public void testLabelledStmtValidation() throws Exception {
  // correct statement
  testValidation("" +
      "['LabelledStmt',{'label':'s'}," +
          "['IdExpr',{'name':'x'}]]");
  // wrong number of children
  testNotEnoughChildrenValidation("" +
      "['LabelledStmt',{'label':'s'}]",
      TagType.LabelledStmt, 1, 0);
  testTooManyChildrenValidation("" +
      "['LabelledStmt',{'label':'s'}," +
          "['IdExpr',{'name':'x'}]," +
          "['IdExpr',{'name':'y'}]]",
      TagType.LabelledStmt, 1, 2);
  // missing attribute
  testMissingArgument("" +
      "['LabelledStmt',{}," +
          "['IdExpr',{'name':'x'}]]",
      TagAttr.LABEL, TagType.LabelledStmt);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:21,代码来源:JsonMLValidationTest.java

示例6: testLiteralExprValidation

import com.google.javascript.jscomp.jsonml.TagAttr; //导入依赖的package包/类
public void testLiteralExprValidation() throws Exception {
  // correct statement
  testValidation("" +
      "['LiteralExpr',{'type':'string','value':'x'}]");
  testValidation("" +
      "['LiteralExpr',{'type':'boolean','value':'true'}]");
  testValidation("" +
      "['LiteralExpr',{'type':'number','value':'1.0'}]");
  // wrong number of children
  testTooManyChildrenValidation("" +
      "['LiteralExpr',{'type':'number','value':'1.0'}," +
          "['BlockStmt',{}]]",
      TagType.LiteralExpr, 0, 1);
  // missing attribute
  testMissingArgument("" +
      "['LiteralExpr',{'type':'string'}]",
      TagAttr.VALUE, TagType.LiteralExpr);
  testMissingArgument("" +
      "['LiteralExpr',{'value':'1.0'}]",
      TagAttr.TYPE, TagType.LiteralExpr);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:22,代码来源:JsonMLValidationTest.java

示例7: testRegExpExprValidation

import com.google.javascript.jscomp.jsonml.TagAttr; //导入依赖的package包/类
public void testRegExpExprValidation() throws Exception {
  // correct statement
  testValidation("" +
      "['RegExpExpr',{'body':'abc','flags':''}]");
  testValidation("" +
      "['RegExpExpr',{'body':'abc','flags':'g'}]");
  // wrong number of children
  testTooManyChildrenValidation("" +
      "['RegExpExpr',{'body':'abc','flags':'g'}," +
          "['IdExpr',{'name':'a'}]]",
      TagType.RegExpExpr, 0, 1);
  // missing attribute
  testMissingArgument("" +
      "['RegExpExpr',{'body':'abc'}]",
      TagAttr.FLAGS, TagType.RegExpExpr);
  testMissingArgument("" +
      "['RegExpExpr',{'flags':'g'}]",
      TagAttr.BODY, TagType.RegExpExpr);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:20,代码来源:JsonMLValidationTest.java

示例8: testUnaryExprValidation

import com.google.javascript.jscomp.jsonml.TagAttr; //导入依赖的package包/类
public void testUnaryExprValidation() throws Exception {
  // correct statement
  testValidation("" +
      "['UnaryExpr',{'op':'-'}," +
          "['IdExpr',{'name':'x'}]]");
  testValidation("" +
      "['UnaryExpr',{'op':'!'}," +
          "['CallExpr',{}," +
              "['IdExpr',{'name':'f'}]," +
                  "['IdExpr',{'name':'x'}]]]");
  // wrong number of children
  testNotEnoughChildrenValidation("" +
      "['UnaryExpr',{'op':'-'}]",
      TagType.UnaryExpr, 1, 0);
  testTooManyChildrenValidation("" +
      "['UnaryExpr',{'op':'+'}," +
          "['IdExpr',{'name':'x'}]," +
          "['IdExpr',{'name':'y'}]]",
      TagType.UnaryExpr, 1, 2);
  // missing attribute
  testMissingArgument("" +
      "['UnaryExpr',{}," +
          "['IdExpr',{'name':'x'}]]",
      TagAttr.OP, TagType.UnaryExpr);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:26,代码来源:JsonMLValidationTest.java

示例9: testDataProp

import com.google.javascript.jscomp.jsonml.TagAttr; //导入依赖的package包/类
public void testDataProp() throws Exception {
  // correct statement
  testValidation("" +
      "['DataProp',{'name':'x'}," +
          "['LiteralExpr',{'type':'number','value':1}]]");
  // wrong number of children
  testNotEnoughChildrenValidation("" +
      "['DataProp',{'name':'x'}]",
      TagType.DataProp, 1, 0);
  // missing argument
  testMissingArgument("" +
      "['DataProp', {}," +
          "['LiteralExpr',{'type':'number','value':1}]]",
      TagAttr.NAME, TagType.DataProp);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:16,代码来源:JsonMLValidationTest.java

示例10: testIdExprValidation

import com.google.javascript.jscomp.jsonml.TagAttr; //导入依赖的package包/类
public void testIdExprValidation() throws Exception {
  // correct statement
  testValidation("" +
      "['IdExpr',{'name':'x'}]");
  // wrong number of children
  testTooManyChildrenValidation("" +
      "['IdExpr',{'name':'x'}," +
          "['BlockStmt',{}]]",
      TagType.IdExpr, 0, 1);
  // missing name argument
  testMissingArgument("" +
      "['IdExpr', {}]",
      TagAttr.NAME, TagType.IdExpr);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:15,代码来源:JsonMLValidationTest.java

示例11: testIdPattValidation

import com.google.javascript.jscomp.jsonml.TagAttr; //导入依赖的package包/类
public void testIdPattValidation() throws Exception {
  // correct statement
  testValidation("" +
      "['IdPatt',{'name':'x'}]");
  // wrong number of children
  testTooManyChildrenValidation("" +
      "['IdPatt',{'name':'x'}," +
          "['BlockStmt',{}]]",
      TagType.IdPatt, 0, 1);
  // missing name argument
  testMissingArgument("" +
      "['IdPatt', {}]",
      TagAttr.NAME, TagType.IdPatt);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:15,代码来源:JsonMLValidationTest.java

示例12: testMissingArgument

import com.google.javascript.jscomp.jsonml.TagAttr; //导入依赖的package包/类
private void testMissingArgument(String jsonml, TagAttr attr, TagType type)
    throws Exception {
  testValidation(jsonml,
      String.format(Validator.MISSING_ARGUMENT, attr, type));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:6,代码来源:JsonMLValidationTest.java


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