diff options
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r-- | test/functional/api/vim_spec.lua | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 7948f7da09..eb5fd7eca7 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -1885,25 +1885,40 @@ describe('API', function() end) describe('nvim_get_runtime_file', function() - it('works', function() + local p = helpers.alter_slashes + it('can find files', function() eq({}, meths.get_runtime_file("bork.borkbork", false)) eq({}, meths.get_runtime_file("bork.borkbork", true)) eq(1, #meths.get_runtime_file("autoload/msgpack.vim", false)) eq(1, #meths.get_runtime_file("autoload/msgpack.vim", true)) local val = meths.get_runtime_file("autoload/remote/*.vim", true) eq(2, #val) - local p = helpers.alter_slashes if endswith(val[1], "define.vim") then - ok(endswith(val[1], p("autoload/remote/define.vim"))) - ok(endswith(val[2], p("autoload/remote/host.vim"))) + ok(endswith(val[1], p"autoload/remote/define.vim")) + ok(endswith(val[2], p"autoload/remote/host.vim")) else - ok(endswith(val[1], p("autoload/remote/host.vim"))) - ok(endswith(val[2], p("autoload/remote/define.vim"))) + ok(endswith(val[1], p"autoload/remote/host.vim")) + ok(endswith(val[2], p"autoload/remote/define.vim")) end val = meths.get_runtime_file("autoload/remote/*.vim", false) eq(1, #val) - ok(endswith(val[1], p("autoload/remote/define.vim")) - or endswith(val[1], p("autoload/remote/host.vim"))) + ok(endswith(val[1], p"autoload/remote/define.vim") + or endswith(val[1], p"autoload/remote/host.vim")) + + eq({}, meths.get_runtime_file("lua", true)) + eq({}, meths.get_runtime_file("lua/vim", true)) + end) + + it('can find directories', function() + local val = meths.get_runtime_file("lua/", true) + eq(1, #val) + ok(endswith(val[1], p"lua/")) + + val = meths.get_runtime_file("lua/vim/", true) + eq(1, #val) + ok(endswith(val[1], p"lua/vim/")) + + eq({}, meths.get_runtime_file("foobarlang/", true)) end) end) end) |