archives

« Bugzilla Issues Index

#197 — Coverage: Missing Function.prototype.bind tests


I went through http://hg.ecmascript.org/tests/test262/file/034836894a85/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5 and noticed that a bunch of things are not tested.
For inspiration, John-David Dalton has some tests here: https://twitter.com/#!/jdalton/status/103332156687925249
One of the goal being to test how a user-provided Function.prototype.bind function can emulate the spec expectations.
A couple of attempts can be found on the web:
* https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind#Compatibility
* https://github.com/kriskowal/es5-shim/blob/master/es5-shim.js#L55

In order to help improving these shims, it would be good to have tests testing other aspects of Function.prototype.bind. In particular, things that can't be emulated like the fact that a bound function doesn't have a "prototype" property (instanceof works anyway thanks to step 14).
Also, calling [[Construct]] of a bound function should be not different from calling [[Target]].[[Construct]], etc.