commit c697c49a769794fdab0b8e77bb69d4435faa3d24
parent 7d8db544417e7811ae6e3c5398e9d0481a0ada22
Author: zeertzjq <zeertzjq@outlook.com>
Date: Fri, 22 Nov 2024 19:16:54 +0800
test(filetype): symlink detection works after expand('<afile>') (#31307)
Also add a test for #31306, which currently fails.
Diffstat:
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/test/functional/lua/filetype_spec.lua b/test/functional/lua/filetype_spec.lua
@@ -199,7 +199,19 @@ describe('filetype.lua', function()
finally(function()
uv.fs_unlink('Xfiletype/.config/git')
end)
- clear({ args = { '--clean', 'Xfiletype/.config/git/config' } })
+ local args = { '--clean', 'Xfiletype/.config/git/config' }
+ clear({ args = args })
eq('gitconfig', api.nvim_get_option_value('filetype', {}))
+ table.insert(args, 2, '--cmd')
+ table.insert(args, 3, "autocmd BufRead * call expand('<afile>')")
+ clear({ args = args })
+ eq('gitconfig', api.nvim_get_option_value('filetype', {}))
+ end)
+
+ pending('works with :doautocmd BufRead #31306', function()
+ clear({ args = { '--clean' } })
+ eq('', api.nvim_get_option_value('filetype', {}))
+ command('doautocmd BufRead README.md')
+ eq('markdown', api.nvim_get_option_value('filetype', {}))
end)
end)