當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。