8242652: Throw SkippedException if no JS engine availabe in TestSearchScript
Reviewed-by: prappo
This commit is contained in:
parent
ee99686b28
commit
f2f3ba92d7
@ -22,3 +22,7 @@ useNewOptions=true
|
|||||||
|
|
||||||
# Use --patch-module instead of -Xmodule:
|
# Use --patch-module instead of -Xmodule:
|
||||||
useNewPatchModule=true
|
useNewPatchModule=true
|
||||||
|
|
||||||
|
# Path to libraries in the topmost test directory. This is needed so @library
|
||||||
|
# does not need ../../ notation to reach them
|
||||||
|
external.lib.roots = ../../
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -26,8 +26,10 @@
|
|||||||
* @bug 8178982 8220497 8210683 8241982
|
* @bug 8178982 8220497 8210683 8241982
|
||||||
* @summary Test the search feature of javadoc.
|
* @summary Test the search feature of javadoc.
|
||||||
* @library ../../lib
|
* @library ../../lib
|
||||||
|
* @library /test/lib
|
||||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||||
* @build javadoc.tester.*
|
* @build javadoc.tester.*
|
||||||
|
* @build jtreg.SkippedException
|
||||||
* @run main TestSearchScript
|
* @run main TestSearchScript
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -45,6 +47,8 @@ import java.io.FileReader;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import jtreg.SkippedException;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tests for the search feature using any available javax.script JavaScript engine.
|
* Tests for the search feature using any available javax.script JavaScript engine.
|
||||||
* The test is skipped if no JavaScript engine is available.
|
* The test is skipped if no JavaScript engine is available.
|
||||||
@ -61,7 +65,7 @@ public class TestSearchScript extends JavadocTester {
|
|||||||
// Use "js" engine name to use any available JavaScript engine.
|
// Use "js" engine name to use any available JavaScript engine.
|
||||||
ScriptEngine engine = engineManager.getEngineByName("js");
|
ScriptEngine engine = engineManager.getEngineByName("js");
|
||||||
if (engine == null) {
|
if (engine == null) {
|
||||||
return null;
|
throw new SkippedException("JavaScript engine is not available.");
|
||||||
}
|
}
|
||||||
// For GraalJS set Nashorn compatibility mode via Bindings,
|
// For GraalJS set Nashorn compatibility mode via Bindings,
|
||||||
// see https://github.com/graalvm/graaljs/blob/master/docs/user/ScriptEngine.md
|
// see https://github.com/graalvm/graaljs/blob/master/docs/user/ScriptEngine.md
|
||||||
@ -85,11 +89,6 @@ public class TestSearchScript extends JavadocTester {
|
|||||||
|
|
||||||
Invocable inv = getEngine();
|
Invocable inv = getEngine();
|
||||||
|
|
||||||
if (inv == null) {
|
|
||||||
out.println("No JavaScript engine available. Test skipped.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// exact match, case sensitivity
|
// exact match, case sensitivity
|
||||||
checkSearch(inv, "mapmodule", List.of("mapmodule"));
|
checkSearch(inv, "mapmodule", List.of("mapmodule"));
|
||||||
checkSearch(inv, "mappkg", List.of("mapmodule/mappkg", "mapmodule/mappkg.impl", "mappkg.system.property"));
|
checkSearch(inv, "mappkg", List.of("mapmodule/mappkg", "mapmodule/mappkg.impl", "mappkg.system.property"));
|
||||||
@ -186,11 +185,6 @@ public class TestSearchScript extends JavadocTester {
|
|||||||
|
|
||||||
Invocable inv = getEngine();
|
Invocable inv = getEngine();
|
||||||
|
|
||||||
if (inv == null) {
|
|
||||||
out.println("No JavaScript engine available. Test skipped.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// exact match, case sensitvity, left boundaries
|
// exact match, case sensitvity, left boundaries
|
||||||
checkSearch(inv, "list", List.of("listpkg", "listpkg.List", "listpkg.ListProvider", "listpkg.MyList",
|
checkSearch(inv, "list", List.of("listpkg", "listpkg.List", "listpkg.ListProvider", "listpkg.MyList",
|
||||||
"listpkg.MyListFactory", "listpkg.ListProvider.ListProvider()",
|
"listpkg.MyListFactory", "listpkg.ListProvider.ListProvider()",
|
||||||
|
Loading…
Reference in New Issue
Block a user