/hg/rhino-tests: Updated four tests in ScriptContextClassTest fo...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Thu May 16 01:22:40 PDT 2013
changeset 3ab1ee93ed90 in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=3ab1ee93ed90
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Thu May 16 10:26:07 2013 +0200
Updated four tests in ScriptContextClassTest for (Open)JDK8 API:
getField, getDeclaredField, getFields and getDeclaredFields.
diffstat:
ChangeLog | 6 ++
src/org/RhinoTests/ScriptContextClassTest.java | 70 ++++++++++++++++++++++++-
2 files changed, 72 insertions(+), 4 deletions(-)
diffs (121 lines):
diff -r d99e0391a6af -r 3ab1ee93ed90 ChangeLog
--- a/ChangeLog Wed May 15 09:39:26 2013 +0200
+++ b/ChangeLog Thu May 16 10:26:07 2013 +0200
@@ -1,3 +1,9 @@
+2013-05-16 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/RhinoTests/ScriptContextClassTest.java:
+ Updated four tests in ScriptContextClassTest for (Open)JDK8 API:
+ getField, getDeclaredField, getFields and getDeclaredFields.
+
2013-05-15 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/RhinoTests/SimpleScriptContextClassTest.java:
diff -r d99e0391a6af -r 3ab1ee93ed90 src/org/RhinoTests/ScriptContextClassTest.java
--- a/src/org/RhinoTests/ScriptContextClassTest.java Wed May 15 09:39:26 2013 +0200
+++ b/src/org/RhinoTests/ScriptContextClassTest.java Thu May 16 10:26:07 2013 +0200
@@ -444,9 +444,24 @@
"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;
+ 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.scriptContextClass.getFields();
@@ -475,10 +490,25 @@
"public static final int javax.script.ScriptContext.ENGINE_SCOPE",
"public static final int javax.script.ScriptContext.GLOBAL_SCOPE",
};
+ final String[] declaredFieldsThatShouldExist_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
// 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.scriptContextClass.getDeclaredFields();
@@ -507,8 +537,23 @@
"ENGINE_SCOPE",
"GLOBAL_SCOPE",
};
+ final String[] fieldsThatShouldExist_jdk8 = {
+ "ENGINE_SCOPE",
+ "GLOBAL_SCOPE",
+ };
- 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) {
@@ -538,8 +583,25 @@
"ENGINE_SCOPE",
"GLOBAL_SCOPE",
};
+ final String[] declaredFieldsThatShouldExist_jdk8 = {
+ "ENGINE_SCOPE",
+ "GLOBAL_SCOPE",
+ };
- 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