use of com.google.template.soy.exprtree.ExprNode in project closure-templates by google.
the class MsgSubstUnitBaseVarNameUtilsTest method assertErrorMsgWhenGenNoncollidingBaseNamesForExprs.
private void assertErrorMsgWhenGenNoncollidingBaseNamesForExprs(String expectedErrorMsg, String... exprTexts) {
List<ExprNode> exprs = new ArrayList<>();
for (String exprText : exprTexts) {
exprs.add(parse(exprText));
}
ErrorReporter errorReporter = ErrorReporter.createForTest();
MsgSubstUnitBaseVarNameUtils.genNoncollidingBaseNamesForExprs(exprs, "FALLBACK", errorReporter);
assertThat(errorReporter.getErrors()).hasSize(1);
assertThat(Iterables.getOnlyElement(errorReporter.getErrors()).message()).contains(expectedErrorMsg);
}
use of com.google.template.soy.exprtree.ExprNode in project closure-templates by google.
the class MsgSubstUnitBaseVarNameUtilsTest method assertCandidateBaseNamesForExpr.
private void assertCandidateBaseNamesForExpr(List<String> expected, String exprText) {
ExprNode exprRoot = parse(exprText);
List<String> actual = MsgSubstUnitBaseVarNameUtils.genCandidateBaseNamesForExpr(exprRoot);
assertEquals(expected, actual);
}
use of com.google.template.soy.exprtree.ExprNode in project closure-templates by google.
the class ExpressionSubject method isValidGlobal.
void isValidGlobal() {
ExprNode expr = parseExpression();
if (errorReporter.hasErrors()) {
fail("is a valid global", errorReporter.getErrors());
}
Truth.assertThat(expr).named(actualAsString()).isInstanceOf(GlobalNode.class);
}
Aggregations