aboutsummaryrefslogtreecommitdiff
path: root/test/unit/path_spec.lua
Commit message (Collapse)AuthorAge
* vim-patch:9.1.0569: fnamemodify() treats ".." and "../" differently (#29673)zeertzjq2024-07-12
| | | | | | | | | 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
* fix(path): avoid chdir() when resolving path (#28799)zeertzjq2024-05-17
| | | | | | | | | | | | | | | | | | | | | | 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().
* fix(path): check return value of append_path() (#28309)Joey Gouly2024-04-13
| | | | | | | | | | | | | | | | | | | | | | | 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.
* 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: use vim.mpack and vim.uv directlyLewis Russell2024-01-12
|
* refactor: use `bool` to represent boolean valuesdundargoc2023-12-19
|
* build: enable lintlua for test/unit/ dir #26396Justin M. Keyes2023-12-04
| | | | | | | | | | | | | 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
* refactor: reorganize option header files (#25437)zeertzjq2023-09-30
| | | | | | - 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
* fix(runtime): respect 'fileignorecase' when sourcing (#24344)zeertzjq2023-07-14
|
* test: replace lfs with luv and vim.fsdundargoc2023-04-04
| | | | | | test: replace lfs with luv luv already pretty much does everything lfs does, so this duplication of dependencies isn't needed.
* test(unit): use file:close() properly (#21505)zeertzjq2022-12-22
|
* fix(path): don't remove trailing slash when getting absolute path (#20853)zeertzjq2022-10-30
| | | | | | 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.
* fix(path): path_is_url returns false for "foo:/" #19797sigmaSd2022-08-23
| | | | | | | | | | | | | | | 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
* test(unit): add unit tests for path_with_urlzeertzjq2022-01-24
|
* vim-patch:8.2.3468: problem with :cd when editing file in non-existent directoryzeertzjq2021-11-19
| | | | | | | 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
* path: add helper for checking a file extensiondm1try2020-12-01
|
* vim-patch:8.1.1371: cannot recover from a swap file #11081Jurica Bradarić2019-10-05
| | | | | | | 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
* tests: improve error message with literat "~" directory (#11032)Daniel Hahler2019-09-17
|
* refactor/rename: path_try_shorten_fname()Justin M. Keyes2018-03-24
|
* refactor/rename: path_is_absolute()Justin M. Keyes2018-03-24
|
* test/unit/path_spec: expect correct buffer size (#7514)Marco Hinz2017-11-13
| | | | Fixed-size buffers and lfs.currentdir().. does not compute. The tests would fail if the current working directory was longer than expected.
* test: avoid extra clear() callsJustin M. Keyes2017-10-02
| | | | also: various other cleanup
* win: vim_FullName(): force backslashes #7287Ignas Anikevicius2017-10-02
| | | | | | | | | - 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
* startup: v:progpath fallback: path_guess_exepathJustin M. Keyes2017-05-15
| | | | | | | If procfs is missing then libuv cannot find the exe path. Fallback to path_guess_exepath(), adapted from Vim findYourself(). Closes #6734
* test/fs: sanity check for literal "~" directory (#6579)Justin M. Keyes2017-04-24
| | | | If the CWD contains a directory with the literal name "~" then the tests will have bogus failures.
* unittests: Do not import libnvim or headers in main processZyX2017-03-11
| | | Slows down unit tests much, but gets rid of as much preserved state as possible.
* unittests: Check core dumps in after_each, like in functestsZyX2017-03-11
|
* unittests: Run all unit tests in their own processesZyX2017-03-11
| | | | | | | | | | | | | | | 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.
* path.c: `vim_FullName()`: Fix heap overflow #5737nfnty2017-01-05
| | | | | | - Clarify documentation. - Return `FAIL` and truncate if `fname` is too long. - Add tests.
* test/unit: clean up according to luacheckMarco Hinz2015-11-23
|
* os/path: Fix path_get_absolute_path for top-level pathsThiago de Arruda2015-09-18
| | | | Close #2833
* tests: Fix test setup/teardown in path_spec.lua #2402David Bürgin2015-04-12
| | | | | | | | 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>
* path_fix_case: unit testScott Prager2015-03-31
|
* unit tests: avoid global scope; add missing cimportsJustin M. Keyes2014-09-11
| | | | temporarily comment out call to vim_deltempdir() to avoid segfault
* unittest: convert path_spec.moon to luaThiago de Arruda2014-08-31