Add case of 5 to createCtorWrapper to align with bindCallback.

This commit is contained in:
jdalton
2015-05-08 11:30:26 -07:00
parent a61bde5b78
commit 569b4b29aa
2 changed files with 5 additions and 2 deletions

View File

@@ -3429,6 +3429,7 @@
case 2: return new Ctor(args[0], args[1]);
case 3: return new Ctor(args[0], args[1], args[2]);
case 4: return new Ctor(args[0], args[1], args[2], args[3]);
case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
}
var thisBinding = baseCreate(Ctor.prototype),
result = Ctor.apply(thisBinding, args);

View File

@@ -1510,11 +1510,12 @@
test('should not error when calling bound class constructors', 1, function() {
var createCtor = _.attempt(Function, '"use strict";return class A{}');
if (typeof createCtor == 'function') {
var bound = _.bind(createCtor()),
expected = _.times(5, _.constant(true));
expected = _.times(6, _.constant(true));
var actual = _.times(5, function(index) {
var actual = _.times(6, function(index) {
try {
switch (index) {
case 0: return !!(new bound);
@@ -1522,6 +1523,7 @@
case 2: return !!(new bound(1, 2));
case 3: return !!(new bound(1, 2, 3));
case 4: return !!(new bound(1, 2, 3, 4));
case 5: return !!(new bound(1, 2, 3, 4, 5));
}
} catch(e) {}
});