1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/ecma_5/misc/unicode-escaped-keyword.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,22 @@ 1.4 +/* 1.5 + * Any copyright is dedicated to the Public Domain. 1.6 + * http://creativecommons.org/licenses/publicdomain/ 1.7 + */ 1.8 + 1.9 +function throws(code) { 1.10 + var type; 1.11 + try { 1.12 + eval(code); 1.13 + } catch (ex) { 1.14 + type = ex.name; 1.15 + } 1.16 + assertEq(type, 'SyntaxError'); 1.17 +} 1.18 + 1.19 +var s = '\\u0073'; 1.20 +throws('var thi' + s); 1.21 +throws('switch (' + s + 'witch) {}') 1.22 +throws('var ' + s + 'witch'); 1.23 + 1.24 +if (typeof reportCompare == 'function') 1.25 + reportCompare(true, true);