From de4463d9a87f915b40d6ffadfc86f51a22f3dbf7 Mon Sep 17 00:00:00 2001 From: jdalton Date: Tue, 2 Jun 2015 08:16:47 -0700 Subject: [PATCH] Add basic `_#concat` test. --- lodash.src.js | 8 ++++---- test/test.js | 13 +++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index 8e971c59f..11baa3ac9 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -6076,14 +6076,14 @@ * @returns {Array} Returns the new concatenated array. * @example * - * var array = [1, 2]; - * var wrapped = _(array).concat([3], 4); + * var array = [1]; + * var wrapped = _(array).concat(2, [3], [[4]]); * * console.log(wrapped.value()); - * // => [1, 2, 3, 4] + * // => [1, 2, 3, [4]] * * console.log(array); - * // => [1, 2] + * // => [1] */ var wrapperConcat = restParam(function(values) { values = baseFlatten(values); diff --git a/test/test.js b/test/test.js index 17dd58dc7..986df8bf8 100644 --- a/test/test.js +++ b/test/test.js @@ -17173,6 +17173,19 @@ QUnit.module('lodash(...).concat'); (function() { + test('should concat arrays and values', 2, function() { + if (!isNpm) { + var array = [1], + wrapped = _(array).concat(2, [3], [[4]]); + + deepEqual(wrapped.value(), [1, 2, 3, [4]]); + deepEqual(array, [1]); + } + else { + skipTest(2); + } + }); + test('should treat sparse arrays as dense', 3, function() { if (!isNpm) { var expected = [],