aboutsummaryrefslogtreecommitdiff
path: root/test/functional/editor/put_spec.lua
Commit message (Collapse)AuthorAge
* feat(editor): undo restores cursor position #41520Justin M. Keyes2026-08-27
| | | | | | | | | | | | | | | | | | Problem: Undo places the cursor wherever the cursor happened to sit at "save time" (`uh_cursor` is sampled lazily on the first change). Examples: - `i` preserves, but `a` does not - `diw`, `atest<Esc>`, `d^` abandon the original position - `D`, `o` restore it (by accident). Solution: `composite` tracks the pending atom (and its `origin`) across frames. A `stuffed` continuation frame inherits the `origin` + prepped redo. Store `origin` info in the undo header, so undo can restore it. - Not for a mid-command undo break (i_CTRL-G_u). - Undoing a mapping restores where the mapping started (which technically may be different than where the "edit" started).
* 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`.
* test: unreliable "put command . register special … ring the bell" #40812Justin M. Keyes2026-07-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: FAILED …/put_spec.lua:894: …/put_spec.lua @ 898: put command . register special tests should ring the bell when deleting if not appropriate …/put_spec.lua:894: …/put_spec.lua:898: Bell was not rung after action Snapshot: screen:expect([[ ^ine of words 1 | Line of words 2 | {1:~ }|*4 {3:[No Name] [+] }| | {1:~ }|*4 {UNKNOWN_HL_ID(4):[No Name] }| {UNKNOWN_HL_ID(1): }| ]]) stack traceback: …/ui/screen.lua:917: in function '_wait' …/ui/screen.lua:540: in function 'expect' …/editor/put_spec.lua:894: in function 'bell_test' …/editor/put_spec.lua:940: in function <…/editor/put_spec.lua:932> Analysis: The bell was asserted via the UI 'bell' event (screen.bell), but vim_beep() rate-limits that to 3 per 500ms. These tests share one long-lived session, so beeps from earlier tests could exhaust the window and drop the asserted beep. Solution: Use assert_beeps()/assert_nobeep(), which check called_vim_beep (set before the rate-limit gate).
* fix(test): screen:expect() render crash masks the real failure #40593Justin M. Keyes2026-07-05
| | | | | | | | | | | | | | | | | | | | | | Problem: When screen:expect() fails, it renders a snapshot for the error message. If the grid references a highlight id that was never defined via "hl_attr_define", the renderer crashes: screen.lua:1910: attempt to index local 'entry' (a nil value) This hides the actual failure, and appears "flaky": it only fires on the failure path, and only when the shared screen is missing an id the grid still references. A screen created in setup() attaches mid-session, so highlight ids allocated before it attached (still referenced by stale grid cells) are never sent to it. Solution: - Don't crash while rendering a diagnostic: show undefined highlight ids as "UNKNOWN_HL_ID(n)", so the real failure and the desync are legible. - put_spec: fix `visualbell` typo. If it fails again then we can find the actual root cause. ref https://github.com/neovim/neovim/issues/36250
* refactor(test): deprecates functions in some tests #36972glepnir2025-12-15
| | | | | | | | | | Problem: feed_command, nvim_buf_set_option, nvim_buf_get_number, and exc_exec are marked as deprecated. Solution: Remove them from the test units in api/buffer_spec, autocmd/focus_spec, ui/input_spec, and editor/put_spec. Some test units only used a few deprecated functions, so creating a separate PR for each would be excessive. Therefore, several were combined into a single PR.
* feat(ui): UI :detach commandJustin M. Keyes2025-02-10
| | | | | | | | | | | Problem: Cannot detach the current UI. Solution: - Introduce `:detach`. - Introduce `Channel.detach`. Co-authored-by: bfredl <bjorn.linse@gmail.com>
* 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: 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
* test: do not inject vim module into global helpersLewis Russell2024-01-12
|
* refactor: format test/*Justin M. Keyes2024-01-03
|
* test: fix dependencies between test cases (#23343)zeertzjq2023-04-27
| | | Discovered using --shuffle argument of busted.
* test: improve editor/fold_spec.lua and editor/put_spec.lua (#22916)zeertzjq2023-04-07
| | | | | - Close and open a new window each time so that window options have their default values in each test. - Change feed_command() to command() as the latter is faster.
* perf(ui): eliminate spurious memory allocations for hl_attr_define eventbfredl2022-07-18
|
* chore: fix typos (#17331)dundargoc2022-03-10
| | | | | | Co-authored-by: Hongyi Lyu <hongyi.lyu95@gmail.com> Co-authored-by: Gregory Anders <greg@gpanders.com> Co-authored-by: notomo <notomo.motono@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* vim-patch:8.2.4242: put in Visual mode cannot be repeatedzeertzjq2022-02-09
| | | | | | | | | | Problem: Put in Visual mode cannot be repeated. Solution: Use "P" to put without yanking the deleted text into the unnamed register. (Shougo Matsushita, closes vim/vim#9591) https://github.com/vim/vim/commit/fb55207ed17918c8a2a6cadf5ad9d5fcf686a7ab Cherry-pick get_y_previous() and set_y_previous() from patch 8.1.1736. Nvim has removed y_current, so code related to it is N/A.
* test(put_spec): correctly order parameters to eq() (#17134)zeertzjq2022-01-19
| | | | The first parameter to eq() should be the expected value, and the second parameter should be the actual value.
* test: reorg #15698Justin M. Keyes2021-09-17
Problem: Subdirectories like "visual", "insert", "normal" encourage people to separate *related* tests for no good reason. Typically the _mode_ is not the relevant topic of a test (and when it is, _then_ create an appropriate describe() or it()). Solution: - Delete the various `test/functional/<mode>/` subdirectories, move their tests to more meaningful topics. - Rename `…/normal/` to `…/editor/`. - Move or merge `…/visual/*` and `…/insert/*` tests into here where appropriate. - Rename `…/eval/` to `…/vimscript/`. - Move `…/viml/*` into here also. * test(reorg): insert/* => editor/mode_insert_spec.lua * test(reorg): cmdline/* => editor/mode_cmdline_spec.lua * test(reorg): eval core tests => eval_spec.lua