michael@0: // Any copyright is dedicated to the Public Domain. michael@0: // http://creativecommons.org/licenses/publicdomain/ michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: var BUGNUMBER = 601262; michael@0: var summary = michael@0: "A string literal containing an octal escape before a strict mode " + michael@0: "directive should be a syntax error"; michael@0: michael@0: print(BUGNUMBER + ": " + summary); michael@0: michael@0: /************** michael@0: * BEGIN TEST * michael@0: **************/ michael@0: michael@0: try michael@0: { michael@0: eval(" '\\145'; 'use strict'; "); michael@0: throw new Error("no error thrown for eval"); michael@0: } michael@0: catch (e) michael@0: { michael@0: assertEq(e instanceof SyntaxError, true, michael@0: "wrong error for octal-escape before strict directive in eval"); michael@0: } michael@0: michael@0: try michael@0: { michael@0: Function(" '\\145'; 'use strict'; "); michael@0: throw new Error("no error thrown for Function"); michael@0: } michael@0: catch (e) michael@0: { michael@0: assertEq(e instanceof SyntaxError, true, michael@0: "wrong error for octal-escape before strict directive in Function"); michael@0: } michael@0: michael@0: try michael@0: { michael@0: eval(" function f(){ '\\145'; 'use strict'; } "); michael@0: throw new Error("no error thrown for eval of function"); michael@0: } michael@0: catch (e) michael@0: { michael@0: assertEq(e instanceof SyntaxError, true, michael@0: "wrong error for octal-escape before strict directive in eval of " + michael@0: "function"); michael@0: } michael@0: michael@0: try michael@0: { michael@0: Function(" function f(){ '\\145'; 'use strict'; } "); michael@0: throw new Error("no error thrown for eval of function"); michael@0: } michael@0: catch (e) michael@0: { michael@0: assertEq(e instanceof SyntaxError, true, michael@0: "wrong error for octal-escape before strict directive in eval of " + michael@0: "function"); michael@0: } michael@0: michael@0: eval("function notAnError1() { 5; '\\145'; function g() { 'use strict'; } }"); michael@0: michael@0: Function("function notAnError2() { 5; '\\145'; function g() { 'use strict'; } }"); michael@0: michael@0: function notAnError3() michael@0: { michael@0: 5; michael@0: "\145"; michael@0: function g() { "use strict"; } michael@0: } michael@0: michael@0: /******************************************************************************/ michael@0: michael@0: if (typeof reportCompare === "function") michael@0: reportCompare(true, true); michael@0: michael@0: print("All tests passed!");