jstrachan 2002/11/27 07:39:43
Modified: jelly/src/test/org/apache/commons/jelly suite.jelly
jelly/src/java/org/apache/commons/jelly JellyContext.java
Log:
Fixed bug that both Gordon and James Johnson found recently.
The problem was that by default the child scope didn't inherit the parent
attributes.
Now fixed and added a JellyUnit test case for this.
Revision Changes Path
1.12 +16 -2
jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/suite.jelly
Index: suite.jelly
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/suite.jelly,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- suite.jelly 27 Nov 2002 12:42:09 -0000 1.11
+++ suite.jelly 27 Nov 2002 15:39:42 -0000 1.12
@@ -19,10 +19,15 @@
<test:case name="testScope">
+ <j:set var="outer" value="def"/>
+
+ <test:assertEquals expected="def" actual="${outer}"/>
+
<j:scope>
<j:set var="x" value="abc"/>
<test:assertEquals expected="abc" actual="${x}"/>
+ <test:assertEquals expected="def" actual="${outer}"/>
</j:scope>
<test:assert test="${x == null}"/>
@@ -251,7 +256,7 @@
<test:assertTrue test="${i==6}"/>
</test:case>
-
+
<test:case name="testVariablesWithDots">
<j:set var="page.name" value="a"/>
@@ -260,7 +265,16 @@
<test:assertEquals expected="a" actual="${page.name}"/>
<test:assertEquals expected="b" actual="${page.foo}"/>
+
+ <j:set var="outer" value="def"/>
+
+ <test:assertEquals expected="def" actual="${outer}"/>
+
+ <j:scope>
+ <test:assertEquals expected="a" actual="${page.name}"/>
+ <test:assertEquals expected="b" actual="${page.foo}"/>
+ </j:scope>
</test:case>
-
+
</test:suite>
1.36 +1 -1
jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/JellyContext.java
Index: JellyContext.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/JellyContext.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- JellyContext.java 27 Nov 2002 12:43:20 -0000 1.35
+++ JellyContext.java 27 Nov 2002 15:39:43 -0000 1.36
@@ -99,7 +99,7 @@
private JellyContext parent;
/** Do we inherit variables from parent context? */
- private boolean inherit = false;
+ private boolean inherit = true;
/** Do we export our variables to parent context? */
private boolean export = false;
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>