mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Add _.word tests.
This commit is contained in:
@@ -19750,13 +19750,20 @@
|
|||||||
QUnit.test('should not treat mathematical operators as words', function(assert) {
|
QUnit.test('should not treat mathematical operators as words', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
var operators = ['\xd7', '\xf7'],
|
var operators = ['\xac', '\xb1', '\xd7', '\xf7'],
|
||||||
expected = _.map(operators, _.constant([])),
|
expected = _.map(operators, _.constant([])),
|
||||||
actual = _.map(operators, _.words);
|
actual = _.map(operators, _.words);
|
||||||
|
|
||||||
assert.deepEqual(actual, expected);
|
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) {
|
QUnit.test('should work as an iteratee for methods like `_.map`', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user