comparison src/testdir/test_json.vim @ 16306:a2c598cbe220 v8.1.1158

patch 8.1.1158: json encoded string is sometimes missing the final NUL commit https://github.com/vim/vim/commit/04af19637c14045fa33b99576de4eea1e3524edb Author: Bram Moolenaar <Bram@vim.org> Date: Fri Apr 12 21:19:04 2019 +0200 patch 8.1.1158: json encoded string is sometimes missing the final NUL Problem: Json encoded string is sometimes missing the final NUL. Solution: Add the NUL. Also for log messages.
author Bram Moolenaar <Bram@vim.org>
date Fri, 12 Apr 2019 21:30:04 +0200
parents 2dcaa860e3fc
children 77bcb5055fec
comparison
equal deleted inserted replaced
16305:7128a1b06d11 16306:a2c598cbe220
287 call assert_fails('call js_decode("[1,")', "E474:") 287 call assert_fails('call js_decode("[1,")', "E474:")
288 call assert_fails('call js_decode("[1 2]")', "E474:") 288 call assert_fails('call js_decode("[1 2]")', "E474:")
289 289
290 call assert_equal(s:varl5, js_decode(s:jsl5)) 290 call assert_equal(s:varl5, js_decode(s:jsl5))
291 endfunc 291 endfunc
292
293 func Test_json_encode_long()
294 " The growarray uses a grow size of 4000, check that a result that is exactly
295 " 4000 bytes long is not missing the final NUL.
296 let json = json_encode([repeat('a', 3996)])
297 call assert_equal(4000, len(json))
298 endfunc