aboutsummaryrefslogtreecommitdiff
path: root/test/functional/testnvim.lua
Commit message (Collapse)AuthorAge
* refactor(tests): merge n.spawn/n.spawn_argv into n.new_session #31859Justin M. Keyes2025-01-04
| | | | | | | | | | | | | | | | | Problem: - `n.spawn()` is misleading because it also connects RPC, it's not just "spawning" a process. - It's confusing that `n.spawn()` and `n.spawn_argv()` are separate. Solution: - Replace `n.spawn()`/`n.spawn_argv()` with a single function `n.new_session()`. This name aligns with the existing functions `n.set_session`/`n.get_session`. - Note: removes direct handling of `prepend_argv`, but I doubt that was important or intentional. If callers want to control use of `prepend_argv` then we should add a new flag to `test.session.Opts`. - Move `keep` to first parameter of `n.new_session()`. - Add a `merge` flag to `test.session.Opts` - Mark `_new_argv()` as private. Test should use clear/new_session/spawn_wait instead.
* test: use spawn_wait() instead of system() #31852Justin M. Keyes2025-01-04
| | | | | | | | | | | Problem: Tests that need to check `nvim` CLI behavior (no RPC session) create their own ad-hoc `system()` wrappers. Solution: - Use `n.spawn_wait` instead of `system()`. - Bonus: this also improves the tests by explicitly checking for `stdout` or `stderr`. And if a signal is raised, `ProcStream.status` will reflect it.
* test: include stderr in EOF failure messageJustin M. Keyes2025-01-03
|
* test: spawn_wait() starts a non-RPC Nvim processJustin M. Keyes2025-01-03
| | | | | | | | | | | Problem: Can't use `n.clear()` to test non-RPC `nvim` invocations. So tests end up creating ad-hoc wrappers around `system()` or `jobstart()`. Solution: - Introduce `n.spawn_wait()` - TODO (followup PR): Rename `n.spawn()` and `n.spawn_wait()`. It's misleading that `n.spawn()` returns a RPC session...
* feat(test): support and document lua test case debuggingMathias Fussenegger2024-12-24
| | | | | | | Similar to how there is a `GDB` environment variable to let the nvim test instances to be run under `gdbserver` this adds a `OSV_PORT` variable to start nvim test instances with `osv` in blocking mode to let a debug client attach to it for debugging of `exec_lua` code blocks.
* test: move exec_lua logic to separate moduleLewis Russell2024-11-21
| | | | | | | | | By making it a separate module, the embedded Nvim session can require this module directly instead of setup code sending over the module via RPC. Also make exec_lua wrap _G.print so messages can be seen in the test output immediately as the exec_lua returns.
* fix(test): better management of tmpfilesLewis Russell2024-11-06
| | | | | | | | | | | | | | | | | | | Problem: When tmpdir is local. The returned values from tmpname may already exist. This can cause problems for tests which pass `create=false` as they may require the file to not exist yet. Solution: When creating tmp names, always remove it to ensure it doesn't exist, and optionally open it if `create~=false` Additionally refactor the tmpname code and flattrn some functions into constants. Also while debugging this issue. It was discovered that `exec_lua()` doesn't report error messages properly. This has been fixed.
* feat(fs.lua): add vim.fs.rm()Lewis Russell2024-09-22
| | | | Analogous to the shell `rm` command.
* test: support upvalues in exec_luaLewis Russell2024-09-21
|
* feat(tui): builtin UI (TUI) sets client info #30397Justin M. Keyes2024-09-18
| | | | | | | | | | | | Problem: The default builtin UI client does not declare its client info. This reduces discoverability and makes it difficult for plugins to identify the UI. Solution: - Call nvim_set_client_info after attaching, as recommended by `:help dev-ui`. - Also set the "pid" field. - Also change `ui_active()` to return a count. Not directly relevant to this commit, but will be useful later.
* refactor(tests): rename terminal/testutil.lua => testterm.lua #30372Justin M. Keyes2024-09-15
| | | | | This module is generally used by any tests that need the full Nvim TUI instead of `screen.lua`. Thus it should live in `functional/` instead of in `functional/terminal/`.
* refactor(test): rename alter_slashes, invert its behaviorJustin M. Keyes2024-09-09
| | | | | | | - `alter_slashes` belongs in `testutil.lua`, not `testnvim.lua`. - `alter_slashes` is an unusual name. Rename it to `fix_slashes`. - invert its behavior, to emphasize that `/` slashes are the preferred, pervasive convention, not `\` slashes.
* fix(startup): server fails if $NVIM_APPNAME is relative dir #30310Justin M. Keyes2024-09-08
| | | | | | | | | | | | | | | | | | Problem: If $NVIM_APPNAME is a relative dir path, Nvim fails to start its primary/default server, and `v:servername` is empty. Root cause is d34c64e342dfba9248d1055e702d02620a1b31a8, but this wasn't noticed until 96128a5076b7 started reporting the error more loudly. Solution: - `server_address_new`: replace slashes "/" in the appname before using it as a servername. - `vim_mktempdir`: always prefer the system-wide top-level "nvim.user/" directory. That isn't intended to be specific to NVIM_APPNAME; rather, each *subdirectory* ("nvim.user/xxx") is owned by each Nvim instance. Nvim "apps" can be identified by the server socket(s) stored in those per-Nvim subdirs. fix #30256
* fix(scrollbind): properly take filler/virtual lines into accountLewis Russell2024-07-31
| | | | | | | | | | | | | | | | | | Problem: `'scrollbind'` does not work properly if the window being scrolled automatically contains any filler/virtual lines (except for diff filler lines). This is because when the scrollbind check is done, the logic only considers changes to topline which are represented as line numbers. Solution: Write the logic for determine the scroll amount to take into account filler/virtual lines. Fixes #29751
* Merge pull request #29103 from gpanders/test-no-tgcGregory Anders2024-06-12
|\ | | | | test: do not set termguicolors in test runner
| * test: do not set termguicolors in test runnerGregory Anders2024-05-31
| | | | | | | | | | It's not clear why this is needed and it has adverse side effects on other tests.
* | refactor(lua): use tuple syntax everywhere #29111Ilia Choly2024-06-04
|/
* fix(test): failure after version bump #28771Justin M. Keyes2024-05-16
| | | | | | | | | Problem: - The test for vim.deprecate() has a "mock" which is outdated because vim.deprecate() no longer uses that. - The tests get confused after a version bump. Solution: Make the tests adapt to the current version.
* 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.