From e28a14d232411ec47a8ba719066ef57f9fc26d0a Mon Sep 17 00:00:00 2001 From: "bclary@bclary.com" Date: Fri, 21 Dec 2007 17:58:43 -0800 Subject: [PATCH] JavaScript Test - add additional tests for Function constructor, bug 408271, not part of the build --- js/tests/js1_5/Regress/regress-352197.js | 29 ++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/js/tests/js1_5/Regress/regress-352197.js b/js/tests/js1_5/Regress/regress-352197.js index 98c2a7e40e3..5e84bb90643 100755 --- a/js/tests/js1_5/Regress/regress-352197.js +++ b/js/tests/js1_5/Regress/regress-352197.js @@ -57,7 +57,7 @@ catch(ex) actual = ex + ''; } -reportCompare(expect, actual, summary); +reportCompare(expect, actual, summary + ': 1'); try { @@ -68,4 +68,29 @@ catch(ex) actual = ex + ''; } -reportCompare(expect, actual, summary); +reportCompare(expect, actual, summary + ': 2'); + +var f; +expect = 'TypeError: function anonymous does not always return a value'; + +try +{ + f = Function('if (x) return y;'); +} +catch(ex) +{ + actual = ex + ''; +} + +reportCompare(expect, actual, summary + ': 3'); + +try +{ + f = Function('if (x) { return y; }'); +} +catch(ex) +{ + actual = ex + ''; +} + +reportCompare(expect, actual, summary + ': 4');