diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-03-09 14:57:57 -0700 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-03-09 14:57:57 -0700 |
commit | c324271b99eee4c621463f368914d57cd729bd9c (patch) | |
tree | 5d979d333a2d5f9c080991d5482fd5916f8579c6 /test/functional/lua/ui_spec.lua | |
parent | 931bffbda3668ddc609fc1da8f9eb576b170aa52 (diff) | |
parent | ade1b12f49c3b3914c74847d791eb90ea90b56b7 (diff) | |
download | rneovim-c324271b99eee4c621463f368914d57cd729bd9c.tar.gz rneovim-c324271b99eee4c621463f368914d57cd729bd9c.tar.bz2 rneovim-c324271b99eee4c621463f368914d57cd729bd9c.zip |
Merge remote-tracking branch 'upstream/master' into userreg
Diffstat (limited to 'test/functional/lua/ui_spec.lua')
-rw-r--r-- | test/functional/lua/ui_spec.lua | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/test/functional/lua/ui_spec.lua b/test/functional/lua/ui_spec.lua index d4c150c5f2..e769843b19 100644 --- a/test/functional/lua/ui_spec.lua +++ b/test/functional/lua/ui_spec.lua @@ -16,7 +16,7 @@ describe('vim.ui', function() describe('select()', function() it('can select an item', function() - local result = exec_lua[[ + local result = exec_lua [[ local items = { { name = 'Item 1' }, { name = 'Item 2' }, @@ -51,7 +51,7 @@ describe('vim.ui', function() describe('input()', function() it('can input text', function() - local result = exec_lua[[ + local result = exec_lua [[ local opts = { prompt = 'Input: ', } @@ -117,38 +117,44 @@ describe('vim.ui', function() it('can return nil when interrupted with Ctrl-C #18144', function() feed(':lua result = "on_confirm not called"<cr>') feed(':lua vim.ui.input({}, function(input) result = input end)<cr>') - poke_eventloop() -- This is needed because Ctrl-C flushes input + poke_eventloop() -- This is needed because Ctrl-C flushes input feed('Inputted Text<c-c>') eq(true, exec_lua('return (nil == result)')) end) - it('can return the identical object when an arbitrary opts.cancelreturn object is given', function() - feed(':lua fn = function() return 42 end<CR>') - eq(42, exec_lua('return fn()')) - feed(':lua vim.ui.input({ cancelreturn = fn }, function(input) result = input end)<cr>') - feed('cancel<esc>') - eq(true, exec_lua('return (result == fn)')) - eq(42, exec_lua('return result()')) - end) - + it( + 'can return the identical object when an arbitrary opts.cancelreturn object is given', + function() + feed(':lua fn = function() return 42 end<CR>') + eq(42, exec_lua('return fn()')) + feed(':lua vim.ui.input({ cancelreturn = fn }, function(input) result = input end)<cr>') + feed('cancel<esc>') + eq(true, exec_lua('return (result == fn)')) + eq(42, exec_lua('return result()')) + end + ) end) describe('open()', function() it('validation', function() if is_os('win') or not is_ci('github') then - exec_lua[[vim.system = function() return { wait=function() return { code=3} end } end]] + exec_lua [[vim.system = function() return { wait=function() return { code=3} end } end]] end if not is_os('bsd') then - matches('vim.ui.open: command failed %(%d%): { "[^"]+", .*"non%-existent%-file" }', - exec_lua[[local _, err = vim.ui.open('non-existent-file') ; return err]]) + matches( + 'vim.ui.open: command failed %(%d%): { "[^"]+", .*"non%-existent%-file" }', + exec_lua [[local _, err = vim.ui.open('non-existent-file') ; return err]] + ) end - exec_lua[[ + exec_lua [[ vim.fn.has = function() return 0 end vim.fn.executable = function() return 0 end ]] - eq('vim.ui.open: no handler found (tried: wslview, xdg-open)', - exec_lua[[local _, err = vim.ui.open('foo') ; return err]]) + eq( + 'vim.ui.open: no handler found (tried: explorer.exe, xdg-open)', + exec_lua [[local _, err = vim.ui.open('foo') ; return err]] + ) end) end) end) |