mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	vim-patch:8.2.2592: code coverage could be improved (#20969)
Problem:    Code coverage could be improved.
Solution:   Add a few more tests. (Dominique Pellé, closes vim/vim#7957)
6fd367a97c
Test case in test_viminfo.vim is applicable.
			
			
This commit is contained in:
		@@ -31,6 +31,15 @@ func Test_fileformat_autocommand()
 | 
				
			|||||||
  bw!
 | 
					  bw!
 | 
				
			||||||
endfunc
 | 
					endfunc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func Test_fileformat_nomodifiable()
 | 
				
			||||||
 | 
					  new
 | 
				
			||||||
 | 
					  setlocal nomodifiable
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  call assert_fails('set fileformat=latin1', 'E21:')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  bw
 | 
				
			||||||
 | 
					endfunc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
" Convert the contents of a file into a literal string
 | 
					" Convert the contents of a file into a literal string
 | 
				
			||||||
func s:file2str(fname)
 | 
					func s:file2str(fname)
 | 
				
			||||||
  let b = readfile(a:fname, 'B')
 | 
					  let b = readfile(a:fname, 'B')
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3399,6 +3399,13 @@ func Test_normal_delete_cmd()
 | 
				
			|||||||
  " delete to a readonly register
 | 
					  " delete to a readonly register
 | 
				
			||||||
  call setline(1, ['abcd'])
 | 
					  call setline(1, ['abcd'])
 | 
				
			||||||
  call assert_beeps('normal ":d2l')
 | 
					  call assert_beeps('normal ":d2l')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  " D and d with 'nomodifiable'
 | 
				
			||||||
 | 
					  call setline(1, ['abcd'])
 | 
				
			||||||
 | 
					  setlocal nomodifiable
 | 
				
			||||||
 | 
					  call assert_fails('normal D', 'E21:')
 | 
				
			||||||
 | 
					  call assert_fails('normal d$', 'E21:')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  close!
 | 
					  close!
 | 
				
			||||||
endfunc
 | 
					endfunc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,6 +21,7 @@ func! Test_sleep_bang()
 | 
				
			|||||||
  call s:assert_takes_longer('sl 50m', 50)
 | 
					  call s:assert_takes_longer('sl 50m', 50)
 | 
				
			||||||
  call s:assert_takes_longer('sl! 50m', 50)
 | 
					  call s:assert_takes_longer('sl! 50m', 50)
 | 
				
			||||||
  call s:assert_takes_longer('1sleep', 1000)
 | 
					  call s:assert_takes_longer('1sleep', 1000)
 | 
				
			||||||
 | 
					  call s:assert_takes_longer('normal 1gs', 1000)
 | 
				
			||||||
endfunc
 | 
					endfunc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
" vim: shiftwidth=2 sts=2 expandtab
 | 
					" vim: shiftwidth=2 sts=2 expandtab
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1044,6 +1044,22 @@ func Test_empty_matchpairs()
 | 
				
			|||||||
  bwipe!
 | 
					  bwipe!
 | 
				
			||||||
endfunc
 | 
					endfunc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func Test_mps_error()
 | 
				
			||||||
 | 
					  let encoding_save = &encoding
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  " for e in ['utf-8', 'latin1']
 | 
				
			||||||
 | 
					  for e in ['utf-8']
 | 
				
			||||||
 | 
					    exe 'set encoding=' .. e
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    call assert_fails('set mps=<:', 'E474:', e)
 | 
				
			||||||
 | 
					    call assert_fails('set mps=:>', 'E474:', e)
 | 
				
			||||||
 | 
					    call assert_fails('set mps=<>', 'E474:', e)
 | 
				
			||||||
 | 
					    call assert_fails('set mps=<:>_', 'E474:', e)
 | 
				
			||||||
 | 
					  endfor
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  let &encoding = encoding_save
 | 
				
			||||||
 | 
					endfunc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
" Test for ra on multi-byte characters
 | 
					" Test for ra on multi-byte characters
 | 
				
			||||||
func Test_ra_multibyte()
 | 
					func Test_ra_multibyte()
 | 
				
			||||||
  new
 | 
					  new
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,4 +18,9 @@ func Test_viminfo_option_error()
 | 
				
			|||||||
  call assert_fails('set viminfo=%10', 'E528:')
 | 
					  call assert_fails('set viminfo=%10', 'E528:')
 | 
				
			||||||
endfunc
 | 
					endfunc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func Test_viminfo_oldfiles_newfile()
 | 
				
			||||||
 | 
					  let v:oldfiles = v:_null_list
 | 
				
			||||||
 | 
					  call assert_equal("\nNo old files", execute('oldfiles'))
 | 
				
			||||||
 | 
					endfunc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
" vim: shiftwidth=2 sts=2 expandtab
 | 
					" vim: shiftwidth=2 sts=2 expandtab
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user