mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
Add _.toPath test for consecutive brackets and dots.
This commit is contained in:
12
test/test.js
12
test/test.js
@@ -18942,6 +18942,18 @@
|
||||
var actual = _.toPath('a[-1.23]["[\\"b\\"]"].c[\'[\\\'d\\\']\'][\ne\n][f].g');
|
||||
assert.deepEqual(actual, ['a', '-1.23', '["b"]', 'c', "['d']", '\ne\n', 'f', 'g']);
|
||||
});
|
||||
|
||||
QUnit.test('should ignore consecutive brackets and dots', function(assert) {
|
||||
assert.expect(4);
|
||||
|
||||
var expected = ['a'];
|
||||
assert.deepEqual(_.toPath('a.'), expected);
|
||||
assert.deepEqual(_.toPath('a[]'), expected);
|
||||
|
||||
expected = ['a', 'b'];
|
||||
assert.deepEqual(_.toPath('a..b'), expected);
|
||||
assert.deepEqual(_.toPath('a[][]b'), expected);
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user