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:
Michael Bayne
2010-10-21 23:06:15 +00:00
parent 134a22bcfd
commit 0bef6a06e5
2 changed files with 21 additions and 0 deletions
@@ -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));