test(main_spec): use CMakePresets.json instead of .git for root marker

This commit is contained in:
James McCoy
2024-11-26 21:04:50 -05:00
parent a930b2666e
commit 584b811aee

View File

@@ -286,14 +286,14 @@ describe('vim.fs', function()
end) end)
it('works with a single marker', function() it('works with a single marker', function()
eq(test_source_path, exec_lua([[return vim.fs.root(0, '.git')]])) eq(test_source_path, exec_lua([[return vim.fs.root(0, 'CMakePresets.json')]]))
end) end)
it('works with multiple markers', function() it('works with multiple markers', function()
local bufnr = api.nvim_get_current_buf() local bufnr = api.nvim_get_current_buf()
eq( eq(
vim.fs.joinpath(test_source_path, 'test/functional/fixtures'), vim.fs.joinpath(test_source_path, 'test/functional/fixtures'),
exec_lua([[return vim.fs.root(..., {'CMakeLists.txt', '.git'})]], bufnr) exec_lua([[return vim.fs.root(..., {'CMakeLists.txt', 'CMakePresets.json'})]], bufnr)
) )
end) end)
@@ -308,26 +308,26 @@ describe('vim.fs', function()
end) end)
it('works with a filename argument', function() it('works with a filename argument', function()
eq(test_source_path, exec_lua([[return vim.fs.root(..., '.git')]], nvim_prog)) eq(test_source_path, exec_lua([[return vim.fs.root(..., 'CMakePresets.json')]], nvim_prog))
end) end)
it('works with a relative path', function() it('works with a relative path', function()
eq( eq(
test_source_path, test_source_path,
exec_lua([[return vim.fs.root(..., '.git')]], vim.fs.basename(nvim_prog)) exec_lua([[return vim.fs.root(..., 'CMakePresets.json')]], vim.fs.basename(nvim_prog))
) )
end) end)
it('uses cwd for unnamed buffers', function() it('uses cwd for unnamed buffers', function()
command('new') command('new')
eq(test_source_path, exec_lua([[return vim.fs.root(0, '.git')]])) eq(test_source_path, exec_lua([[return vim.fs.root(0, 'CMakePresets.json')]]))
end) end)
it("uses cwd for buffers with non-empty 'buftype'", function() it("uses cwd for buffers with non-empty 'buftype'", function()
command('new') command('new')
command('set buftype=nofile') command('set buftype=nofile')
command('file lua://') command('file lua://')
eq(test_source_path, exec_lua([[return vim.fs.root(0, '.git')]])) eq(test_source_path, exec_lua([[return vim.fs.root(0, 'CMakePresets.json')]]))
end) end)
end) end)