changeset 3477:21d7cd823247

7015908: 3 javax.script tests fail with openjdk build Reviewed-by: alanb
author sundar
date Tue, 01 Feb 2011 21:00:09 +0530
parents d4bc38aa7594
children 312dc0abb960
files test/javax/script/CauseExceptionTest.java test/javax/script/StringWriterPrintTest.java test/javax/script/UnescapedBracketRegExTest.java
diffstat 3 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test/javax/script/CauseExceptionTest.java	Tue Feb 01 04:45:10 2011 -0800
+++ b/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/test/javax/script/StringWriterPrintTest.java	Tue Feb 01 04:45:10 2011 -0800
+++ b/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/test/javax/script/UnescapedBracketRegExTest.java	Tue Feb 01 04:45:10 2011 -0800
+++ b/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+/=]/;");
     }