aboutsummaryrefslogtreecommitdiff
path: root/test/functional/core/channels_spec.lua
Commit message (Collapse)AuthorAge
* test(harness): migrate away from magic globalsJustin M. Keyes2026-07-21
| | | | | | | | | | | | | | | | | | | | | Problem: The magic globals `it`, `describe`, etc., are more trouble than they are worth. - Hooking into `after_each` requires `getfenv()` hacks. - They confuse luals/emmylua, because the top-level `.luarc.json` isn't merged with `test/.luarc.json` (apparently a luals limitation?) - They totally defeat discoverability because the user just has to "know" about the various magic symbols. So they harm DX, which means they serve no purpose at all. Solution: - Expose the test API from `testutil`, so tests can call `t.it()`, `t.describe()`, etc., in the conventional way. - Drop `getfenv()` hacks. - Drop the `setfenv()` injection in `load_chunk`. - Drop `test/_meta.lua`.
* feat(channel): add ChanClose event #40568Barrett Ruth2026-07-04
| | | | | | | | | Problem: Plugins using RPC sockets cannot detect when the peer closes a `sockconnect()` channel, so reconnect logic has no reliable trigger. Solution: Add a `ChanClose` event with channel info before the channel is removed, matching the existing `ChanOpen`/`ChanInfo` event model.
* test(windows): unskip some channel/job tests #38515Justin M. Keyes2026-06-12
|
* fix(channel): stack-buffer-overflow with exit during connection (#39387)zeertzjq2026-04-25
| | | | | | Problem: When Nvim exits while connecting to a socket it leads to stack-buffer-overflow. Solution: Associate the handle with the Stream and use the Stream's internal_close_cb to update the "closed" status.
* refactor: update usages of deprecated "buffer" param #39089Justin M. Keyes2026-04-15
|
* test(core/channels_spec): fix flaky test (#38025)zeertzjq2026-02-23
| | | | | If the last nvim_eval arrives on RPC channel before rpc_close_event() is processed, it will be scheduled immediately after rpc_close_event() and before free_channel_event(), causing the test to fail.
* fix(channel): possible hang after connecting with TCP times out (#37813)zeertzjq2026-02-11
| | | | Problem: Possible hang after connecting with TCP times out. Solution: Wait for the close callback to arrive.
* fix(channel): crash on failed sockconnect() (#37811)zeertzjq2026-02-11
| | | | | | | Problem: Crash on failed sockconnect() if a new connection is accepted while polling for uv events. Solution: Don't use channel_destroy_early(). Also test "tcp" mode failure properly.
* ci(test): bump Windows runners to windows-2025 and unskip tests (#37666)zeertzjq2026-02-03
| | | | Bumping to windows-2025 seems to fix at least one case of spaces having wrong attributes in TUI tests, which allow unskipping dozens of tests.
* test: fix flaky tests (#37478)zeertzjq2026-01-21
| | | | | | | | | | | * test(core/channels_spec): fix flaky test Always use expect_stdout() to check PTY output. * test(autocmd/termxx_spec): fix flaky test Usually the Ctrl-C cancels the following :qa!, but sometimes it doesn't, and Nvim exits before feed() returns. Instead make sure that :qa! always reaches Nvim and use expect_exit().
* fix(msgpack): use fixstr encoding for strings of length 20-31 #36737benarcher26912025-12-01
| | | | | | | | | | | | | | | | | Problem: MessagePack fixstr format supports string lengths 0-31, but mpack_str() only used fixstr for lengths < 20. Strings of 20-31 bytes were incorrectly encoded as str8 (2-byte header) instead of fixstr (1-byte header). Solution: Change the condition from `len < 20` to `len < 32` to match the MessagePack specification. This fix affects message timing which exposed a pre-existing race condition in the channels_spec PTY test. The test now uses a helper function to accumulate partial PTY reads, making it more robust. Fixes #32784
* fix(socket): avoid stack-use-after-return after timeout (#36405)zeertzjq2025-11-01
| | | | | | | | | | | | | | | | | | | Problem: In socket_connect(), if connecting to the given TCP address times out, libuv is still trying to connect to the address, and connect_cb may be called when running the libuv event loop after the `status` variable referenced by `req.data` goes out of scope. Solution: Close the uv_tcp_t handle and wait for connect_cb to be called before retrying or failing in socket_connect(). This also avoid leaking libuv handles. The tests added here only check that the non-timeout case still works, as checking the timeout case is very hard without modifications to the code. Removing the first LOOP_PROCESS_EVENT_UNTIL() in socket_connect() (the one with the timeout) is a way to check that manually. Also add a comment about the cause of the ASAN error in #34586.
* fix(events): always allow some events to be nested (#32706)zeertzjq2025-03-08
| | | | | | | | | | | | | | | Always allow the following four events to be nested, as they may contain important information, and are triggered on the event loop, which may be processed by a blocking call inside another autocommand. - ChanInfo - ChanOpen - TermRequest - TermResponse There are some other events that are triggered on the event loop, but they are mostly triggered by user actions in a UI client, and therefore not very likely to happen during another autocommand, so leave them unchanged for now.
* 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.
* fix(channel): handle writing to file instead of pipe (#30519)zeertzjq2024-09-26
|
* 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.
* test: use matches(...) instead of ok(string.find(...)) (#28111)zeertzjq2024-03-30
|
* test(core/channel_spec): fix lint failurezeertzjq2024-01-22
|
* test(core/channels_spec): fix variable namezeertzjq2024-01-22
|
* fix(rpc): assertion failure due to invalid msgpack inputnwounkn2024-01-21
| | | | | | | | | Problem: rbuffer_consumed assertion fails if Unpacker fails to parse msgpack, because it doesn't consume bytes on errors Solution: Call rbuffer_consumed_compact only if Unpacker isn't closed
* test: rename (meths, funcs) -> (api, fn)Lewis Russell2024-01-12
|
* test: typing for helpers.methsLewis Russell2024-01-12
|
* test: remove helpers.sleep()Lewis Russell2024-01-12
|
* refactor: format test/*Justin M. Keyes2024-01-03
|
* test: re-bundle cat on windows (#21255)dundargoc2023-03-14
| | | | | | | | | | The builtin cat was removed in 4bc9229ecbec514e9a87cfc4be88ea27a971e9a1 as it is not used during runtime but only for tests. However, it is a very small and useful utility program that we need for a lot of our tests, so there's no harm in bundling it, and it helps us avoid complicating our build system by having two versions of neovim (neovim for users and neovim for testing). Also skip tests if "grep" or "sleep" isn't available.
* test: simplify platform detection (#21020)dundargoc2022-11-22
| | | | | Extend the capabilities of is_os to detect more platforms such as freebsd and openbsd. Also remove `iswin()` helper function as it can be replaced by `is_os("win")`.
* test: introduce skip() #21010dundargoc2022-11-13
| | | | | | | This is essentially a convenience wrapper around the `pending()` function, similar to `skip_fragile()` but more general-purpose. Also remove `pending_win32` function as it can be replaced by `skip(iswin())`.
* fix(channel): fix channel consistencyerw72022-03-12
| | | | | | | - Fix the problem that chanclose() does not work for channel created by nvim_open_term(). - Fix the problem that the loopback channel is not released. - Fix the error message when sending raw data to the loopback channel.
* feat(--headless): add on_print callback to stdioopenglacambre2022-01-24
| | | | | | | This commit adds an on_print callback to stdioopen's dictionary argument which lets the caller specify a function called each time neovim will try to output something to stdout (e.g. on "echo" or "echoerr" in --headless mode).
* test: fix running functional tests under gdbserverShreyansh Chouhan2021-09-20
| | | | | | | | | | | It was not possible to run the tests under the gdbserver because we were not closing the old session before starting a new one. This caused the server to not to be able to bind to the given address and crashing the tests. This commit closes the session before starting a new one. Signed-off-by: Shreyansh Chouhan <chouhan.shreyansh2702@gmail.com>
* feat(f_chansend): support Blob data argumentSean Dewar2021-09-16
|
* test: is_os() #10933Justin M. Keyes2019-09-04
| | | | | - Move os_name() up to "global helpers". - Rename it to is_os(). - Make it depend on uname() instead of a running Nvim instance.
* test/uname(): always lowercaseJustin M. Keyes2019-09-01
|
* CI/OpenBSD: run functional testsEdd Barrett2019-09-01
| | | | | | | | | | | Adapt some tests for OpenBSD: - scrollback_spec: - seq(1) is not available on OpenBSD: we'd use jot(1). - Instead use a (hopefully) portable awk(1) snippet. - channels_spec - job_spec - tui_spec
* test: remove use of require('test.helpers')Justin M. Keyes2019-05-18
| | | | | | The test.functional.helpers and test.unit.helpers modules now include all of the public functions from test.helpers, so there is no need to separately require('test.helpers').
* test/channels_spec: cleanupJustin M. Keyes2019-05-12
| | | | | - Remove stray print() - Use uname() instead of system('uname')
* functionaltest: enable buffered output testsJan Edmund Lazo2018-10-31
|
* test: rename next_message() to next_msg()Justin M. Keyes2018-03-11
|
* channel: check for existance before trying to set keyBjörn Linse2017-12-23
| | | | This avoids an error message in async context, where it is not safe.
* tests: mark flaky socket test pending for nowBjörn Linse2017-11-27
|
* channels: testsBjörn Linse2017-11-26