From 569b4b29aaf8111064d64853149df6fe097cc790 Mon Sep 17 00:00:00 2001 From: jdalton Date: Fri, 8 May 2015 11:30:26 -0700 Subject: [PATCH] Add case of 5 to `createCtorWrapper` to align with `bindCallback`. --- lodash.src.js | 1 + test/test.js | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index 14a9d3eac..93566bcf2 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -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); diff --git a/test/test.js b/test/test.js index 19472c21f..46440dacb 100644 --- a/test/test.js +++ b/test/test.js @@ -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) {} });