summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Function/prototype/bind/S15.3.4.5_A5.js
blob: 55061a1aa522e31ea75fa7f80d2d015eaa662c51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright 2011 Google Inc.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
es5id: 15.3.4.5_A5
description: >
    Function.prototype.bind must curry [[Construct]] as  well as
    [[Call]].
---*/

function construct(f, args) {
  var bound = Function.prototype.bind.apply(f, [null].concat(args));
  return new bound();
}
var d = construct(Date, [1957, 4, 27]);

assert.sameValue(
  Object.prototype.toString.call(d),
  '[object Date]',
  'Object.prototype.toString.call(construct(Date, [1957, 4, 27])) must return "[object Date]"'
);

reportCompare(0, 0);