To: vim_dev@googlegroups.com Subject: Patch 8.2.1863 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1863 Problem: Json code not sufficiently tested. Solution: Add more test cases. (Dominique Pellé, closes #7166) Files: src/testdir/test_json.vim *** ../vim-8.2.1862/src/testdir/test_json.vim 2020-10-05 20:07:14.413414315 +0200 --- src/testdir/test_json.vim 2020-10-19 13:10:05.576826574 +0200 *************** *** 62,68 **** let s:vard4 = {"key": v:none} let s:vard4x = {"key": v:null} let s:jsond4 = '{"key":null}' ! let s:jsd4 = '{key:null}' let s:jsonvals = '[true,false,null,null]' let s:varvals = [v:true, v:false, v:null, v:null] --- 62,72 ---- let s:vard4 = {"key": v:none} let s:vard4x = {"key": v:null} let s:jsond4 = '{"key":null}' ! let s:jsd4 = '{key:null}' " js_encode puts no quotes around simple key. ! let s:vard5 = {"key!": v:none} ! let s:vard5x = {"key!": v:null} ! let s:jsond5 = '{"key!":null}' ! let s:jsd5 = '{"key!":null}' " js_encode puts quotes around non-simple key. let s:jsonvals = '[true,false,null,null]' let s:varvals = [v:true, v:false, v:null, v:null] *************** *** 93,98 **** --- 97,103 ---- call assert_equal(s:jsond2, json_encode(s:vard2)) call assert_equal(s:jsond3, json_encode(s:vard3)) call assert_equal(s:jsond4, json_encode(s:vard4)) + call assert_equal(s:jsond5, json_encode(s:vard5)) call assert_equal(s:jsonvals, json_encode(s:varvals)) *************** *** 139,144 **** --- 144,150 ---- call assert_equal(s:vard2x, json_decode(s:jsond2s)) call assert_equal(s:vard3, json_decode(s:jsond3)) call assert_equal(s:vard4x, json_decode(s:jsond4)) + call assert_equal(s:vard5x, json_decode(s:jsond5)) call assert_equal(s:varvals, json_decode(s:jsonvals)) *************** *** 194,199 **** --- 200,206 ---- call assert_fails('call json_decode("{{}:42}")', "E491:") call assert_fails('call json_decode("{[]:42}")', "E491:") + call assert_fails('call json_decode("{1:1{")', "E491:") call assert_fails('call json_decode("-")', "E491:") call assert_fails('call json_decode("-1x")', "E491:") *************** *** 235,240 **** --- 242,248 ---- call assert_equal(s:jsd2, js_encode(s:vard2)) call assert_equal(s:jsd3, js_encode(s:vard3)) call assert_equal(s:jsd4, js_encode(s:vard4)) + call assert_equal(s:jsd5, js_encode(s:vard5)) call assert_equal(s:jsonvals, js_encode(s:varvals)) *************** *** 281,286 **** --- 289,296 ---- call assert_equal(s:vard3, js_decode(s:jsd3)) call assert_equal(s:vard4x, js_decode(s:jsond4)) call assert_equal(s:vard4x, js_decode(s:jsd4)) + call assert_equal(s:vard5x, js_decode(s:jsond5)) + call assert_equal(s:vard5x, js_decode(s:jsd5)) call assert_equal(s:varvals, js_decode(s:jsonvals)) *** ../vim-8.2.1862/src/version.c 2020-10-18 23:32:10.107420617 +0200 --- src/version.c 2020-10-19 13:12:19.292457500 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 1863, /**/ -- There's no place like $(HOME)! /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///