| 42 | } |
| 43 | |
| 44 | void jsonpatch_add_add_add_failed1() |
| 45 | { |
| 46 | json target = json::parse(R"( |
| 47 | { "foo": "bar"} |
| 48 | )"); |
| 49 | |
| 50 | json patch = json::parse(R"( |
| 51 | [ |
| 52 | { "op": "add", "path": "/baz", "value": "qux" }, |
| 53 | { "op": "add", "path": "/foo", "value": [ "bar", "baz" ] }, |
| 54 | { "op": "add", "path": "/baz/bat", "value": "qux" } // nonexistent target |
| 55 | ] |
| 56 | )"); |
| 57 | |
| 58 | try |
| 59 | { |
| 60 | jsonpatch::apply_patch(target, patch); |
| 61 | } |
| 62 | catch (const jsonpatch::jsonpatch_error& e) |
| 63 | { |
| 64 | std::cout << "(1) " << e.what() << '\n'; |
| 65 | std::cout << "(2) " << target << '\n'; |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | void jsonpatch_add_add_add_failed2() |
| 70 | { |
no test coverage detected