mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	legacy tests: implement :source helper method.
This commit is contained in:
		
				
					committed by
					
						
						Thiago de Arruda
					
				
			
			
				
	
			
			
			
						parent
						
							1732615290
						
					
				
				
					commit
					e0332e7f7c
				
			@@ -182,6 +182,16 @@ local function execute(...)
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
local function source(code)
 | 
			
		||||
  local tmpname = os.tmpname()
 | 
			
		||||
  local tmpfile = io.open(tmpname, "w")
 | 
			
		||||
  tmpfile:write(code)
 | 
			
		||||
  tmpfile:flush()
 | 
			
		||||
  tmpfile:close()
 | 
			
		||||
  nvim_command('source '..tmpname)
 | 
			
		||||
  os.remove(tmpname)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
local function eq(expected, actual)
 | 
			
		||||
  return assert.are.same(expected, actual)
 | 
			
		||||
end
 | 
			
		||||
@@ -247,6 +257,7 @@ clear()
 | 
			
		||||
return {
 | 
			
		||||
  clear = clear,
 | 
			
		||||
  dedent = dedent,
 | 
			
		||||
  source = source,
 | 
			
		||||
  rawfeed = rawfeed,
 | 
			
		||||
  insert = insert,
 | 
			
		||||
  feed = feed,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user