velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nbu...@apache.org
Subject svn commit: r703587 - in /velocity/engine/trunk/src: java/org/apache/velocity/runtime/directive/VelocimacroProxy.java test/org/apache/velocity/test/issues/Velocity625TestCase.java
Date Fri, 10 Oct 2008 22:11:53 GMT
Author: nbubna
Date: Fri Oct 10 15:11:53 2008
New Revision: 703587

URL: http://svn.apache.org/viewvc?rev=703587&view=rev
Log:
VELOCITY-625 fix bug when calling macros w/too few arguments

Added:
    velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity625TestCase.java
  (with props)
Modified:
    velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java

Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java?rev=703587&r1=703586&r2=703587&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java
(original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java
Fri Oct 10 15:11:53 2008
@@ -151,7 +151,7 @@
         if (callArguments > 0)
         {
             // the 0th element is the macro name
-            for (int i = 1; i < argArray.length; i++)
+            for (int i = 1; i < argArray.length && i <= callArguments; i++)
             {
                 Node macroCallArgument = node.jjtGetChild(i - 1);
 

Added: velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity625TestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity625TestCase.java?rev=703587&view=auto
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity625TestCase.java
(added)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity625TestCase.java
Fri Oct 10 15:11:53 2008
@@ -0,0 +1,42 @@
+package org.apache.velocity.test.issues;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+import org.apache.velocity.test.BaseEvalTestCase;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.runtime.RuntimeConstants;
+
+/**
+ * This class tests VELOCITY-625.
+ */
+public class Velocity625TestCase extends BaseEvalTestCase
+{
+    public Velocity625TestCase(String name)
+    {
+       super(name);
+    }
+
+    public void test1()
+    {
+        String template = "#macro(test $a $b)test#end#test('x')";
+        assertEvalEquals("test", template);
+    }
+
+}

Propchange: velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity625TestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity625TestCase.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity625TestCase.java
------------------------------------------------------------------------------
    svn:keywords = Revision

Propchange: velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity625TestCase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message