From d15cedbda55de2300f347f28ac69703866b886be Mon Sep 17 00:00:00 2001 From: Doran Moppert Date: Wed, 23 Dec 2020 00:50:06 +0000 Subject: [PATCH] introduce some tests for malformed array indexes in GetString() --- parser_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/parser_test.go b/parser_test.go index b02ccb6..11b3e66 100644 --- a/parser_test.go +++ b/parser_test.go @@ -988,6 +988,18 @@ var getStringTests = []GetTest{ path: []string{"c"}, isErr: true, }, + { + desc: `empty array index`, + json: `[""]`, + path: []string{"[]"}, + isFound: false, + }, + { + desc: `malformed array index`, + json: `[""]`, + path: []string{"["}, + isFound: false, + }, } var getUnsafeStringTests = []GetTest{