From f5a34d5191c176dd051923fb6c655ca5ceb64c4e Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 19 Oct 2014 20:15:10 -0700 Subject: [PATCH] Add indexOf method test for empty arrays. --- test/test.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/test.js b/test/test.js index be008575c..0c3280cad 100644 --- a/test/test.js +++ b/test/test.js @@ -7155,6 +7155,14 @@ strictEqual(func(empty, undefined, true), -1); }); + test('`_.' + methodName + '` should not match values on empty arrays', 2, function() { + var array = []; + array[-1] = 0; + + strictEqual(func(array, undefined), -1); + strictEqual(func(array, 0, true), -1); + }); + test('`_.' + methodName + '` should match `NaN`', 2, function() { strictEqual(func([1, NaN, 3], NaN), 1); strictEqual(func([1, 3, NaN], NaN, true), 2);