Jacek Caban : jscript/tests: Added more exception tests.

Alexandre Julliard julliard at winehq.org
Mon May 1 16:38:05 CDT 2017


Module: wine
Branch: master
Commit: 4b5291a519f8dd5b4e3d9eb73da6f77ea32989f8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4b5291a519f8dd5b4e3d9eb73da6f77ea32989f8

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon May  1 18:31:13 2017 +0200

jscript/tests: Added more exception tests.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/jscript/tests/lang.js | 158 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 158 insertions(+)

diff --git a/dlls/jscript/tests/lang.js b/dlls/jscript/tests/lang.js
index 01d41d5..aba6dda 100644
--- a/dlls/jscript/tests/lang.js
+++ b/dlls/jscript/tests/lang.js
@@ -981,6 +981,164 @@ case 3:
     return i;
 })();
 
+(function() {
+    var ret, x;
+
+    function unreachable() {
+        ok(false, "unreachable");
+    }
+
+    function expect(value, expect_value) {
+        ok(value === expect_value, "got " + value + " expected " + expect_value);
+    }
+
+    ret = (function() {
+        try {
+            return "try";
+            unreachable();
+        }catch(e) {
+            unreachable();
+        }finally {
+            return "finally";
+            unreachable();
+        }
+        unreachable();
+    })();
+    expect(ret, "finally");
+
+    x = "";
+    ret = (function() {
+        try {
+            x += "try,";
+            return x;
+            unreachable();
+        }catch(e) {
+            unreachable();
+        }finally {
+            x += "finally,";
+        }
+        unreachable();
+    })();
+    expect(ret, "try,");
+    expect(x, "try,finally,");
+
+    x = "";
+    ret = (function() {
+        try {
+            x += "try,"
+            throw 1;
+            unreachable();
+        }catch(e) {
+            x += "catch,";
+            return "catch";
+            unreachable();
+        }finally {
+            x += "finally,";
+            return "finally";
+            unreachable();
+        }
+        unreachable();
+    })();
+    expect(ret, "finally");
+    expect(x, "try,catch,finally,");
+
+    x = "";
+    ret = (function() {
+        try {
+            x += "try,"
+            throw 1;
+            unreachable();
+        }catch(e) {
+            x += "catch,";
+            return "catch";
+            unreachable();
+        }finally {
+            x += "finally,";
+        }
+        unreachable();
+    })();
+    expect(ret, "catch");
+    expect(x, "try,catch,finally,");
+
+    x = "";
+    ret = (function() {
+        try {
+            x += "try,"
+            try {
+                x += "try2,";
+                return "try2";
+            }catch(e) {
+                unreachable();
+            }finally {
+                x += "finally2,";
+            }
+            unreachable();
+        }catch(e) {
+            unreachable();
+        }finally {
+            x += "finally,";
+        }
+        unreachable();
+    })();
+    expect(ret, "try2");
+    expect(x, "try,try2,finally2,finally,");
+
+    x = "";
+    ret = (function() {
+        while(true) {
+            try {
+                x += "try,"
+                try {
+                    x += "try2,";
+                    break;
+                }catch(e) {
+                    unreachable();
+                }finally {
+                    x += "finally2,";
+                }
+                unreachable();
+            }catch(e) {
+                unreachable();
+            }finally {
+                x += "finally,";
+            }
+            unreachable();
+        }
+        x += "ret";
+        return "ret";
+    })();
+    expect(ret, "ret");
+    expect(x, "try,try2,finally2,finally,ret");
+
+    x = "";
+    ret = (function() {
+        while(true) {
+            try {
+                x += "try,"
+                try {
+                    x += "try2,";
+                    continue;
+                }catch(e) {
+                    unreachable();
+                }finally {
+                    x += "finally2,";
+                }
+                unreachable();
+            }catch(e) {
+                unreachable();
+            }finally {
+                x += "finally,";
+                break;
+            }
+            unreachable();
+        }
+        x += "ret";
+        return "ret";
+    })();
+    expect(ret, "ret");
+    expect(x, "try,try2,finally2,finally,ret");
+})();
+
 tmp = eval("1");
 ok(tmp === 1, "eval(\"1\") !== 1");
 eval("{ ok(tmp === 1, 'eval: tmp !== 1'); } tmp = 2;");




More information about the wine-cvs mailing list