/hg/rhino-tests: Updated four tests in ScriptExceptionClassTest ...

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Tue Jun 18 05:20:30 PDT 2013


changeset 620b718077c0 in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=620b718077c0
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Tue Jun 18 14:24:02 2013 +0200

	Updated four tests in ScriptExceptionClassTest for (Open)JDK8 API:
	getField, getFields, getDeclaredField and getDeclaredFields.


diffstat:

 ChangeLog                                        |   6 ++
 src/org/RhinoTests/ScriptExceptionClassTest.java |  70 ++++++++++++++++++++++-
 2 files changed, 72 insertions(+), 4 deletions(-)

diffs (121 lines):

diff -r 6fb422bd339f -r 620b718077c0 ChangeLog
--- a/ChangeLog	Fri Jun 14 10:13:51 2013 +0200
+++ b/ChangeLog	Tue Jun 18 14:24:02 2013 +0200
@@ -1,3 +1,9 @@
+2013-06-18  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/RhinoTests/ScriptExceptionClassTest.java:
+	Updated four tests in ScriptExceptionClassTest for (Open)JDK8 API:
+	getField, getFields, getDeclaredField and getDeclaredFields.
+
 2013-06-14  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/RhinoTests/SimpleScriptContextClassTest.java:
diff -r 6fb422bd339f -r 620b718077c0 src/org/RhinoTests/ScriptExceptionClassTest.java
--- a/src/org/RhinoTests/ScriptExceptionClassTest.java	Fri Jun 14 10:13:51 2013 +0200
+++ b/src/org/RhinoTests/ScriptExceptionClassTest.java	Tue Jun 18 14:24:02 2013 +0200
@@ -505,9 +505,22 @@
         };
         final String[] fieldsThatShouldExist_jdk7 = {
         };
+        final String[] fieldsThatShouldExist_jdk8 = {
+        };
 
         // get the right array of field signatures
-        final String[] fieldsThatShouldExist = getJavaVersion() < 7 ? fieldsThatShouldExist_jdk6 : fieldsThatShouldExist_jdk7;
+        String[] fieldsThatShouldExist = null;
+        switch (getJavaVersion()) {
+            case 6:
+                fieldsThatShouldExist = fieldsThatShouldExist_jdk6;
+                break;
+            case 7:
+                fieldsThatShouldExist = fieldsThatShouldExist_jdk7;
+                break;
+            case 8:
+                fieldsThatShouldExist = fieldsThatShouldExist_jdk8;
+                break;
+        }
 
         // get all fields
         Field[] fields = this.scriptExceptionClass.getFields();
@@ -538,10 +551,27 @@
             "private int javax.script.ScriptException.lineNumber",
             "private int javax.script.ScriptException.columnNumber",
         };
+        final String[] declaredFieldsThatShouldExist_jdk8 = {
+            "private static final long javax.script.ScriptException.serialVersionUID",
+            "private java.lang.String javax.script.ScriptException.fileName",
+            "private int javax.script.ScriptException.lineNumber",
+            "private int javax.script.ScriptException.columnNumber",
+        };
 
         // get the right array of field signatures
         // following fields should be declared
-        final String[] declaredFieldsThatShouldExist = getJavaVersion() < 7 ? declaredFieldsThatShouldExist_jdk6 : declaredFieldsThatShouldExist_jdk7;
+        String[] declaredFieldsThatShouldExist = null;
+        switch (getJavaVersion()) {
+            case 6:
+                declaredFieldsThatShouldExist = declaredFieldsThatShouldExist_jdk6;
+                break;
+            case 7:
+                declaredFieldsThatShouldExist = declaredFieldsThatShouldExist_jdk7;
+                break;
+            case 8:
+                declaredFieldsThatShouldExist = declaredFieldsThatShouldExist_jdk8;
+                break;
+        }
 
         // get all declared fields
         Field[] declaredFields = this.scriptExceptionClass.getDeclaredFields();
@@ -566,8 +596,21 @@
         };
         final String[] fieldsThatShouldExist_jdk7 = {
         };
+        final String[] fieldsThatShouldExist_jdk8 = {
+        };
 
-        final String[] fieldsThatShouldExist = getJavaVersion() < 7 ? fieldsThatShouldExist_jdk6 : fieldsThatShouldExist_jdk7;
+        String[] fieldsThatShouldExist = null;
+        switch (getJavaVersion()) {
+            case 6:
+                fieldsThatShouldExist = fieldsThatShouldExist_jdk6;
+                break;
+            case 7:
+                fieldsThatShouldExist = fieldsThatShouldExist_jdk7;
+                break;
+            case 8:
+                fieldsThatShouldExist = fieldsThatShouldExist_jdk8;
+                break;
+        }
 
         // check if all required fields really exists
         for (String fieldThatShouldExists : fieldsThatShouldExist) {
@@ -599,8 +642,27 @@
             "lineNumber",
             "columnNumber",
         };
+        final String[] declaredFieldsThatShouldExist_jdk8 = {
+            "serialVersionUID",
+            "fileName",
+            "lineNumber",
+            "columnNumber",
+        };
 
-        final String[] declaredFieldsThatShouldExist = getJavaVersion() < 7 ? declaredFieldsThatShouldExist_jdk6 : declaredFieldsThatShouldExist_jdk7;
+        // get the right array of field signatures
+        // following fields should be declared
+        String[] declaredFieldsThatShouldExist = null;
+        switch (getJavaVersion()) {
+            case 6:
+                declaredFieldsThatShouldExist = declaredFieldsThatShouldExist_jdk6;
+                break;
+            case 7:
+                declaredFieldsThatShouldExist = declaredFieldsThatShouldExist_jdk7;
+                break;
+            case 8:
+                declaredFieldsThatShouldExist = declaredFieldsThatShouldExist_jdk8;
+                break;
+        }
 
         // check if all required declared fields really exists
         for (String declaredFieldThatShouldExists : declaredFieldsThatShouldExist) {



More information about the distro-pkg-dev mailing list