mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	 64b0e6582a
			
		
	
	64b0e6582a
	
	
	
		
			
			Problem:
- `n.spawn()` is misleading because it also connects RPC, it's not just
  "spawning" a process.
- It's confusing that `n.spawn()` and `n.spawn_argv()` are separate.
Solution:
- Replace `n.spawn()`/`n.spawn_argv()` with a single function `n.new_session()`.
  This name aligns with the existing functions `n.set_session`/`n.get_session`.
    - Note: removes direct handling of `prepend_argv`, but I doubt that was
      important or intentional. If callers want to control use of `prepend_argv`
      then we should add a new flag to `test.session.Opts`.
- Move `keep` to first parameter of `n.new_session()`.
- Add a `merge` flag to `test.session.Opts`
- Mark `_new_argv()` as private. Test should use clear/new_session/spawn_wait
  instead.
		
	
		
			
				
	
	
		
			36 lines
		
	
	
		
			871 B
		
	
	
	
		
			Lua
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			871 B
		
	
	
	
		
			Lua
		
	
	
	
	
	
| -- Specs for :wundo and underlying functions
 | |
| 
 | |
| local n = require('test.functional.testnvim')()
 | |
| 
 | |
| local command = n.command
 | |
| local clear = n.clear
 | |
| local eval = n.eval
 | |
| local set_session = n.set_session
 | |
| 
 | |
| describe(':wundo', function()
 | |
|   before_each(clear)
 | |
|   after_each(function()
 | |
|     os.remove(eval('getcwd()') .. '/foo')
 | |
|   end)
 | |
| 
 | |
|   it('safely fails on new, non-empty buffer', function()
 | |
|     command('normal! iabc')
 | |
|     command('wundo foo') -- This should not segfault. #1027
 | |
|     --TODO: check messages for error message
 | |
|   end)
 | |
| end)
 | |
| 
 | |
| describe('u_* functions', function()
 | |
|   it('safely fail on new, non-empty buffer', function()
 | |
|     local session = n.new_session(false, {
 | |
|       args = {
 | |
|         '-c',
 | |
|         'set undodir=. undofile',
 | |
|       },
 | |
|     })
 | |
|     set_session(session)
 | |
|     command('echo "True"') -- Should not error out due to crashed Neovim
 | |
|     session:close()
 | |
|   end)
 | |
| end)
 |