aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/overrides_spec.lua
Commit message (Collapse)AuthorAge
* fix(strings): non fatal errors for [NULL] safety in vim_snprintfbfredl2026-09-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | context: vim_snprintf provides a "portable" replacement for a system vsnprintf(). However we rely on system vsnprintf() in places. This is quite arbitrary. I want to use system vsnprintf() only, and reduce the machinery in string.c for typval printf only, which will delet a lot of duplicated code. The biggest hurdle here is not "portably" (we only support sane c runtimes) but the following discrepancy: standard libc printf() considers NULL args to %s to be undefined behavior strictly while vim_snprintf() _defacto_ allows this by replacement to "[NULL]" IMO, this should be seen as "graceful" error handling (nicer than crashing on the user), not a valid means to have the string "[NULL]" intentionally be shoved in the users face. more robust code should explicitly check for NULL and replace it with a _appropriate_ fallback for the situation, depending on what a NULL string actually means in the context (unnamed buffer? anonymous namespace? global augroup?) soo, this PR provides the most _gently_ incremental nudge towards considering this case again as an error one could possible imagine. If sanitizers are complied in, this minor incursion gets printed into the sanitizers' log as a "report-and-continue" error with a traceback. This doesn't annoy the end user or "stop the world" in the test suite, but the CI will see the reported error and fail the build, just like other non-fatal CI errors.
* fix(lua): blast radius of broken `_G.debug` #41507Justin M. Keyes2026-08-27
| | | | | | | | | | | | | | | | | | | | | | | | Problem: `nlua_pcall()` references `_G.debug.traceback`. If user code deletes it or breaks it some other way, various Lua features are broken. _G.debug = nil vim.schedule(function() end) vim.wait(100) E5113: Lua chunk: attempt to index a nil value stack traceback: [C]: in function 'loop_poll' [string "vim/_core/editor"]:176: in function 'wait' crash.lua:3: in main chunk PANIC: unprotected error in call to Lua API (attempt to index a nil value) Solution: Check `_G.debug.traceback` before using it as errfunc. If it's broken, omit the traceback and say so in the error message. Note: We could cache `_G.debug` in LUA_REGISTRYINDEX on startup, but that would prevent plugins from providing custom functionality there (and we happen to do so in `tui_spec.lua` for example).
* 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(tests): use builtin default attributes in more placesbfredl2026-06-19
|
* fix(lua): use even safer and even better error() message conversionbfredl2026-05-25
| | | | | | | | | | | | problem: this crashes neovim: ondska = setmetatable({}, {__tostring = error}) error(ondska) solution: make it not crash neovim
* feat(messages): cleanup Lua error messagesJustin M. Keyes2025-05-04
| | | | | "Error" in error messages is redundant. Just provide the context, don't say "Error ...".
* 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: support upvalues in exec_luaLewis Russell2024-09-21
|
* 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.
* fix(test): typingLewis Russell2024-03-25
|
* 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: typing for helpers.methsLewis Russell2024-01-12
|
* test: do not inject vim module into global helpersLewis Russell2024-01-12
|
* refactor: format test/*Justin M. Keyes2024-01-03
|
* test: avoid repeated screen lines in expected stateszeertzjq2023-12-09
| | | | | | This is the command invoked repeatedly to make the changes: :%s/^\(.*\)|\%(\*\(\d\+\)\)\?$\n\1|\%(\*\(\d\+\)\)\?$/\=submatch(1)..'|*'..(max([str2nr(submatch(2)),1])+max([str2nr(submatch(3)),1]))/g
* feat(treesitter): improve query error messageAmaan Qureshi2023-08-31
|
* fix(api, lua): make blank lines in a message work properly (#24244)zeertzjq2023-07-04
|
* feat(lua): rename vim.loop -> vim.uv (#22846)Lewis Russell2023-06-03
|
* refactor(options): deprecate nvim[_buf|_win]_[gs]et_optionLewis Russell2023-05-21
| | | | | Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: famiu <famiuhaque@protonmail.com>
* feat(lua): make sure require'bit' always works, even with PUC lua 5.1bfredl2023-02-22
|
* 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")`.
* fix(tests): remove irrelevant usage of display-=msgsepbfredl2022-08-17
| | | | | | | | These were just added to avoid churn when changing the default of 'display'. To simplify message handling logic, we might want to remove support for printing messages in default_grid later on. This would allow things like printing error messages safely in the middle of redraw, or a future graduation of the 'multigrid' feature.
* feat: call __tostring on lua errors if possible before reporting to userOliver Marriott2022-02-25
|
* feat(lua): enable stack traces in error output (#16228)Gregory Anders2021-11-06
|
* 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`.
* fixup! startup: handle autoload and lua packages during startupJan Edmund Lazo2020-11-02
|
* startup: handle autoload and lua packages during startupBjörn Linse2020-11-02
| | | | ¡NO HAY BANDA!
* API: rename nvim_execute_lua => nvim_exec_luaJustin M. Keyes2019-12-02
| | | | | | - We already find ourselves renaming nvim_execute_lua in tests and scripts, which suggests "exec" is the verb we actually want. - Add "exec" verb to `:help dev-api`.
* Add v:lua.func() vimL syntax for calling luaBjörn Linse2019-11-16
| | | | Also simplify error messages when calling lua from vimL.
* lua: do not crash on syntax error in debug.debug()Björn Linse2019-08-05
|
* lua: immediate-callback safe print()Björn Linse2019-08-05
|
* Merge #9686 'win/Lua: monkey-patch os.getenv()'Justin M. Keyes2019-03-16
|\ | | | | | | fixes #9681
| * Fix os.getenv of lua on Windowserw72019-03-07
|/ | | | | Change to use os_getenv instead of getenv because environment variable set by uv_os_setenv can not be get with getenv.
* msg: do not scroll entire screen (#8088)Björn Linse2018-03-31
|
* lua/executor: Fix crash when printing empty string (#7157)Nikolai Aleksandrovich Pavlov2017-08-13
|
* lua: Use automatic determining of suffixes only for package.cpathZyX2017-05-28
|
* lua: Add paths from &runtimepath to package.path and package.cpathZyX2017-05-25
|
* eval,functests: Fix linter errorsZyX2017-03-27
|
* functests: Add test for debug.debugZyX2017-03-27
|
* executor,functests: Add print() tests, some fixesZyX2017-03-27