8007643: Add testing for quit and exit
authorjlaskey
Wed, 06 Feb 2013 12:51:09 -0400
changeset 16220 f5502e7b3b71
parent 16219 ccf1c34f26d9
child 16221 38ac51eba133
8007643: Add testing for quit and exit Reviewed-by: sundar Contributed-by: james.laskey@oracle.com
nashorn/test/script/sandbox/exit.js
nashorn/test/script/sandbox/exit.js.EXPECTED
--- 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!