7015908: 3 javax.script tests fail with openjdk build
authorsundar
Tue, 01 Feb 2011 21:00:09 +0530
changeset 8164 84f2b622b407
parent 8163 d9bcc1208691
child 8165 b67d8b1f4e46
7015908: 3 javax.script tests fail with openjdk build Reviewed-by: alanb
jdk/test/javax/script/CauseExceptionTest.java
jdk/test/javax/script/StringWriterPrintTest.java
jdk/test/javax/script/UnescapedBracketRegExTest.java
--- a/jdk/test/javax/script/CauseExceptionTest.java	Tue Feb 01 04:45:10 2011 -0800
+++ b/jdk/test/javax/script/CauseExceptionTest.java	Tue Feb 01 21:00:09 2011 +0530
@@ -34,6 +34,10 @@
     public static void main(String[] args) throws ScriptException, NoSuchMethodException {
         ScriptEngineManager sem = new ScriptEngineManager();
         ScriptEngine engine = sem.getEngineByName("js");
+        if (engine == null) {
+            System.out.println("Warning: No js engine found; test vacuously passes.");
+            return;
+        }
         engine.eval("function hello_world() { println('hello world'); throw 'out of here'; } ");
         Invocable invocable = (Invocable) engine;
         try {
--- a/jdk/test/javax/script/StringWriterPrintTest.java	Tue Feb 01 04:45:10 2011 -0800
+++ b/jdk/test/javax/script/StringWriterPrintTest.java	Tue Feb 01 21:00:09 2011 +0530
@@ -34,6 +34,10 @@
     public static void main(String[] args) throws ScriptException {
         ScriptEngineManager sem = new ScriptEngineManager();
         ScriptEngine engine = sem.getEngineByName("js");
+        if (engine == null) {
+            System.out.println("Warning: No js engine found; test vacuously passes.");
+            return;
+        }
         StringWriter sw = new StringWriter();
         engine.eval("print(\"hello world 1\\n\")");
         engine.getContext().setWriter(sw);
--- a/jdk/test/javax/script/UnescapedBracketRegExTest.java	Tue Feb 01 04:45:10 2011 -0800
+++ b/jdk/test/javax/script/UnescapedBracketRegExTest.java	Tue Feb 01 21:00:09 2011 +0530
@@ -34,6 +34,10 @@
     public static void main(String[] args) throws ScriptException {
         ScriptEngineManager sem = new ScriptEngineManager();
         ScriptEngine engine = sem.getEngineByName("js");
+        if (engine == null) {
+            System.out.println("Warning: No js engine found; test vacuously passes.");
+            return;
+        }
         // the following throws exception
         engine.eval("var x = /[a-zA-Z+/=]/;");
     }