From: Keats K. <ke...@us...> - 2006-03-28 23:45:14
|
Update of /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2207 Modified Files: TestCountDirective.java Log Message: Added test for undefined arguments. Index: TestCountDirective.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template/TestCountDirective.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TestCountDirective.java 29 Jul 2003 17:33:45 -0000 1.5 --- TestCountDirective.java 28 Mar 2006 23:45:09 -0000 1.6 *************** *** 91,94 **** --- 91,95 ---- public void testCountByZero () throws Exception { + // NOTE: this requires use of the DefaultEvaluationExceptionHandler to suppress the exception! executeStringTemplate("#count $i from 1 to 10 step 0 { $Counter.next() }"); Integer i = (Integer) _context.get("i"); *************** *** 99,102 **** --- 100,124 ---- + public void testUndefArgs () throws Exception + { + // NOTE: this requires use of the DefaultEvaluationExceptionHandler to suppress the exception! + executeStringTemplate("#count $i from 1 to 10 step $stepUndef { $Counter.next() }"); + Integer i = (Integer) _context.get("i"); + Counter c = (Counter) _context.get("Counter"); + assertTrue(c.toString(), c.getCount() == 0); + assertTrue(i == null); + executeStringTemplate("#count $i from $startUndef to 10 step 1 { $Counter.next() }"); + i = (Integer) _context.get("i"); + c = (Counter) _context.get("Counter"); + assertTrue(c.toString(), c.getCount() == 0); + assertTrue(i == null); + executeStringTemplate("#count $i from 1 to $stopUndef step 1 { $Counter.next() }"); + i = (Integer) _context.get("i"); + c = (Counter) _context.get("Counter"); + assertTrue(c.toString(), c.getCount() == 0); + assertTrue(i == null); + } + + public void testCountForwardsWithNegativeStep () throws Exception { |