File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed
Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -49,10 +49,10 @@ func findTokenStart(data []byte, token byte) int {
4949}
5050
5151func findKeyStart (data []byte , key string ) (int , error ) {
52- i := 0
52+ i := nextToken ( data )
5353 ln := len (data )
54- if ln > 0 && (data [0 ] == '{' || data [0 ] == '[' ) {
55- i = 1
54+ if ln > 0 && (data [i ] == '{' || data [i ] == '[' ) {
55+ i + = 1
5656 }
5757 var stackbuf [unescapeStackBufSize ]byte // stack-allocated array for allocation-free unescaping of small strings
5858
Original file line number Diff line number Diff line change @@ -221,6 +221,12 @@ var deleteTests = []DeleteTest{
221221 path : []string {"" },
222222 data : `^_�^C^A^@{` ,
223223 },
224+ {
225+ desc : "Issue #150: leading space" ,
226+ json : ` {"test":"input"}` ,
227+ path : []string {"test" },
228+ data : ` {}` ,
229+ },
224230}
225231
226232var setTests = []SetTest {
@@ -989,15 +995,15 @@ var getStringTests = []GetTest{
989995 isErr : true ,
990996 },
991997 {
992- desc : `empty array index` ,
993- json : `[""]` ,
994- path : []string {"[]" },
998+ desc : `empty array index` ,
999+ json : `[""]` ,
1000+ path : []string {"[]" },
9951001 isFound : false ,
9961002 },
9971003 {
998- desc : `malformed array index` ,
999- json : `[""]` ,
1000- path : []string {"[" },
1004+ desc : `malformed array index` ,
1005+ json : `[""]` ,
1006+ path : []string {"[" },
10011007 isFound : false ,
10021008 },
10031009}
You can’t perform that action at this time.
0 commit comments