test(filetype): symlink detection works after expand('<afile>') (#31307)

Also add a test for #31306, which currently fails.
This commit is contained in:
zeertzjq 2024-11-22 19:16:54 +08:00 committed by GitHub
parent 7d8db54441
commit c697c49a76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)