diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2020-10-19 20:05:54 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2020-11-02 15:21:36 +0100 |
commit | c60c7375f5754eea2a4209cc6441e70b2bb44f14 (patch) | |
tree | 930007daa8fbb65ad55acff0a8ecb49d8cb20b00 /test/functional/lua/overrides_spec.lua | |
parent | 6224ec3d4a672a9beb7522a34e61fa3b335bf070 (diff) | |
download | rneovim-c60c7375f5754eea2a4209cc6441e70b2bb44f14.tar.gz rneovim-c60c7375f5754eea2a4209cc6441e70b2bb44f14.tar.bz2 rneovim-c60c7375f5754eea2a4209cc6441e70b2bb44f14.zip |
startup: handle autoload and lua packages during startup
¡NO HAY BANDA!
Diffstat (limited to 'test/functional/lua/overrides_spec.lua')
-rw-r--r-- | test/functional/lua/overrides_spec.lua | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/test/functional/lua/overrides_spec.lua b/test/functional/lua/overrides_spec.lua index 1bccc02847..5fbba63736 100644 --- a/test/functional/lua/overrides_spec.lua +++ b/test/functional/lua/overrides_spec.lua @@ -285,119 +285,6 @@ describe('debug.debug', function() end) end) -describe('package.path/package.cpath', function() - local sl = alter_slashes - - local function get_new_paths(sufs, runtimepaths) - runtimepaths = runtimepaths or meths.list_runtime_paths() - local new_paths = {} - local sep = package.config:sub(1, 1) - for _, v in ipairs(runtimepaths) do - for _, suf in ipairs(sufs) do - new_paths[#new_paths + 1] = v .. sep .. 'lua' .. suf - end - end - return new_paths - end - local function eval_lua(expr, ...) - return meths.exec_lua('return '..expr, {...}) - end - local function set_path(which, value) - return exec_lua('package[select(1, ...)] = select(2, ...)', which, value) - end - - it('contains directories from &runtimepath on first invocation', function() - local new_paths = get_new_paths(sl{'/?.lua', '/?/init.lua'}) - local new_paths_str = table.concat(new_paths, ';') - eq(new_paths_str, eval_lua('package.path'):sub(1, #new_paths_str)) - - local new_cpaths = get_new_paths(iswin() and {'\\?.dll'} or {'/?.so'}) - local new_cpaths_str = table.concat(new_cpaths, ';') - eq(new_cpaths_str, eval_lua('package.cpath'):sub(1, #new_cpaths_str)) - end) - it('puts directories from &runtimepath always at the start', function() - meths.set_option('runtimepath', 'a,b') - local new_paths = get_new_paths(sl{'/?.lua', '/?/init.lua'}, {'a', 'b'}) - local new_paths_str = table.concat(new_paths, ';') - eq(new_paths_str, eval_lua('package.path'):sub(1, #new_paths_str)) - - set_path('path', sl'foo/?.lua;foo/?/init.lua;' .. new_paths_str) - - neq(new_paths_str, eval_lua('package.path'):sub(1, #new_paths_str)) - - command('set runtimepath+=c') - new_paths = get_new_paths(sl{'/?.lua', '/?/init.lua'}, {'a', 'b', 'c'}) - new_paths_str = table.concat(new_paths, ';') - eq(new_paths_str, eval_lua('package.path'):sub(1, #new_paths_str)) - end) - it('understands uncommon suffixes', function() - set_path('cpath', './?/foo/bar/baz/x.nlua') - meths.set_option('runtimepath', 'a') - local new_paths = get_new_paths({'/?/foo/bar/baz/x.nlua'}, {'a'}) - local new_paths_str = table.concat(new_paths, ';') - eq(new_paths_str, eval_lua('package.cpath'):sub(1, #new_paths_str)) - - set_path('cpath', './yyy?zzz/x') - meths.set_option('runtimepath', 'b') - new_paths = get_new_paths({'/yyy?zzz/x'}, {'b'}) - new_paths_str = table.concat(new_paths, ';') - eq(new_paths_str, eval_lua('package.cpath'):sub(1, #new_paths_str)) - - set_path('cpath', './yyy?zzz/123?ghi/x') - meths.set_option('runtimepath', 'b') - new_paths = get_new_paths({'/yyy?zzz/123?ghi/x'}, {'b'}) - new_paths_str = table.concat(new_paths, ';') - eq(new_paths_str, eval_lua('package.cpath'):sub(1, #new_paths_str)) - end) - it('preserves empty items', function() - local many_empty_path = ';;;;;;' - local many_empty_cpath = ';;;;;;./?.luaso' - set_path('path', many_empty_path) - set_path('cpath', many_empty_cpath) - meths.set_option('runtimepath', 'a') - local new_paths = get_new_paths(sl{'/?.lua', '/?/init.lua'}, {'a'}) - local new_paths_str = table.concat(new_paths, ';') - eq(new_paths_str .. ';' .. many_empty_path, eval_lua('package.path')) - local new_cpaths = get_new_paths({'/?.luaso'}, {'a'}) - local new_cpaths_str = table.concat(new_cpaths, ';') - eq(new_cpaths_str .. ';' .. many_empty_cpath, eval_lua('package.cpath')) - end) - it('preserves empty value', function() - set_path('path', '') - meths.set_option('runtimepath', 'a') - local new_paths = get_new_paths(sl{'/?.lua', '/?/init.lua'}, {'a'}) - local new_paths_str = table.concat(new_paths, ';') - eq(new_paths_str .. ';', eval_lua('package.path')) - end) - it('purges out all additions if runtimepath is set to empty', function() - local new_paths = get_new_paths(sl{'/?.lua', '/?/init.lua'}) - local new_paths_str = table.concat(new_paths, ';') - local path = eval_lua('package.path') - eq(new_paths_str, path:sub(1, #new_paths_str)) - - local new_cpaths = get_new_paths(iswin() and {'\\?.dll'} or {'/?.so'}) - local new_cpaths_str = table.concat(new_cpaths, ';') - local cpath = eval_lua('package.cpath') - eq(new_cpaths_str, cpath:sub(1, #new_cpaths_str)) - - meths.set_option('runtimepath', '') - eq(path:sub(#new_paths_str + 2, -1), eval_lua('package.path')) - eq(cpath:sub(#new_cpaths_str + 2, -1), eval_lua('package.cpath')) - end) - it('works with paths with escaped commas', function() - meths.set_option('runtimepath', '\\,') - local new_paths = get_new_paths(sl{'/?.lua', '/?/init.lua'}, {','}) - local new_paths_str = table.concat(new_paths, ';') - eq(new_paths_str, eval_lua('package.path'):sub(1, #new_paths_str)) - end) - it('ignores paths with semicolons', function() - meths.set_option('runtimepath', 'foo;bar,\\,') - local new_paths = get_new_paths(sl{'/?.lua', '/?/init.lua'}, {','}) - local new_paths_str = table.concat(new_paths, ';') - eq(new_paths_str, eval_lua('package.path'):sub(1, #new_paths_str)) - end) -end) - describe('os.getenv', function() it('returns nothing for undefined env var', function() eq(NIL, funcs.luaeval('os.getenv("XTEST_1")')) |