summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional/testnvim.lua
AgeCommit message (Collapse)AuthorFiles
2026-04-23fix(build.zig): reunify parser install pathbfredl1
Both for tests and for system wide install, $PREFIX/lib/nvim/parser is a valid path for tree-sitter parsers. This also brings the build.zig behavior in line with how we set up the paths in CMakeLists.txt
2026-04-20refactor(test): drop deprecated exc_exec #39242Justin M. Keyes1
2026-04-15test: replace busted with local harnessLewis Russell1
Replace the busted-based Lua test runner with a repo-local harness. The new harness runs spec files directly under `nvim -ll`, ships its own reporter and lightweight `luassert` shim, and keeps the helper/preload flow used by the functional and unit test suites. Keep the file boundary model shallow and busted-like by restoring `_G`, `package.loaded`, `package.preload`, `arg`, and the process environment between files, without carrying extra reset APIs or custom assertion machinery. Update the build and test entrypoints to use the new runner, add black-box coverage for the harness itself, and drop the bundled busted/luacheck dependency path. AI-assisted: Codex
2026-04-14test: n.rmdir() save-and-restore CWD #39048Justin M. Keyes1
2026-03-13test: include :cd in pcall() in rmdir() (#38278)zeertzjq1
If the Nvim session has exited, the nvim_command will fail too. ERROR test/functional/core/fileio_spec.lua @ 342: tmpdir failure modes test\functional\testnvim.lua:133: sending request after EOF from Nvim stack traceback: test\functional\testnvim.lua:133: in function 'command' test\functional\testnvim.lua:847: in function 'rmdir' test/functional/core\fileio_spec.lua:353: in function <test/functional/core\fileio_spec.lua:342>
2026-02-19test(lsp): fix fake LSP server timeout not working (#37970)zeertzjq1
Problem: Fake LSP server does not timeout or respond to SIGTERM as it does not run the event loop. Solution: Instead of io.read(), use stdioopen()'s on_stdin callback to accumulate input and use vim.wait() to wait for input. Also, in the test suite, don't stop a session when it's not running, as calling uv.stop() outside uv.run() will instead cause the next uv.run() to stop immediately, which cancels the next RPC request.
2026-02-19test(ex_cmds/write_spec): don't create files under test/ (#37963)zeertzjq1
2026-02-16refactor(tests): server_spec #37912Justin M. Keyes1
2026-02-03feat(defaults): exclude temp dirs from 'shada' oldfiles #37631Pavel Pisetski1
Problem: Temporary files from /tmp/ and /private/ paths clutter :oldfiles list. Additionally, the documented Windows default (rA:,rB:) was never applied due to a missing platform condition. Solution: Drop platform-specific shada differences and default to excluding /tmp/ and /private/ paths.
2026-02-01fix(lua): close vim.defer_fn() timer if vim.schedule() failed (#37647)zeertzjq1
Problem: Using vim.defer_fn() just before Nvim exit leaks luv handles. Solution: Make vim.schedule() return an error message if scheduling failed. Make vim.defer_fn() close timer if vim.schedule() failed.
2026-01-13fix(shell): ceci n'est pas une pipebfredl1
On linux /dev/stdin is defined as a symlink to /proc/self/fd/0 This in turn is defined as a "magic" symlink which is allowed to point to internal kernel objects which really does not have a file name. As a glaring inconsistency, fopen("/proc/self/fd/0", "r") works if fd was originally opened using pipe() but not using socketpair(). As it happens UV_CREATE_PIPE does not create pipes but creates socket pairs. These two unfortunate conditions means that using /dev/stdin and similar does not work in shell commands in nvim on linux. as a work around, override libuv's descicion and create an actual pipe pair. This change is not needed on BSD:s but done unconditionally for simplicity, except for on windows where it is not done for stdout because of windows fixes #35984
2025-12-05test: skip noisy "terminal mode unavailable" logs #36794Justin M. Keyes1
Problem: Every CI log has a lot of noise at the end, which makes it harder to find relevant test failures: Running tests from test/functional/terminal/tui_spec.lua ... T5831 TUI bg color queries the terminal for background color: T5832 TUI bg color triggers OptionSet from automatic background processing: T5833 TUI bg color sends theme update notifications when background changes #31652: ... Running tests from test/functional/ui/output_spec.lua ... WRN 2025-12-02T03:36:47.304 ui/c/T5831.28003.0 tui_handle_term_mode:223: TUI: terminal mode 2026 unavailable, state 0 WRN 2025-12-02T03:36:47.359 ui/c/T5832.28006.0 tui_handle_term_mode:223: TUI: terminal mode 2048 unavailable, state 0 WRN 2025-12-02T03:36:47.414 ui/c/T5833.28009.0 tui_handle_term_mode:223: TUI: terminal mode 2048 unavailable, state 0 Solution: - Skip logging in test-mode. - This can be reverted later, when these logs are changed to "INFO" level, per this TODO comment: ``` // TODO(bfredl): This is really ILOG but we want it in all builds. // add to show_verbose_terminfo() without being too racy ???? WLOG("TUI: terminal mode %d unavailable, state %d", mode, state); ```
2025-11-22docs: misc, build, lspJustin M. Keyes1
2025-11-15docs: getpos, getregion, lspJustin M. Keyes1
2025-10-26refactor(spell): cleanupJustin M. Keyes1
- prefer `stdpath(data)/site/spell` instead of looking for random dirs in 'runtimepath'. - drop unused functions `choose_directory`, `setup`, etc.
2025-09-24test(tui_spec): avoid dangling Nvim processes on test failure (#35900)zeertzjq1
Also don't wait indefinitely for all Nvim processes to exit.
2025-09-23test: don't block to wait for previous session's exit (#35885)zeertzjq1
This reduces the time taken by clear() by over 20% with ASAN.
2025-09-22test: make error clearer for RPC request after crashzeertzjq1
2025-05-02feat(build): build.zig MVP: build and run functionaltests on linuxbfredl1
NEW BUILD SYSTEM! This is a MVP implementation which supports building the "nvim" binary, including cross-compilation for some targets. As an example, you can build a aarch64-macos binary from an x86-64-linux-gnu host, or vice versa Add CI target for build.zig currently for functionaltests on linux x86_64 only Follow up items: - praxis for version and dependency bumping - windows 💀 - full integration of libintl and gettext (or a desicion not to) - update help and API metadata files - installation into a $PREFIX - more tests and linters
2025-04-21feat(options): default statusline expression #33036Shadman1
Problem: Default 'statusline' is implemented in C and not representable as a statusline expression. This makes it hard for user configs/plugins to extend it. Solution: - Change the default 'statusline' slightly to a statusline expression. - Remove the C implementation.
2025-04-12feat(defaults): shelltemp=false #33012Alexej Kowalew1
Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-03-15refactor(test): deprecate n.feed_command() #32915Justin M. Keyes1
Problem: `feed_command()` was added as a "bridge" for old test code. 99% of those cases should be using `n.command()`, which raises errors instead of silently continuing the test. Solution: Deprecate `feed_command()`. It should not be used in new tests. All usages of `feed_command()` should be converted to `command()` or `feed()`.
2025-03-14test: do not dedent() in feed() (#32884)zeertzjq1
Most callers of feed() do not expect feed() to dedent. Now use a literal space in tests where it looks better.
2025-03-02test: simplify ASAN detectiondundargoc1
2025-02-26feat(lua): vim.text.indent()Justin M. Keyes1
Problem: Indenting text is a common task in plugins/scripts for presentation/formatting, yet vim has no way of doing it (especially "dedent", and especially non-buffer text). Solution: Introduce `vim.text.indent()`. It sets the *exact* indentation because that's a more difficult (and thus more useful) task than merely "increasing the current indent" (which is somewhat easy with a `gsub()` one-liner).
2025-02-11refactor(tests): drop os_kill #32401Justin M. Keyes1
Also change job tests to use `nvim` instead of random programs like `ping`.
2025-02-10feat(ui): UI :detach commandJustin M. Keyes1
Problem: Cannot detach the current UI. Solution: - Introduce `:detach`. - Introduce `Channel.detach`. Co-authored-by: bfredl <bjorn.linse@gmail.com>
2025-01-04refactor(tests): merge n.spawn/n.spawn_argv into n.new_session #31859Justin M. Keyes1
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.
2025-01-04test: use spawn_wait() instead of system() #31852Justin M. Keyes1
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.
2025-01-03test: include stderr in EOF failure messageJustin M. Keyes1
2025-01-03test: spawn_wait() starts a non-RPC Nvim processJustin M. Keyes1
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...
2024-12-24feat(test): support and document lua test case debuggingMathias Fussenegger1
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.
2024-11-21test: move exec_lua logic to separate moduleLewis Russell1
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.
2024-11-06fix(test): better management of tmpfilesLewis Russell1
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.
2024-09-22feat(fs.lua): add vim.fs.rm()Lewis Russell1
Analogous to the shell `rm` command.
2024-09-21test: support upvalues in exec_luaLewis Russell1
2024-09-18feat(tui): builtin UI (TUI) sets client info #30397Justin M. Keyes1
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.
2024-09-15refactor(tests): rename terminal/testutil.lua => testterm.lua #30372Justin M. Keyes1
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/`.
2024-09-09refactor(test): rename alter_slashes, invert its behaviorJustin M. Keyes1
- `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.
2024-09-08fix(startup): server fails if $NVIM_APPNAME is relative dir #30310Justin M. Keyes1
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
2024-07-31fix(scrollbind): properly take filler/virtual lines into accountLewis Russell1
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
2024-06-12Merge pull request #29103 from gpanders/test-no-tgcGregory Anders1
test: do not set termguicolors in test runner
2024-06-04refactor(lua): use tuple syntax everywhere #29111Ilia Choly1
2024-05-31test: do not set termguicolors in test runnerGregory Anders1
It's not clear why this is needed and it has adverse side effects on other tests.
2024-05-16fix(test): failure after version bump #28771Justin M. Keyes1
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.
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.