You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by nb...@apache.org on 2010/09/01 21:13:16 UTC
svn commit: r991659 -
/velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity762TestCase.java
Author: nbubna
Date: Wed Sep 1 19:13:16 2010
New Revision: 991659
URL: http://svn.apache.org/viewvc?rev=991659&view=rev
Log:
a more thorough $foreach test
Modified:
velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity762TestCase.java
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity762TestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity762TestCase.java?rev=991659&r1=991658&r2=991659&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity762TestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity762TestCase.java Wed Sep 1 19:13:16 2010
@@ -37,4 +37,17 @@ public class Velocity762TestCase extends
assertEvalEquals("false false true ", template);
}
+ public void testAllForeachProps()
+ {
+ String template = "#foreach( $number in [1..3] )"+
+ "number:$number hasNext:$foreach.hasNext "+
+ "first:$foreach.first last:$foreach.last "+
+ "count:$foreach.count index:$foreach.index \n"+
+ "#end";
+ String expect = "number:1 hasNext:true first:true last:false count:1 index:0 \n"+
+ "number:2 hasNext:true first:false last:false count:2 index:1 \n"+
+ "number:3 hasNext:false first:false last:true count:3 index:2 \n";
+ assertEvalEquals(expect, template);
+ }
+
}