diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-07-14 07:57:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-14 07:57:13 +0800 |
commit | 9176b5e10a6b32ff65c8ba3f532e3bd55c168ec6 (patch) | |
tree | c6ad5b716b04547789d252bd2f70882f7d8fad4d /test | |
parent | dbb840da01c72d8a311e0c55d3248d78a64b63a4 (diff) | |
download | rneovim-9176b5e10a6b32ff65c8ba3f532e3bd55c168ec6.tar.gz rneovim-9176b5e10a6b32ff65c8ba3f532e3bd55c168ec6.tar.bz2 rneovim-9176b5e10a6b32ff65c8ba3f532e3bd55c168ec6.zip |
fix(runtime): respect 'fileignorecase' when sourcing (#24344)
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/lua/runtime_spec.lua | 25 | ||||
-rw-r--r-- | test/unit/path_spec.lua | 10 |
2 files changed, 35 insertions, 0 deletions
diff --git a/test/functional/lua/runtime_spec.lua b/test/functional/lua/runtime_spec.lua index 1f312fc513..0b8b2234db 100644 --- a/test/functional/lua/runtime_spec.lua +++ b/test/functional/lua/runtime_spec.lua @@ -177,6 +177,31 @@ describe('runtime:', function() exec('setfiletype new-ft') eq('ABCDEFabcdef', eval('g:seq')) end) + + it("'rtp' order is respected with 'fileignorecase'", function() + exec('set fileignorecase') + local after_ftplugin_folder = table.concat({plug_dir, 'after', 'ftplugin'}, sep) + mkdir_p(table.concat({ftplugin_folder, 'new-ft'}, sep)) + mkdir_p(table.concat({after_ftplugin_folder, 'new-ft'}, sep)) + exec('set rtp+=' .. plug_dir .. '/after') + exec('let g:seq = ""') + -- A .lua file is loaded after a .vim file if they only differ in extension. + -- All files in after/ftplugin/ are loaded after all files in ftplugin/. + write_file(table.concat({ftplugin_folder, 'new-ft.VIM'}, sep), [[let g:seq ..= 'A']]) + write_file(table.concat({ftplugin_folder, 'new-ft.LUA'}, sep), [[vim.g.seq = vim.g.seq .. 'B']]) + write_file(table.concat({ftplugin_folder, 'new-ft_a.vim'}, sep), [[let g:seq ..= 'C']]) + write_file(table.concat({ftplugin_folder, 'new-ft_a.lua'}, sep), [[vim.g.seq = vim.g.seq .. 'D']]) + write_file(table.concat({ftplugin_folder, 'new-ft', 'a.VIM'}, sep), [[let g:seq ..= 'E']]) + write_file(table.concat({ftplugin_folder, 'new-ft', 'a.LUA'}, sep), [[vim.g.seq = vim.g.seq .. 'F']]) + write_file(table.concat({after_ftplugin_folder, 'new-ft.vim'}, sep), [[let g:seq ..= 'a']]) + write_file(table.concat({after_ftplugin_folder, 'new-ft.lua'}, sep), [[vim.g.seq = vim.g.seq .. 'b']]) + write_file(table.concat({after_ftplugin_folder, 'new-ft_a.VIM'}, sep), [[let g:seq ..= 'c']]) + write_file(table.concat({after_ftplugin_folder, 'new-ft_a.LUA'}, sep), [[vim.g.seq = vim.g.seq .. 'd']]) + write_file(table.concat({after_ftplugin_folder, 'new-ft', 'a.vim'}, sep), [[let g:seq ..= 'e']]) + write_file(table.concat({after_ftplugin_folder, 'new-ft', 'a.lua'}, sep), [[vim.g.seq = vim.g.seq .. 'f']]) + exec('setfiletype new-ft') + eq('ABCDEFabcdef', eval('g:seq')) + end) end) describe('indent', function() diff --git a/test/unit/path_spec.lua b/test/unit/path_spec.lua index 5808e2013a..f9ce1ff099 100644 --- a/test/unit/path_spec.lua +++ b/test/unit/path_spec.lua @@ -15,6 +15,7 @@ local mkdir = helpers.mkdir cimport('string.h') local cimp = cimport('./src/nvim/os/os.h', './src/nvim/path.h') +local options = cimport('./src/nvim/option_defs.h') local length = 0 local buffer = nil @@ -636,6 +637,15 @@ describe('path.c', function() eq(false, path_with_extension('/some/path/file.vim', 'lua')) eq(false, path_with_extension('/some/path/file', 'lua')) end) + + itp("respects 'fileignorecase' option", function() + options.p_fic = false + eq(false, path_with_extension('/some/path/file.VIM', 'vim')) + eq(false, path_with_extension('/some/path/file.LUA', 'lua')) + options.p_fic = true + eq(true, path_with_extension('/some/path/file.VIM', 'vim')) + eq(true, path_with_extension('/some/path/file.LUA', 'lua')) + end) end) describe('path_with_url', function() |