use of com.google.template.soy.sharedpasses.render.Environment in project closure-templates by google.
the class PreevalVisitorTest method preeval.
// -----------------------------------------------------------------------------------------------
// Helpers.
/**
* Evaluates the given expression and returns the result.
*
* @param expression The expression to preevaluate.
* @return The expression result.
*/
private static SoyValue preeval(String expression, String... params) {
String header = "";
for (String param : params) {
header += "{@param " + param + " : ?}\n";
}
PrintNode code = (PrintNode) SoyFileSetParserBuilder.forTemplateContents(header + "{" + expression + "}").parse().fileSet().getChild(0).getChild(0).getChild(0);
ExprRootNode expr = code.getExpr();
Environment env = TestingEnvironment.createForTest(SoyValueConverterUtility.newDict("boo", 8), ImmutableMap.<String, SoyValueProvider>of());
return new PreevalVisitor(env).exec(expr);
}
Aggregations