commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r148877 - in jakarta/commons/proper/jelly/trunk/src: java/org/apache/commons/jelly/tags/core test/org/apache/commons/jelly/core
Date Fri, 28 Jan 2005 11:42:46 GMT
Author: dion
Date: Fri Jan 28 03:42:44 2005
New Revision: 148877

URL: http://svn.apache.org/viewcvs?view=rev&rev=148877
Log:
Apply fixes for Jelly-196.
Added:
   jakarta/commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/testSeveralSwitchCall.jelly
Modified:
   jakarta/commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/tags/core/SwitchTag.java
   jakarta/commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/TestSwitchTag.java

Modified: jakarta/commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/tags/core/SwitchTag.java
Url: http://svn.apache.org/viewcvs/jakarta/commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/tags/core/SwitchTag.java?view=diff&rev=148877&p1=jakarta/commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/tags/core/SwitchTag.java&r1=148876&p2=jakarta/commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/tags/core/SwitchTag.java&r2=148877
==============================================================================
--- jakarta/commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/tags/core/SwitchTag.java
(original)
+++ jakarta/commons/proper/jelly/trunk/src/java/org/apache/commons/jelly/tags/core/SwitchTag.java
Fri Jan 28 03:42:44 2005
@@ -31,7 +31,7 @@
  * @see DefaultTag
  *
  * @author Rodney Waldhoff
- * @version $Revision: 1.7 $ $Date: 2004/09/09 12:27:53 $
+ * @version $Revision: 1.7 $ $Date$
  */
 public class SwitchTag extends TagSupport {
 
@@ -52,6 +52,10 @@
     }
 
     public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException
{
+        this.defaultEncountered = false;
+        this.someCaseMatched = false;
+        this.fallingThru = false;
+                
         if(null == on) {
             throw new MissingAttributeException("on");
         } else {

Modified: jakarta/commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/TestSwitchTag.java
Url: http://svn.apache.org/viewcvs/jakarta/commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/TestSwitchTag.java?view=diff&rev=148877&p1=jakarta/commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/TestSwitchTag.java&r1=148876&p2=jakarta/commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/TestSwitchTag.java&r2=148877
==============================================================================
--- jakarta/commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/TestSwitchTag.java
(original)
+++ jakarta/commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/TestSwitchTag.java
Fri Jan 28 03:42:44 2005
@@ -24,7 +24,7 @@
 
 /**
  * @author Rodney Waldhoff
- * @version $Revision: 1.9 $ $Date: 2004/10/26 23:54:37 $
+ * @version $Revision: 1.9 $ $Date$
  */
 public class TestSwitchTag extends BaseJellyTest {
 
@@ -182,6 +182,14 @@
         } catch(JellyException e) {
             // expected
         }
+    }
+
+    public void testSeveralCall() throws Exception {
+        setUpScript("testSeveralSwitchCall.jelly");
+        Script script = getJelly().compileScript();
+        getJellyContext().setVariable("var","foo");
+        script.run(getJellyContext(),getXMLOutput());        
+        assertEquals("defaultdefault",getJellyContext().getVariable("res"));
     }
 
 }

Added: jakarta/commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/testSeveralSwitchCall.jelly
Url: http://svn.apache.org/viewcvs/jakarta/commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/testSeveralSwitchCall.jelly?view=auto&rev=148877
==============================================================================
--- (empty file)
+++ jakarta/commons/proper/jelly/trunk/src/test/org/apache/commons/jelly/core/testSeveralSwitchCall.jelly
Fri Jan 28 03:42:44 2005
@@ -0,0 +1,15 @@
+<j:jelly xmlns:j="jelly:core">
+	<j:forEach var="var" items="a,b">
+		<j:switch on="${var}">
+			<j:case value="unencountered1">
+				<j:set var="res" value="1"/>
+			</j:case>
+			<j:case value="unencountered2">
+				<j:set var="res" value="2"/>
+			</j:case>			
+			<j:default>
+				<j:set var="res" value="${res}default"/>			
+			</j:default>
+		</j:switch>
+	</j:forEach>		
+</j:jelly>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message