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 = 520696; michael@0: var summary = michael@0: 'Implement support for string literals as names for properties defined ' + michael@0: 'using ES5 get/set syntax'; michael@0: michael@0: print(BUGNUMBER + ": " + summary); michael@0: michael@0: michael@0: var o; michael@0: michael@0: o = { get "a b c"() { return 17; } }; michael@0: assertEq("get" in Object.getOwnPropertyDescriptor(o, "a b c"), true); michael@0: michael@0: o = eval('({ get "a b c"() { return 17; } })'); michael@0: assertEq("get" in Object.getOwnPropertyDescriptor(o, "a b c"), true); michael@0: michael@0: var f = eval("(function literalInside() { return { set 'c d e'(q) { } }; })"); michael@0: f = function literalInside() { return { set 'c d e'(q) { } }; }; michael@0: michael@0: function checkO() michael@0: { michael@0: assertEq(3.141592654 in o, true, "fractional-named property isn't in object"); michael@0: assertEq(10000 in o, true, "exponential-named property is in object"); michael@0: assertEq(0xdeadbeef in o, true, "hex-named property is in object"); michael@0: assertEq("Infinity" in o, true, "numeric index stringified correctly"); michael@0: } michael@0: michael@0: o = eval('({ 3.141592654: "pi", 1e4: 17, 0xdeadbeef: "hex", 1e3000: "Infinity" })'); michael@0: checkO(); michael@0: o = { 3.141592654: "pi", 1e4: 17, 0xdeadbeef: "hex", 1e3000: "Infinity" }; michael@0: checkO(); michael@0: michael@0: reportCompare(true, true);