mirror of
https://github.com/neovim/neovim
synced 2025-07-18 10:11:50 +00:00
vim-patch:8.0.0861: still many old style tests
Problem: Still many old style tests. Solution: Convert several tests to new style. (Yegappan Lakshmanan)4a137b4586
vim-patch:8.0.0862: file size test fails on MS-Windows Problem: File size test fails on MS-Windows. Solution: Set fileformat after opening new buffer. Strip CR.07c043af5f
This commit is contained in:
@ -47,10 +47,12 @@ NEW_TESTS ?= \
|
|||||||
test_cmdline.res \
|
test_cmdline.res \
|
||||||
test_command_count.res \
|
test_command_count.res \
|
||||||
test_cscope.res \
|
test_cscope.res \
|
||||||
|
test_curswant.res \
|
||||||
test_digraph.res \
|
test_digraph.res \
|
||||||
test_edit.res \
|
test_edit.res \
|
||||||
test_diffmode.res \
|
test_diffmode.res \
|
||||||
test_farsi.res \
|
test_farsi.res \
|
||||||
|
test_file_size.res \
|
||||||
test_filter_map.res \
|
test_filter_map.res \
|
||||||
test_findfile.res \
|
test_findfile.res \
|
||||||
test_fnameescape.res \
|
test_fnameescape.res \
|
||||||
@ -68,6 +70,8 @@ NEW_TESTS ?= \
|
|||||||
test_increment_dbcs.res \
|
test_increment_dbcs.res \
|
||||||
test_lambda.res \
|
test_lambda.res \
|
||||||
test_langmap.res \
|
test_langmap.res \
|
||||||
|
test_let.res \
|
||||||
|
test_lineending.res \
|
||||||
test_makeencoding.res \
|
test_makeencoding.res \
|
||||||
test_marks.res \
|
test_marks.res \
|
||||||
test_match.res \
|
test_match.res \
|
||||||
@ -82,6 +86,7 @@ NEW_TESTS ?= \
|
|||||||
test_profile.res \
|
test_profile.res \
|
||||||
test_quickfix.res \
|
test_quickfix.res \
|
||||||
test_retab.res \
|
test_retab.res \
|
||||||
|
test_scrollbind.res \
|
||||||
test_search.res \
|
test_search.res \
|
||||||
test_signs.res \
|
test_signs.res \
|
||||||
test_smartindent.res \
|
test_smartindent.res \
|
||||||
|
@ -442,3 +442,41 @@ func Test_Cmdline()
|
|||||||
au! CmdlineEnter
|
au! CmdlineEnter
|
||||||
au! CmdlineLeave
|
au! CmdlineLeave
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Test for Bufleave autocommand that deletes the buffer we are about to edit.
|
||||||
|
func Test_BufleaveWithDelete()
|
||||||
|
new | edit Xfile1
|
||||||
|
|
||||||
|
augroup test_bufleavewithdelete
|
||||||
|
autocmd!
|
||||||
|
autocmd BufLeave Xfile1 bwipe Xfile2
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
call assert_fails('edit Xfile2', 'E143:')
|
||||||
|
call assert_equal('Xfile1', bufname('%'))
|
||||||
|
|
||||||
|
autocmd! test_bufleavewithdelete BufLeave Xfile1
|
||||||
|
augroup! test_bufleavewithdelete
|
||||||
|
|
||||||
|
new
|
||||||
|
bwipe! Xfile1
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
" Test for Bufleave autocommand that deletes the buffer we are about to edit.
|
||||||
|
func Test_BufleaveWithDelete()
|
||||||
|
new | edit Xfile1
|
||||||
|
|
||||||
|
augroup test_bufleavewithdelete
|
||||||
|
autocmd!
|
||||||
|
autocmd BufLeave Xfile1 bwipe Xfile2
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
call assert_fails('edit Xfile2', 'E143:')
|
||||||
|
call assert_equal('Xfile1', bufname('%'))
|
||||||
|
|
||||||
|
autocmd! test_bufleavewithdelete BufLeave Xfile1
|
||||||
|
augroup! test_bufleavewithdelete
|
||||||
|
|
||||||
|
new
|
||||||
|
bwipe! Xfile1
|
||||||
|
endfunc
|
||||||
|
23
src/nvim/testdir/test_curswant.vim
Normal file
23
src/nvim/testdir/test_curswant.vim
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
" Tests for curswant not changing when setting an option
|
||||||
|
|
||||||
|
func Test_curswant()
|
||||||
|
new
|
||||||
|
call append(0, ['1234567890', '12345'])
|
||||||
|
|
||||||
|
normal! ggf8j
|
||||||
|
call assert_equal(7, winsaveview().curswant)
|
||||||
|
let &tabstop=&tabstop
|
||||||
|
call assert_equal(4, winsaveview().curswant)
|
||||||
|
|
||||||
|
normal! ggf8j
|
||||||
|
call assert_equal(7, winsaveview().curswant)
|
||||||
|
let &timeoutlen=&timeoutlen
|
||||||
|
call assert_equal(7, winsaveview().curswant)
|
||||||
|
|
||||||
|
normal! ggf8j
|
||||||
|
call assert_equal(7, winsaveview().curswant)
|
||||||
|
let &ttimeoutlen=&ttimeoutlen
|
||||||
|
call assert_equal(7, winsaveview().curswant)
|
||||||
|
|
||||||
|
enew!
|
||||||
|
endfunc
|
27
src/nvim/testdir/test_let.vim
Normal file
27
src/nvim/testdir/test_let.vim
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
" Tests for the :let command.
|
||||||
|
|
||||||
|
func Test_let()
|
||||||
|
" Test to not autoload when assigning. It causes internal error.
|
||||||
|
set runtimepath+=./sautest
|
||||||
|
let Test104#numvar = function('tr')
|
||||||
|
call assert_equal("function('tr')", string(Test104#numvar))
|
||||||
|
|
||||||
|
let a = 1
|
||||||
|
let b = 2
|
||||||
|
|
||||||
|
let out = execute('let a b')
|
||||||
|
let s = "\na #1\nb #2"
|
||||||
|
call assert_equal(s, out)
|
||||||
|
|
||||||
|
let out = execute('let {0 == 1 ? "a" : "b"}')
|
||||||
|
let s = "\nb #2"
|
||||||
|
call assert_equal(s, out)
|
||||||
|
|
||||||
|
let out = execute('let {0 == 1 ? "a" : "b"} a')
|
||||||
|
let s = "\nb #2\na #1"
|
||||||
|
call assert_equal(s, out)
|
||||||
|
|
||||||
|
let out = execute('let a {0 == 1 ? "a" : "b"}')
|
||||||
|
let s = "\na #1\nb #2"
|
||||||
|
call assert_equal(s, out)
|
||||||
|
endfunc
|
19
src/nvim/testdir/test_lineending.vim
Normal file
19
src/nvim/testdir/test_lineending.vim
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
" Tests for saving/loading a file with some lines ending in
|
||||||
|
" CTRL-M, some not
|
||||||
|
func Test_lineending()
|
||||||
|
let l = ["this line ends in a\<CR>",
|
||||||
|
\ "this one doesn't",
|
||||||
|
\ "this one does\<CR>",
|
||||||
|
\ "and the last one doesn't"]
|
||||||
|
set fileformat=dos
|
||||||
|
enew!
|
||||||
|
call append(0, l)
|
||||||
|
$delete
|
||||||
|
write Xfile1
|
||||||
|
bwipe Xfile1
|
||||||
|
edit Xfile1
|
||||||
|
let t = getline(1, '$')
|
||||||
|
call assert_equal(l, t)
|
||||||
|
new | only
|
||||||
|
call delete('Xfile1')
|
||||||
|
endfunc
|
32
src/nvim/testdir/test_scrollbind.vim
Normal file
32
src/nvim/testdir/test_scrollbind.vim
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
" Test for 'scrollbind' causing an unexpected scroll of one of the windows.
|
||||||
|
func Test_scrollbind()
|
||||||
|
" We don't want the status line to cause problems:
|
||||||
|
set laststatus=0
|
||||||
|
let totalLines = &lines * 20
|
||||||
|
let middle = totalLines / 2
|
||||||
|
new | only
|
||||||
|
for i in range(1, totalLines)
|
||||||
|
call setline(i, 'LINE ' . i)
|
||||||
|
endfor
|
||||||
|
exe string(middle)
|
||||||
|
normal zt
|
||||||
|
normal M
|
||||||
|
aboveleft vert new
|
||||||
|
for i in range(1, totalLines)
|
||||||
|
call setline(i, 'line ' . i)
|
||||||
|
endfor
|
||||||
|
exe string(middle)
|
||||||
|
normal zt
|
||||||
|
normal M
|
||||||
|
" Execute the following two commands at once to reproduce the problem.
|
||||||
|
setl scb | wincmd p
|
||||||
|
setl scb
|
||||||
|
wincmd w
|
||||||
|
let topLineLeft = line('w0')
|
||||||
|
wincmd p
|
||||||
|
let topLineRight = line('w0')
|
||||||
|
setl noscrollbind
|
||||||
|
wincmd p
|
||||||
|
setl noscrollbind
|
||||||
|
call assert_equal(0, topLineLeft - topLineRight)
|
||||||
|
endfunc
|
Reference in New Issue
Block a user