test: remove internal assertions and simplify

This commit is contained in:
futsuuu 2024-07-23 21:52:18 +09:00 committed by Lewis Russell
parent b621921074
commit ab561302a3

View File

@ -90,16 +90,13 @@ describe('vim.loader', function()
end) end)
it('correct indent on error message (#29809)', function() it('correct indent on error message (#29809)', function()
exec_lua [[ local errmsg = exec_lua [[
vim.loader.enable() vim.loader.enable()
local _, errmsg = pcall(require, 'non_existent_module')
local success, errmsg = pcall(require, 'non_existent_module') return errmsg
assert(not success)
errmsg = errmsg:gsub("^module 'non_existent_module' not found:\n", '')
for line in vim.gsplit(errmsg, '\n') do
assert(line:find('^\t'), ('not indented: %q'):format(line))
end
]] ]]
local errors = vim.split(errmsg, '\n')
eq("\tcache_loader: module 'non_existent_module' not found", errors[3])
eq("\tcache_loader_lib: module 'non_existent_module' not found", errors[4])
end) end)
end) end)