/hg/rhino-tests: Seven new tests added into ScriptContextTest.

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Tue May 27 06:54:37 UTC 2014


changeset 7d807b490b62 in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=7d807b490b62
author: ptisnovs
date: Tue May 27 08:54:25 2014 +0200

	Seven new tests added into ScriptContextTest.


diffstat:

 ChangeLog                                 |    5 +
 src/org/RhinoTests/ScriptContextTest.java |  139 ++++++++++++++++++++++++++++++
 2 files changed, 144 insertions(+), 0 deletions(-)

diffs (161 lines):

diff -r ac41c65e3bb9 -r 7d807b490b62 ChangeLog
--- a/ChangeLog	Fri May 23 08:25:17 2014 +0200
+++ b/ChangeLog	Tue May 27 08:54:25 2014 +0200
@@ -1,3 +1,8 @@
+2014-05-27  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/RhinoTests/ScriptContextTest.java:
+	Seven new tests added into ScriptContextTest.
+
 2014-05-23  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/RhinoTests/ScriptContextTest.java:
diff -r ac41c65e3bb9 -r 7d807b490b62 src/org/RhinoTests/ScriptContextTest.java
--- a/src/org/RhinoTests/ScriptContextTest.java	Fri May 23 08:25:17 2014 +0200
+++ b/src/org/RhinoTests/ScriptContextTest.java	Tue May 27 08:54:25 2014 +0200
@@ -714,6 +714,145 @@
     }
 
     /**
+     * Test for method SimpleScriptContext.setAttribute().
+     */
+    protected void testSetAttribute39() {
+        // tested object
+        ScriptContext object = new SimpleScriptContext();
+
+        // setup global scope
+        Bindings bindings = new SimpleBindings(new HashMap<String, Object>());
+        object.setBindings(bindings, ScriptContext.GLOBAL_SCOPE);
+
+        try {
+            object.setAttribute("name", null, INVALID_SCOPE);
+            throw new AssertionError("ScriptContext.setAttribute() does not throw any exception for invalid scope");
+        }
+        catch (Exception e) {
+        }
+    }
+
+    /**
+     * Test for method SimpleScriptContext.setAttribute().
+     */
+    protected void testSetAttribute40() {
+        // tested object
+        ScriptContext object = new SimpleScriptContext();
+
+        // setup global scope
+        Bindings bindings = new SimpleBindings(new HashMap<String, Object>());
+        object.setBindings(bindings, ScriptContext.GLOBAL_SCOPE);
+
+        try {
+            object.setAttribute("", "value", INVALID_SCOPE);
+            throw new AssertionError("ScriptContext.setAttribute() does not throw any exception for invalid scope");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+    }
+
+    /**
+     * Test for method SimpleScriptContext.setAttribute().
+     */
+    protected void testSetAttribute41() {
+        // tested object
+        ScriptContext object = new SimpleScriptContext();
+
+        // setup global scope
+        Bindings bindings = new SimpleBindings(new HashMap<String, Object>());
+        object.setBindings(bindings, ScriptContext.GLOBAL_SCOPE);
+
+        try {
+            object.setAttribute("", "", INVALID_SCOPE);
+            throw new AssertionError("ScriptContext.setAttribute() does not throw any exception for invalid scope");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+    }
+
+    /**
+     * Test for method SimpleScriptContext.setAttribute().
+     */
+    protected void testSetAttribute42() {
+        // tested object
+        ScriptContext object = new SimpleScriptContext();
+
+        // setup global scope
+        Bindings bindings = new SimpleBindings(new HashMap<String, Object>());
+        object.setBindings(bindings, ScriptContext.GLOBAL_SCOPE);
+
+        try {
+            object.setAttribute("", null, INVALID_SCOPE);
+            throw new AssertionError("ScriptContext.setAttribute() does not throw any exception for invalid scope");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+    }
+
+    /**
+     * Test for method SimpleScriptContext.setAttribute().
+     */
+    protected void testSetAttribute43() {
+        // tested object
+        ScriptContext object = new SimpleScriptContext();
+
+        // setup global scope
+        Bindings bindings = new SimpleBindings(new HashMap<String, Object>());
+        object.setBindings(bindings, ScriptContext.GLOBAL_SCOPE);
+
+        try {
+            object.setAttribute(null, "value", INVALID_SCOPE);
+            throw new AssertionError("ScriptContext.setAttribute() does not throw any exception for invalid scope");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+    }
+
+    /**
+     * Test for method SimpleScriptContext.setAttribute().
+     */
+    protected void testSetAttribute44() {
+        // tested object
+        ScriptContext object = new SimpleScriptContext();
+
+        // setup global scope
+        Bindings bindings = new SimpleBindings(new HashMap<String, Object>());
+        object.setBindings(bindings, ScriptContext.GLOBAL_SCOPE);
+
+        try {
+            object.setAttribute(null, "", INVALID_SCOPE);
+            throw new AssertionError("ScriptContext.setAttribute() does not throw any exception for invalid scope");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+    }
+
+    /**
+     * Test for method SimpleScriptContext.setAttribute().
+     */
+    protected void testSetAttribute45() {
+        // tested object
+        ScriptContext object = new SimpleScriptContext();
+
+        // setup global scope
+        Bindings bindings = new SimpleBindings(new HashMap<String, Object>());
+        object.setBindings(bindings, ScriptContext.GLOBAL_SCOPE);
+
+        try {
+            object.setAttribute(null, null, INVALID_SCOPE);
+            throw new AssertionError("ScriptContext.setAttribute() does not throw any exception for invalid scope");
+        }
+        catch (Exception e) {
+            // expected exception
+        }
+    }
+
+    /**
      * Entry point to this test case.
      *
      * @param args parameters passed from command line


More information about the distro-pkg-dev mailing list