Squashed 'tests/json-patch-tests/' changes from 99264bb..9ecd703

9ecd703 Merge pull request #39 from mr-mixas/test-absent-from-location-for-copy-and-move-ops
66817e7 test absent 'from' location for copy and move
09dee56 Fix anonymous test
8bae8ed Fix « test should pass - no error » test
855f2a4 Fix « test should pass despite (nested) rearrangement » test
53283fc Fix « test should pass despite rearrangement » test
ecf01e7 Fix « null value should be valid obj property » test
1586cdf Fix « Empty-string element » test

git-subtree-dir: tests/json-patch-tests
git-subtree-split: 9ecd703c08cda4864cd2d2fb580a513ec5740934
This commit is contained in:
Max Bruckner 2018-10-11 00:30:43 +02:00
parent 2718d30a3d
commit e2162adeed

View File

@ -214,6 +214,7 @@
{ "doc": {"foo": null}, { "doc": {"foo": null},
"patch": [{"op": "test", "path": "/foo", "value": null}], "patch": [{"op": "test", "path": "/foo", "value": null}],
"expected": {"foo": null},
"comment": "null value should be valid obj property" }, "comment": "null value should be valid obj property" },
{ "doc": {"foo": null}, { "doc": {"foo": null},
@ -243,14 +244,17 @@
{ "doc": {"foo": {"foo": 1, "bar": 2}}, { "doc": {"foo": {"foo": 1, "bar": 2}},
"patch": [{"op": "test", "path": "/foo", "value": {"bar": 2, "foo": 1}}], "patch": [{"op": "test", "path": "/foo", "value": {"bar": 2, "foo": 1}}],
"expected": {"foo": {"foo": 1, "bar": 2}},
"comment": "test should pass despite rearrangement" }, "comment": "test should pass despite rearrangement" },
{ "doc": {"foo": [{"foo": 1, "bar": 2}]}, { "doc": {"foo": [{"foo": 1, "bar": 2}]},
"patch": [{"op": "test", "path": "/foo", "value": [{"bar": 2, "foo": 1}]}], "patch": [{"op": "test", "path": "/foo", "value": [{"bar": 2, "foo": 1}]}],
"expected": {"foo": [{"foo": 1, "bar": 2}]},
"comment": "test should pass despite (nested) rearrangement" }, "comment": "test should pass despite (nested) rearrangement" },
{ "doc": {"foo": {"bar": [1, 2, 5, 4]}}, { "doc": {"foo": {"bar": [1, 2, 5, 4]}},
"patch": [{"op": "test", "path": "/foo", "value": {"bar": [1, 2, 5, 4]}}], "patch": [{"op": "test", "path": "/foo", "value": {"bar": [1, 2, 5, 4]}}],
"expected": {"foo": {"bar": [1, 2, 5, 4]}},
"comment": "test should pass - no error" }, "comment": "test should pass - no error" },
{ "doc": {"foo": {"bar": [1, 2, 5, 4]}}, { "doc": {"foo": {"bar": [1, 2, 5, 4]}},
@ -264,7 +268,8 @@
{ "comment": "Empty-string element", { "comment": "Empty-string element",
"doc": { "": 1 }, "doc": { "": 1 },
"patch": [{"op": "test", "path": "/", "value": 1}] }, "patch": [{"op": "test", "path": "/", "value": 1}],
"expected": { "": 1 } },
{ "doc": { { "doc": {
"foo": ["bar", "baz"], "foo": ["bar", "baz"],
@ -288,8 +293,23 @@
{"op": "test", "path": "/i\\j", "value": 5}, {"op": "test", "path": "/i\\j", "value": 5},
{"op": "test", "path": "/k\"l", "value": 6}, {"op": "test", "path": "/k\"l", "value": 6},
{"op": "test", "path": "/ ", "value": 7}, {"op": "test", "path": "/ ", "value": 7},
{"op": "test", "path": "/m~0n", "value": 8}] }, {"op": "test", "path": "/m~0n", "value": 8}],
"expected": {
"": 0,
" ": 7,
"a/b": 1,
"c%d": 2,
"e^f": 3,
"foo": [
"bar",
"baz"
],
"g|h": 4,
"i\\j": 5,
"k\"l": 6,
"m~n": 8
}
},
{ "comment": "Move to same location has no effect", { "comment": "Move to same location has no effect",
"doc": {"foo": 1}, "doc": {"foo": 1},
"patch": [{"op": "move", "from": "/foo", "path": "/foo"}], "patch": [{"op": "move", "from": "/foo", "path": "/foo"}],
@ -388,11 +408,21 @@
"patch": [ { "op": "copy", "path": "/-" } ], "patch": [ { "op": "copy", "path": "/-" } ],
"error": "missing 'from' parameter" }, "error": "missing 'from' parameter" },
{ "comment": "missing from location to copy",
"doc": { "foo": 1 },
"patch": [ { "op": "copy", "from": "/bar", "path": "/foo" } ],
"error": "missing 'from' location" },
{ "comment": "missing from parameter to move", { "comment": "missing from parameter to move",
"doc": { "foo": 1 }, "doc": { "foo": 1 },
"patch": [ { "op": "move", "path": "" } ], "patch": [ { "op": "move", "path": "" } ],
"error": "missing 'from' parameter" }, "error": "missing 'from' parameter" },
{ "comment": "missing from location to move",
"doc": { "foo": 1 },
"patch": [ { "op": "move", "from": "/bar", "path": "/foo" } ],
"error": "missing 'from' location" },
{ "comment": "duplicate ops", { "comment": "duplicate ops",
"doc": { "foo": "bar" }, "doc": { "foo": "bar" },
"patch": [ { "op": "add", "path": "/baz", "value": "qux", "patch": [ { "op": "add", "path": "/baz", "value": "qux",