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

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Thu Apr 11 02:00:18 PDT 2013


changeset 857eee8c4f34 in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=857eee8c4f34
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Thu Apr 11 11:03:34 2013 +0200

	Updated four tests in SimpleScriptContextClassTest for (Open)JDK8 API:
	getConstructor, getDeclaredConstructor, getConstructors and
	getDeclaredConstructors.


diffstat:

 ChangeLog                                            |   7 ++
 src/org/RhinoTests/SimpleScriptContextClassTest.java |  64 ++++++++++++++++++-
 2 files changed, 67 insertions(+), 4 deletions(-)

diffs (126 lines):

diff -r 03d34eb842e5 -r 857eee8c4f34 ChangeLog
--- a/ChangeLog	Wed Apr 10 09:28:01 2013 +0200
+++ b/ChangeLog	Thu Apr 11 11:03:34 2013 +0200
@@ -1,3 +1,10 @@
+2013-04-11  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/RhinoTests/SimpleScriptContextClassTest.java:
+	Updated four tests in SimpleScriptContextClassTest for (Open)JDK8 API:
+	getConstructor, getDeclaredConstructor, getConstructors and
+	getDeclaredConstructors.
+
 2013-04-10  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/RhinoTests/CompilableClassTest.java:
diff -r 03d34eb842e5 -r 857eee8c4f34 src/org/RhinoTests/SimpleScriptContextClassTest.java
--- a/src/org/RhinoTests/SimpleScriptContextClassTest.java	Wed Apr 10 09:28:01 2013 +0200
+++ b/src/org/RhinoTests/SimpleScriptContextClassTest.java	Thu Apr 11 11:03:34 2013 +0200
@@ -294,12 +294,24 @@
         Map<String, String> testedConstructors = null;
         Map<String, String> testedConstructors_jdk6 = new HashMap<String, String>();
         Map<String, String> testedConstructors_jdk7 = new HashMap<String, String>();
+        Map<String, String> testedConstructors_jdk8 = new HashMap<String, String>();
 
         testedConstructors_jdk6.put("public javax.script.SimpleScriptContext()", "javax.script.SimpleScriptContext");
         testedConstructors_jdk7.put("public javax.script.SimpleScriptContext()", "javax.script.SimpleScriptContext");
+        testedConstructors_jdk8.put("public javax.script.SimpleScriptContext()", "javax.script.SimpleScriptContext");
 
         // get the right map containing constructor signatures
-        testedConstructors = getJavaVersion() < 7 ? testedConstructors_jdk6 : testedConstructors_jdk7;
+        switch (getJavaVersion()) {
+            case 6:
+                testedConstructors = testedConstructors_jdk6;
+                break;
+            case 7:
+                testedConstructors = testedConstructors_jdk7;
+                break;
+            case 8:
+                testedConstructors = testedConstructors_jdk8;
+                break;
+        }
 
         // get all constructors for this class
         Constructor<?>[] constructors = this.simpleScriptContextClass.getConstructors();
@@ -324,12 +336,24 @@
         Map<String, String> testedConstructors = null;
         Map<String, String> testedConstructors_jdk6 = new HashMap<String, String>();
         Map<String, String> testedConstructors_jdk7 = new HashMap<String, String>();
+        Map<String, String> testedConstructors_jdk8 = new HashMap<String, String>();
 
         testedConstructors_jdk6.put("public javax.script.SimpleScriptContext()", "javax.script.SimpleScriptContext");
         testedConstructors_jdk7.put("public javax.script.SimpleScriptContext()", "javax.script.SimpleScriptContext");
+        testedConstructors_jdk8.put("public javax.script.SimpleScriptContext()", "javax.script.SimpleScriptContext");
 
         // get the right map containing constructor signatures
-        testedConstructors = getJavaVersion() < 7 ? testedConstructors_jdk6 : testedConstructors_jdk7;
+        switch (getJavaVersion()) {
+            case 6:
+                testedConstructors = testedConstructors_jdk6;
+                break;
+            case 7:
+                testedConstructors = testedConstructors_jdk7;
+                break;
+            case 8:
+                testedConstructors = testedConstructors_jdk8;
+                break;
+        }
 
         // get all declared constructors for this class
         Constructor<?>[] declaredConstructors = this.simpleScriptContextClass.getDeclaredConstructors();
@@ -357,7 +381,21 @@
         Map<String, Class[]> constructorsThatShouldExist_jdk7 = new TreeMap<String, Class[]>();
         constructorsThatShouldExist_jdk7.put("javax.script.SimpleScriptContext", new Class[] {});
 
-        Map<String, Class[]> constructorsThatShouldExist = getJavaVersion() < 7 ? constructorsThatShouldExist_jdk6 : constructorsThatShouldExist_jdk7;
+        Map<String, Class[]> constructorsThatShouldExist_jdk8 = new TreeMap<String, Class[]>();
+        constructorsThatShouldExist_jdk8.put("javax.script.SimpleScriptContext", new Class[] {});
+
+        Map<String, Class[]> constructorsThatShouldExist = null;
+        switch (getJavaVersion()) {
+            case 6:
+                constructorsThatShouldExist = constructorsThatShouldExist_jdk6;
+                break;
+            case 7:
+                constructorsThatShouldExist = constructorsThatShouldExist_jdk7;
+                break;
+            case 8:
+                constructorsThatShouldExist = constructorsThatShouldExist_jdk8;
+                break;
+        }
 
         // check if all required constructors really exist
         for (Map.Entry<String, Class[]> constructorThatShouldExists : constructorsThatShouldExist.entrySet()) {
@@ -389,7 +427,21 @@
         Map<String, Class[]> constructorsThatShouldExist_jdk7 = new TreeMap<String, Class[]>();
         constructorsThatShouldExist_jdk7.put("javax.script.SimpleScriptContext", new Class[] {});
 
-        Map<String, Class[]> constructorsThatShouldExist = getJavaVersion() < 7 ? constructorsThatShouldExist_jdk6 : constructorsThatShouldExist_jdk7;
+        Map<String, Class[]> constructorsThatShouldExist_jdk8 = new TreeMap<String, Class[]>();
+        constructorsThatShouldExist_jdk8.put("javax.script.SimpleScriptContext", new Class[] {});
+
+        Map<String, Class[]> constructorsThatShouldExist = null;
+        switch (getJavaVersion()) {
+            case 6:
+                constructorsThatShouldExist = constructorsThatShouldExist_jdk6;
+                break;
+            case 7:
+                constructorsThatShouldExist = constructorsThatShouldExist_jdk7;
+                break;
+            case 8:
+                constructorsThatShouldExist = constructorsThatShouldExist_jdk8;
+                break;
+        }
 
         // check if all required constructors really exist
         for (Map.Entry<String, Class[]> constructorThatShouldExists : constructorsThatShouldExist.entrySet()) {
@@ -423,6 +475,10 @@
             "public static final int javax.script.ScriptContext.ENGINE_SCOPE",
             "public static final int javax.script.ScriptContext.GLOBAL_SCOPE",
         };
+        final String[] fieldsThatShouldExist_jdk8 = {
+            "public static final int javax.script.ScriptContext.ENGINE_SCOPE",
+            "public static final int javax.script.ScriptContext.GLOBAL_SCOPE",
+        };
 
         // get the right array of field signatures
         final String[] fieldsThatShouldExist = getJavaVersion() < 7 ? fieldsThatShouldExist_jdk6 : fieldsThatShouldExist_jdk7;



More information about the distro-pkg-dev mailing list