aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/vim_spec.lua
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2020-11-24 16:47:48 +0100
committerGitHub <noreply@github.com>2020-11-24 16:47:48 +0100
commita6bd52d877875deecb65d367bca8eda5d89fb8bc (patch)
tree732c1fd886be77aa31d0781a2c6816f8fa1b1b0f /test/functional/api/vim_spec.lua
parent7e0e0782a17b91a9d90d493f326770dcf33c7598 (diff)
parentd285fa73da7ce2cb9abfbbb423eb8506e7202411 (diff)
downloadrneovim-a6bd52d877875deecb65d367bca8eda5d89fb8bc.tar.gz
rneovim-a6bd52d877875deecb65d367bca8eda5d89fb8bc.tar.bz2
rneovim-a6bd52d877875deecb65d367bca8eda5d89fb8bc.zip
Merge pull request #13366 from bfredl/path3a
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.lua31
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)