]> git.ipfire.org Git - thirdparty/json-c.git/commit
tests: test_json_patch: add test suite for JSON patch
authorAlexandru Ardelean <ardeleanalex@gmail.com>
Tue, 20 Apr 2021 12:47:18 +0000 (15:47 +0300)
committerEric Hawicz <erh+git@nimenees.com>
Tue, 1 Aug 2023 02:18:03 +0000 (22:18 -0400)
commit3b8363fcdc21a80a6eead3cf3651a59185f4a78d
tree646c8e628a3e787bea721808451660752ccfda69
parent538b0468847660d52191ad202edb4ab585b6fd19
tests: test_json_patch: add test suite for JSON patch

Essentially, this change adds the test cases from this repo:
   https://github.com/json-patch/json-patch-tests

Specifically:
   https://github.com/json-patch/json-patch-tests/blob/master/spec_tests.json
   https://github.com/json-patch/json-patch-tests/blob/master/tests.json

The files were taken at the date of this commit, at git hash
  ea3af85790cb72893d0676597814b7532019c24e

Some tests may not have an 'expected' or 'error' field. Those are ignored.
One test was disabled manually via "disabled_in_json_c", because it tries
an impossible test, i.e. to add 2 "op" fields in the same patch entry,
something which is impossible in a JSON object.

For the 'error' cases, right now we only test that an error happens.
Later, we can extend this to check the error codes.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
tests/CMakeLists.txt
tests/json_patch_spec_tests.json [new file with mode: 0644]
tests/json_patch_tests.json [new file with mode: 0644]
tests/test_json_patch.c [new file with mode: 0644]
tests/test_json_patch.expected [new file with mode: 0644]
tests/test_json_patch.test [new file with mode: 0755]