8007643: Add testing for quit and exit
Reviewed-by: sundar
Contributed-by: james.laskey@oracle.com
--- a/nashorn/test/script/sandbox/exit.js Wed Feb 06 11:57:51 2013 -0400
+++ b/nashorn/test/script/sandbox/exit.js Wed Feb 06 12:51:09 2013 -0400
@@ -22,7 +22,7 @@
*/
/**
- * Try to call System.exit.
+ * Try to call System.exit, quit and exit.
*
* @test
* @security
@@ -43,4 +43,18 @@
check(e);
}
+try {
+ quit();
+ // will not reach here regardless of outcome..
+} catch (e) {
+ check(e);
+}
+
+try {
+ exit(0);
+ // will not reach here regardless of outcome..
+} catch (e) {
+ check(e);
+}
+
print("Success, didn't exit!");
--- a/nashorn/test/script/sandbox/exit.js.EXPECTED Wed Feb 06 11:57:51 2013 -0400
+++ b/nashorn/test/script/sandbox/exit.js.EXPECTED Wed Feb 06 12:51:09 2013 -0400
@@ -1,2 +1,4 @@
+java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "exitVM.0")
+java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "exitVM.0")
java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "exitVM.0")
Success, didn't exit!