You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
characterizeParse(st,'[abc=v',undefined,{'[abc': 'v'},'key starting with an unclosed bracket');
341
-
characterizeParse(st,'[[]b=v',undefined,{'[[]b': 'v'},'key starting with an unbalanced bracket group');
342
+
t.test('throws on bracket-prefixed unbalanced keys (issue #558)',function(st){
343
+
throwsUnbalancedBracket(st,'[abc=v',undefined,'key starting with an unclosed bracket');
344
+
throwsUnbalancedBracket(st,'[[]b=v',undefined,'key starting with an unbalanced bracket group');
342
345
st.end();
343
346
});
344
347
345
-
t.test('lenient unbalanced-bracket handling currently depends on the depth option (issue #558)',function(st){
346
-
characterizeParse(st,'a[b]c[d]e[f=v',{depth: 5},{a: {b: {d: {'[f': 'v'}}}},'consumes groups up to the depth budget then keeps the unclosed remainder literal');
347
-
characterizeParse(st,'a[b]c[d]e[f=v',{depth: 1},{a: {b: {'[d]e[f': 'v'}}},'a lower depth keeps more of the unclosed remainder literal');
348
-
characterizeParse(st,'a[bc=v',{depth: 0},{'a[bc': 'v'},'depth 0 keeps the entire key literal');
348
+
t.test('throws on unbalanced brackets regardless of depth option (issue #558)',function(st){
349
+
throwsUnbalancedBracket(st,'a[b]c[d]e[f=v',{depth: 5},'unclosed group within the depth budget');
350
+
throwsUnbalancedBracket(st,'a[b]c[d]e[f=v',{depth: 1},'unclosed group beyond the depth budget');
351
+
throwsUnbalancedBracket(st,'a[bc=v',{depth: 0},'depth 0 still rejects an unclosed bracket group');
349
352
st.end();
350
353
});
351
354
352
-
t.test('currently parses an allowDots key with a trailing unclosed bracket leniently (issue #558)',function(st){
353
-
characterizeParse(st,'a.b[c=v',{allowDots: true},{a: {b: {'[c': 'v'}}},'allowDots expands the dot then keeps the unclosed bracket literal');
355
+
t.test('throws on an allowDots key with a trailing unclosed bracket (issue #558)',function(st){
356
+
throwsUnbalancedBracket(st,'a.b[c=v',{allowDots: true},'allowDots expands the dot before detecting the unclosed bracket');
354
357
st.end();
355
358
});
356
359
@@ -899,10 +902,19 @@ test('parse()', function (t) {
899
902
st.end();
900
903
});
901
904
902
-
t.test('params starting with a starting bracket',function(st){
0 commit comments