changeset 16220:f5502e7b3b71

8007643: Add testing for quit and exit Reviewed-by: sundar Contributed-by: james.laskey@oracle.com
author jlaskey
date Wed, 06 Feb 2013 12:51:09 -0400
parents ccf1c34f26d9
children 38ac51eba133
files nashorn/test/script/sandbox/exit.js nashorn/test/script/sandbox/exit.js.EXPECTED
diffstat 2 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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!