aboutsummaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-07-12 14:30:49 +0800
committerGitHub <noreply@github.com>2024-07-12 14:30:49 +0800
commit028dd3c5c4d1828eec64c099d3372ffb90572dc0 (patch)
tree45e4625195d0c27e91e01b0455b6b99022f0ae06 /test/unit
parentbcb17689da4fef9059f0c0fae2f1493969b0a78c (diff)
downloadrneovim-028dd3c5c4d1828eec64c099d3372ffb90572dc0.tar.gz
rneovim-028dd3c5c4d1828eec64c099d3372ffb90572dc0.tar.bz2
rneovim-028dd3c5c4d1828eec64c099d3372ffb90572dc0.zip
vim-patch:9.1.0569: fnamemodify() treats ".." and "../" differently (#29673)
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
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/path_spec.lua34
1 files changed, 17 insertions, 17 deletions
diff --git a/test/unit/path_spec.lua b/test/unit/path_spec.lua
index 6f6a80f44e..ffad552a8a 100644
--- a/test/unit/path_spec.lua
+++ b/test/unit/path_spec.lua
@@ -468,8 +468,11 @@ describe('path.c', function()
eq(OK, result)
end)
- itp('concatenates directory name if it does not contain a slash', function()
- local expected = uv.cwd() .. '/..'
+ itp('produces absolute path for .. without a slash', function()
+ local old_dir = uv.cwd()
+ uv.chdir('..')
+ local expected = uv.cwd()
+ uv.chdir(old_dir)
local filename = '..'
local buflen = get_buf_len(expected, filename)
local do_expand = 1
@@ -478,21 +481,18 @@ describe('path.c', function()
eq(OK, result)
end)
- itp(
- 'enters given directory (instead of just concatenating the strings) if possible and if path contains a slash',
- function()
- local old_dir = uv.cwd()
- uv.chdir('..')
- local expected = uv.cwd() .. '/test.file'
- uv.chdir(old_dir)
- local filename = '../test.file'
- local buflen = get_buf_len(expected, filename)
- local do_expand = 1
- local buf, result = vim_FullName(filename, buflen, do_expand)
- eq(expected, ffi.string(buf))
- eq(OK, result)
- end
- )
+ itp('produces absolute path if possible and if path contains a slash', function()
+ local old_dir = uv.cwd()
+ uv.chdir('..')
+ local expected = uv.cwd() .. '/test.file'
+ uv.chdir(old_dir)
+ local filename = '../test.file'
+ local buflen = get_buf_len(expected, filename)
+ local do_expand = 1
+ local buf, result = vim_FullName(filename, buflen, do_expand)
+ eq(expected, ffi.string(buf))
+ eq(OK, result)
+ end)
itp('just copies the path if it is already absolute and force=0', function()
local absolute_path = '/absolute/path'