michael@0: /* michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/licenses/publicdomain/ michael@0: */ michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: var BUGNUMBER = 672854; michael@0: var summary = michael@0: "Syntax errors at the end of |for| statement header parts shouldn't cause " + michael@0: "crashes"; michael@0: michael@0: print(BUGNUMBER + ": " + summary); michael@0: michael@0: /************** michael@0: * BEGIN TEST * michael@0: **************/ michael@0: michael@0: function checkSyntaxError(str) michael@0: { michael@0: try michael@0: { michael@0: var f = Function("for(w in\\"); michael@0: throw new Error("didn't throw, returned " + f); michael@0: } michael@0: catch (e) michael@0: { michael@0: assertEq(e instanceof SyntaxError, true, michael@0: "expected SyntaxError, got " + e); michael@0: } michael@0: } michael@0: michael@0: checkSyntaxError("for(var w in \\"); michael@0: checkSyntaxError("for(w in \\"); michael@0: checkSyntaxError("for(var w\\"); michael@0: checkSyntaxError("for(w\\"); michael@0: checkSyntaxError("for(var w;\\"); michael@0: checkSyntaxError("for(w;\\"); michael@0: checkSyntaxError("for(var w; w >\\"); michael@0: checkSyntaxError("for(w; w >\\"); michael@0: checkSyntaxError("for(var w; w > 3;\\"); michael@0: checkSyntaxError("for(w; w > 3;\\"); michael@0: checkSyntaxError("for(var w; w > 3; 5\\"); michael@0: checkSyntaxError("for(w; w > 3; 5\\"); michael@0: checkSyntaxError("for(var w; w > 3; 5foo"); michael@0: checkSyntaxError("for(w; w > 3; 5foo"); michael@0: michael@0: /******************************************************************************/ michael@0: michael@0: reportCompare(true, true); michael@0: michael@0: print("Tests complete!");