Skip to content

Commit d15cedb

Browse files
committed
introduce some tests for malformed array indexes in GetString()
1 parent 9b2f299 commit d15cedb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

parser_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,18 @@ var getStringTests = []GetTest{
988988
path: []string{"c"},
989989
isErr: true,
990990
},
991+
{
992+
desc: `empty array index`,
993+
json: `[""]`,
994+
path: []string{"[]"},
995+
isFound: false,
996+
},
997+
{
998+
desc: `malformed array index`,
999+
json: `[""]`,
1000+
path: []string{"["},
1001+
isFound: false,
1002+
},
9911003
}
9921004

9931005
var getUnsafeStringTests = []GetTest{

0 commit comments

Comments
 (0)