mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-03 17:24:29 +00:00 
			
		
		
		
	functests/helpers: Add exc_exec function that checks the exception
This commit is contained in:
		@@ -324,6 +324,19 @@ local function rmdir(path)
 | 
			
		||||
  return ret
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
local exc_exec = function(cmd)
 | 
			
		||||
  nvim_command(([[
 | 
			
		||||
    try
 | 
			
		||||
      execute "%s"
 | 
			
		||||
    catch
 | 
			
		||||
      let g:__exception = v:exception
 | 
			
		||||
    endtry
 | 
			
		||||
  ]]):format(cmd:gsub('\n', '\\n'):gsub('[\\"]', '\\%0')))
 | 
			
		||||
  local ret = nvim_eval('get(g:, "__exception", 0)')
 | 
			
		||||
  nvim_command('unlet! g:__exception')
 | 
			
		||||
  return ret
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
return {
 | 
			
		||||
  clear = clear,
 | 
			
		||||
  spawn = spawn,
 | 
			
		||||
@@ -358,5 +371,6 @@ return {
 | 
			
		||||
  wait = wait,
 | 
			
		||||
  set_session = set_session,
 | 
			
		||||
  write_file = write_file,
 | 
			
		||||
  rmdir = rmdir
 | 
			
		||||
  rmdir = rmdir,
 | 
			
		||||
  exc_exec = exc_exec,
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user