Added -index special variable.

This commit is contained in:
Michael Bayne
2010-10-22 05:29:31 +00:00
parent 0b9b01dab6
commit 00113a5a36
3 changed files with 22 additions and 16 deletions
@@ -188,6 +188,11 @@ public class MustacheTest
context("things", Arrays.asList("foo", "bar", "baz")));
}
@Test public void testIndex () {
test("123", "{{#things}}{{-index}}{{/things}}",
context("things", Arrays.asList("foo", "bar", "baz")));
}
protected void test (String expected, String template, Object ctx)
{
assertEquals(expected, Mustache.compiler().compile(template).execute(ctx));