diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-02-02 00:57:49 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-02-11 15:27:56 +0100 |
commit | cbecae46f4b098cd6018055c7f4c70bd147c7938 (patch) | |
tree | 738da5fd30a7cbb66a7a6d456461ce3049bcf770 /src | |
parent | 4fe4b5abb6845b51af195e77576179ff5281451e (diff) | |
download | rneovim-cbecae46f4b098cd6018055c7f4c70bd147c7938.tar.gz rneovim-cbecae46f4b098cd6018055c7f4c70bd147c7938.tar.bz2 rneovim-cbecae46f4b098cd6018055c7f4c70bd147c7938.zip |
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)
https://github.com/vim/vim/commit/4a137b45864310060410f34cb9c7d0f0231bb256
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.
https://github.com/vim/vim/commit/07c043af5f054c7dfeb676414f8fa6aeda8f9c2b
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/testdir/Makefile | 5 | ||||
-rw-r--r-- | src/nvim/testdir/test_autocmd.vim | 38 | ||||
-rw-r--r-- | src/nvim/testdir/test_curswant.vim | 23 | ||||
-rw-r--r-- | src/nvim/testdir/test_let.vim | 27 | ||||
-rw-r--r-- | src/nvim/testdir/test_lineending.vim | 19 | ||||
-rw-r--r-- | src/nvim/testdir/test_scrollbind.vim | 32 |
6 files changed, 144 insertions, 0 deletions
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index b0356e050e..1b927076d8 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -47,10 +47,12 @@ NEW_TESTS ?= \ test_cmdline.res \ test_command_count.res \ test_cscope.res \ + test_curswant.res \ test_digraph.res \ test_edit.res \ test_diffmode.res \ test_farsi.res \ + test_file_size.res \ test_filter_map.res \ test_findfile.res \ test_fnameescape.res \ @@ -68,6 +70,8 @@ NEW_TESTS ?= \ test_increment_dbcs.res \ test_lambda.res \ test_langmap.res \ + test_let.res \ + test_lineending.res \ test_makeencoding.res \ test_marks.res \ test_match.res \ @@ -82,6 +86,7 @@ NEW_TESTS ?= \ test_profile.res \ test_quickfix.res \ test_retab.res \ + test_scrollbind.res \ test_search.res \ test_signs.res \ test_smartindent.res \ diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index 82c04abf5b..a4ef5de1ba 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -442,3 +442,41 @@ func Test_Cmdline() au! CmdlineEnter au! CmdlineLeave 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 diff --git a/src/nvim/testdir/test_curswant.vim b/src/nvim/testdir/test_curswant.vim new file mode 100644 index 0000000000..e54cd4b280 --- /dev/null +++ b/src/nvim/testdir/test_curswant.vim @@ -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 diff --git a/src/nvim/testdir/test_let.vim b/src/nvim/testdir/test_let.vim new file mode 100644 index 0000000000..24c6ef5e01 --- /dev/null +++ b/src/nvim/testdir/test_let.vim @@ -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 diff --git a/src/nvim/testdir/test_lineending.vim b/src/nvim/testdir/test_lineending.vim new file mode 100644 index 0000000000..5be3be8db3 --- /dev/null +++ b/src/nvim/testdir/test_lineending.vim @@ -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 diff --git a/src/nvim/testdir/test_scrollbind.vim b/src/nvim/testdir/test_scrollbind.vim new file mode 100644 index 0000000000..baa24f1979 --- /dev/null +++ b/src/nvim/testdir/test_scrollbind.vim @@ -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 |