8055830: JDK-8015969.js is silently failing
authorsundar
Fri, 22 Aug 2014 22:50:38 +0530
changeset 26238 829648e12198
parent 26237 b6509e37ce64
child 26239 f38221b60b31
8055830: JDK-8015969.js is silently failing Reviewed-by: lagergren, jlaskey, hannesw
nashorn/test/script/basic/JDK-8015969.js
--- a/nashorn/test/script/basic/JDK-8015969.js	Fri Aug 22 15:47:28 2014 +0530
+++ b/nashorn/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);
     }
 }