use of com.google.template.soy.exprtree.LegacyObjectMapLiteralNode in project closure-templates by google.
the class ParseExpressionTest method testParseListsAndMaps.
@Test
public void testParseListsAndMaps() throws Exception {
ExprNode expr = assertThatExpression("[]").isValidExpression();
assertThat(((ListLiteralNode) expr).numChildren()).isEqualTo(0);
expr = assertThatExpression("[55]").isValidExpression();
assertThat(((ListLiteralNode) expr).numChildren()).isEqualTo(1);
expr = assertThatExpression("[55,]").isValidExpression();
assertThat(((ListLiteralNode) expr).numChildren()).isEqualTo(1);
expr = assertThatExpression("['blah', 123, $boo]").isValidExpression();
assertThat(((ListLiteralNode) expr).numChildren()).isEqualTo(3);
expr = assertThatExpression("['blah', 123, $boo,]").isValidExpression();
assertThat(((ListLiteralNode) expr).numChildren()).isEqualTo(3);
expr = assertThatExpression("[:]").isValidExpression();
assertThat(((LegacyObjectMapLiteralNode) expr).numChildren()).isEqualTo(0);
expr = assertThatExpression("['aa': 55]").isValidExpression();
assertThat(((LegacyObjectMapLiteralNode) expr).numChildren()).isEqualTo(2);
expr = assertThatExpression("['aa': 55,]").isValidExpression();
assertThat(((LegacyObjectMapLiteralNode) expr).numChildren()).isEqualTo(2);
expr = assertThatExpression("['aaa': 'blah', 'bbb': 123, $foo.bar: $boo]").isValidExpression();
assertThat(((LegacyObjectMapLiteralNode) expr).numChildren()).isEqualTo(6);
expr = assertThatExpression("['aaa': 'blah', 'bbb': 123, $foo.bar: $boo,]").isValidExpression();
assertThat(((LegacyObjectMapLiteralNode) expr).numChildren()).isEqualTo(6);
}
Aggregations