/hg/rhino-tests: Added five new tests into JavaScriptsTest.

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Fri Dec 20 01:59:39 PST 2013


changeset 19f1168ca1c0 in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=19f1168ca1c0
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Fri Dec 20 11:03:41 2013 +0100

	Added five new tests into JavaScriptsTest.


diffstat:

 ChangeLog                               |   5 +
 src/org/RhinoTests/JavaScriptsTest.java |  85 +++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+), 0 deletions(-)

diffs (107 lines):

diff -r 381ab825c25b -r 19f1168ca1c0 ChangeLog
--- a/ChangeLog	Fri Dec 13 10:01:46 2013 +0100
+++ b/ChangeLog	Fri Dec 20 11:03:41 2013 +0100
@@ -1,3 +1,8 @@
+2013-12-20  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/RhinoTests/JavaScriptsTest.java:
+	Added five new tests into JavaScriptsTest.
+
 2013-12-13  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/RhinoTests/SimpleBindingsClassTest.java:
diff -r 381ab825c25b -r 19f1168ca1c0 src/org/RhinoTests/JavaScriptsTest.java
--- a/src/org/RhinoTests/JavaScriptsTest.java	Fri Dec 13 10:01:46 2013 +0100
+++ b/src/org/RhinoTests/JavaScriptsTest.java	Fri Dec 20 11:03:41 2013 +0100
@@ -164,6 +164,91 @@
     }
 
     /**
+     * Test if exception is thrown when string contains script with unknown
+     * command.
+     * 
+     * @throws Exception
+     *             this exception is thrown when this test case failed.
+     */
+    protected void testRunScriptContainingError3StoredInString() throws Exception {
+        try {
+            this.scriptEngine.eval("do");
+        } catch (ScriptException e) {
+        	System.out.println("\tException thrown as expected " + e.getMessage());
+            return; // ok, it's correct if this exception is thrown
+        }
+        throw new Exception("ScriptException not thrown as expected");
+    }
+
+    /**
+     * Test if exception is thrown when string contains script with unknown
+     * command.
+     * 
+     * @throws Exception
+     *             this exception is thrown when this test case failed.
+     */
+    protected void testRunScriptContainingError4StoredInString() throws Exception {
+        try {
+            this.scriptEngine.eval("while");
+        } catch (ScriptException e) {
+        	System.out.println("\tException thrown as expected " + e.getMessage());
+            return; // ok, it's correct if this exception is thrown
+        }
+        throw new Exception("ScriptException not thrown as expected");
+    }
+
+    /**
+     * Test if exception is thrown when string contains script with unknown
+     * command.
+     * 
+     * @throws Exception
+     *             this exception is thrown when this test case failed.
+     */
+    protected void testRunScriptContainingError5StoredInString() throws Exception {
+        try {
+            this.scriptEngine.eval("if");
+        } catch (ScriptException e) {
+        	System.out.println("\tException thrown as expected " + e.getMessage());
+            return; // ok, it's correct if this exception is thrown
+        }
+        throw new Exception("ScriptException not thrown as expected");
+    }
+
+    /**
+     * Test if exception is thrown when string contains script with unknown
+     * command.
+     * 
+     * @throws Exception
+     *             this exception is thrown when this test case failed.
+     */
+    protected void testRunScriptContainingError6StoredInString() throws Exception {
+        try {
+            this.scriptEngine.eval("class");
+        } catch (ScriptException e) {
+        	System.out.println("\tException thrown as expected " + e.getMessage());
+            return; // ok, it's correct if this exception is thrown
+        }
+        throw new Exception("ScriptException not thrown as expected");
+    }
+
+    /**
+     * Test if exception is thrown when string contains script with unknown
+     * command.
+     * 
+     * @throws Exception
+     *             this exception is thrown when this test case failed.
+     */
+    protected void testRunScriptContainingError7StoredInString() throws Exception {
+        try {
+            this.scriptEngine.eval("function");
+        } catch (ScriptException e) {
+        	System.out.println("\tException thrown as expected " + e.getMessage());
+            return; // ok, it's correct if this exception is thrown
+        }
+        throw new Exception("ScriptException not thrown as expected");
+    }
+
+    /**
      * Test empty script.
      * 
      * @throws ScriptException


More information about the distro-pkg-dev mailing list