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: function throws(code) { michael@0: var type; michael@0: try { michael@0: eval(code); michael@0: } catch (ex) { michael@0: type = ex.name; michael@0: } michael@0: assertEq(type, 'SyntaxError'); michael@0: } michael@0: michael@0: var s = '\\u0073'; michael@0: throws('var thi' + s); michael@0: throws('switch (' + s + 'witch) {}') michael@0: throws('var ' + s + 'witch'); michael@0: michael@0: if (typeof reportCompare == 'function') michael@0: reportCompare(true, true);