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

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Mon Apr 29 01:21:58 PDT 2013


changeset 1b9cfd28c6e2 in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=1b9cfd28c6e2
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Mon Apr 29 10:25:19 2013 +0200

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


diffstat:

 ChangeLog                                             |   6 +
 src/org/RhinoTests/AbstractScriptEngineClassTest.java |  78 ++++++++++++++++++-
 2 files changed, 80 insertions(+), 4 deletions(-)

diffs (129 lines):

diff -r 4af92415b07c -r 1b9cfd28c6e2 ChangeLog
--- a/ChangeLog	Fri Apr 26 09:23:44 2013 +0200
+++ b/ChangeLog	Mon Apr 29 10:25:19 2013 +0200
@@ -1,3 +1,9 @@
+2013-04-29  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/RhinoTests/AbstractScriptEngineClassTest.java:
+	Updated four tests in AbstractScriptEngineClassTest for (Open)JDK8 API:
+	getField, getDeclaredField, getFields and getDeclaredFields.
+
 2013-04-26  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/RhinoTests/ScriptEngineManagerClassTest.java:
diff -r 4af92415b07c -r 1b9cfd28c6e2 src/org/RhinoTests/AbstractScriptEngineClassTest.java
--- a/src/org/RhinoTests/AbstractScriptEngineClassTest.java	Fri Apr 26 09:23:44 2013 +0200
+++ b/src/org/RhinoTests/AbstractScriptEngineClassTest.java	Mon Apr 29 10:25:19 2013 +0200
@@ -495,9 +495,29 @@
             "public static final java.lang.String javax.script.ScriptEngine.LANGUAGE",
             "public static final java.lang.String javax.script.ScriptEngine.LANGUAGE_VERSION",
         };
+        final String[] fieldsThatShouldExist_jdk8 = {
+            "public static final java.lang.String javax.script.ScriptEngine.ARGV",
+            "public static final java.lang.String javax.script.ScriptEngine.FILENAME",
+            "public static final java.lang.String javax.script.ScriptEngine.ENGINE",
+            "public static final java.lang.String javax.script.ScriptEngine.ENGINE_VERSION",
+            "public static final java.lang.String javax.script.ScriptEngine.NAME",
+            "public static final java.lang.String javax.script.ScriptEngine.LANGUAGE",
+            "public static final java.lang.String javax.script.ScriptEngine.LANGUAGE_VERSION",
+        };
 
         // 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.abstractScriptEngineClass.getFields();
@@ -524,10 +544,24 @@
         final String[] declaredFieldsThatShouldExist_jdk7 = {
             "protected javax.script.ScriptContext javax.script.AbstractScriptEngine.context",
         };
+        final String[] declaredFieldsThatShouldExist_jdk8 = {
+            "protected javax.script.ScriptContext javax.script.AbstractScriptEngine.context",
+        };
 
         // 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.abstractScriptEngineClass.getDeclaredFields();
@@ -566,8 +600,28 @@
             "LANGUAGE",
             "LANGUAGE_VERSION",
         };
+        final String[] fieldsThatShouldExist_jdk8 = {
+            "ARGV",
+            "FILENAME",
+            "ENGINE",
+            "ENGINE_VERSION",
+            "NAME",
+            "LANGUAGE",
+            "LANGUAGE_VERSION",
+        };
 
-        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) {
@@ -595,8 +649,24 @@
         final String[] declaredFieldsThatShouldExist_jdk7 = {
             "context",
         };
+        final String[] declaredFieldsThatShouldExist_jdk8 = {
+            "context",
+        };
 
-        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