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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /*
michael@0 2 * Any copyright is dedicated to the Public Domain.
michael@0 3 * http://creativecommons.org/licenses/publicdomain/
michael@0 4 * Contributor:
michael@0 5 * Jeff Walden <jwalden+code@mit.edu>
michael@0 6 */
michael@0 7
michael@0 8 //-----------------------------------------------------------------------------
michael@0 9 var BUGNUMBER = 518663;
michael@0 10 var summary = 'Object.getOwnPropertyNames: function objects';
michael@0 11
michael@0 12 print(BUGNUMBER + ": " + summary);
michael@0 13
michael@0 14 /**************
michael@0 15 * BEGIN TEST *
michael@0 16 **************/
michael@0 17
michael@0 18 function two(a, b) { }
michael@0 19
michael@0 20 assertEq(Object.getOwnPropertyNames(two).indexOf("length") >= 0, true);
michael@0 21
michael@0 22 var bound0 = Function.prototype.bind
michael@0 23 ? two.bind("this")
michael@0 24 : function two(a, b) { };
michael@0 25
michael@0 26 assertEq(Object.getOwnPropertyNames(bound0).indexOf("length") >= 0, true);
michael@0 27 assertEq(bound0.length, 2);
michael@0 28
michael@0 29 var bound1 = Function.prototype.bind
michael@0 30 ? two.bind("this", 1)
michael@0 31 : function one(a) { };
michael@0 32
michael@0 33 assertEq(Object.getOwnPropertyNames(bound1).indexOf("length") >= 0, true);
michael@0 34 assertEq(bound1.length, 1);
michael@0 35
michael@0 36 var bound2 = Function.prototype.bind
michael@0 37 ? two.bind("this", 1, 2)
michael@0 38 : function zero() { };
michael@0 39
michael@0 40 assertEq(Object.getOwnPropertyNames(bound2).indexOf("length") >= 0, true);
michael@0 41 assertEq(bound2.length, 0);
michael@0 42
michael@0 43 var bound3 = Function.prototype.bind
michael@0 44 ? two.bind("this", 1, 2, 3)
michael@0 45 : function zero() { };
michael@0 46
michael@0 47 assertEq(Object.getOwnPropertyNames(bound3).indexOf("length") >= 0, true);
michael@0 48 assertEq(bound3.length, 0);
michael@0 49
michael@0 50
michael@0 51 /******************************************************************************/
michael@0 52
michael@0 53 reportCompare(true, true);
michael@0 54
michael@0 55 print("All tests passed!");

mercurial