Added support for composite keys, e.g. foo.bar.baz, which extracts foo from the
context, then extracts bar from that object, then extracts baz from that.
This commit is contained in:
@@ -135,6 +135,18 @@ public class MustacheTest
|
||||
execute(context("things", Arrays.asList("bar", "baz", "bif"))));
|
||||
}
|
||||
|
||||
@Test public void testStructuredVariable () {
|
||||
test("hello", "{{foo.bar.baz}}", new Object() {
|
||||
Object foo () {
|
||||
return new Object() {
|
||||
Object bar = new Object() {
|
||||
String baz = "hello";
|
||||
};
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void test (String expected, String template, Object ctx)
|
||||
{
|
||||
assertEquals(expected, Mustache.compiler().compile(template).execute(ctx));
|
||||
|
||||
Reference in New Issue
Block a user