Skip to content

Commit 812fd63

Browse files
committed
add fail tests for Delete()
1 parent fda8192 commit 812fd63

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

parser_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,30 @@ var deleteTests = []DeleteTest{
143143
path: []string{"b"},
144144
data: `{"a":}`,
145145
},
146+
{
147+
desc: "Delete object without inner array",
148+
json: `{"a": {"b": 1}, "b": 2}`,
149+
path: []string{"b"},
150+
data: `{"a": {"b": 1}}`,
151+
},
152+
{
153+
desc: "Delete object without inner array",
154+
json: `{"a": [{"b": 1}], "b": 2}`,
155+
path: []string{"b"},
156+
data: `{"a": [{"b": 1}]}`,
157+
},
158+
{
159+
desc: "Delete object without inner array",
160+
json: `{"a": {"c": {"b": 3}, "b": 1}, "b": 2}`,
161+
path: []string{"a", "b"},
162+
data: `{"a": {"c": {"b": 3}}, "b": 2}`,
163+
},
164+
{
165+
desc: "Delete object without inner array",
166+
json: `{"a": [{"c": {"b": 3}, "b": 1}], "b": 2}`,
167+
path: []string{"a", "[0]", "b"},
168+
data: `{"a": [{"c": {"b": 3}}], "b": 2}`,
169+
},
146170
}
147171

148172
var setTests = []SetTest{

0 commit comments

Comments
 (0)