Skip to content

Commit 0277fab

Browse files
author
Mike McCabe
committed
json-pointer tests from latest draft
1 parent bf01a2d commit 0277fab

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

tests.json

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,42 @@
180180
"patch": [{"test": "/foo", "value": [1, 2]}],
181181
"error": "test op should fail" },
182182

183-
{ "doc": {"foo": 1},
183+
{ "comment": "json-pointer tests" },
184+
185+
{ "comment": "Whole document",
186+
"doc": { "foo": 1 },
187+
"patch": [{"test":"", "value": {"foo": 1}}] },
188+
189+
{ "comment": "Empty-string element",
190+
"doc": { "": 1 },
191+
"patch": [{"test":"/", "value": 1}] },
192+
193+
{ "doc": {
194+
"foo": ["bar", "baz"],
195+
"": 0,
196+
"a/b": 1,
197+
"c%d": 2,
198+
"e^f": 3,
199+
"g|h": 4,
200+
"i\\j": 5,
201+
"k\"l": 6,
202+
" ": 7,
203+
"m~n": 8
204+
},
205+
"patch": [{"test": "/foo", "value": ["bar", "baz"]},
206+
{"test": "/foo/0", "value": "bar"},
207+
{"test": "/", "value": 0},
208+
{"test": "/a~1b", "value": 1},
209+
{"test": "/c%d", "value": 2},
210+
{"test": "/e^f", "value": 3},
211+
{"test": "/g|h", "value": 4},
212+
{"test": "/i\\j", "value": 5},
213+
{"test": "/k\"l", "value": 6},
214+
{"test": "/ ", "value": 7},
215+
{"test": "/m~0n", "value": 8}] },
216+
217+
{ "comment": "Move to same location has no effect",
218+
"doc": {"foo": 1},
184219
"patch": [{"move": "/foo", "to": "/foo"}],
185220
"expected": {"foo": 1} },
186221

0 commit comments

Comments
 (0)