1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/ecma_5/Expressions/11.1.5-01.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,37 @@ 1.4 +// Any copyright is dedicated to the Public Domain. 1.5 +// http://creativecommons.org/licenses/publicdomain/ 1.6 + 1.7 +//----------------------------------------------------------------------------- 1.8 +var BUGNUMBER = 520696; 1.9 +var summary = 1.10 + 'Implement support for string literals as names for properties defined ' + 1.11 + 'using ES5 get/set syntax'; 1.12 + 1.13 +print(BUGNUMBER + ": " + summary); 1.14 + 1.15 + 1.16 +var o; 1.17 + 1.18 +o = { get "a b c"() { return 17; } }; 1.19 +assertEq("get" in Object.getOwnPropertyDescriptor(o, "a b c"), true); 1.20 + 1.21 +o = eval('({ get "a b c"() { return 17; } })'); 1.22 +assertEq("get" in Object.getOwnPropertyDescriptor(o, "a b c"), true); 1.23 + 1.24 +var f = eval("(function literalInside() { return { set 'c d e'(q) { } }; })"); 1.25 +f = function literalInside() { return { set 'c d e'(q) { } }; }; 1.26 + 1.27 +function checkO() 1.28 +{ 1.29 + assertEq(3.141592654 in o, true, "fractional-named property isn't in object"); 1.30 + assertEq(10000 in o, true, "exponential-named property is in object"); 1.31 + assertEq(0xdeadbeef in o, true, "hex-named property is in object"); 1.32 + assertEq("Infinity" in o, true, "numeric index stringified correctly"); 1.33 +} 1.34 + 1.35 +o = eval('({ 3.141592654: "pi", 1e4: 17, 0xdeadbeef: "hex", 1e3000: "Infinity" })'); 1.36 +checkO(); 1.37 +o = { 3.141592654: "pi", 1e4: 17, 0xdeadbeef: "hex", 1e3000: "Infinity" }; 1.38 +checkO(); 1.39 + 1.40 +reportCompare(true, true);