Skip to content

Commit 2a928f9

Browse files
authored
Merge pull request #46 from cyangle/change_after_copy
Test change after copy
2 parents ea3af85 + 98e13a6 commit 2a928f9

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

tests.json

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
"doc": ["foo", "sil"],
137137
"patch": [{"op":"add", "path": "/3", "value": "bar"}],
138138
"error": "index is greater than number of items in array" },
139-
139+
140140
{ "comment": "test against implementation-specific numeric parsing",
141141
"doc": {"1e0": "foo"},
142142
"patch": [{"op": "test", "path": "/1e0", "value": "foo"}],
@@ -478,7 +478,23 @@
478478
{ "comment": "Patch with different capitalisation than doc",
479479
"doc": {"foo":"bar"},
480480
"patch": [{"op": "add", "path": "/FOO", "value": "BAR"}],
481-
"expected": {"foo": "bar", "FOO": "BAR"}
481+
"expected": {"foo": "bar", "FOO": "BAR"} },
482+
483+
{ "comment": "test copy object then change destination",
484+
"doc": {"foo": {"bar": {"baz": [{"boo": "net"}]}}},
485+
"patch": [
486+
{"op": "copy", "from": "/foo", "path": "/bak"},
487+
{"op": "replace", "path": "/bak/bar/baz/0/boo", "value": "qux"}
488+
],
489+
"expected": {"foo": {"bar": {"baz": [{"boo": "net"}]}}, "bak": {"bar": {"baz": [{"boo":"qux"}]}}} },
490+
491+
{ "comment": "test copy object then change source",
492+
"doc": {"foo": {"bar": {"baz": [{"boo": "net"}]}}},
493+
"patch": [
494+
{"op": "copy", "from": "/foo", "path": "/bak"},
495+
{"op": "replace", "path": "/foo/bar/baz/0/boo", "value": "qux"}
496+
],
497+
"expected": {"foo": {"bar": {"baz": [{"boo": "qux"}]}}, "bak": {"bar": {"baz": [{"boo":"net"}]}}}
482498
}
483499

484500
]

0 commit comments

Comments
 (0)