From 1fd710e88d47e32b1cc0a6a6cd88b471f5dac087 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 8 Oct 2015 23:32:23 -0700 Subject: [PATCH] Add `_.word` tests. --- test/test.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/test.js b/test/test.js index c35e8802e..f39bdd64d 100644 --- a/test/test.js +++ b/test/test.js @@ -19750,13 +19750,20 @@ QUnit.test('should not treat mathematical operators as words', function(assert) { assert.expect(1); - var operators = ['\xd7', '\xf7'], + var operators = ['\xac', '\xb1', '\xd7', '\xf7'], expected = _.map(operators, _.constant([])), actual = _.map(operators, _.words); assert.deepEqual(actual, expected); }); + QUnit.test('should support a `pattern` argument', function(assert) { + assert.expect(2); + + assert.deepEqual(_.words('abcd', /ab|cd/g), ['ab', 'cd']); + assert.deepEqual(_.words('abcd', 'ab|cd'), ['ab']); + }); + QUnit.test('should work as an iteratee for methods like `_.map`', function(assert) { assert.expect(1);