js/src/tests/ecma_5/Object/15.2.3.4-03.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/ecma_5/Object/15.2.3.4-03.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +/*
     1.5 + * Any copyright is dedicated to the Public Domain.
     1.6 + * http://creativecommons.org/licenses/publicdomain/
     1.7 + * Contributor:
     1.8 + *   Jeff Walden <jwalden+code@mit.edu>
     1.9 + */
    1.10 +
    1.11 +//-----------------------------------------------------------------------------
    1.12 +var BUGNUMBER = 518663;
    1.13 +var summary = 'Object.getOwnPropertyNames: function objects';
    1.14 +
    1.15 +print(BUGNUMBER + ": " + summary);
    1.16 +
    1.17 +/**************
    1.18 + * BEGIN TEST *
    1.19 + **************/
    1.20 +
    1.21 +function two(a, b) { }
    1.22 +
    1.23 +assertEq(Object.getOwnPropertyNames(two).indexOf("length") >= 0, true);
    1.24 +
    1.25 +var bound0 = Function.prototype.bind
    1.26 +           ? two.bind("this")
    1.27 +           : function two(a, b) { };
    1.28 +
    1.29 +assertEq(Object.getOwnPropertyNames(bound0).indexOf("length") >= 0, true);
    1.30 +assertEq(bound0.length, 2);
    1.31 +
    1.32 +var bound1 = Function.prototype.bind
    1.33 +           ? two.bind("this", 1)
    1.34 +           : function one(a) { };
    1.35 +
    1.36 +assertEq(Object.getOwnPropertyNames(bound1).indexOf("length") >= 0, true);
    1.37 +assertEq(bound1.length, 1);
    1.38 +
    1.39 +var bound2 = Function.prototype.bind
    1.40 +           ? two.bind("this", 1, 2)
    1.41 +           : function zero() { };
    1.42 +
    1.43 +assertEq(Object.getOwnPropertyNames(bound2).indexOf("length") >= 0, true);
    1.44 +assertEq(bound2.length, 0);
    1.45 +
    1.46 +var bound3 = Function.prototype.bind
    1.47 +           ? two.bind("this", 1, 2, 3)
    1.48 +           : function zero() { };
    1.49 +
    1.50 +assertEq(Object.getOwnPropertyNames(bound3).indexOf("length") >= 0, true);
    1.51 +assertEq(bound3.length, 0);
    1.52 +
    1.53 +
    1.54 +/******************************************************************************/
    1.55 +
    1.56 +reportCompare(true, true);
    1.57 +
    1.58 +print("All tests passed!");

mercurial