aboutsummaryrefslogtreecommitdiff
path: root/test/functional/autocmd/tabclose_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`.
* fix(window): use real last buffer of closed windowSean Dewar2026-02-08
| | | | | | | | | | | | | | | | Problem: close_buffer autocmds may switch buffers at the last moment when closing a window, causing terminal_check_size to prefer the size of a closed window, or TabClosed to set an old <abuf>. Solution: use the actual last buffer, similar to what TabClosed did before. NOTE: If buffer was unloaded/deleted (not wiped), then TabClosed's <abuf> may not use it. (w_buffer = NULL) Maybe odd, but it's how it worked before anyhow. Relies on close_buffer reliably setting w_buffer to NULL if freed, otherwise buf_valid is better. Only concern I see is if the window wasn't in the window list after closing the buffer (close_buffer won't set it to NULL then), but then win_close{_othertab} should've returned earlier.
* fix(autocmd): potential TabClosed UAF, always set abufSean Dewar2026-02-08
| | | | | | | | | | | | | | | Problem: win_free_mem can free w_buffer (via qf_free_all), which may cause a heap use-after-free if used as TabClosed's <abuf>. I think TabClosed is also the only event to conditionally set <abuf> not based on event type. Solution: use the buffer saved by the bufref. Fall back to curbuf if invalid, like WinResized/WinScrolled. NOTE: Not always equivalent if close_buffer autocmds switch buffers at the last moment; previously <abuf> would be set to that buffer. Fixed in next commit. https://github.com/neovim/neovim/actions/runs/21765657455/job/62800643599?pr=37758#step:9:159 for an example of qf_free_all being a nuisance.
* test(tabclose): remove deprecated calls, use testnvim helpersSean Dewar2025-07-22
|
* fix(autocmd): fire TabClosed after freeing tab pageSean Dewar2025-07-22
| | | | | | | | | | | | | Problem: TabClosed is fired after close_buffer is called (after b_nwindows is decremented) and after the tab page is removed from the list, but before it's freed. This causes inconsistencies such as the removed tabpage having a valid handle and functions like nvim_tabpage_get_number returning nonsense. Solution: fire it after free_tabpage. Try to maintain the Nvim-specific behaviour of setting `<amatch>` to the old tab page number, and the (undocumented) behaviour of setting `<abuf>` to the buffer it was showing (close_buffer sets w_buffer to NULL if it was freed, so it should be OK pass it to apply_autocmds_group, similar to before).
* 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: rename (meths, funcs) -> (api, fn)Lewis Russell2024-01-12
|
* test: normalise nvim bridge functionsLewis Russell2024-01-12
| | | | | - remove helpers.cur*meths - remove helpers.nvim
* refactor: format test/*Justin M. Keyes2024-01-03
|
* API: deprecate nvim_command_outputJustin M. Keyes2019-12-02
|
* api: change nvim_command_output behaviorJustin M. Keyes2018-01-10
| | | | | | | | | | | | | | | | | | | Implement nvim_command_output with `execute({cmd},"silent")`. Behavior changes: - does not provoke any hit-enter prompt - no longer prepends a newline char - does not capture some noise (like the "[New File]" message, see the change to tabnewentered_spec.lua) Technically ("bug-for-bug") this a breaking change. But the previous behavior of nvim_command_output meant that it probably wasn't used for anything outside of tests. Also remove the undocumented `v:command_output` variable which was a hack introduced only for the purposes of nvim_command_output. closes #7726
* Merge #7782 'Fix TabClose autocommand via close_windows'Justin M. Keyes2017-12-30
|\
| * Move applying of TabClosed to win_close_othertabDaniel Hahler2017-12-29
|/
* build: Target luacheck HEAD.Justin M. Keyes2016-11-17
| | | | | | | | | | | | https://github.com/mpeterv/luacheck/pull/81#issuecomment-261099606 > If you really want to use bleeding-edge version you should get the > rockspec from master branch, not a fixed commit ... > The correct way to install from a specific commit is cloning that > commit and running "luarocks make" from project directory. The reason > is that running "install" or "build" on an scm rockspec fetches > sources from master but uses build description from the rockspec > itself, which may be outdated.
* functests: Check logs in lua codeZyX2016-06-10
| | | | | | It is otherwise impossible to determine which test failed sanitizer/valgrind check. test/functional/helpers.lua module return was changed so that tests which do not provide after_each function to get new check will automatically fail.
* test/functional: clean up according to luacheck (part 2)Marco Hinz2015-11-23
|
* Add TabClosed eventFelipe Morales2015-02-16
TabClosed is triggered when a tab page closes.