forked from aniani/vim
patch 8.0.1391: encoding empty string to JSON sometimes gives "null"
Problem: Encoding empty string to JSON sometimes gives "null". Solution: Handle NULL string as empty string. (closes #2446)
This commit is contained in:
@@ -103,6 +103,10 @@ func Test_json_encode()
|
||||
call assert_fails('echo json_encode(function("tr"))', 'E474:')
|
||||
call assert_fails('echo json_encode([function("tr")])', 'E474:')
|
||||
|
||||
call assert_equal('{"a":""}', json_encode({'a': test_null_string()}))
|
||||
call assert_equal('{"a":[]}', json_encode({"a": test_null_list()}))
|
||||
call assert_equal('{"a":{}}', json_encode({"a": test_null_dict()}))
|
||||
|
||||
silent! let res = json_encode(function("tr"))
|
||||
call assert_equal("", res)
|
||||
endfunc
|
||||
|
Reference in New Issue
Block a user