summaryrefslogtreecommitdiffstatshomepage
path: root/test/unit/path_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-02-19vim-patch:9.2.0020: Wrong shortened buffer after :cd with duplicate slashes ↵zeertzjq1
(#37955) Problem: Wrong shortened buffer name after :cd with duplicate slashes. Solution: Skip over multiple consecutive path separators (zeertzjq). related: neovim/neovim#37080 closes: vim/vim#19444 https://github.com/vim/vim/commit/f245e17ac70df43fd7fe650c7227bb16a4615283 N/A patches: vim-patch:9.0.1859: heap-use-after-free in bt_normal() vim-patch:9.2.0022: bt_quickfix() is slow
2025-11-15refactor(path)!: support RFC3986 in path_with_url() #36564Chip Senkbeil1
Problem: Nvim does not recognize URI scheme with numeric characters. While rare, there are URIs that contain numbers (e.g. [ed2k://](https://en.wikipedia.org/wiki/Ed2k_URI_scheme)) and characters like `+` (e.g. `svn+ssh`). I use it in [distant.nvim](https://github.com/chipsenkbeil/distant.nvim) to support multiple, distinct connections using `distant+1234://` as the scheme. Otherwise, if you open a file with the same name & path on two different machines from the same Nvim instance, their buffer names will conflict when just using `distant://`. Solution: Adds full support for detecting URI scheme per [RFC3986](https://www.rfc-editor.org/rfc/rfc3986#section-3.1)
2024-07-12vim-patch:9.1.0569: fnamemodify() treats ".." and "../" differently (#29673)zeertzjq1
Problem: fnamemodify() treats ".." and "../" differently. Solution: Expand ".." properly like how "/.." is treated in 8.2.3388. (zeertzjq) closes: vim/vim#15218 https://github.com/vim/vim/commit/1ee7420460768df67ea4bc73467f2d4f8b1555bd
2024-05-17fix(path): avoid chdir() when resolving path (#28799)zeertzjq1
Use uv_fs_realpath() instead. It seems that uv_fs_realpath() has some problems on non-Linux platforms: - macOS and other BSDs: this function will fail with UV_ELOOP if more than 32 symlinks are found while resolving the given path. This limit is hardcoded and cannot be sidestepped. - Windows: while this function works in the common case, there are a number of corner cases where it doesn't: - Paths in ramdisk volumes created by tools which sidestep the Volume Manager (such as ImDisk) cannot be resolved. - Inconsistent casing when using drive letters. - Resolved path bypasses subst'd drives. Ref: https://docs.libuv.org/en/v1.x/fs.html#c.uv_fs_realpath I don't know if the old implementation that uses uv_chdir() and uv_cwd() also suffers from the same problems. - For the ELOOP case, chdir() seems to have the same limitations. - On Windows, Vim doesn't use anything like chdir() either. It uses _wfullpath(), while libuv uses GetFinalPathNameByHandleW().
2024-04-13fix(path): check return value of append_path() (#28309)Joey Gouly1
If the filename passed to vim_FullName() is a relative directory, and does not exist, it is appended to the current working directory. Since the return value of append_path() was ignored, and if the buffer length was too small to fit getcwd() + dirname(filename), it would still try to append the basename(filename). This was manifesting as a failure in test/unit/path_spec.lua in: itp('fails and uses filename if given filename contains non-existing directory', .. This failure occurs when running the tests from directory with a short path such as: /work/src/nv test/unit/path_spec.lua:420: Expected objects to be the same. Passed in: (string) '/work/src/nv/test.file' Expected: (string) 'non_existing_dir/test.file' This return value for the second call to append_path() to append basename(filename) was checked, and this is where it would fail for normal / longer getcwd()s.
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
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-07-14fix(runtime): respect 'fileignorecase' when sourcing (#24344)zeertzjq1
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-10-30fix(path): don't remove trailing slash when getting absolute path (#20853)zeertzjq1
Before Vim patch 8.2.3468 relative_directory is never used in the resulting path name, so whether it has a trailing slash didn't matter. Now path_full_dir_name() appends a non-existing relative directory to the current directory name, so the trailing slash needs to be kept.
2022-08-23fix(path): path_is_url returns false for "foo:/" #19797sigmaSd1
Problem: path_to_url() returns false for single-slash URIs ("foo:/" vs "foo://"). This is not compliant with the URI spec. https://url.spec.whatwg.org/#url-representation LSP in particular allows single-slash URIs. Solution: Relax path_to_url() to accept single-slash URIs. This is not fully compliant (only ":" is required by the spec), but it is hopefully good enough without causing false-positives in typical text files. ref https://url.spec.whatwg.org/#windows-drive-letter ref https://github.com/neovim/neovim/pull/19773 ref https://github.com/neovim/neovim/pull/19773#issuecomment-1214763769
2022-01-24test(unit): add unit tests for path_with_urlzeertzjq1
2021-11-19vim-patch:8.2.3468: problem with :cd when editing file in non-existent directoryzeertzjq1
Problem: Problem with :cd when editing file in non-existent directory. (Yee Cheng Chin) Solution: Prepend the current directory to get the full path. (closes vim/vim#8903) https://github.com/vim/vim/commit/c6376c798433bcb9ee38a8664299d11454546950
2020-12-01path: add helper for checking a file extensiondm1try1
2019-10-05vim-patch:8.1.1371: cannot recover from a swap file #11081Jurica Bradarić1
Problem: Cannot recover from a swap file. Solution: Do not expand environment variables in the swap file name. Do not check the extension when we already know a file is a swap file. (Ken Takata, closes 4415, closes vim/vim#4369) https://github.com/vim/vim/commit/99499b1c05f85f83876b828eea3f6e14f0f407b4
2019-09-17tests: improve error message with literat "~" directory (#11032)Daniel Hahler1
2018-03-24refactor/rename: path_try_shorten_fname()Justin M. Keyes1
2018-03-24refactor/rename: path_is_absolute()Justin M. Keyes1
2017-11-13test/unit/path_spec: expect correct buffer size (#7514)Marco Hinz1
Fixed-size buffers and lfs.currentdir().. does not compute. The tests would fail if the current working directory was longer than expected.
2017-10-02test: avoid extra clear() callsJustin M. Keyes1
also: various other cleanup
2017-10-02win: vim_FullName(): force backslashes #7287Ignas Anikevicius1
- Replace obvious cases of '/' literal with PATHSEP. (There are still some remaining cases that need closer inspection.) - Fixup tests: ui/screen_basic closes #7117 ref https://github.com/neovim/neovim/issues/2471#issuecomment-271193714
2017-05-15startup: v:progpath fallback: path_guess_exepathJustin M. Keyes1
If procfs is missing then libuv cannot find the exe path. Fallback to path_guess_exepath(), adapted from Vim findYourself(). Closes #6734
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-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-01-05path.c: `vim_FullName()`: Fix heap overflow #5737nfnty1
- Clarify documentation. - Return `FAIL` and truncate if `fname` is too long. - Add tests.
2015-11-23test/unit: clean up according to luacheckMarco Hinz1
2015-09-18os/path: Fix path_get_absolute_path for top-level pathsThiago de Arruda1
Close #2833
2015-04-12tests: Fix test setup/teardown in path_spec.lua #2402David Bürgin1
A call to lfs.mkdir instead of lfs.rmdir left a temp directory hanging around. Changed to do proper setup/teardown using {before,after}_each. Helped-by: Scott Prager <splinterofchaos@gmail.com> Suggested-by: Scott Prager <splinterofchaos@gmail.com>
2015-03-31path_fix_case: unit testScott Prager1
2014-09-11unit tests: avoid global scope; add missing cimportsJustin M. Keyes1
temporarily comment out call to vim_deltempdir() to avoid segfault
2014-08-31unittest: convert path_spec.moon to luaThiago de Arruda1