1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-01-06 08:01:16 +03:00

Add the RFC-7396 Appendix A test cases for json_patch().

FossilOrigin-Name: c5441d2df2526723f72610cc14dd243223663979e67ecdd76fe06fcd366f2b29
This commit is contained in:
drh
2017-03-24 13:31:47 +00:00
parent 29c9969871
commit f9e91972c9
3 changed files with 61 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
C Fix\san\serror\sin\sthe\snew\sjson_patch()\sroutine\sdiscovered\sby\sRalf\sJunker.
D 2017-03-24T12:35:17.534
C Add\sthe\sRFC-7396\sAppendix\sA\stest\scases\sfor\sjson_patch().
D 2017-03-24T13:31:47.314
F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 1faf9f06aadc9284c212dea7bbc7c0dea7e8337f0287c81001eff500912c790a
@@ -913,7 +913,7 @@ F test/jrnlmode3.test 556b447a05be0e0963f4311e95ab1632b11c9eaa
F test/json101.test c0897616f32d95431f37fd291cb78742181980ac
F test/json102.test bf3fe7a706d30936a76a0f7a0375e1e8e73aff5a
F test/json103.test c5f6b85e69de05f6b3195f9f9d5ce9cd179099a0
F test/json104.test 2966101e14463655546eb8f639db25382957e9b7136de717e17db945a6f539fb
F test/json104.test 877d5845f6303899b7889ea5dd1bea99076e3100574d5c536082245c5805dcaa
F test/keyword1.test 37ef6bba5d2ed5b07ecdd6810571de2956599dff
F test/kvtest.c b9a9822dda05a1aa481215a52e2fc93cd8b22ee5
F test/lastinsert.test 42e948fd6442f07d60acbd15d33fb86473e0ef63
@@ -1568,7 +1568,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 476088482024e411e2549b1697cdaf0124294c79d43f508c71c4eb66906a56fc
R 08d6f399deb89f284d166c511d46a6ea
P 9d5350418b2f6113e0b50c57e8a872006f27753067baf08ffdfa7943c0c9a148
R f5d3be53ea90768240f7c6616a0ecd20
U drh
Z 437a93d0f27334776c018af18840b42a
Z c6323f1875b7921e440a4d008ab9c650

View File

@@ -1 +1 @@
9d5350418b2f6113e0b50c57e8a872006f27753067baf08ffdfa7943c0c9a148
c5441d2df2526723f72610cc14dd243223663979e67ecdd76fe06fcd366f2b29

View File

@@ -72,5 +72,59 @@ do_execsql_test json104-222 {
SELECT json_patch('{}','{"a":{"bb":{"ccc":[1,{"dddd":null},3]}}}');
} {{{"a":{"bb":{"ccc":[1,{"dddd":null},3]}}}}}
# Example test cases at the end of the RFC-7396 document
do_execsql_test json104-300 {
SELECT json_patch('{"a":"b"}','{"a":"c"}');
} {{{"a":"c"}}}
do_execsql_test json104-300a {
SELECT coalesce(json_patch(null,'{"a":"c"}'), 'real-null');
} {{real-null}}
do_execsql_test json104-301 {
SELECT json_patch('{"a":"b"}','{"b":"c"}');
} {{{"a":"b","b":"c"}}}
do_execsql_test json104-302 {
SELECT json_patch('{"a":"b"}','{"a":null}');
} {{{}}}
do_execsql_test json104-303 {
SELECT json_patch('{"a":"b","b":"c"}','{"a":null}');
} {{{"b":"c"}}}
do_execsql_test json104-304 {
SELECT json_patch('{"a":["b"]}','{"a":"c"}');
} {{{"a":"c"}}}
do_execsql_test json104-305 {
SELECT json_patch('{"a":"c"}','{"a":["b"]}');
} {{{"a":["b"]}}}
do_execsql_test json104-306 {
SELECT json_patch('{"a":{"b":"c"}}','{"a":{"b":"d","c":null}}');
} {{{"a":{"b":"d"}}}}
do_execsql_test json104-307 {
SELECT json_patch('{"a":[{"b":"c"}]}','{"a":[1]}');
} {{{"a":[1]}}}
do_execsql_test json104-308 {
SELECT json_patch('["a","b"]','["c","d"]');
} {{["c","d"]}}
do_execsql_test json104-309 {
SELECT json_patch('{"a":"b"}','["c"]');
} {{["c"]}}
do_execsql_test json104-310 {
SELECT json_patch('{"a":"foo"}','null');
} {{null}}
do_execsql_test json104-310a {
SELECT coalesce(json_patch('{"a":"foo"}',null), 'real-null');
} {{real-null}}
do_execsql_test json104-311 {
SELECT json_patch('{"a":"foo"}','"bar"');
} {{"bar"}}
do_execsql_test json104-312 {
SELECT json_patch('{"e":null}','{"a":1}');
} {{{"e":null,"a":1}}}
do_execsql_test json104-313 {
SELECT json_patch('[1,2]','{"a":"b","c":null}');
} {{{"a":"b"}}}
do_execsql_test json104-314 {
SELECT json_patch('{}','{"a":{"bb":{"ccc":null}}}');
} {{{"a":{"bb":{}}}}}
finish_test