This is an automated email from the ASF dual-hosted git repository.

cbrisson pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/velocity-engine.git


The following commit(s) were added to refs/heads/master by this push:
     new 3a9b2912 Add test case for VELOCITY-961
3a9b2912 is described below

commit 3a9b29121d4efc617ce2845cb6e51f2de279822d
Author: Claude Brisson <[email protected]>
AuthorDate: Fri Aug 23 20:48:27 2024 +0200

    Add test case for VELOCITY-961
---
 .../velocity/test/issues/Velocity961TestCase.java  | 47 ++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git 
a/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity961TestCase.java
 
b/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity961TestCase.java
new file mode 100755
index 00000000..37ebc9e2
--- /dev/null
+++ 
b/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity961TestCase.java
@@ -0,0 +1,47 @@
+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.exception.ParseErrorException;
+import org.apache.velocity.exception.TemplateInitException;
+import org.apache.velocity.test.BaseTestCase;
+
+/**
+ * This class tests the fix for VELOCITY-961.
+ */
+public class Velocity961TestCase extends BaseTestCase
+{
+    public Velocity961TestCase(String name)
+    {
+       super(name);
+    }
+
+    public void test1()
+    {
+        String template = "$child.typeName()#if($child.isRepeated())[]#end";
+        assertEvalEquals("$child.typeName()", template);
+    }
+
+    public void test2()
+    {
+        String template = "$child.typeName()#if(1)[]#end";
+        assertEvalEquals("$child.typeName()[]", template);
+    }
+}

Reply via email to