7015908: 3 javax.script tests fail with openjdk build

Reviewed-by: alanb
This commit is contained in:
Athijegannathan Sundararajan 2011-02-01 21:00:09 +05:30
parent 85a3f20cef
commit 932380b9e0
3 changed files with 12 additions and 0 deletions

View File

@ -34,6 +34,10 @@ public class CauseExceptionTest {
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 {

View File

@ -34,6 +34,10 @@ public class StringWriterPrintTest {
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);

View File

@ -34,6 +34,10 @@ public class UnescapedBracketRegExTest {
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+/=]/;");
}