本文整理汇总了Java中com.google.javascript.jscomp.jsonml.JsonML类的典型用法代码示例。如果您正苦于以下问题:Java JsonML类的具体用法?Java JsonML怎么用?Java JsonML使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JsonML类属于com.google.javascript.jscomp.jsonml包,在下文中一共展示了JsonML类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testJsonMLToAstConversion
import com.google.javascript.jscomp.jsonml.JsonML; //导入依赖的package包/类
private void testJsonMLToAstConversion(String js) throws Exception {
JsonML jsonml = JsonMLParser.parse(js);
Node root = parseExpectedJs(js);
Node ast = root.getFirstChild();
Preconditions.checkState(ast.getType() == Token.SCRIPT);
testJsonMLToAstConversion(ast, jsonml, js);
}
示例2: testAstToJsonMLConverstion
import com.google.javascript.jscomp.jsonml.JsonML; //导入依赖的package包/类
private void testAstToJsonMLConverstion(Node astRoot, JsonML jsonmlRoot,
String js) {
JsonML resultJsonMLRoot = (new Writer()).processAst(astRoot);
String explanation = JsonMLUtil.compare(resultJsonMLRoot, jsonmlRoot);
assertNull("AST -> JsonML converter returned incorrect result for " + js +
"\n" + explanation, explanation);
}
示例3: testConversion
import com.google.javascript.jscomp.jsonml.JsonML; //导入依赖的package包/类
private void testConversion(String js) throws Exception {
JsonML jsonml = JsonMLParser.parse(js);
Node root = parseExpectedJs(js);
Node ast = root.getFirstChild();
Preconditions.checkState(ast.getType() == Token.SCRIPT);
testJsonMLToAstConversion(ast, jsonml, js);
jsonml = JsonMLParser.parse(js);
testAstToJsonMLConverstion(ast, jsonml, js);
}
示例4: testSuccess
import com.google.javascript.jscomp.jsonml.JsonML; //导入依赖的package包/类
private void testSuccess(JsonML source) throws Exception {
SecureCompiler compiler = new SecureCompiler();
compiler.compile(source);
Report report = compiler.getReport();
assertTrue(report.isSuccessful());
assertEquals(0, report.getErrors().length);
assertEquals(0, report.getWarnings().length);
}
示例5: testValidation
import com.google.javascript.jscomp.jsonml.JsonML; //导入依赖的package包/类
private void testValidation(String jsonml) throws Exception {
JsonML jsonMLRoot = JsonMLUtil.parseString(jsonml);
String msg = Validator.validate(jsonMLRoot);
if (msg != null) {
String errorMsg = String.format(
"Validation error for %s.\n Received: %s\n", jsonml, msg);
}
}
示例6: testError
import com.google.javascript.jscomp.jsonml.JsonML; //导入依赖的package包/类
private void testError(JsonML source) throws Exception {
SecureCompiler compiler = new SecureCompiler();
compiler.compile(source);
Report report = compiler.getReport();
assertFalse(report.isSuccessful());
}
示例7: testString
import com.google.javascript.jscomp.jsonml.JsonML; //导入依赖的package包/类
private void testString(String jsonml) throws Exception {
JsonML source = JsonMLUtil.parseString(jsonml);
testSuccess(source);
}
示例8: testInvalidString
import com.google.javascript.jscomp.jsonml.JsonML; //导入依赖的package包/类
private void testInvalidString(String jsonml) throws Exception {
JsonML source = JsonMLUtil.parseString(jsonml);
testError(source);
}