js/src/tests/ecma_5/Expressions/11.1.5-01.js

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

michael@0 1 // Any copyright is dedicated to the Public Domain.
michael@0 2 // http://creativecommons.org/licenses/publicdomain/
michael@0 3
michael@0 4 //-----------------------------------------------------------------------------
michael@0 5 var BUGNUMBER = 520696;
michael@0 6 var summary =
michael@0 7 'Implement support for string literals as names for properties defined ' +
michael@0 8 'using ES5 get/set syntax';
michael@0 9
michael@0 10 print(BUGNUMBER + ": " + summary);
michael@0 11
michael@0 12
michael@0 13 var o;
michael@0 14
michael@0 15 o = { get "a b c"() { return 17; } };
michael@0 16 assertEq("get" in Object.getOwnPropertyDescriptor(o, "a b c"), true);
michael@0 17
michael@0 18 o = eval('({ get "a b c"() { return 17; } })');
michael@0 19 assertEq("get" in Object.getOwnPropertyDescriptor(o, "a b c"), true);
michael@0 20
michael@0 21 var f = eval("(function literalInside() { return { set 'c d e'(q) { } }; })");
michael@0 22 f = function literalInside() { return { set 'c d e'(q) { } }; };
michael@0 23
michael@0 24 function checkO()
michael@0 25 {
michael@0 26 assertEq(3.141592654 in o, true, "fractional-named property isn't in object");
michael@0 27 assertEq(10000 in o, true, "exponential-named property is in object");
michael@0 28 assertEq(0xdeadbeef in o, true, "hex-named property is in object");
michael@0 29 assertEq("Infinity" in o, true, "numeric index stringified correctly");
michael@0 30 }
michael@0 31
michael@0 32 o = eval('({ 3.141592654: "pi", 1e4: 17, 0xdeadbeef: "hex", 1e3000: "Infinity" })');
michael@0 33 checkO();
michael@0 34 o = { 3.141592654: "pi", 1e4: 17, 0xdeadbeef: "hex", 1e3000: "Infinity" };
michael@0 35 checkO();
michael@0 36
michael@0 37 reportCompare(true, true);

mercurial