diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2025-08-24 23:12:46 -0400 |
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2025-09-03 23:03:51 -0400 |
| commit | 9c3099f0cf0d1e9aa4edba13c5b5f6d3575aa18d (patch) | |
| tree | 17fe60d8d41d17a2b76de1e72c8a717da6ac8d9c /test/functional/lua/luaeval_spec.lua | |
| parent | de950f827236e2c7447bd776c2509faa39c27b63 (diff) | |
| download | rneovim-9c3099f0cf0d1e9aa4edba13c5b5f6d3575aa18d.tar.gz rneovim-9c3099f0cf0d1e9aa4edba13c5b5f6d3575aa18d.tar.bz2 rneovim-9c3099f0cf0d1e9aa4edba13c5b5f6d3575aa18d.zip | |
docs: lsp, misc
- Problem: It's not clear for new plugin developers that `:help` uses
a help-tags file for searching the docs, generated by `:helptags`.
- Solution: Hint to the |:helptags| docs for regenerating the tags
file for their freshly written documentation.
Co-authored-by: Yochem van Rosmalen <git@yochem.nl>
Diffstat (limited to 'test/functional/lua/luaeval_spec.lua')
| -rw-r--r-- | test/functional/lua/luaeval_spec.lua | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/test/functional/lua/luaeval_spec.lua b/test/functional/lua/luaeval_spec.lua index 6e2f5c08cb..199fda6ca1 100644 --- a/test/functional/lua/luaeval_spec.lua +++ b/test/functional/lua/luaeval_spec.lua @@ -93,7 +93,7 @@ describe('luaeval()', function() -- Not checked: funcrefs converted to NIL. To be altered to something more -- meaningful later. - it('correctly evaluates scalars', function() + it('scalars', function() -- Also test method call (->) syntax eq(1, fn.luaeval('1')) eq(0, eval('"1"->luaeval()->type()')) @@ -114,7 +114,7 @@ describe('luaeval()', function() eq(NIL, fn.luaeval('nil')) end) - it('correctly evaluates containers', function() + it('containers', function() eq({}, fn.luaeval('{}')) eq(3, eval('type(luaeval("{}"))')) @@ -145,7 +145,7 @@ describe('luaeval()', function() ) end) - it('correctly passes scalars as argument', function() + it('passes scalars as argument', function() eq(1, fn.luaeval('_A', 1)) eq(1.5, fn.luaeval('_A', 1.5)) eq('', fn.luaeval('_A', '')) @@ -155,7 +155,7 @@ describe('luaeval()', function() eq(false, fn.luaeval('_A', false)) end) - it('correctly passes containers as argument', function() + it('passes containers as argument', function() eq({}, fn.luaeval('_A', {})) eq({ test = 1 }, fn.luaeval('_A', { test = 1 })) eq({ 4, 2 }, fn.luaeval('_A', { 4, 2 })) @@ -187,7 +187,7 @@ describe('luaeval()', function() ]=]):format(expr or '"_A"', argexpr):gsub('\n', ''))) end - it('correctly passes special dictionaries', function() + it('passes special dictionaries', function() eq({ 0, '\000\n\000' }, luaevalarg(sp('string', '["\\n", "\\n"]'))) eq({ 0, true }, luaevalarg(sp('boolean', 1))) eq({ 0, false }, luaevalarg(sp('boolean', 0))) @@ -195,7 +195,7 @@ describe('luaeval()', function() eq({ 0, { [''] = '' } }, luaevalarg(mapsp(sp('string', '[""]'), '""'))) end) - it('issues an error in some cases', function() + it('failure modes', function() eq( 'Vim(call):E5100: Cannot convert given Lua table: table should contain either only integer keys or only string keys', exc_exec('call luaeval("{1, foo=2}")') @@ -205,7 +205,7 @@ describe('luaeval()', function() startswith('Vim(call):E5108: Lua: [string "luaeval()"]:', exc_exec('call luaeval("(nil)()")')) end) - it('should handle sending lua functions to viml', function() + it('handles sending lua functions to viml', function() eq( true, exec_lua [[ @@ -294,7 +294,7 @@ describe('luaeval()', function() matches(': dead function\n', api.nvim_get_vvar('errmsg')) end) - it('should handle passing functions around', function() + it('can pass functions around', function() command [[ function VimCanCallLuaCallbacks(Concat, Cb) let message = a:Concat("Hello Vim", "I'm Lua") @@ -317,7 +317,7 @@ describe('luaeval()', function() ) end) - it('should handle funcrefs', function() + it('handles funcrefs', function() command [[ function VimCanCallLuaCallbacks(Concat, Cb) let message = a:Concat("Hello Vim", "I'm Lua") @@ -340,7 +340,7 @@ describe('luaeval()', function() ) end) - it('should work with metatables using __call', function() + it('works with metatables using __call', function() eq( 1, exec_lua [[ @@ -362,7 +362,7 @@ describe('luaeval()', function() ) end) - it('should handle being called from a timer once.', function() + it('handles being called from a timer once.', function() eq( 3, exec_lua [[ @@ -381,7 +381,7 @@ describe('luaeval()', function() ) end) - it('should call functions once with __call metamethod', function() + it('calls functions once with __call metamethod', function() eq( true, exec_lua [[ @@ -398,7 +398,7 @@ describe('luaeval()', function() ) end) - it('should work with lists using __call', function() + it('works with lists using __call', function() eq( 3, exec_lua [[ @@ -429,7 +429,7 @@ describe('luaeval()', function() ) end) - it('should not work with tables not using __call', function() + it('fails with tables not using __call', function() eq( { false, 'Vim:E921: Invalid callback argument' }, exec_lua [[ @@ -441,7 +441,7 @@ describe('luaeval()', function() ) end) - it('correctly converts containers with type_idx', function() + it('converts containers with type_idx', function() eq(5, eval('type(luaeval("{[vim.type_idx]=vim.types.float, [vim.val_idx]=0}"))')) eq(4, eval([[type(luaeval('{[vim.type_idx]=vim.types.dictionary}'))]])) eq(3, eval([[type(luaeval('{[vim.type_idx]=vim.types.array}'))]])) @@ -463,7 +463,7 @@ describe('luaeval()', function() eq({}, fn.luaeval('{[vim.type_idx]=vim.types.dictionary}')) end) - it('correctly converts self-containing containers', function() + it('converts self-containing containers', function() api.nvim_set_var('l', {}) eval('add(l, l)') eq(true, eval('luaeval("_A == _A[1]", l)')) @@ -479,7 +479,7 @@ describe('luaeval()', function() eq(true, eval('luaeval("_A ~= _A.d", {"d": d})')) end) - it('errors out correctly when doing incorrect things in lua', function() + it('fails when doing incorrect things in lua', function() -- Conversion errors eq( 'Vim(call):E5108: Lua: [string "luaeval()"]:1: attempt to call field \'xxx_nonexistent_key_xxx\' (a nil value)', @@ -531,7 +531,7 @@ describe('v:lua', function() ]]) end) - it('works in expressions', function() + it('in expressions', function() eq(7, eval('v:lua.foo(3,4,v:null)')) eq(true, exec_lua([[return _G.val == vim.NIL]])) eq(NIL, eval('v:lua.mymod.noisy("eval")')) @@ -545,7 +545,7 @@ describe('v:lua', function() ) end) - it('works when called as a method', function() + it('when called as a method', function() eq(123, eval('110->v:lua.foo(13)')) eq(true, exec_lua([[return _G.val == nil]])) @@ -562,7 +562,7 @@ describe('v:lua', function() ) end) - it('works in :call', function() + it('in :call', function() command(":call v:lua.mymod.noisy('command')") eq('hey command', api.nvim_get_current_line()) eq( @@ -571,7 +571,7 @@ describe('v:lua', function() ) end) - it('works in func options', function() + it('in func options', function() local screen = Screen.new(60, 8) api.nvim_set_option_value('omnifunc', 'v:lua.mymod.omni', {}) feed('isome st<c-x><c-o>') @@ -599,7 +599,7 @@ describe('v:lua', function() eq(9004, eval("0 ? v:lua.require'bar'.doit() : v:lua.require'baz-quux'.doit()")) end) - it('throw errors for invalid use', function() + it('fails for invalid usage', function() eq( [[Vim(let):E15: Invalid expression: "v:lua.func"]], pcall_err(command, 'let g:Func = v:lua.func') @@ -639,7 +639,7 @@ describe('v:lua', function() eq([[Vim:E15: Invalid expression: "v:lua.()"]], pcall_err(eval, 'v:lua.()')) end) - describe('invalid use in fold text', function() + describe('invalid usage in fold text', function() before_each(function() feed('ifoo<CR>bar<Esc>') command('1,2fold') |