js/src/tests/js1_8_5/extensions/proxy-enumerateOwn-duplicates.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/js1_8_5/extensions/proxy-enumerateOwn-duplicates.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,40 @@
     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 = 580200;
     1.9 +var summary =
    1.10 +  'Assertion failure enumerating own properties of proxy returning ' +
    1.11 +  'duplicated own property name';
    1.12 +print(BUGNUMBER + ": " + summary);
    1.13 +
    1.14 +/**************
    1.15 + * BEGIN TEST *
    1.16 + **************/
    1.17 +
    1.18 +var x = Proxy.create({ keys: function() { return ["0","0"]; } }, [1,2]);
    1.19 +var ax = Object.keys(x);
    1.20 +assertEq(ax.length, 1, "array: " + ax);
    1.21 +assertEq(ax[0], "0");
    1.22 +
    1.23 +var p = Proxy.create({ keys: function() { return ["1","1"]; } }, null);
    1.24 +var ap = Object.keys(p);
    1.25 +assertEq(ap.length, 1, "array: " + ap);
    1.26 +assertEq(ap[0], "1");
    1.27 +
    1.28 +var x = Proxy.create({ getOwnPropertyNames: function() { return ["0","0"]; } }, [1,2]);
    1.29 +var ax = Object.getOwnPropertyNames(x);
    1.30 +assertEq(ax.length, 1, "array: " + ax);
    1.31 +assertEq(ax[0], "0");
    1.32 +
    1.33 +var p = Proxy.create({ getOwnPropertyNames: function() { return ["1","1"]; } }, null);
    1.34 +var ap = Object.getOwnPropertyNames(p);
    1.35 +assertEq(ap.length, 1, "array: " + ap);
    1.36 +assertEq(ap[0], "1");
    1.37 +
    1.38 +/******************************************************************************/
    1.39 +
    1.40 +if (typeof reportCompare === "function")
    1.41 +  reportCompare(true, true);
    1.42 +
    1.43 +print("All tests passed!");

mercurial