Commit Graph

11 Commits

Author SHA1 Message Date
Lewis Russell
47f2769b46 fix(Man): completion on Mac
Problem:
`man -w` does not work on recent versions of MacOs.

Solution:
Make it so an empty result is interpreted as an error unless silent=true
2024-12-16 16:05:08 +00:00
Lewis Russell
f7e32fb6e6 fix(test): better management of tmpfiles
Problem:

When tmpdir is local. The returned values from tmpname may already
exist. This can cause problems for tests which pass `create=false` as
they may require the file to not exist yet.

Solution:

When creating tmp names, always remove it to ensure it doesn't exist,
and optionally open it if `create~=false`

Additionally refactor the tmpname code and flattrn some functions into
constants.

Also while debugging this issue. It was discovered that `exec_lua()`
doesn't report error messages properly. This has been fixed.
2024-11-06 11:37:33 +00:00
Justin M. Keyes
47e6b2233f
fix(vim.fs): dirname() returns "." on mingw/msys2 #30480
Problem:
`vim.fs.dirname([[C:\User\XXX\AppData\Local]])` returns "." on
mingw/msys2.

Solution:
- Check for "mingw" when deciding `iswin`.
- Use `has("win32")` where possible, it works in "fast" contexts since
  b02eeb6a72.
2024-09-23 06:05:58 -07:00
Justin M. Keyes
ed832b9ddf refactor(test): rename alter_slashes, invert its behavior
- `alter_slashes` belongs in `testutil.lua`, not `testnvim.lua`.
- `alter_slashes` is an unusual name. Rename it to `fix_slashes`.
- invert its behavior, to emphasize that `/` slashes are the preferred,
  pervasive convention, not `\` slashes.
2024-09-09 12:23:54 +02:00
Justin M. Keyes
8a2aec9974
fix(startup): server fails if $NVIM_APPNAME is relative dir #30310
Problem:
If $NVIM_APPNAME is a relative dir path, Nvim fails to start its
primary/default server, and `v:servername` is empty.
Root cause is d34c64e342, but this wasn't
noticed until 96128a5076 started reporting the error more loudly.

Solution:
- `server_address_new`: replace slashes "/" in the appname before using
  it as a servername.
- `vim_mktempdir`: always prefer the system-wide top-level "nvim.user/"
  directory. That isn't intended to be specific to NVIM_APPNAME; rather,
  each *subdirectory* ("nvim.user/xxx") is owned by each Nvim instance.
  Nvim "apps" can be identified by the server socket(s) stored in those
  per-Nvim subdirs.

fix #30256
2024-09-08 12:48:32 -07:00
Justin M. Keyes
975aeee537
test: avoid noise in CI logs #30264
Problem:
Since 96128a5076 the test logs have noise from tests that *expect*
failures:

    $NVIM_LOG_FILE: /tmp/cirrus-ci-build/build/.nvimlog
    (last 100 lines)
    ERR 2024-09-04T13:38:45.181 T949.28335.0/c terminfo_start:486: uv_pipe_open failed: no such device or address
    ERR 2024-09-04T13:38:45.181 T949.28335.0/c flush_buf:2527: uv_write failed: bad file descriptor
    ERR 2024-09-04T13:38:45.181 T949.28335.0/c flush_buf:2527: uv_write failed: bad file descriptor
    WRN 2024-09-04T13:43:43.294 ?.35904    server_start:173: Failed to start server: address already in use: /…/Xtest_tmpdir/…/T7159.35895.0
    WRN 2024-09-04T13:43:43.314 ?.35907    server_start:173: Failed to start server: illegal operation on a directory: /
    ERR 2024-09-04T13:43:43.332 ?.35909    socket_watcher_init:60: Host lookup failed: https://example.com

Solution:
Rewrite the test to use `vim.system()`. Set NVIM_LOG_FILE in the child
process to a "throwaway" logfile.
2024-09-05 02:39:58 -07:00
Justin M. Keyes
ea2d949351
test: tmpname(create:boolean) #30242
Problem:
137f98cf64 added the `create` parameter to `tmpname()` but didn't
fully implement it.

Solution:
- Update impl for the `os.tmpname()` codepath.
- Inspect all usages of `tmpname()`, update various tests.
2024-09-03 02:18:17 -07:00
Justin M. Keyes
137f98cf64 test: tmpname() can skip file creation 2024-09-02 20:19:50 +02:00
dundargoc
052498ed42 test: improve test conventions
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.
2024-04-23 18:17:04 +02:00
Justin M. Keyes
8886b1807c
refactor(lua): "module" => "M" #28426
Most of the codebase uses the `M` convention for Lua module.
Update the last remaining cases.
2024-04-20 09:06:49 -07:00
dundargoc
7035125b2b test: improve test conventions
Work on https://github.com/neovim/neovim/issues/27004.
2024-04-08 22:51:00 +02:00