Ensure punctuation is not treated as words. [closes #2268]

This commit is contained in:
John-David Dalton
2016-04-20 16:21:50 -07:00
parent 6987d70dc2
commit 38edd713e4
2 changed files with 17 additions and 2 deletions

View File

@@ -180,11 +180,11 @@
rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
rsQuoteRange = '\\u2018\\u2019\\u201c\\u201d',
rsPunctuationRange = '\\u2000-\\u206f',
rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
rsVarRange = '\\ufe0e\\ufe0f',
rsBreakRange = rsMathOpRange + rsNonCharRange + rsQuoteRange + rsSpaceRange;
rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
/** Used to compose unicode capture groups. */
var rsApos = "['\u2019]",

View File

@@ -24685,6 +24685,21 @@
assert.deepEqual(actual, expected);
});
QUnit.test('should not treat punctuation as words', function(assert) {
assert.expect(1);
var marks = [
'\u2012', '\u2013', '\u2014', '\u2015',
'\u2024', '\u2025', '\u2026',
'\u205d', '\u205e'
];
var expected = lodashStable.map(marks, alwaysEmptyArray),
actual = lodashStable.map(marks, _.words);
assert.deepEqual(actual, expected);
});
QUnit.test('should support a `pattern` argument', function(assert) {
assert.expect(2);