diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2016-04-13 09:21:32 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2016-04-13 09:21:32 -0300 |
commit | c18d5917e3442162f20eb9e95ba4bcffbbd8408b (patch) | |
tree | b85f5789efce5713b5e5f05b27fda6166afb17c3 | |
parent | 10a8bb02acabe2c3a0d7cd2e9d8462e0228769a1 (diff) | |
download | rneovim-c18d5917e3442162f20eb9e95ba4bcffbbd8408b.tar.gz rneovim-c18d5917e3442162f20eb9e95ba4bcffbbd8408b.tar.bz2 rneovim-c18d5917e3442162f20eb9e95ba4bcffbbd8408b.zip |
Update lua client to 0.0.1-24
The new version of the lua client uses libmpack as a backend, and some test
scripts had to be updated to reflect that.
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | scripts/msgpack-gen.lua | 4 | ||||
-rw-r--r-- | test/functional/api/vim_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/ex_cmds/wundo_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/ex_cmds/wviminfo_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/helpers.lua | 15 | ||||
-rw-r--r-- | test/functional/plugin/helpers.lua | 2 | ||||
-rw-r--r-- | test/functional/plugin/shada_spec.lua | 45 | ||||
-rw-r--r-- | test/functional/shada/compatibility_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/shada/helpers.lua | 12 | ||||
-rw-r--r-- | test/functional/shada/registers_spec.lua | 18 | ||||
-rw-r--r-- | test/functional/shada/shada_spec.lua | 16 | ||||
-rw-r--r-- | test/functional/ui/screen.lua | 2 | ||||
-rw-r--r-- | third-party/cmake/BuildLuarocks.cmake | 20 |
14 files changed, 54 insertions, 90 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5798a74369..0953bcd93a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -367,7 +367,7 @@ endforeach() # Find Lua interpreter include(LuaHelpers) -set(LUA_DEPENDENCIES lpeg MessagePack bit) +set(LUA_DEPENDENCIES lpeg mpack bit) if(NOT LUA_PRG) foreach(CURRENT_LUA_PRG luajit lua) # If LUA_PRG is set find_program() will not search diff --git a/scripts/msgpack-gen.lua b/scripts/msgpack-gen.lua index d50ebd85a2..c726db3920 100644 --- a/scripts/msgpack-gen.lua +++ b/scripts/msgpack-gen.lua @@ -1,5 +1,5 @@ lpeg = require('lpeg') -msgpack = require('MessagePack') +mpack = require('mpack') -- lpeg grammar for building api metadata from a set of header files. It -- ignores comments and preprocessor commands and parses a very small subset @@ -115,7 +115,7 @@ static const uint8_t msgpack_metadata[] = { ]]) -- serialize the API metadata using msgpack and embed into the resulting -- binary for easy querying by clients -packed = msgpack.pack(functions) +packed = mpack.pack(functions) for i = 1, #packed do output:write(string.byte(packed, i)..', ') if i % 10 == 0 then diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 99f67fe43a..699a0bd588 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -80,7 +80,7 @@ describe('vim_* functions', function() it('set_var returns the old value', function() local val1 = {1, 2, {['3'] = 1}} local val2 = {4, 7} - eq(nil, nvim('set_var', 'lua', val1)) + eq(NIL, nvim('set_var', 'lua', val1)) eq(val1, nvim('set_var', 'lua', val2)) end) diff --git a/test/functional/ex_cmds/wundo_spec.lua b/test/functional/ex_cmds/wundo_spec.lua index c3147e1c0f..969dfea3d9 100644 --- a/test/functional/ex_cmds/wundo_spec.lua +++ b/test/functional/ex_cmds/wundo_spec.lua @@ -24,6 +24,6 @@ describe('u_* functions', function() '-c', 'set undodir=. undofile'}) set_session(session) execute('echo "True"') -- Should not error out due to crashed Neovim - session:exit(0) + session:close() end) end) diff --git a/test/functional/ex_cmds/wviminfo_spec.lua b/test/functional/ex_cmds/wviminfo_spec.lua index 207d94124f..21f14be62c 100644 --- a/test/functional/ex_cmds/wviminfo_spec.lua +++ b/test/functional/ex_cmds/wviminfo_spec.lua @@ -9,7 +9,7 @@ describe(':wshada', function() before_each(function() if session then - session:exit(0) + session:close() end -- Override the default session because we need 'swapfile' for these tests. diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 919e6e077b..a382641cff 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -1,9 +1,8 @@ require('coxpcall') +NIL = require('mpack').NIL local lfs = require('lfs') local assert = require('luassert') -local Loop = require('nvim.loop') -local MsgpackStream = require('nvim.msgpack_stream') -local AsyncSession = require('nvim.async_session') +local ChildProcessStream = require('nvim.child_process_stream') local Session = require('nvim.session') local nvim_prog = os.getenv('NVIM_PROG') or 'build/bin/nvim' @@ -60,7 +59,7 @@ local session, loop_running, last_error local function set_session(s) if session then - session:exit(0) + session:close() end session = s end @@ -212,12 +211,8 @@ local function merge_args(...) end local function spawn(argv, merge) - local loop = Loop.new() - local msgpack_stream = MsgpackStream.new(loop) - local async_session = AsyncSession.new(msgpack_stream) - local sess = Session.new(async_session) - loop:spawn(merge and merge_args(prepend_argv, argv) or argv) - return sess + local child_stream = ChildProcessStream.spawn(merge and merge_args(prepend_argv, argv) or argv) + return Session.new(child_stream) end local function clear(extra_cmd) diff --git a/test/functional/plugin/helpers.lua b/test/functional/plugin/helpers.lua index cc76794267..5b6ea88c34 100644 --- a/test/functional/plugin/helpers.lua +++ b/test/functional/plugin/helpers.lua @@ -25,7 +25,7 @@ local session = nil local reset = function(...) if session then - session:exit(0) + session:close() end session = spawn(nvim_argv(...)) set_session(session) diff --git a/test/functional/plugin/shada_spec.lua b/test/functional/plugin/shada_spec.lua index a3f617eeb0..aad0e366bf 100644 --- a/test/functional/plugin/shada_spec.lua +++ b/test/functional/plugin/shada_spec.lua @@ -4,7 +4,7 @@ local eq, nvim_eval, nvim_command, nvim, exc_exec, funcs, nvim_feed, curbuf = helpers.funcs, helpers.feed, helpers.curbuf local neq = helpers.neq -local msgpack = require('MessagePack') +local mpack = require('mpack') local plugin_helpers = require('test.functional.plugin.helpers') local reset = plugin_helpers.reset @@ -15,13 +15,13 @@ local get_shada_rw = shada_helpers.get_shada_rw local mpack_eq = function(expected, mpack_result) local mpack_keys = {'type', 'timestamp', 'length', 'value'} - local unpacker = msgpack.unpacker(mpack_result) + local unpack = mpack.Unpacker() local actual = {} - local cur + local cur, val local i = 0 - while true do - local off, val = unpacker() - if not off then break end + local off = 1 + while off <= #mpack_result do + val, off = unpack(mpack_result, off) if i % 4 == 0 then cur = {} actual[#actual + 1] = cur @@ -78,36 +78,6 @@ describe('In autoload/shada.vim', function() return ('{"_TYPE": v:msgpack_types.%s, "_VAL": %s}'):format(typ, val) end - local st_meta = { - __pairs=function(table) - local ret = {} - local next_key = nil - local num_keys = 0 - while true do - next_key = next(table, next_key) - if next_key == nil then - break - end - num_keys = num_keys + 1 - ret[num_keys] = {next_key, table[next_key]} - end - table.sort(ret, function(a, b) - return a[1] < b[1] - end) - local state = {i=0} - return (function(state_, _) - state_.i = state_.i + 1 - if ret[state_.i] then - return table.unpack(ret[state_.i]) - end - end), state - end - } - - local st = function(table) - return setmetatable(table, st_meta) - end - describe('function shada#mpack_to_sd', function() local mpack2sd = function(arg) return ('shada#mpack_to_sd(%s)'):format(arg) @@ -184,7 +154,7 @@ describe('In autoload/shada.vim', function() ' + b 2', ' + c column 3', ' + d 4', - }, {{type=1, timestamp=0, data=st({a=1, b=2, c=3, d=4})}}) + }, {{type=1, timestamp=0, data={a=1, b=2, c=3, d=4}}}) sd2strings_eq({ 'Header with timestamp ' .. epoch .. ':', ' % Key Value', @@ -2848,3 +2818,4 @@ describe('syntax/shada.vim', function() eq(exp, act) end) end) + diff --git a/test/functional/shada/compatibility_spec.lua b/test/functional/shada/compatibility_spec.lua index 2ca0b16e75..774a1f1346 100644 --- a/test/functional/shada/compatibility_spec.lua +++ b/test/functional/shada/compatibility_spec.lua @@ -272,7 +272,7 @@ describe('ShaDa forward compatibility support code', function() eq(0, exc_exec(sdrcmd(true))) -- getreg may return empty list as list with NULL pointer which API -- translates into nil for some reason. - eq({}, funcs.getreg('a', 1, 1) or {}) + eq(NIL, funcs.getreg('a', 1, 1) or {}) eq('', funcs.getregtype('a')) nvim_command('wshada ' .. shada_fname) local found = 0 diff --git a/test/functional/shada/helpers.lua b/test/functional/shada/helpers.lua index cc554097c6..d4eb7f57bd 100644 --- a/test/functional/shada/helpers.lua +++ b/test/functional/shada/helpers.lua @@ -3,7 +3,7 @@ local spawn, set_session, meths, nvim_prog = helpers.spawn, helpers.set_session, helpers.meths, helpers.nvim_prog local write_file, merge_args = helpers.write_file, helpers.merge_args -local msgpack = require('MessagePack') +local mpack = require('mpack') local tmpname = os.tmpname() local additional_cmd = '' @@ -60,13 +60,13 @@ local read_shada_file = function(fname) local fd = io.open(fname, 'r') local mstring = fd:read('*a') fd:close() - local unpacker = msgpack.unpacker(mstring) + local unpack = mpack.Unpacker() local ret = {} - local cur + local cur, val local i = 0 - while true do - local off, val = unpacker() - if not off then break end + local off = 1 + while off <= #mstring do + val, off = unpack(mstring, off) if i % 4 == 0 then cur = {} ret[#ret + 1] = cur diff --git a/test/functional/shada/registers_spec.lua b/test/functional/shada/registers_spec.lua index f0133b1086..d3af35cf7f 100644 --- a/test/functional/shada/registers_spec.lua +++ b/test/functional/shada/registers_spec.lua @@ -43,9 +43,9 @@ describe('ShaDa support code', function() setreg('b', {'bca', 'abc', 'cba'}, 'b3') nvim_command('qall') reset() - eq({nil, ''}, getreg('c')) - eq({nil, ''}, getreg('l')) - eq({nil, ''}, getreg('b')) + eq({NIL, ''}, getreg('c')) + eq({NIL, ''}, getreg('l')) + eq({NIL, ''}, getreg('b')) end) it('does restore registers with zero <', function() @@ -67,9 +67,9 @@ describe('ShaDa support code', function() setreg('b', {'bca', 'abc', 'cba'}, 'b3') nvim_command('qall') reset() - eq({nil, ''}, getreg('c')) - eq({nil, ''}, getreg('l')) - eq({nil, ''}, getreg('b')) + eq({NIL, ''}, getreg('c')) + eq({NIL, ''}, getreg('l')) + eq({NIL, ''}, getreg('b')) end) it('does restore registers with zero "', function() @@ -103,7 +103,7 @@ describe('ShaDa support code', function() nvim_command('qall') reset() eq({{'d'}, 'v'}, getreg('o')) - eq({nil, ''}, getreg('t')) + eq({NIL, ''}, getreg('t')) end) it('does limit number of lines according to "', function() @@ -113,7 +113,7 @@ describe('ShaDa support code', function() nvim_command('qall') reset() eq({{'d'}, 'v'}, getreg('o')) - eq({nil, ''}, getreg('t')) + eq({NIL, ''}, getreg('t')) end) it('does limit number of lines according to < rather then "', function() @@ -125,7 +125,7 @@ describe('ShaDa support code', function() reset() eq({{'d'}, 'v'}, getreg('o')) eq({{'a', 'b', 'cde'}, 'V'}, getreg('t')) - eq({nil, ''}, getreg('h')) + eq({NIL, ''}, getreg('h')) end) it('dumps and loads register correctly when &encoding is not UTF-8', diff --git a/test/functional/shada/shada_spec.lua b/test/functional/shada/shada_spec.lua index 822ab3913c..683d520627 100644 --- a/test/functional/shada/shada_spec.lua +++ b/test/functional/shada/shada_spec.lua @@ -8,7 +8,7 @@ local write_file, spawn, set_session, nvim_prog, exc_exec = local lfs = require('lfs') local paths = require('test.config.paths') -local msgpack = require('MessagePack') +local mpack = require('mpack') local shada_helpers = require('test.functional.shada.helpers') local reset, clear, get_shada_rw = @@ -107,7 +107,7 @@ describe('ShaDa support code', function() end) it('reads correctly various timestamps', function() - local mpack = { + local msgpack = { '\100', -- Positive fixnum 100 '\204\255', -- uint 8 255 '\205\010\003', -- uint 16 2563 @@ -116,23 +116,23 @@ describe('ShaDa support code', function() } local s = '\100' local e = '\001\192' - wshada(s .. table.concat(mpack, e .. s) .. e) + wshada(s .. table.concat(msgpack, e .. s) .. e) eq(0, exc_exec('wshada ' .. shada_fname)) local found = 0 - local typ = select(2, msgpack.unpacker(s)()) + local typ = mpack.unpack(s) for _, v in ipairs(read_shada_file(shada_fname)) do if v.type == typ then found = found + 1 - eq(select(2, msgpack.unpacker(mpack[found])()), v.timestamp) + eq(mpack.unpack(msgpack[found]), v.timestamp) end end - eq(#mpack, found) + eq(#msgpack, found) end) it('does not write NONE file', function() local session = spawn({nvim_prog, '-u', 'NONE', '-i', 'NONE', '--embed', '--cmd', 'qall'}, true) - session:exit(0) + session:close() eq(nil, lfs.attributes('NONE')) eq(nil, lfs.attributes('NONE.tmp.a')) end) @@ -143,7 +143,7 @@ describe('ShaDa support code', function() true) set_session(session) eq('', funcs.getreg('a')) - session:exit(0) + session:close() os.remove('NONE') end) diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index b35e0cde69..a11fab18a2 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -138,7 +138,7 @@ do -- this is just a helper to get any canonical name of a color colornames[rgb] = name end - session:exit(0) + session:close() Screen.colors = colors Screen.colornames = colornames end diff --git a/third-party/cmake/BuildLuarocks.cmake b/third-party/cmake/BuildLuarocks.cmake index 8427ca87b4..1662f89b24 100644 --- a/third-party/cmake/BuildLuarocks.cmake +++ b/third-party/cmake/BuildLuarocks.cmake @@ -96,21 +96,19 @@ endif() # Each target depends on the previous module, this serializes all calls to # luarocks since it is unhappy to be called in parallel. -add_custom_command(OUTPUT ${HOSTDEPS_LIB_DIR}/luarocks/rocks/lua-messagepack +add_custom_command(OUTPUT ${HOSTDEPS_LIB_DIR}/luarocks/rocks/mpack COMMAND ${LUAROCKS_BINARY} - ARGS build lua-messagepack ${LUAROCKS_BUILDARGS} + ARGS build mpack ${LUAROCKS_BUILDARGS} DEPENDS luarocks) -add_custom_target(lua-messagepack - DEPENDS ${HOSTDEPS_LIB_DIR}/luarocks/rocks/lua-messagepack) -list(APPEND THIRD_PARTY_DEPS lua-messagepack) +add_custom_target(mpack + DEPENDS ${HOSTDEPS_LIB_DIR}/luarocks/rocks/mpack) +list(APPEND THIRD_PARTY_DEPS mpack) -# Like before, depend on lua-messagepack to ensure serialization of install -# commands add_custom_command(OUTPUT ${HOSTDEPS_LIB_DIR}/luarocks/rocks/lpeg COMMAND ${LUAROCKS_BINARY} ARGS build lpeg ${LUAROCKS_BUILDARGS} - DEPENDS lua-messagepack) + DEPENDS mpack) add_custom_target(lpeg DEPENDS ${HOSTDEPS_LIB_DIR}/luarocks/rocks/lpeg) @@ -120,7 +118,7 @@ if(USE_BUNDLED_BUSTED) add_custom_command(OUTPUT ${HOSTDEPS_BIN_DIR}/busted COMMAND ${LUAROCKS_BINARY} ARGS build https://raw.githubusercontent.com/Olivine-Labs/busted/v2.0.rc11-0/busted-2.0.rc11-0.rockspec ${LUAROCKS_BUILDARGS} - DEPENDS luarocks) + DEPENDS lpeg) add_custom_target(busted DEPENDS ${HOSTDEPS_BIN_DIR}/busted) @@ -145,8 +143,8 @@ if(USE_BUNDLED_BUSTED) add_custom_command(OUTPUT ${HOSTDEPS_LIB_DIR}/luarocks/rocks/nvim-client COMMAND ${LUAROCKS_BINARY} - ARGS build https://raw.githubusercontent.com/neovim/lua-client/0.0.1-14/nvim-client-0.0.1-14.rockspec ${LUAROCKS_BUILDARGS} LIBUV_DIR=${HOSTDEPS_INSTALL_DIR} - DEPENDS luacheck libuv) + ARGS build https://raw.githubusercontent.com/neovim/lua-client/0.0.1-24/nvim-client-0.0.1-24.rockspec ${LUAROCKS_BUILDARGS} + DEPENDS luv) add_custom_target(nvim-client DEPENDS ${HOSTDEPS_LIB_DIR}/luarocks/rocks/nvim-client) |