summaryrefslogtreecommitdiffstatshomepage
path: root/test/unit/os/fs_spec.lua
AgeCommit message (Collapse)AuthorFiles
2026-04-15test: replace busted with local harnessLewis Russell1
Replace the busted-based Lua test runner with a repo-local harness. The new harness runs spec files directly under `nvim -ll`, ships its own reporter and lightweight `luassert` shim, and keeps the helper/preload flow used by the functional and unit test suites. Keep the file boundary model shallow and busted-like by restoring `_G`, `package.loaded`, `package.preload`, `arg`, and the process environment between files, without carrying extra reset APIs or custom assertion machinery. Update the build and test entrypoints to use the new runner, add black-box coverage for the harness itself, and drop the bundled busted/luacheck dependency path. AI-assisted: Codex
2026-01-12docs: misc (#37281)zeertzjq1
Close #37289 Close #37348 Co-authored-by: Marc Jakobi <marc@jakobi.dev> Co-authored-by: Anton Kesy <anton@kesy.de>
2025-07-26fix(unittests): use -1ULL to mean UNSIGNED MATH.MAXbfredl1
2024-04-10refactor(test): inject after_each differentlyLewis Russell1
2024-04-08test: improve test conventionsdundargoc1
Work on https://github.com/neovim/neovim/issues/27004.
2024-01-12test: use vim.mpack and vim.uv directlyLewis Russell1
2024-01-12test: do not inject vim module into global helpersLewis Russell1
2023-12-19refactor: use `bool` to represent boolean valuesdundargoc1
2023-12-04build: enable lintlua for test/unit/ dir #26396Justin M. Keyes1
Problem: Not all Lua code is checked by stylua. Automating code-style is an important mechanism for reducing time spent on accidental (non-essential) complexity. Solution: - Enable lintlua for `test/unit/` directory. - TODO: only `test/functional/` remains unchecked. previous: 45fe4d11add933df76a2ea4bf52ce8904f4a778b previous: 517f0cc634b985057da5b95cf4ad659ee456a77e
2023-09-30refactor: reorganize option header files (#25437)zeertzjq1
- Move vimoption_T to option.h - option_defs.h is for option-related types - option_vars.h corresponds to Vim's option.h - option_defs.h and option_vars.h don't include each other
2023-04-16test(unit): add test for os_mkdir_recurse "created"zeertzjq1
2023-04-16vim-patch:9.0.0411: only created files can be cleaned up with one callzeertzjq1
Problem: Only created files can be cleaned up with one call. Solution: Add flags to mkdir() to delete with a deferred function. Expand the writefile() name to a full path to handle changing directory. https://github.com/vim/vim/commit/6f14da15ac900589f2f413d77898b9bff3b31ece vim-patch:8.2.3742: dec mouse test fails without gnome terminfo entry Problem: Dec mouse test fails without gnome terminfo entry. Solution: Check if there is a gnome entry. Also fix 'acd' test on MS-Windows. (Dominique Pellé, closes vim/vim#9282) https://github.com/vim/vim/commit/f589fd3e1047cdf90566b68aaf9a13389e54d26a Cherry-pick test_autochdir.vim changes from patch 9.0.0313. Cherry-pick test_autocmd.vim changes from patch 9.0.0323. Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-04-04test: replace lfs with luv and vim.fsdundargoc1
test: replace lfs with luv luv already pretty much does everything lfs does, so this duplication of dependencies isn't needed.
2022-12-22test(unit): use file:close() properly (#21505)zeertzjq1
2022-01-04chore: fix typos (#16816)dundargoc1
Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com> Co-authored-by: Gregory Anders <greg@gpanders.com> Co-authored-by: Sebastian Volland <seb@baunz.net> Co-authored-by: Lewis Russell <lewis6991@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2019-09-17tests: improve error message with literat "~" directory (#11032)Daniel Hahler1
2019-07-28build/tests: remove pre/uv.h #10531Daniel Hahler1
Initially done in 28e59cb22, but does not appear to be necessary anymore. Uses UV_EEXIST directly, just like UV_ENOENT.
2019-06-01test: cleanup, reduce verbosityJustin M. Keyes1
2018-07-11test: Rename includes/pre/uv-errno.h to includes/pre/uv.hJames McCoy1
libuv users are only supposed to directly include uv.h. In v1.21.0, all the uv-*.h headers were renamed to uv/*.h, which caused the unit tests to fail with [123/125] Generating post/uv-errno.h FAILED: test/includes/post/uv-errno.h cd «SRCDIR»/src/neovim/build/test/includes && /usr/bin/clang -std=c99 -E -P «SRCDIR»/src/neovim/test/includes/pre/uv-errno.h -I/usr/include -I/usr/include -o «SRCDIR»/neovim/build/test/includes/post/uv-errno.h «SRCDIR»/src/neovim/test/includes/pre/uv-errno.h:1:10: error: 'uv-errno.h' file not found with <angled> include; use "quotes" instead #include <uv-errno.h> ^~~~~~~~~~~~ "uv-errno.h" The intention of the file is to extend libuv's error constants with more values used by the unit tests. This can just as easily be achieved without poking into pseudo-private header files.
2018-04-14Merge branch 'master' into s-dash-stdinb-r-o-c-k1
2018-03-24refactor/rename: path_is_absolute()Justin M. Keyes1
2017-12-03Merge branch 'master' into s-dash-stdinZyX1
2017-08-10os_stat: return ENOENT on NULL filename argJames McCoy1
Closes #4370 Explication: In the backtrace in #4370, we see that `buf_write()` was called with non-NULL `fname` and `sfname` arguments, but they've since _become_ NULL. #7 0x00000000004de09d in buf_write (buf=0x1dee040, fname=0x0, fname@entry=0x1e985b0 "/home/sean/src/github.com/snczl/virta/pkg/meld/segment.go", sfname=0x0, sfname@entry=0x1ddfa60 "segment.go", start=1, end=72, eap=eap@entry=0x7ffc6b032e60, append=0, forceit=0, reset_changed=1, filtering=0) at /home/travis/build/neovim/bot-ci/build/neovim/src/nvim/fileio.c:2576 This is most likely due to the code that restores those values from `buf`, which happens just before the fatal call to `os_fileinfo` ```c /* * The autocommands may have changed the name of the buffer, which may * be kept in fname, ffname and sfname. */ if (buf_ffname) ffname = buf->b_ffname; if (buf_sfname) sfname = buf->b_sfname; if (buf_fname_f) fname = buf->b_ffname; if (buf_fname_s) fname = buf->b_sfname; ``` It's worth noting that at this point `ffname` is still non-NULL, so it _could_ be used. However, our current code is purely more strict than Vim in this area, which has caused us problems before (e.g., `getdigits()`). The commentary for `struct file_buffer` clearly indicate that all of `b_ffname`, `b_sfname`, and `b_fname` may be NULL: ```c /* * b_ffname has the full path of the file (NULL for no name). * b_sfname is the name as the user typed it (or NULL). * b_fname is the same as b_sfname, unless ":cd" has been done, * then it is the same as b_ffname (NULL for no name). */ char_u *b_ffname; /* full path file name */ char_u *b_sfname; /* short file name */ char_u *b_fname; /* current file name */ ``` Vim directly calls `stat(2)` which, although it is annotated to tell the compiler that the path argument is non-NULL, does handle a NULL pointer by returning a `-1` value and setting `errno` to `EFAULT`. This satisfies Vim's check, since it treats any `-1` return from `stat(2)` to mean the file doesn't exist (at least in this code path). Note that Vim's mch_stat() implementations on win32 and solaris clearly cannot accept NULL `name`. But the codepaths that call mch_stat will NULL `name` tend to be unix-only (eg: u_read_undo)!
2017-04-24test/fs: sanity check for literal "~" directory (#6579)Justin M. Keyes1
If the CWD contains a directory with the literal name "~" then the tests will have bogus failures.
2017-03-19fileio,main: Do not restart syscall at EAGAIN when reading for -sZyX1
2017-03-19main: Temporary fix assertion errorZyX1
This variant uses `fdopen()` which is not standard, but it fixes problem on my system. In next commit `scriptin` will use `FileDescriptor*` from os/fileio in place of `FILE*`.
2017-03-11unittests: Do not import libnvim or headers in main processZyX1
Slows down unit tests much, but gets rid of as much preserved state as possible.
2017-03-11unittests: Check core dumps in after_each, like in functestsZyX1
2017-03-11unittests: Run all unit tests in their own processesZyX1
Used sed -r -i -e '/ helpers =/ s/$/\nlocal itp = helpers.gen_itp(it)/; s/^(\s*)it\(/\1itp(/' test/unit/**/*_spec.lua to alter all tests. Locally they all run fine now. Reasoning: 1. General: state from one test should not affect other tests. 2. Local: travis build is failing with something which may be an output of garbage collector. This should prevent state of the garbage collector from interferring as well.
2017-02-04build: Do not force busted into front of $PATHJustin M. Keyes1
This was a workaround from long ago, but it doesn't seem to be needed anymore. And it breaks the $PATH on the Windows build (AppVeyor CI). After this change python3 (and 2) is correctly detected on AppVeyor CI. References #5946
2016-11-17build: Target luacheck HEAD.Justin M. Keyes1
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.
2016-07-06os/fs: Rename os_file_exists to os_path_exists (#4973)Daniel Xu1
Because the old name did not indicate that the function would return true on directories as well.
2016-06-24unittests: Fix bug somewhere that makes file_read tests SEGVZyX1
2016-06-24unittests: Add tests for file.cZyX1
Also fixes some errors found.
2016-06-23unittests: Add os_write testZyX1
New os/fs.c functions are now all tested.
2016-06-23unittests: Add os_close, os_read and os_readv testsZyX1
2016-05-22os_nodetype: Return NODE_NORMAL if os_stat fails.Justin M. Keyes1
Conforms to Vim's mch_nodetype. Regression by 7db4a15. buf_write() expects NODE_WRITABLE for character devices such as /dev/stderr. Closes #4772
2016-05-02vim-patch:7.4.672KillTheMule1
Problem: When completing a shell command, directories in the current directory are not listed. Solution: When "." is not in $PATH also look in the current directory for directories. https://github.com/vim/vim/commit/b5971141dff0c69355fd64196fcc0d0d071d4c82 Most of it applied manually.
2016-01-14test: sys/fcntl.h -> fcntl.hMichael Reed1
POSIX.1-2008[1] says that the latter should be used, and all of our supported platforms would seem to support this scheme, apparently even Windows[2]. [1]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/fcntl.h.html [2]: https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx
2015-11-25Use libuv errors instead of errno in unit testsRui Abreu Ferreira1
Replaced old unit tests for errno with libuv error codes UV_ENOENT and UV_EEXIST (for os_open and os_getperms). Added libuv include path to test/includes compiler calls - needed to get hold of libuv headers.
2015-11-23test/unit: clean up according to luacheckMarco Hinz1
2015-10-23os/fs: Allow os_mkdir_recurse directory name to end with ///ZyX1
2015-08-17os/fs.c: remove os_file_is_readonly()Justin M. Keyes1
os_file_is_readonly() in its current form is equivalent to !os_file_is_writable(). This does not appear to be a bug, because Vim's use of check_file_readonly() (which we changed to os_file_is_readonly()) is equivalent to !os_file_is_writable() in every case. os_file_is_readonly() also fails this test: returns false if the file is non-read, non-write A more useful form would define behavior under these cases: - path is executable (but not writable) - path is non-existent - path is directory But there is no reason for os_file_is_readonly() to exist, so remove it.
2015-08-17test: more cases for os_file_is_readonly()Justin M. Keyes1
2015-08-17test: cover os_file_is_readable()Justin M. Keyes1
2015-08-09test: fix pending() invocationsJustin M. Keyes1
AFAICT busted does not report pending() invocations without the 2nd argument.
2015-07-26os/fs: Move mkdir_recurse from eval.c to os/fs.cZyX1
2015-07-17event loop: New abstraction layer with refactored time/signal APIThiago de Arruda1
- Add event loop abstraction module under src/nvim/event. The src/nvim/event/loop module replaces src/nvim/os/event - Remove direct dependency on libuv signal/timer API and use the new abstraction instead. - Replace all references to uv_default_loop() by &loop.uv, a new global variable that wraps libuv main event loop but allows the event loop functions to be reused in other contexts.
2015-05-29tests: Use pending() instead of silently skipping test. #2737Florian Walch1
2015-04-01Use lfs.currentdir() to fix symlink test fail.Rich Churcher1