Add _.toPath test for consecutive brackets and dots.

This commit is contained in:
John-David Dalton
2015-10-15 06:08:30 -07:00
parent e197884e07
commit f6a4ab62b8

View File

@@ -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);
});
}());
/*--------------------------------------------------------------------------*/