1
0
forked from aniani/vim

patch 8.2.4695: JSON encoding could be faster

Problem:    JSON encoding could be faster.
Solution:   Optimize encoding JSON strings. (closes #10086)
This commit is contained in:
LemonBoy
2022-04-05 15:07:32 +01:00
committed by Bram Moolenaar
parent 02560424bf
commit beb0ef1ab2
3 changed files with 94 additions and 36 deletions

View File

@@ -107,6 +107,9 @@ func Test_json_encode()
call assert_equal('"café"', json_encode("caf\xe9"))
let &encoding = save_encoding
" Invalid utf-8 sequences are replaced with U+FFFD (replacement character)
call assert_equal('"foo' . "\ufffd" . '"', json_encode("foo\xAB"))
call assert_fails('echo json_encode(function("tr"))', 'E1161: Cannot json encode a func')
call assert_fails('echo json_encode([function("tr")])', 'E1161: Cannot json encode a func')