diff options
author | ZyX <kp-pav@yandex.ru> | 2017-07-15 18:56:45 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-07-15 18:56:45 +0300 |
commit | 69719e658c48bb5e95a7b57d5813ed4dc48e68e3 (patch) | |
tree | c4f8584a7437ea6127389b26ff6876404cb58ce7 /test/functional/api/vim_spec.lua | |
parent | 7ab152aaa58f493e54d03a15960b8a288196e588 (diff) | |
parent | 8898793adeb3a82fe50da4258c30940e10ebcc9d (diff) | |
download | rneovim-69719e658c48bb5e95a7b57d5813ed4dc48e68e3.tar.gz rneovim-69719e658c48bb5e95a7b57d5813ed4dc48e68e3.tar.bz2 rneovim-69719e658c48bb5e95a7b57d5813ed4dc48e68e3.zip |
Merge branch 'master' into colored-cmdline
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r-- | test/functional/api/vim_spec.lua | 53 |
1 files changed, 44 insertions, 9 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 161682b973..e59b5d712d 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 @@ -373,6 +373,11 @@ describe('api', function() '<NL>x<Esc>x<CR>x<lt>x', true, true, true)) end) + it('does not convert keycodes if special=false', function() + eq('<NL>x<Esc>x<CR>x<lt>x', helpers.nvim('replace_termcodes', + '<NL>x<Esc>x<CR>x<lt>x', true, true, false)) + end) + it('does not crash when transforming an empty string', function() -- Actually does not test anything, because current code will use NULL for -- an empty string. @@ -391,13 +396,13 @@ describe('api', function() -- notice the special char(…) \xe2\80\xa6 nvim('feedkeys', ':let x1="…"\n', '', true) - -- Both replace_termcodes and feedkeys escape \x80 + -- Both nvim_replace_termcodes and nvim_feedkeys escape \x80 local inp = helpers.nvim('replace_termcodes', ':let x2="…"<CR>', true, true, true) - nvim('feedkeys', inp, '', true) + nvim('feedkeys', inp, '', true) -- escape_csi=true - -- Disabling CSI escaping in feedkeys + -- nvim_feedkeys with CSI escaping disabled inp = helpers.nvim('replace_termcodes', ':let x3="…"<CR>', true, true, true) - nvim('feedkeys', inp, '', false) + nvim('feedkeys', inp, '', false) -- escape_csi=false helpers.stop() end @@ -588,6 +593,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) |