Author: nbubna
Date: Tue Feb 24 00:32:03 2009
New Revision: 747235

URL: http://svn.apache.org/viewvc?rev=747235&view=rev
Log:
update vm localscope test a bit

Modified:
    
velocity/engine/trunk/src/test/org/apache/velocity/test/VMContextLocalscopeTestCase.java

Modified: 
velocity/engine/trunk/src/test/org/apache/velocity/test/VMContextLocalscopeTestCase.java
URL: 
http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/VMContextLocalscopeTestCase.java?rev=747235&r1=747234&r2=747235&view=diff
==============================================================================
--- 
velocity/engine/trunk/src/test/org/apache/velocity/test/VMContextLocalscopeTestCase.java
 (original)
+++ 
velocity/engine/trunk/src/test/org/apache/velocity/test/VMContextLocalscopeTestCase.java
 Tue Feb 24 00:32:03 2009
@@ -19,7 +19,6 @@
  * under the License.    
  */
 
-import junit.framework.TestCase;
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.context.InternalContextAdapterImpl;
 import org.apache.velocity.context.ProxyVMContext;
@@ -32,23 +31,33 @@
  * @author <a href="mailto:[email protected]";>Stephen Habermann</a>
  * @version $Id$
  */
-public class VMContextLocalscopeTestCase extends TestCase {
+public class VMContextLocalscopeTestCase extends BaseTestCase {
 
-    private RuntimeInstance instance;
+    public VMContextLocalscopeTestCase(String name)
+    {
+        super(name);
+    }
 
-    public void setUp() throws Exception 
+    public void testViaEval()
     {
-        this.instance = new RuntimeInstance();
-        this.instance.setProperty(RuntimeConstants.VM_CONTEXT_LOCALSCOPE, 
Boolean.TRUE);
-        this.instance.init();
+        engine.setProperty(RuntimeConstants.VM_CONTEXT_LOCALSCOPE, 
Boolean.TRUE);
+        assertEvalEquals("$a", "#macro(a)#set($a = 'b')#end#a$a");
+        context.put("b", "b");
+        assertEvalEquals("b", "#macro(b)$b#set($b = 'c')#end#b");
+        assertContextValue("b", "b");
     }
 
     public void testLocalscopePutDoesntLeakButGetDoes() 
     {
+        RuntimeInstance instance = new RuntimeInstance();
+        instance.setProperty(RuntimeConstants.VM_CONTEXT_LOCALSCOPE, 
Boolean.TRUE);
+        instance.init();
+
         VelocityContext base = new VelocityContext();
         base.put("outsideVar", "value1");
 
-        ProxyVMContext vm = new ProxyVMContext(new 
InternalContextAdapterImpl(base), this.instance, true);
+        ProxyVMContext vm =
+            new ProxyVMContext(new InternalContextAdapterImpl(base), instance, 
true);
         vm.put("newLocalVar", "value2");
 
         // New variable put doesn't leak


Reply via email to