Skip to content

Commit

Permalink
Add a test to expose jashkenas#2214
Browse files Browse the repository at this point in the history
  • Loading branch information
jgonggrijp committed May 3, 2020
1 parent 77dae23 commit 2a11f87
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/functions.js
Expand Up @@ -46,6 +46,12 @@
assert.strictEqual(boundf().hello, 'moe curly', "When called without the new operator, it's OK to be bound to the context");
assert.ok(newBoundf instanceof F, 'a bound instance is an instance of the original function');

// Ensure that we are not reproducing #2214.
var D = _.bind(Date, null, 2015, 5);
var newD = new D(10);
assert.ok(newD instanceof Date, 'works on variable argument constructors');
assert.ok(newD.toISOString(), 'works on nontrivial constructors');

assert.raises(function() { _.bind('notafunction'); }, TypeError, 'throws an error when binding to a non-function');
});

Expand Down

0 comments on commit 2a11f87

Please sign in to comment.