Skip to content

Commit 6c1c39d

Browse files
committed
Test array size when adding to array
In [Section 4.1](https://tools.ietf.org/html/rfc6902#section-4.1) it states: > The specified index MUST NOT be greater than the number of elements in the array.
1 parent 1327f8c commit 6c1c39d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@
112112
"patch": [{"op":"add", "path": "/2", "value": "bar"}],
113113
"expected": ["foo", "sil", "bar"] },
114114

115+
{ "comment": "add item to array at index > length should fail",
116+
"doc": ["foo", "sil"],
117+
"patch": [{"op":"add", "path": "/3", "value": "bar"}],
118+
"error": "index is greater than number of items in array" },
119+
115120
{ "comment": "test against implementation-specific numeric parsing",
116121
"doc": {"1e0": "foo"},
117122
"patch": [{"op": "test", "path": "/1e0", "value": "foo"}],

0 commit comments

Comments
 (0)