/hg/rhino-tests: Updated SimpleScriptContextClassTest to works c...

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Tue Mar 12 01:28:37 PDT 2013


changeset 64b1fc64c1b9 in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=64b1fc64c1b9
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Tue Mar 12 09:31:43 2013 +0100

	Updated SimpleScriptContextClassTest to works correctly with JDK6 and
	JDK7 too.


diffstat:

 ChangeLog                                            |   6 ++++++
 src/org/RhinoTests/SimpleScriptContextClassTest.java |  18 +++++++++++++-----
 2 files changed, 19 insertions(+), 5 deletions(-)

diffs (66 lines):

diff -r 9282fedae49b -r 64b1fc64c1b9 ChangeLog
--- a/ChangeLog	Mon Mar 11 10:00:23 2013 +0100
+++ b/ChangeLog	Tue Mar 12 09:31:43 2013 +0100
@@ -1,3 +1,9 @@
+2013-03-12  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/RhinoTests/SimpleScriptContextClassTest.java:
+	Updated SimpleScriptContextClassTest to works correctly with JDK6 and
+	JDK7 too.
+
 2013-03-11  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/RhinoTests/CompiledScriptClassTest.java:
diff -r 9282fedae49b -r 64b1fc64c1b9 src/org/RhinoTests/SimpleScriptContextClassTest.java
--- a/src/org/RhinoTests/SimpleScriptContextClassTest.java	Mon Mar 11 10:00:23 2013 +0100
+++ b/src/org/RhinoTests/SimpleScriptContextClassTest.java	Tue Mar 12 09:31:43 2013 +0100
@@ -415,10 +415,18 @@
      */
     protected void testGetFields() {
         // following fields should exists
-        final String[] fieldsThatShouldExist = {
+        final String[] fieldsThatShouldExist_jdk6 = {
             "public static final int javax.script.ScriptContext.ENGINE_SCOPE",
             "public static final int javax.script.ScriptContext.GLOBAL_SCOPE",
         };
+        final String[] fieldsThatShouldExist_jdk7 = {
+            "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;
+
         // get all fields
         Field[] fields = this.simpleScriptContextClass.getFields();
         // and transform the array into a list of field names
@@ -548,7 +556,7 @@
      */
     protected void testGetMethods() {
         // following methods should be inherited
-        final String[] methodsThatShouldExists_jdk6 = {
+        final String[] methodsThatShouldExist_jdk6 = {
             "public boolean java.lang.Object.equals(java.lang.Object)",
             "public final native java.lang.Class java.lang.Object.getClass()",
             "public final native void java.lang.Object.notify()",
@@ -574,7 +582,7 @@
             "public void javax.script.SimpleScriptContext.setWriter(java.io.Writer)",
         };
 
-        final String[] methodsThatShouldExists_jdk7 = {
+        final String[] methodsThatShouldExist_jdk7 = {
             "public boolean java.lang.Object.equals(java.lang.Object)",
             "public final native java.lang.Class java.lang.Object.getClass()",
             "public final native void java.lang.Object.notify()",
@@ -607,9 +615,9 @@
         for (Method method : methods) {
             methodsAsString.add(method.toString());
         }
-        String[] methodsThatShouldExists = getJavaVersion() < 7 ? methodsThatShouldExists_jdk6 : methodsThatShouldExists_jdk7;
+        String[] methodsThatShouldExist = getJavaVersion() < 7 ? methodsThatShouldExist_jdk6 : methodsThatShouldExist_jdk7;
         // check if all required methods really exists
-        for (String methodThatShouldExists : methodsThatShouldExists) {
+        for (String methodThatShouldExists : methodsThatShouldExist) {
             assertTrue(methodsAsString.contains(methodThatShouldExists),
                     "method " + methodThatShouldExists + " not found");
         }



More information about the distro-pkg-dev mailing list