aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/vim_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2026-02-18 15:56:50 +0800
committerGitHub <noreply@github.com>2026-02-18 15:56:50 +0800
commit496eca22b37b243aba2efe8383e591ef57d27df9 (patch)
tree8b1a148a3f0b3446ee1eb611c847a891a0c5bb0a /test/functional/api/vim_spec.lua
parent9492df027d0715e2bbd3508d6733fd6f6ca6de0b (diff)
downloadrneovim-496eca22b37b243aba2efe8383e591ef57d27df9.tar.gz
rneovim-496eca22b37b243aba2efe8383e591ef57d27df9.tar.bz2
rneovim-496eca22b37b243aba2efe8383e591ef57d27df9.zip
test: support running functionaltests in parallel by directory (#37918)
Define a CMake target for every subdirectory of test/functional that contains functional tests, and a functionaltest_parallel target that depends on all those targets, allowing multiple test runners to run in parallel. On CI, use at most 2 parallel test runners, as using more may increase system load and make tests unstable.
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r--test/functional/api/vim_spec.lua28
1 files changed, 16 insertions, 12 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 7bf8295878..74af76bdd2 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -734,23 +734,24 @@ describe('API', function()
describe('nvim_set_current_dir', function()
local start_dir
+ local test_dir = 'Xtest_set_current_dir'
before_each(function()
- fn.mkdir('Xtestdir')
+ fn.mkdir(test_dir)
start_dir = fn.getcwd()
end)
after_each(function()
- n.rmdir('Xtestdir')
+ n.rmdir(test_dir)
end)
it('works', function()
- api.nvim_set_current_dir('Xtestdir')
- eq(start_dir .. n.get_pathsep() .. 'Xtestdir', fn.getcwd())
+ api.nvim_set_current_dir(test_dir)
+ eq(start_dir .. n.get_pathsep() .. test_dir, fn.getcwd())
end)
it('sets previous directory', function()
- api.nvim_set_current_dir('Xtestdir')
+ api.nvim_set_current_dir(test_dir)
command('cd -')
eq(start_dir, fn.getcwd())
end)
@@ -1670,8 +1671,9 @@ describe('API', function()
-- Check if autoload works properly
local pathsep = n.get_pathsep()
- local xconfig = 'Xhome' .. pathsep .. 'Xconfig'
- local xdata = 'Xhome' .. pathsep .. 'Xdata'
+ local xhome = 'Xhome_api'
+ local xconfig = xhome .. pathsep .. 'Xconfig'
+ local xdata = xhome .. pathsep .. 'Xdata'
local autoload_folder = table.concat({ xconfig, 'nvim', 'autoload' }, pathsep)
local autoload_file = table.concat({ autoload_folder, 'testload.vim' }, pathsep)
mkdir_p(autoload_folder)
@@ -1679,7 +1681,7 @@ describe('API', function()
clear { args_rm = { '-u' }, env = { XDG_CONFIG_HOME = xconfig, XDG_DATA_HOME = xdata } }
eq(2, api.nvim_get_var('testload#value'))
- rmdir('Xhome')
+ rmdir(xhome)
end)
it('nvim_get_vvar, nvim_set_vvar', function()
@@ -2966,16 +2968,18 @@ describe('API', function()
end)
describe('nvim_list_runtime_paths', function()
+ local test_dir = 'Xtest_list_runtime_paths'
+
setup(function()
local pathsep = n.get_pathsep()
- mkdir_p('Xtest' .. pathsep .. 'a')
- mkdir_p('Xtest' .. pathsep .. 'b')
+ mkdir_p(test_dir .. pathsep .. 'a')
+ mkdir_p(test_dir .. pathsep .. 'b')
end)
teardown(function()
- rmdir 'Xtest'
+ rmdir(test_dir)
end)
before_each(function()
- api.nvim_set_current_dir 'Xtest'
+ api.nvim_set_current_dir(test_dir)
end)
it('returns nothing with empty &runtimepath', function()