aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/commands_spec.lua
Commit message (Collapse)AuthorAge
* fix(tests): needing two calls to setup a screen is cringebfredl2024-11-14
| | | | | | | | | | 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.
* test: allow exec_lua to handle functionsLewis Russell2024-08-02
| | | | | | | | | | | 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.
* test: improve test conventionsdundargoc2024-04-23
| | | | | | | | | 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.
* refactor(test): inject after_each differentlyLewis Russell2024-04-10
|
* test: improve test conventionsdundargoc2024-04-08
| | | | Work on https://github.com/neovim/neovim/issues/27004.
* feat(ex_cmds): no error on :lua with {range} and {code} (#27290)luukvbaal2024-02-02
| | | | | | 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.
* fix(lua): avoid internal error when :luado deletes lines (#27262)zeertzjq2024-01-30
|
* docs(lua): update ":{range}lua" docs + error message #27231Justin M. Keyes2024-01-27
| | | | | - `:lua (no file)` is misleading because `:lua` never takes a file arg, unlike `:source`. - Update various related docs.
* feat(ex_cmds): ranged :lua #27167luukvbaal2024-01-26
| | | | | | :{range}lua executes the specified lines in the current buffer as Lua code, regardless of its extension or 'filetype'. Close #27103
* test: rename (meths, funcs) -> (api, fn)Lewis Russell2024-01-12
|
* test: normalise nvim bridge functionsLewis Russell2024-01-12
| | | | | - remove helpers.cur*meths - remove helpers.nvim
* test: typing for helpers.methsLewis Russell2024-01-12
|
* test: do not inject vim module into global helpersLewis Russell2024-01-12
|
* refactor: format test/*Justin M. Keyes2024-01-03
|
* test: avoid repeated screen lines in expected stateszeertzjq2023-12-09
| | | | | | 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
* fix(excmd): append original command to error messagezeertzjq2023-05-05
| | | | | | | | | | 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.
* vim-patch:8.2.4890: inconsistent capitalization in error messageszeertzjq2023-05-05
| | | | | | | | | 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>
* fix(heredoc): allow missing end marker for scriptszeertzjq2023-04-29
| | | | Also do not crash when getting heredoc fails.
* feat(lua): allow `:=expr` as a shorter version of `:lua =expr`bfredl2023-03-22
| | | | | | | | | | | | | | | | 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.
* refactor!: rename vim.pretty_print => vim.printJustin M. Keyes2023-03-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* fix(lua): print multiple return values with =expr (#16933)Shadman2022-01-06
|
* feat(lua): make =expr print result of exprshadmansaleh2022-01-04
|
* feat(lua): enable stack traces in error output (#16228)Gregory Anders2021-11-06
|
* refactor(tests): remove redir_exec #15718Justin M. Keyes2021-09-19
| | | | | | | | | | | 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`.
* test/vim.validate(): assert normalized stacktraceJustin M. Keyes2020-10-05
| | | | | | | - 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()
* API: include invalid buffer/window/tabpage in error message (#11712)Daniel Hahler2020-01-14
|
* Add v:lua.func() vimL syntax for calling luaBjörn Linse2019-11-16
| | | | Also simplify error messages when calling lua from vimL.
* tests/lua: test for multiline error messages in luaBjörn Linse2019-01-23
|
* executor,functests: Add print() tests, some fixesZyX2017-03-27
|
* executor: Add :luafile commandZyX2017-03-27
|
* executor: Fix some memory leaksZyX2017-03-27
|
* executor,functests: Add tests for :luado, also some fixesZyX2017-03-27
| | | | | | | | 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.
* doc,functests: Add documentationZyX2017-03-27
| | | Missing: updates to various lists.
* functests: Add tests for :luaZyX2017-03-27
|
* functests: Add some testsZyX2017-03-27