1
0
forked from aniani/vim

patch 7.4.1278

Problem:    When jsonencode() fails it still returns something.
Solution:   Return an empty string on failure.
This commit is contained in:
Bram Moolenaar
2016-02-07 16:53:13 +01:00
parent a6f72ba7c6
commit 55fab439a6
6 changed files with 47 additions and 12 deletions

View File

@@ -75,6 +75,9 @@ func Test_encode()
call assert_fails('echo jsonencode(function("tr"))', 'E474:')
call assert_fails('echo jsonencode([function("tr")])', 'E474:')
call assert_fails('echo jsonencode({"key":v:none})', 'E474:')
silent! let res = jsonencode(function("tr"))
call assert_equal("", res)
endfunc
func Test_decode()