File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -276,6 +276,27 @@ test('parse()', function (t) {
276276 'preserves inner [] while still treating outer [] as array push'
277277 ) ;
278278
279+ // Multiple nested bracket pairs: inner [] remains literal as part of the key
280+ st . deepEqual (
281+ qs . parse ( 'a[b[c[]]]=d' ) ,
282+ { a : { 'b[c[]]' : 'd' } } ,
283+ 'treats "b[c[]]" as a literal key inside the bracket group'
284+ ) ;
285+
286+ // Depth limits with literal brackets: preserve inner [] while limiting bracket-group parsing
287+ st . deepEqual (
288+ qs . parse ( 'a[b[c[]]][d]=e' , { depth : 1 } ) ,
289+ { a : { 'b[c[]]' : { '[d]' : 'e' } } } ,
290+ 'respects depth: 1 and preserves literal inner [] in the parsed key'
291+ ) ;
292+
293+ // Unterminated inner bracket group is wrapped as a literal remainder segment
294+ st . deepEqual (
295+ qs . parse ( 'a[[]b=c' ) ,
296+ { a : { '[[]b' : 'c' } } ,
297+ 'handles unterminated inner bracket groups without throwing'
298+ ) ;
299+
279300 st . end ( ) ;
280301 } ) ;
281302
You can’t perform that action at this time.
0 commit comments