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

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Fri May 23 06:25:32 UTC 2014


changeset ac41c65e3bb9 in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=ac41c65e3bb9
author: ptisnovs
date: Fri May 23 08:25:17 2014 +0200

	Ten new tests added into ScriptContextTest.


diffstat:

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

diffs (181 lines):

diff -r 946d61915104 -r ac41c65e3bb9 ChangeLog
--- a/ChangeLog	Fri May 23 08:16:04 2014 +0200
+++ b/ChangeLog	Fri May 23 08:25:17 2014 +0200
@@ -1,3 +1,8 @@
+2014-05-23  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/RhinoTests/ScriptContextTest.java:
+	Ten new tests added into ScriptContextTest.
+
 2014-05-23  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/RhinoTests/SimpleBindingsTest.java:
diff -r 946d61915104 -r ac41c65e3bb9 src/org/RhinoTests/ScriptContextTest.java
--- a/src/org/RhinoTests/ScriptContextTest.java	Fri May 23 08:16:04 2014 +0200
+++ b/src/org/RhinoTests/ScriptContextTest.java	Fri May 23 08:25:17 2014 +0200
@@ -555,6 +555,165 @@
     }
 
     /**
+     * Test for method SimpleScriptContext.setAttribute().
+     */
+    protected void testSetAttribute29() {
+        // tested object
+        ScriptContext object = new SimpleScriptContext();
+        try {
+            object.setAttribute("name", "", 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 testSetAttribute30() {
+        // tested object
+        ScriptContext object = new SimpleScriptContext();
+        try {
+            object.setAttribute("name", 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 testSetAttribute31() {
+        // tested object
+        ScriptContext object = new SimpleScriptContext();
+        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 testSetAttribute32() {
+        // tested object
+        ScriptContext object = new SimpleScriptContext();
+        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 testSetAttribute33() {
+        // tested object
+        ScriptContext object = new SimpleScriptContext();
+        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 testSetAttribute34() {
+        // tested object
+        ScriptContext object = new SimpleScriptContext();
+        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 testSetAttribute35() {
+        // tested object
+        ScriptContext object = new SimpleScriptContext();
+        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 testSetAttribute36() {
+        // tested object
+        ScriptContext object = new SimpleScriptContext();
+        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
+        }
+    }
+
+    /**
+     * Test for method SimpleScriptContext.setAttribute().
+     */
+    protected void testSetAttribute37() {
+        // 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", "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 testSetAttribute38() {
+        // 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", "", INVALID_SCOPE);
+            throw new AssertionError("ScriptContext.setAttribute() does not throw any exception for invalid scope");
+        }
+        catch (Exception e) {
+        }
+    }
+
+    /**
      * Entry point to this test case.
      *
      * @param args parameters passed from command line


More information about the distro-pkg-dev mailing list