changeset 980:0f91116bb4bd

8055830: JDK-8015969.js is silently failing Reviewed-by: lagergren, jlaskey, hannesw
author sundar
date Fri, 22 Aug 2014 22:50:38 +0530
parents ee00439d1d54
children 11e4f12a45b0
files test/script/basic/JDK-8015969.js
diffstat 1 files changed, 5 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/test/script/basic/JDK-8015969.js	Fri Aug 22 15:47:28 2014 +0530
+++ b/test/script/basic/JDK-8015969.js	Fri Aug 22 22:50:38 2014 +0530
@@ -32,43 +32,26 @@
 var m = new javax.script.ScriptEngineManager();
 var e = m.getEngineByName("nashorn");
 
+e.put("fail", fail);
 e.eval(<<EOF
 
 'use strict';
 
 try {
-    context = 444;
-    print("FAILED!! context write should have thrown error");
-} catch (e) {
-    if (! (e instanceof TypeError)) {
-        print("TypeError expected but got " + e);
-    }
-}
-
-try {
-    engine = "hello";
-    print("FAILED!! engine write should have thrown error");
-} catch (e) {
-    if (! (e instanceof TypeError)) {
-        print("TypeError expected but got " + e);
-    }
-}
-
-try {
     delete context;
-    print("FAILED!! context delete should have thrown error");
+    fail("FAILED!! context delete should have thrown error");
 } catch (e) {
     if (! (e instanceof SyntaxError)) {
-        print("SyntaxError expected but got " + e);
+        fail("SyntaxError expected but got " + e);
     }
 }
 
 try {
     delete engine;
-    print("FAILED!! engine delete should have thrown error");
+    fail("FAILED!! engine delete should have thrown error");
 } catch (e) {
     if (! (e instanceof SyntaxError)) {
-        print("SyntaxError expected but got " + e);
+        fail("SyntaxError expected but got " + e);
     }
 }