aboutsummaryrefslogtreecommitdiff
path: root/test/functional/vimscript
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2026-02-20 06:53:33 +0800
committerGitHub <noreply@github.com>2026-02-20 06:53:33 +0800
commite3d46a63375c84b7bd409f1f07ef56eb985eae50 (patch)
tree8abacd32ada06bbeddfb6d707283a7a2dc8e297e /test/functional/vimscript
parent785ac9f2285a413751ce963082469598aa81f74e (diff)
downloadrneovim-e3d46a63375c84b7bd409f1f07ef56eb985eae50.tar.gz
rneovim-e3d46a63375c84b7bd409f1f07ef56eb985eae50.tar.bz2
rneovim-e3d46a63375c84b7bd409f1f07ef56eb985eae50.zip
test: start test runners in Xtest_xdg dir (#37964)
This is a better way to prevent parallel tests from interfering with each other, as there are many ways files can be created and deleted in tests, so enforcing different file names is hard. Using $TMPDIR can also work in most cases, but 'backipskip' etc. have special defaults for $TMPDIR. Symlink runtime/, src/, test/ and README.md to Xtest_xdg dir to make tests more convenient (and symlinking test/ is required for busted). Also, use README.md instead of test/README.md in the Ex mode inccommand test, as test/README.md no longer contains 'N' char.
Diffstat (limited to 'test/functional/vimscript')
-rw-r--r--test/functional/vimscript/executable_spec.lua6
-rw-r--r--test/functional/vimscript/fnamemodify_spec.lua3
-rw-r--r--test/functional/vimscript/system_spec.lua7
3 files changed, 15 insertions, 1 deletions
diff --git a/test/functional/vimscript/executable_spec.lua b/test/functional/vimscript/executable_spec.lua
index 05d249ca32..3840f55e84 100644
--- a/test/functional/vimscript/executable_spec.lua
+++ b/test/functional/vimscript/executable_spec.lua
@@ -20,6 +20,9 @@ describe('executable()', function()
if is_os('win') then
it('exepath respects shellslash', function()
+ -- test/ cannot be a symlink in this test.
+ n.api.nvim_set_current_dir(t.paths.test_source_path)
+
command('let $PATH = fnamemodify("./test/functional/fixtures/bin", ":p")')
eq(
[[test\functional\fixtures\bin\null.CMD]],
@@ -33,6 +36,9 @@ describe('executable()', function()
end)
it('stdpath respects shellslash', function()
+ -- Needs to check paths relative to repo root dir.
+ n.api.nvim_set_current_dir(t.paths.test_source_path)
+
t.matches(
[[build\Xtest_xdg[%w_]*\share\nvim%-data]],
call('fnamemodify', call('stdpath', 'data'), ':.')
diff --git a/test/functional/vimscript/fnamemodify_spec.lua b/test/functional/vimscript/fnamemodify_spec.lua
index f2cee9b83e..8b0b242c62 100644
--- a/test/functional/vimscript/fnamemodify_spec.lua
+++ b/test/functional/vimscript/fnamemodify_spec.lua
@@ -45,6 +45,9 @@ describe('fnamemodify()', function()
end)
it('handles examples from ":help filename-modifiers"', function()
+ -- src/ cannot be a symlink in this test.
+ n.api.nvim_set_current_dir(t.paths.test_source_path)
+
local filename = 'src/version.c'
local cwd = getcwd()
diff --git a/test/functional/vimscript/system_spec.lua b/test/functional/vimscript/system_spec.lua
index 54650caa71..67a613d848 100644
--- a/test/functional/vimscript/system_spec.lua
+++ b/test/functional/vimscript/system_spec.lua
@@ -131,11 +131,16 @@ describe('system()', function()
before_each(function()
screen = Screen.new()
+ t.write_file('Xmorefile', ('line1\nline2\nline3\n'):rep(10))
+ end)
+
+ after_each(function()
+ os.remove('Xmorefile')
end)
if is_os('win') then
local function test_more()
- eq('root = true', eval([[get(split(system('"more" ".editorconfig"'), "\n"), 0, '')]]))
+ eq('line1', eval([[get(split(system('"more" "Xmorefile"'), "\n"), 0, '')]]))
end
local function test_shell_unquoting()
eval([[system('"ping" "-n" "1" "127.0.0.1"')]])