sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1068876 - /sling/trunk/bundles/scripting/javascript/src/test/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngineTest.java
Date Wed, 09 Feb 2011 13:04:30 GMT
Author: fmeschbe
Date: Wed Feb  9 13:04:30 2011
New Revision: 1068876

URL: http://svn.apache.org/viewvc?rev=1068876&view=rev
Log:
SLING-1972 fix testcase to use an engine scoped binding to maintain the "shared" variables

Modified:
    sling/trunk/bundles/scripting/javascript/src/test/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngineTest.java

Modified: sling/trunk/bundles/scripting/javascript/src/test/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngineTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/javascript/src/test/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngineTest.java?rev=1068876&r1=1068875&r2=1068876&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/javascript/src/test/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngineTest.java
(original)
+++ sling/trunk/bundles/scripting/javascript/src/test/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngineTest.java
Wed Feb  9 13:04:30 2011
@@ -18,8 +18,10 @@
  */
 package org.apache.sling.scripting.javascript.internal;
 
+import javax.script.Bindings;
 import javax.script.ScriptEngine;
 import javax.script.ScriptException;
+import javax.script.SimpleBindings;
 
 import junit.framework.TestCase;
 
@@ -33,10 +35,11 @@ public class RhinoJavaScriptEngineTest e
     public void testPreserveScopeBetweenEvals() throws ScriptException {
         MockRhinoJavaScriptEngineFactory factory = new MockRhinoJavaScriptEngineFactory();
         ScriptEngine engine = factory.getScriptEngine();
-        engine.eval("var f = 1");
+        Bindings context = new SimpleBindings();
+        engine.eval("var f = 1", context);
         Object result = null;
         try {
-            result = engine.eval("f += 1");
+            result = engine.eval("f += 1", context);
         } catch (ScriptException e) {
             TestCase.fail(e.getMessage());
         }



Mime
View raw message