diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2015-10-07 13:40:53 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2015-10-08 20:18:46 +0200 |
commit | 57d3a2a52fea57874d08472d0f8ee8f1bcee87c1 (patch) | |
tree | 764866fa88a472ab0afd89a31fa1290a31713387 | |
parent | cd6b4af649ac1cfbfa5db82ce299a4c7bb83054e (diff) | |
download | rneovim-57d3a2a52fea57874d08472d0f8ee8f1bcee87c1.tar.gz rneovim-57d3a2a52fea57874d08472d0f8ee8f1bcee87c1.tar.bz2 rneovim-57d3a2a52fea57874d08472d0f8ee8f1bcee87c1.zip |
api: represent api type String as msgpack type STR. closes #1250
-rw-r--r-- | runtime/doc/msgpack_rpc.txt | 2 | ||||
-rw-r--r-- | src/nvim/msgpack_rpc/helpers.c | 7 | ||||
-rw-r--r-- | test/functional/eval/msgpack_functions_spec.lua | 6 |
3 files changed, 7 insertions, 8 deletions
diff --git a/runtime/doc/msgpack_rpc.txt b/runtime/doc/msgpack_rpc.txt index d03d97ec85..d732e7f818 100644 --- a/runtime/doc/msgpack_rpc.txt +++ b/runtime/doc/msgpack_rpc.txt @@ -175,7 +175,7 @@ Nil -> msgpack nil Boolean -> msgpack boolean Integer (signed 64-bit integer) -> msgpack integer Float (IEEE 754 double precision) -> msgpack float -String -> msgpack binary +String -> msgpack string Array -> msgpack array Dictionary -> msgpack map diff --git a/src/nvim/msgpack_rpc/helpers.c b/src/nvim/msgpack_rpc/helpers.c index 473958c765..a119c4653a 100644 --- a/src/nvim/msgpack_rpc/helpers.c +++ b/src/nvim/msgpack_rpc/helpers.c @@ -225,8 +225,8 @@ void msgpack_rpc_from_float(Float result, msgpack_packer *res) void msgpack_rpc_from_string(String result, msgpack_packer *res) FUNC_ATTR_NONNULL_ARG(2) { - msgpack_pack_bin(res, result.size); - msgpack_pack_bin_body(res, result.data, result.size); + msgpack_pack_str(res, result.size); + msgpack_pack_str_body(res, result.data, result.size); } void msgpack_rpc_from_object(Object result, msgpack_packer *res) @@ -332,8 +332,7 @@ void msgpack_rpc_serialize_request(uint64_t request_id, msgpack_pack_uint64(pac, request_id); } - msgpack_pack_bin(pac, method.size); - msgpack_pack_bin_body(pac, method.data, method.size); + msgpack_rpc_from_string(method, pac); msgpack_rpc_from_array(args, pac); } diff --git a/test/functional/eval/msgpack_functions_spec.lua b/test/functional/eval/msgpack_functions_spec.lua index 943bdfca30..9a7b630f64 100644 --- a/test/functional/eval/msgpack_functions_spec.lua +++ b/test/functional/eval/msgpack_functions_spec.lua @@ -452,12 +452,12 @@ describe('msgpackparse() function', function() end) it('msgpackparse(systemlist(...)) does not segfault. #3135', function() - local cmd = "msgpackparse(systemlist('" - ..helpers.nvim_prog.." --api-info'))['_TYPE']['_VAL'][0][0]" + local cmd = "sort(keys(msgpackparse(systemlist('" + ..helpers.nvim_prog.." --api-info'))[0]))" local api_info = eval(cmd) api_info = eval(cmd) -- do it again (try to force segfault) api_info = eval(cmd) -- do it again - eq('functions', api_info) + eq({'error_types', 'functions', 'types'}, api_info) end) it('fails when called with no arguments', function() |