Add _.word tests.

This commit is contained in:
John-David Dalton
2015-10-08 23:32:23 -07:00
parent dc2e760b5a
commit 1fd710e88d

View File

@@ -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);