19750e409Sopenharmony_ciJSON Patch Tests 29750e409Sopenharmony_ci================ 39750e409Sopenharmony_ci 49750e409Sopenharmony_ciThese are test cases for implementations of [IETF JSON Patch (RFC6902)](http://tools.ietf.org/html/rfc6902). 59750e409Sopenharmony_ci 69750e409Sopenharmony_ciSome implementations can be found at [jsonpatch.com](http://jsonpatch.com). 79750e409Sopenharmony_ci 89750e409Sopenharmony_ci 99750e409Sopenharmony_ciTest Format 109750e409Sopenharmony_ci----------- 119750e409Sopenharmony_ci 129750e409Sopenharmony_ciEach test file is a JSON document that contains an array of test records. A 139750e409Sopenharmony_citest record is an object with the following members: 149750e409Sopenharmony_ci 159750e409Sopenharmony_ci- doc: The JSON document to test against 169750e409Sopenharmony_ci- patch: The patch(es) to apply 179750e409Sopenharmony_ci- expected: The expected resulting document, OR 189750e409Sopenharmony_ci- error: A string describing an expected error 199750e409Sopenharmony_ci- comment: A string describing the test 209750e409Sopenharmony_ci- disabled: True if the test should be skipped 219750e409Sopenharmony_ci 229750e409Sopenharmony_ciAll fields except 'doc' and 'patch' are optional. Test records consisting only 239750e409Sopenharmony_ciof a comment are also OK. 249750e409Sopenharmony_ci 259750e409Sopenharmony_ci 269750e409Sopenharmony_ciFiles 279750e409Sopenharmony_ci----- 289750e409Sopenharmony_ci 299750e409Sopenharmony_ci- tests.json: the main test file 309750e409Sopenharmony_ci- spec_tests.json: tests from the RFC6902 spec 319750e409Sopenharmony_ci 329750e409Sopenharmony_ci 339750e409Sopenharmony_ciWriting Tests 349750e409Sopenharmony_ci------------- 359750e409Sopenharmony_ci 369750e409Sopenharmony_ciAll tests should have a descriptive comment. Tests should be as 379750e409Sopenharmony_cisimple as possible - just what's required to test a specific piece of 389750e409Sopenharmony_cibehavior. If you want to test interacting behaviors, create tests for 399750e409Sopenharmony_cieach behavior as well as the interaction. 409750e409Sopenharmony_ci 419750e409Sopenharmony_ciIf an 'error' member is specified, the error text should describe the 429750e409Sopenharmony_cierror the implementation should raise - *not* what's being tested. 439750e409Sopenharmony_ciImplementation error strings will vary, but the suggested error should 449750e409Sopenharmony_cibe easily matched to the implementation error string. Try to avoid 459750e409Sopenharmony_cicreating error tests that might pass because an incorrect error was 469750e409Sopenharmony_cireported. 479750e409Sopenharmony_ci 489750e409Sopenharmony_ciPlease feel free to contribute! 499750e409Sopenharmony_ci 509750e409Sopenharmony_ci 519750e409Sopenharmony_ciCredits 529750e409Sopenharmony_ci------- 539750e409Sopenharmony_ci 549750e409Sopenharmony_ciThe seed test set was adapted from Byron Ruth's 559750e409Sopenharmony_ci[jsonpatch-js](https://github.com/bruth/jsonpatch-js/blob/master/test.js) and 569750e409Sopenharmony_ciextended by [Mike McCabe](https://github.com/mikemccabe). 579750e409Sopenharmony_ci 589750e409Sopenharmony_ci 599750e409Sopenharmony_ciLicense 609750e409Sopenharmony_ci------- 619750e409Sopenharmony_ci 629750e409Sopenharmony_ci Copyright 2014 The Authors 639750e409Sopenharmony_ci 649750e409Sopenharmony_ci Licensed under the Apache License, Version 2.0 (the "License"); 659750e409Sopenharmony_ci you may not use this file except in compliance with the License. 669750e409Sopenharmony_ci You may obtain a copy of the License at 679750e409Sopenharmony_ci 689750e409Sopenharmony_ci http://www.apache.org/licenses/LICENSE-2.0 699750e409Sopenharmony_ci 709750e409Sopenharmony_ci Unless required by applicable law or agreed to in writing, software 719750e409Sopenharmony_ci distributed under the License is distributed on an "AS IS" BASIS, 729750e409Sopenharmony_ci WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 739750e409Sopenharmony_ci See the License for the specific language governing permissions and 749750e409Sopenharmony_ci limitations under the License. 759750e409Sopenharmony_ci 76