diff options
Diffstat (limited to 'test/functional/lua/fs_spec.lua')
-rw-r--r-- | test/functional/lua/fs_spec.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/functional/lua/fs_spec.lua b/test/functional/lua/fs_spec.lua index b651297db3..aba02ab01b 100644 --- a/test/functional/lua/fs_spec.lua +++ b/test/functional/lua/fs_spec.lua @@ -310,6 +310,25 @@ describe('vim.fs', function() it('works with a filename argument', function() eq(test_source_path, exec_lua([[return vim.fs.root(..., '.git')]], nvim_prog)) end) + + it('works with a relative path', function() + eq( + test_source_path, + exec_lua([[return vim.fs.root(..., '.git')]], vim.fs.basename(nvim_prog)) + ) + end) + + it('uses cwd for unnamed buffers', function() + command('new') + eq(test_source_path, exec_lua([[return vim.fs.root(0, '.git')]])) + end) + + it("uses cwd for buffers with non-empty 'buftype'", function() + command('new') + command('set buftype=nofile') + command('file lua://') + eq(test_source_path, exec_lua([[return vim.fs.root(0, '.git')]])) + end) end) describe('joinpath()', function() |