diff options
author | ZyX <kp-pav@yandex.ru> | 2017-05-23 00:16:23 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-05-23 00:16:23 +0300 |
commit | a5a5c83608e6d4455ac40e8786fd16eaf817c608 (patch) | |
tree | 9ea66faf78b01e2750f1d8a7653aa09da86b0e65 /test/functional/api/vim_spec.lua | |
parent | 9cc10c69f2533a71c0e352b534d0b09567e51668 (diff) | |
download | rneovim-a5a5c83608e6d4455ac40e8786fd16eaf817c608.tar.gz rneovim-a5a5c83608e6d4455ac40e8786fd16eaf817c608.tar.bz2 rneovim-a5a5c83608e6d4455ac40e8786fd16eaf817c608.zip |
api/vim: Fix nvim_list_runtimepaths
It used to
1. Always omit last component in runtimepath.
2. Always omit trailing empty item and leave uninitialized memory in place of
it.
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r-- | test/functional/api/vim_spec.lua | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 161682b973..c531d4af46 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -327,11 +327,11 @@ describe('api', function() {'nvim_get_mode', {}}, {'nvim_eval', {'1'}}, } - eq({{{mode='n', blocking=false}, - 13, - {mode='n', blocking=false}, -- TODO: should be blocked=true - 1}, - NIL}, meths.call_atomic(req)) + eq({ { {mode='n', blocking=false}, + 13, + {mode='n', blocking=false}, -- TODO: should be blocked=true + 1 }, + NIL}, meths.call_atomic(req)) eq({mode='r', blocking=true}, nvim("get_mode")) end) -- TODO: bug #6166 @@ -588,6 +588,36 @@ describe('api', function() end) end) + describe('list_runtime_paths', function() + it('returns nothing with empty &runtimepath', function() + meths.set_option('runtimepath', '') + eq({}, meths.list_runtime_paths()) + end) + it('returns single runtimepath', function() + meths.set_option('runtimepath', 'a') + eq({'a'}, meths.list_runtime_paths()) + end) + it('returns two runtimepaths', function() + meths.set_option('runtimepath', 'a,b') + eq({'a', 'b'}, meths.list_runtime_paths()) + end) + it('returns empty strings when appropriate', function() + meths.set_option('runtimepath', 'a,,b') + eq({'a', '', 'b'}, meths.list_runtime_paths()) + meths.set_option('runtimepath', ',a,b') + eq({'', 'a', 'b'}, meths.list_runtime_paths()) + meths.set_option('runtimepath', 'a,b,') + eq({'a', 'b', ''}, meths.list_runtime_paths()) + end) + it('truncates too long paths', function() + local long_path = ('/a'):rep(8192) + meths.set_option('runtimepath', long_path) + local paths_list = meths.list_runtime_paths() + neq({long_path}, paths_list) + eq({long_path:sub(1, #(paths_list[1]))}, paths_list) + end) + end) + it('can throw exceptions', function() local status, err = pcall(nvim, 'get_option', 'invalid-option') eq(false, status) |