summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional/lua/commands_spec.lua
AgeCommit message (Collapse)AuthorFiles
2026-04-20refactor(test): drop deprecated exc_exec #39242Justin M. Keyes1
2025-05-04feat(messages): cleanup Lua error messagesJustin M. Keyes1
"Error" in error messages is redundant. Just provide the context, don't say "Error ...".
2025-03-07fix(lua): always use vim.inspect() for :lua= (#32715)zeertzjq1
2025-02-28vim-patch:8.2.4603: sourcing buffer lines is too complicatedzeertzjq1
Problem: Sourcing buffer lines is too complicated. Solution: Simplify the code. Make it possible to source Vim9 script lines. (Yegappan Lakshmanan, closes vim/vim#9974) https://github.com/vim/vim/commit/85b43c6cb7d56919e245622f4e42db6d8bee4194 This commit changes the behavior of sourcing buffer lines to always have a script ID, although sourcing the same buffer always produces the same script ID. vim-patch:9.1.0372: Calling CLEAR_FIELD() on the same struct twice Problem: Calling CLEAR_FIELD() on the same struct twice. Solution: Remove the second CLEAR_FIELD(). Move the assignment of cookie.sourceing_lnum (zeertzjq). closes: vim/vim#14627 https://github.com/vim/vim/commit/f68517c1671dfedcc1555da50bc0b3de6d2842f6 Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2024-11-14fix(tests): needing two calls to setup a screen is cringebfredl1
Before calling "attach" a screen object is just a dummy container for (row, col) values whose purpose is to be sent as part of the "attach" function call anyway. Just create the screen in an attached state directly. Keep the complete (row, col, options) config together. It is still completely valid to later detach and re-attach as needed, including to another session.
2024-08-02test: allow exec_lua to handle functionsLewis Russell1
Problem: Tests have lots of exec_lua calls which input blocks of code provided as unformatted strings. Solution: Teach exec_lua how to handle functions.
2024-04-23test: improve test conventionsdundargoc1
Specifically, functions that are run in the context of the test runner are put in module `test/testutil.lua` while the functions that are run in the context of the test session are put in `test/functional/testnvim.lua`. Closes https://github.com/neovim/neovim/issues/27004.
2024-04-10refactor(test): inject after_each differentlyLewis Russell1
2024-04-08test: improve test conventionsdundargoc1
Work on https://github.com/neovim/neovim/issues/27004.
2024-02-02feat(ex_cmds): no error on :lua with {range} and {code} (#27290)luukvbaal1
Problem: Erroring when both {range} and {code} are supplied to :lua is inconvenient and may break mappings. Solution: Don't error, ignore {range} and execute {code} when both are supplied.
2024-01-30fix(lua): avoid internal error when :luado deletes lines (#27262)zeertzjq1
2024-01-27docs(lua): update ":{range}lua" docs + error message #27231Justin M. Keyes1
- `:lua (no file)` is misleading because `:lua` never takes a file arg, unlike `:source`. - Update various related docs.
2024-01-26feat(ex_cmds): ranged :lua #27167luukvbaal1
:{range}lua executes the specified lines in the current buffer as Lua code, regardless of its extension or 'filetype'. Close #27103
2024-01-12test: rename (meths, funcs) -> (api, fn)Lewis Russell1
2024-01-12test: normalise nvim bridge functionsLewis Russell1
- remove helpers.cur*meths - remove helpers.nvim
2024-01-12test: typing for helpers.methsLewis Russell1
2024-01-12test: do not inject vim module into global helpersLewis Russell1
2024-01-03refactor: format test/*Justin M. Keyes1
2023-12-09test: avoid repeated screen lines in expected stateszeertzjq1
This is the command invoked repeatedly to make the changes: :%s/^\(.*\)|\%(\*\(\d\+\)\)\?$\n\1|\%(\*\(\d\+\)\)\?$/\=submatch(1)..'|*'..(max([str2nr(submatch(2)),1])+max([str2nr(submatch(3)),1]))/g
2023-05-05fix(excmd): append original command to error messagezeertzjq1
Revert the change to do_cmdline_cmd() from #5226. This function is used in many places, so making it different from Vim leads to small differences from Vim in the behavior of some functions like execute() and assert_fails(). If DOCMD_VERBOSE really needs to be removed somewhere, a do_cmdline() call without DOCMD_VERBOSE is also shorter than a do_cmdline() call with DOCMD_VERBOSE.
2023-05-05vim-patch:8.2.4890: inconsistent capitalization in error messageszeertzjq1
Problem: Inconsistent capitalization in error messages. Solution: Make capitalization consistent. (Doug Kearns) https://github.com/vim/vim/commit/cf030578b26460643dca4a40e7f2e3bc19c749aa Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-29fix(heredoc): allow missing end marker for scriptszeertzjq1
Also do not crash when getting heredoc fails.
2023-03-22feat(lua): allow `:=expr` as a shorter version of `:lua =expr`bfredl1
existing behavior of := and :[range]= are unchanged. `|` is still allowed with this usage. However, :=p and similar are changed in a way which could be construed as a breaking change. Allowing |ex-flags| for := in the first place was a mistake as any form of := DOES NOT MOVE THE CURSOR. So it would print one line number and then print a completely different line contents after that.
2023-03-13refactor!: rename vim.pretty_print => vim.printJustin M. Keyes1
Problem: The function name `vim.pretty_print`: 1. is verbose, which partially defeats its purpose as sugar 2. does not draw from existing precedent or any sort of convention (except external projects like penlight or python?), which reduces discoverability, and degrades signaling about best practices. Solution: - Rename to `vim.print`. - Change the behavior so that 1. strings are printed without quotes 2. each arg is printed on its own line 3. tables are indented with 2 instead of 4 spaces - Example: :lua ='a', 'b', 42, {a=3} a b 42 { a = 3 } Comparison of alternatives: - `vim.print`: - pro: consistent with Lua's `print()` - pro: aligns with potential `nvim_print` API function which will replace nvim_echo, nvim_notify, etc. - con: behaves differently than Lua's `print()`, slightly misleading? - `vim.echo`: - pro: `:echo` has similar "pretty print" behavior. - con: inconsistent with Lua idioms. - `vim.p`: - pro: very short, fits with `vim.o`, etc. - con: not as discoverable as "echo" - con: less opportunity for `local p = vim.p` because of potential shadowing.
2022-01-06fix(lua): print multiple return values with =expr (#16933)Shadman1
2022-01-04feat(lua): make =expr print result of exprshadmansaleh1
2021-11-06feat(lua): enable stack traces in error output (#16228)Gregory Anders1
2021-09-19refactor(tests): remove redir_exec #15718Justin M. Keyes1
Problem - `redir_exec` is obsolete, but it keeps getting used in new tests because people copy existing tests. - Disadvantages of `redir_exec`: - Captures extra junk before the actual error/message that we _want_ to test. - Does not fail on error, unlike e.g. `command()`. Solution - Use new functions like `nvim_exec` and `pcall_err`.
2020-10-05test/vim.validate(): assert normalized stacktraceJustin M. Keyes1
- The previous commit lost information in the tests. Instead, add some more "normalization" substitutions in pcall_err(), so that the general shape of the stacktrace is included in the asserted text. - Eliminate contains(), it is redundant with matches()
2020-01-14API: include invalid buffer/window/tabpage in error message (#11712)Daniel Hahler1
2019-11-16Add v:lua.func() vimL syntax for calling luaBjörn Linse1
Also simplify error messages when calling lua from vimL.
2019-01-23tests/lua: test for multiline error messages in luaBjörn Linse1
2017-03-27executor,functests: Add print() tests, some fixesZyX1
2017-03-27executor: Add :luafile commandZyX1
2017-03-27executor: Fix some memory leaksZyX1
2017-03-27executor,functests: Add tests for :luado, also some fixesZyX1
Fixes: 1. Allocate space for the NUL byte. 2. Do not exclude last line from range. 3. Remove code for sandbox: it is handled earlier. 4. Fix index in new_line_transformed when converting NULs to NLs. 5. Always allocate new_line_transformed, but save allocated value.
2017-03-27doc,functests: Add documentationZyX1
Missing: updates to various lists.
2017-03-27functests: Add tests for :luaZyX1
2017-03-27functests: Add some testsZyX1