Patch 8.2.1181
Problem:    Json code not fully tested.
Solution:   Add more test coverage. (Dominique Pellé, closes #6433)
Files:      src/testdir/test_json.vim


*** ../vim-8.2.1180/src/testdir/test_json.vim   2020-05-19 22:38:55.608777143 
+0200
--- src/testdir/test_json.vim   2020-07-11 14:25:19.048580369 +0200
***************
*** 96,101 ****
--- 96,107 ----
  
    call assert_equal(s:jsonvals, json_encode(s:varvals))
  
+   " JSON is always encoded in utf-8 regardless of 'encoding' value.
+   let save_encoding = &encoding
+   set encoding=latin1
+   call assert_equal('"café"', json_encode("caf\xe9"))
+   let &encoding = save_encoding
+ 
    call assert_fails('echo json_encode(function("tr"))', 'E474:')
    call assert_fails('echo json_encode([function("tr")])', 'E474:')
  
***************
*** 142,147 ****
--- 148,162 ----
    call assert_equal(type(v:none), type(json_decode('')))
    call assert_equal("", json_decode('""'))
  
+   " Character in string after \ is ignored if not special.
+   call assert_equal("x", json_decode('"\x"'))
+ 
+   " JSON is always encoded in utf-8 regardless of 'encoding' value.
+   let save_encoding = &encoding
+   set encoding=latin1
+   call assert_equal("caf\xe9", json_decode('"café"'))
+   let &encoding = save_encoding
+ 
    " empty key is OK
    call assert_equal({'': 'ok'}, json_decode('{"": "ok"}'))
    " but not twice
***************
*** 165,170 ****
--- 180,188 ----
    call assert_fails('call json_decode("{\"n\":1,")', "E491:")
    call assert_fails('call json_decode("{\"n\",1}")', "E491:")
    call assert_fails('call json_decode("{-}")', "E491:")
+   if has('float')
+     call assert_fails('call json_decode("{3.14:1}")', "E474:")
+   endif
  
    call assert_fails('call json_decode("[foobar]")', "E491:")
    call assert_fails('call json_decode("[")', "E491:")
***************
*** 177,182 ****
--- 195,203 ----
    call assert_fails('call json_decode("{{}:42}")', "E491:")
    call assert_fails('call json_decode("{[]:42}")', "E491:")
  
+   call assert_fails('call json_decode("-")', "E491:")
+   call assert_fails('call json_decode("infinit")', "E491:")
+ 
    call assert_fails('call json_decode("\"\\u111Z\"")', 'E491:')
    call assert_equal('[😂]', json_decode('"[\uD83D\uDE02]"'))
    call assert_equal('a😂b', json_decode('"a\uD83D\uDE02b"'))
*** ../vim-8.2.1180/src/version.c       2020-07-11 14:08:01.283533287 +0200
--- src/version.c       2020-07-11 14:25:15.320590544 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     1181,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
4. Your eyeglasses have a web site burned in on them.

 /// Bram Moolenaar -- [email protected] -- 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    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202007111226.06BCQg5a2166569%40masaka.moolenaar.net.

Raspunde prin e-mail lui