aboutsummaryrefslogtreecommitdiff
path: root/test/functional/vimscript/let_spec.lua
Commit message (Collapse)AuthorAge
* refactor(option): simplify error buffer handlingLewis Russell2026-09-21
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Option validators and setters repeatedly pass error buffers and their sizes separately. Some setters return messages in static storage. Solution: - Add CharBuf for borrowed writable storage, with its length including space for a terminating NUL. - Move option error buffers to the callers that report errors. Preserve existing buffer sizes, truncation, and calls that do not need a message. - Consolidate option error formatting and the duplicated code that lists valid option values. - Return error messages directly from do_one_set_option(). - Remove unused arguments from get_option_newval() and set_option_value_for(). - Handle legacy TTY assignments in the existing callers and remove the redundant compatibility wrapper. - Reuse CharBuf for Tree-sitter query errors. - Pass CharBuf through the statusline and statuscolumn builders, retaining the buffer sizes provided by their callers, including title formatting. AI-assisted
* fix(options): crash on ":let &l:autoread = v:true" #41158Justin M. Keyes2026-08-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Assigning to the local value of a global-local boolean option ('autoread', 'autocomplete', 'fsync') aborts: Assertion failed: (curval.type == newval.type), function ex_let_option, file vars.c, line 1408. ex_let_one ex_let_vars ex_let execute_cmd0 do_cmdline call_user_func ... eval_map_expr vgetorpeek vgetc state_enter main A global-local option may have local value `kObjectTypeUnset`, but `ex_let_option()` guards only `kObjectTypeNil`. Solution: When curval is Unset, resolve it to the inherited global value.
* fix(options): crash on ":let &t_Co = v:true" #41152Justin M. Keyes2026-08-04
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Assigning a Boolean or special value (v:true/v:false/v:null/v:none) to a TTY option aborts: Assertion failed: (curval.type == newval.type), function ex_let_option, file vars.c, line 1408. 3 libsystem_c.dylib __assert_rtn + 284 4 nvim ex_let_one + 3308 5 nvim ex_let_vars + 112 6 nvim ex_let + 2356 7 nvim execute_cmd0 + 252 8 nvim do_cmdline + 9076 9 nvim call_user_func + 3320 10 nvim call_func + 2076 11 nvim get_func_tv + 696 12 nvim eval_func + 380 20 nvim eval_to_string_eap + 276 21 nvim eval_map_expr + 444 22 nvim vgetorpeek + 3172 23 nvim vgetc + 764 Solution: Apply the string-type check to TTY options too, so a Boolean/special value gives "E928: String required" instead of aborting. Valid string/number assignments to `t_*` pseudo-options still silently no-op.
* 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: 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: typing for helpers.methsLewis Russell2024-01-12
|
* refactor: format test/*Justin M. Keyes2024-01-03
|
* fix(:let): fix error when applying operator to boolean option (#24030)zeertzjq2023-06-15
|
* test(let_spec): increase expect_exit() timeoutzeertzjq2022-08-05
| | | Test ":unlet self-referencing node in a List graph #6070" feeds many characters into typeahead, so a timeout of only 100 milliseconds sometimes fails. Change that timeout to 1000 milliseconds.
* test: deal with RPC call causing Nvim to exit laterzeertzjq2022-07-19
|
* fix(ex_cmds): correct flags for :const (#19387)zeertzjq2022-07-16
|
* refactor(tests): introduce testprg()Justin M. Keyes2022-06-25
| | | | | | Also: - Add a describe('shell :!') section to system_spec. - Make the test for #16271 work on systems without powershell.
* feat(logging): include test-id in log messagesJustin M. Keyes2022-06-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: 1. Log messages (especially in CI) are hard to correlate with tests. 2. Since b353a5c05f02 #11886, dumplog() prints the logs next to test failures. This is noisy and gets in the way of the test results. Solution: 1. Associate an incrementing id with each test and include it in log messages. - FUTURE: add v:name so Nvim instances can be formally "named"? 2. Mention "child" in log messages if the current Nvim is a child (based on the presence of $NVIM). BEFORE: DBG … 12345 UI: event DBG … 12345 log_server_msg:722: RPC ->ch 1: … DBG … 12345 UI: flush DBG … 12345 inbuf_poll:444: blocking... events_enabled=1 events_pending=0 DBG … 23454 UI: stop INF … 23454 os_exit:594: Nvim exit: 0 AFTER: DBG … T57 UI: event DBG … T57 log_server_msg:722: RPC ->ch 1: … DBG … T57 UI: flush DBG … T57 inbuf_poll:444: blocking... events_enabled=1 events_pending=0 DBG … T57/child UI: stop INF … T57/child os_exit:594: Nvim exit: 0
* refactor(tests): remove redir_exec #15718Justin M. Keyes2021-09-19
| | | | | | | | | | | Problem - `redir_exec` is obsolete, but it keeps getting used in new tests because people copy existing tests. - Disadvantages of `redir_exec`: - Captures extra junk before the actual error/message that we _want_ to test. - Does not fail on error, unlike e.g. `command()`. Solution - Use new functions like `nvim_exec` and `pcall_err`.
* 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