use of com.google.template.soy.data.SoyList in project closure-templates by google.
the class EvalVisitorTest method testEvalListLiteral.
@Test
public void testEvalListLiteral() throws Exception {
SoyList result = (SoyList) eval("['blah', 123, $boo]");
assertThat(result.length()).isEqualTo(3);
assertThat(result.get(0).stringValue()).isEqualTo("blah");
assertThat(result.get(1).integerValue()).isEqualTo(123);
assertThat(result.get(2).integerValue()).isEqualTo(8);
// trailing comma
result = (SoyList) eval("['blah', 123, $boo,]");
assertThat(result.length()).isEqualTo(3);
assertThat(result.get(0).stringValue()).isEqualTo("blah");
assertThat(result.get(1).integerValue()).isEqualTo(123);
assertThat(result.get(2).integerValue()).isEqualTo(8);
result = (SoyList) eval("[]");
assertThat(result.length()).isEqualTo(0);
}
Aggregations