@@ -306,6 +306,36 @@ public void testJson() throws IOException, MustacheException {
306306
307307 }
308308
309+ @ SuppressWarnings ("serial" )
310+ public void testCurrentElementInArray () throws IOException , MustacheException {
311+
312+ MustacheCompiler c = init ();
313+ Mustache m = c .parseFile ("simple_array.html" );
314+ StringWriter sw = new StringWriter ();
315+ FutureWriter writer = new FutureWriter (sw );
316+ m .execute (writer , new Scope (new HashMap <String , Object >() {
317+ {
318+ put ("list" , Arrays .asList (1 ,2 ,3 ));
319+ }
320+ }));
321+ writer .flush ();
322+ assertEquals (getContents (root , "simple_array.txt" ), sw .toString ());
323+
324+ /*
325+ * verify null elements in a list are properly handled when using {{.}}
326+ */
327+ sw = new StringWriter ();
328+ writer = new FutureWriter (sw );
329+ m .execute (writer , new Scope (new HashMap <String , Object >() {
330+ {
331+ put ("list" , Arrays .asList (null ,null ));
332+ }
333+ }));
334+ writer .flush ();
335+ assertEquals ("\n \n " , sw .toString ());
336+
337+ }
338+
309339 public void testReadme () throws MustacheException , IOException {
310340 MustacheCompiler c = init ();
311341 Mustache m = c .parseFile ("items.html" );
0 commit comments