diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2020-11-24 14:18:46 +0100 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2020-11-24 14:18:46 +0100 |
commit | d285fa73da7ce2cb9abfbbb423eb8506e7202411 (patch) | |
tree | 900f9e0b6ded0bba865106d6c1cf367b06145aed /test/functional/api/vim_spec.lua | |
parent | 7dfeadb0fcbcedeafc357e60f0b7b2b8916afeaf (diff) | |
download | rneovim-d285fa73da7ce2cb9abfbbb423eb8506e7202411.tar.gz rneovim-d285fa73da7ce2cb9abfbbb423eb8506e7202411.tar.bz2 rneovim-d285fa73da7ce2cb9abfbbb423eb8506e7202411.zip |
api: enable nvim_get_runtime_file to find subdirectories
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) |