aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-01-01 17:40:26 -0500
committerGitHub <noreply@github.com>2021-01-01 17:40:26 -0500
commit5eccfd2b2e5366f2bbe6aca1471a5d52e77c9fbc (patch)
treebee93b8000a81cc57203a8f408425a656c05e410 /src/nvim/testdir
parent7718826edf0a4af175d230a691d9d9559f9d8acc (diff)
parent52bfaea70e901f2e1db9f9db173a50ef3da898c9 (diff)
downloadrneovim-5eccfd2b2e5366f2bbe6aca1471a5d52e77c9fbc.tar.gz
rneovim-5eccfd2b2e5366f2bbe6aca1471a5d52e77c9fbc.tar.bz2
rneovim-5eccfd2b2e5366f2bbe6aca1471a5d52e77c9fbc.zip
Merge pull request #13655 from janlazo/vim-8.2.2255
vim-patch:8.1.{1241,1261,1275,1281,1549,1590,1881,2079,2322,2360,2411},8.2.{113,388,934,2255,2258,2260,2269}
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_filetype.vim5
-rw-r--r--src/nvim/testdir/test_hardcopy.vim80
-rw-r--r--src/nvim/testdir/test_quickfix.vim218
-rw-r--r--src/nvim/testdir/test_usercommands.vim10
-rw-r--r--src/nvim/testdir/test_window_cmd.vim2
5 files changed, 269 insertions, 46 deletions
diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim
index 2123780f11..1cb68e7fef 100644
--- a/src/nvim/testdir/test_filetype.vim
+++ b/src/nvim/testdir/test_filetype.vim
@@ -150,6 +150,7 @@ let s:filename_checks = {
\ 'dsl': ['file.dsl'],
\ 'dtd': ['file.dtd'],
\ 'dts': ['file.dts', 'file.dtsi'],
+ \ 'dune': ['jbuild', 'dune', 'dune-project', 'dune-workspace'],
\ 'dylan': ['file.dylan'],
\ 'dylanintr': ['file.intr'],
\ 'dylanlid': ['file.lid'],
@@ -322,9 +323,10 @@ let s:filename_checks = {
\ 'nroff': ['file.tr', 'file.nr', 'file.roff', 'file.tmac', 'file.mom'],
\ 'nsis': ['file.nsi', 'file.nsh'],
\ 'obj': ['file.obj'],
- \ 'ocaml': ['file.ml', 'file.mli', 'file.mll', 'file.mly', '.ocamlinit'],
+ \ 'ocaml': ['file.ml', 'file.mli', 'file.mll', 'file.mly', '.ocamlinit', 'file.mlt', 'file.mlp', 'file.mlip', 'file.mli.cppo', 'file.ml.cppo'],
\ 'occam': ['file.occ'],
\ 'omnimark': ['file.xom', 'file.xin'],
+ \ 'opam': ['opam', 'file.opam', 'file.opam.template'],
\ 'openroad': ['file.or'],
\ 'ora': ['file.ora'],
\ 'pamconf': ['/etc/pam.conf'],
@@ -398,6 +400,7 @@ let s:filename_checks = {
\ 'scheme': ['file.scm', 'file.ss', 'file.rkt'],
\ 'scilab': ['file.sci', 'file.sce'],
\ 'screen': ['.screenrc', 'screenrc'],
+ \ 'sexplib': ['file.sexp'],
\ 'scss': ['file.scss'],
\ 'sd': ['file.sd'],
\ 'sdc': ['file.sdc'],
diff --git a/src/nvim/testdir/test_hardcopy.vim b/src/nvim/testdir/test_hardcopy.vim
index 6125f9b993..e390bd5cc8 100644
--- a/src/nvim/testdir/test_hardcopy.vim
+++ b/src/nvim/testdir/test_hardcopy.vim
@@ -1,5 +1,7 @@
" Test :hardcopy
+source check.vim
+
func Test_printoptions()
edit test_hardcopy.vim
syn on
@@ -8,8 +10,10 @@ func Test_printoptions()
\ 'left:2in,top:30pt,right:16mm,bottom:3pc',
\ 'header:3,syntax:y,number:y,wrap:n',
\ 'header:3,syntax:n,number:y,wrap:y',
+ \ 'header:0,syntax:a,number:y,wrap:y',
\ 'duplex:short,collate:n,jobsplit:y,portrait:n',
\ 'duplex:long,collate:y,jobsplit:n,portrait:y',
+ \ 'duplex:off,collate:y,jobsplit:y,portrait:y',
\ 'paper:10x14',
\ 'paper:A3',
\ 'paper:A4',
@@ -28,7 +32,7 @@ func Test_printoptions()
\ '']
exe 'set printoptions=' .. opt
if has('postscript')
- hardcopy > Xhardcopy_printoptions
+ 1,50hardcopy > Xhardcopy_printoptions
let lines = readfile('Xhardcopy_printoptions')
call assert_true(len(lines) > 20, opt)
call assert_true(lines[0] =~ 'PS-Adobe', opt)
@@ -44,8 +48,8 @@ func Test_printoptions()
endfunc
func Test_printmbfont()
- " Print a small help page which contains tabs to cover code that expands tabs to spaces.
- help help
+ " Print a help page which contains tabs, underlines (etc) to recover more code.
+ help syntax.txt
syn on
for opt in [':WadaMin-Regular,b:WadaMin-Bold,i:WadaMin-Italic,o:WadaMin-Bold-Italic,c:yes,a:no',
@@ -63,10 +67,39 @@ func Test_printmbfont()
bwipe
endfunc
+func Test_printmbcharset()
+ CheckFeature postscript
+
+ " digraph.txt has plenty of non-latin1 characters.
+ help digraph.txt
+ set printmbcharset=ISO10646 printencoding=utf-8
+ for courier in ['yes', 'no']
+ for ascii in ['yes', 'no']
+ exe 'set printmbfont=r:WadaMin-Regular,b:WadaMin-Bold,i:WadaMin-Italic,o:WadaMin-BoldItalic'
+ \ .. ',c:' .. courier .. ',a:' .. ascii
+ hardcopy > Xhardcopy_printmbcharset
+ let lines = readfile('Xhardcopy_printmbcharset')
+ call assert_true(len(lines) > 20)
+ call assert_true(lines[0] =~ 'PS-Adobe')
+ endfor
+ endfor
+
+ set printmbcharset=does-not-exist printencoding=utf-8 printmbfont=r:WadaMin-Regular
+ call assert_fails('hardcopy > Xhardcopy_printmbcharset', 'E456:')
+
+ set printmbcharset=GB_2312-80 printencoding=utf-8 printmbfont=r:WadaMin-Regular
+ call assert_fails('hardcopy > Xhardcopy_printmbcharset', 'E673:')
+
+ set printmbcharset=ISO10646 printencoding=utf-8 printmbfont=
+ call assert_fails('hardcopy > Xhardcopy_printmbcharset', 'E675:')
+
+ call delete('Xhardcopy_printmbcharset')
+ set printmbcharset& printencoding& printmbfont&
+ bwipe
+endfunc
+
func Test_printexpr()
- if !has('unix')
- return
- endif
+ CheckFeature postscript
" Not a very useful printexpr value, but enough to test
" hardcopy with 'printexpr'.
@@ -84,7 +117,7 @@ func Test_printexpr()
\ readfile('Xhardcopy_printexpr'))
call delete('Xhardcopy_printexpr')
- " Function return 1 to test print failure.
+ " Function returns 1 to test print failure.
function PrintFails(fname)
call delete(a:fname)
return 1
@@ -97,12 +130,11 @@ func Test_printexpr()
endfunc
func Test_errors()
- " FIXME: Windows fails differently than Unix.
- if has('unix')
- edit test_hardcopy.vim
- call assert_fails('hardcopy >', 'E324:')
- bwipe
- endif
+ CheckFeature postscript
+
+ edit test_hardcopy.vim
+ call assert_fails('hardcopy >', 'E324:')
+ bwipe
endfunc
func Test_dark_background()
@@ -126,12 +158,11 @@ func Test_dark_background()
endfun
func Test_empty_buffer()
- " FIXME: Unclear why this fails on Windows.
- if has('unix')
- new
- call assert_equal("\nNo text to be printed", execute('hardcopy'))
- bwipe
- endif
+ CheckFeature postscript
+
+ new
+ call assert_equal("\nNo text to be printed", execute('hardcopy'))
+ bwipe
endfunc
func Test_printheader_parsing()
@@ -145,9 +176,8 @@ func Test_printheader_parsing()
endfunc
func Test_fname_with_spaces()
- if !has('postscript')
- return
- endif
+ CheckFeature postscript
+
split t\ e\ s\ t.txt
call setline(1, ['just', 'some', 'text'])
hardcopy > %.ps
@@ -157,9 +187,11 @@ func Test_fname_with_spaces()
endfunc
func Test_illegal_byte()
- if !has('postscript') || &enc != 'utf-8'
+ CheckFeature postscript
+ if &enc != 'utf-8'
return
endif
+
new
" conversion of 0xff will fail, this used to cause a crash
call setline(1, "\xff")
@@ -168,3 +200,5 @@ func Test_illegal_byte()
bwipe!
call delete('Xpstest')
endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim
index 563dbd90d9..be7ea908c7 100644
--- a/src/nvim/testdir/test_quickfix.vim
+++ b/src/nvim/testdir/test_quickfix.vim
@@ -29,7 +29,7 @@ func s:setup_commands(cchar)
command! -count -nargs=* -bang Xprev <mods><count>cprev<bang> <args>
command! -nargs=* -bang Xfirst <mods>cfirst<bang> <args>
command! -nargs=* -bang Xlast <mods>clast<bang> <args>
- command! -nargs=* -bang -range Xnfile <mods><count>cnfile<bang> <args>
+ command! -count -nargs=* -bang Xnfile <mods><count>cnfile<bang> <args>
command! -nargs=* -bang Xpfile <mods>cpfile<bang> <args>
command! -nargs=* Xexpr <mods>cexpr <args>
command! -range -nargs=* Xvimgrep <mods><count>vimgrep <args>
@@ -40,6 +40,8 @@ func s:setup_commands(cchar)
command! -nargs=0 -count Xcc <count>cc
command! -count=1 -nargs=0 Xbelow <mods><count>cbelow
command! -count=1 -nargs=0 Xabove <mods><count>cabove
+ command! -count=1 -nargs=0 Xbefore <mods><count>cbefore
+ command! -count=1 -nargs=0 Xafter <mods><count>cafter
let g:Xgetlist = function('getqflist')
let g:Xsetlist = function('setqflist')
call setqflist([], 'f')
@@ -64,7 +66,7 @@ func s:setup_commands(cchar)
command! -count -nargs=* -bang Xprev <mods><count>lprev<bang> <args>
command! -nargs=* -bang Xfirst <mods>lfirst<bang> <args>
command! -nargs=* -bang Xlast <mods>llast<bang> <args>
- command! -nargs=* -bang -range Xnfile <mods><count>lnfile<bang> <args>
+ command! -count -nargs=* -bang Xnfile <mods><count>lnfile<bang> <args>
command! -nargs=* -bang Xpfile <mods>lpfile<bang> <args>
command! -nargs=* Xexpr <mods>lexpr <args>
command! -range -nargs=* Xvimgrep <mods><count>lvimgrep <args>
@@ -75,6 +77,8 @@ func s:setup_commands(cchar)
command! -nargs=0 -count Xcc <count>ll
command! -count=1 -nargs=0 Xbelow <mods><count>lbelow
command! -count=1 -nargs=0 Xabove <mods><count>labove
+ command! -count=1 -nargs=0 Xbefore <mods><count>lbefore
+ command! -count=1 -nargs=0 Xafter <mods><count>lafter
let g:Xgetlist = function('getloclist', [0])
let g:Xsetlist = function('setloclist', [0])
call setloclist(0, [], 'f')
@@ -260,6 +264,9 @@ func XwindowTests(cchar)
\ winheight('.') == 7 &&
\ getline('.') ==# '|| non-error 1')
+ " :cnext in quickfix window should move to the next entry
+ Xnext
+ call assert_equal(2, g:Xgetlist({'idx' : 0}).idx)
" Calling cwindow should close the quickfix window with no valid errors
Xwindow
@@ -431,13 +438,19 @@ func Xtest_browse(cchar)
" result in failure
if a:cchar == 'c'
let err = 'E42:'
+ let cmd = '$cc'
else
let err = 'E776:'
+ let cmd = '$ll'
endif
call assert_fails('Xnext', err)
call assert_fails('Xprev', err)
call assert_fails('Xnfile', err)
call assert_fails('Xpfile', err)
+ call assert_fails(cmd, err)
+
+ Xexpr ''
+ call assert_fails(cmd, 'E42:')
call s:create_test_file('Xqftestfile1')
call s:create_test_file('Xqftestfile2')
@@ -1810,14 +1823,27 @@ func s:test_xgrep(cchar)
enew! | only
set makeef&vim
silent Xgrep Grep_Test_Text: test_quickfix.vim
- call assert_true(len(g:Xgetlist()) == 3)
+ call assert_true(len(g:Xgetlist()) == 5)
Xopen
call assert_true(w:quickfix_title =~ '^:grep')
Xclose
enew
set makeef=Temp_File_##
silent Xgrepadd GrepAdd_Test_Text: test_quickfix.vim
- call assert_true(len(g:Xgetlist()) == 6)
+
+ " Try with 'grepprg' set to 'internal'
+ set grepprg=internal
+ silent Xgrep Grep_Test_Text: test_quickfix.vim
+ silent Xgrepadd GrepAdd_Test_Text: test_quickfix.vim
+ call assert_true(len(g:Xgetlist()) == 9)
+ set grepprg&vim
+
+ call writefile(['Vim'], 'XtestTempFile')
+ set makeef=XtestTempFile
+ silent Xgrep Grep_Test_Text: test_quickfix.vim
+ call assert_equal(5, len(g:Xgetlist()))
+ call assert_false(filereadable('XtestTempFile'))
+ set makeef&vim
endfunc
func Test_grep()
@@ -1914,9 +1940,23 @@ func HistoryTest(cchar)
call assert_equal(' error list 2 of 3; 2 ' . common, res[1])
call assert_equal('> error list 3 of 3; 3 ' . common, res[2])
+ " Test for changing the quickfix lists
+ call assert_equal(3, g:Xgetlist({'nr' : 0}).nr)
+ exe '1' . a:cchar . 'hist'
+ call assert_equal(1, g:Xgetlist({'nr' : 0}).nr)
+ exe '3' . a:cchar . 'hist'
+ call assert_equal(3, g:Xgetlist({'nr' : 0}).nr)
+ call assert_fails('-2' . a:cchar . 'hist', 'E16:')
+ call assert_fails('4' . a:cchar . 'hist', 'E16:')
+
call g:Xsetlist([], 'f')
let l = split(execute(a:cchar . 'hist'), "\n")
call assert_equal('No entries', l[0])
+ if a:cchar == 'c'
+ call assert_fails('4chist', 'E16:')
+ else
+ call assert_fails('4lhist', 'E776:')
+ endif
" An empty list should still show the stack history
call g:Xsetlist([])
@@ -2365,14 +2405,28 @@ func Test_Autocmd()
silent grepadd GrepAdd_Autocmd_Text test_quickfix.vim
silent grep abc123def Xtest
silent grepadd abc123def Xtest
+ set grepprg=internal
+ silent grep Grep_Autocmd_Text test_quickfix.vim
+ silent grepadd GrepAdd_Autocmd_Text test_quickfix.vim
+ silent lgrep Grep_Autocmd_Text test_quickfix.vim
+ silent lgrepadd GrepAdd_Autocmd_Text test_quickfix.vim
+ set grepprg&vim
let l = ['pregrep',
- \ 'postgrep',
- \ 'pregrepadd',
- \ 'postgrepadd',
- \ 'pregrep',
- \ 'postgrep',
- \ 'pregrepadd',
- \ 'postgrepadd']
+ \ 'postgrep',
+ \ 'pregrepadd',
+ \ 'postgrepadd',
+ \ 'pregrep',
+ \ 'postgrep',
+ \ 'pregrepadd',
+ \ 'postgrepadd',
+ \ 'pregrep',
+ \ 'postgrep',
+ \ 'pregrepadd',
+ \ 'postgrepadd',
+ \ 'prelgrep',
+ \ 'postlgrep',
+ \ 'prelgrepadd',
+ \ 'postlgrepadd']
call assert_equal(l, g:acmds)
endif
@@ -2491,6 +2545,19 @@ func Test_cwindow_jump()
call assert_true(winnr('$') == 2)
call assert_true(winnr() == 1)
+ " Jumping to a file from the location list window should find a usuable
+ " window by wrapping around the window list.
+ enew | only
+ call setloclist(0, [], 'f')
+ new | new
+ lgetexpr ["F1%10%Line 10", "F2%20%Line 20", "F3%30%Line 30"]
+ lopen
+ 1close
+ call assert_equal(0, getloclist(3, {'id' : 0}).id)
+ lnext
+ call assert_equal(3, winnr())
+ call assert_equal(getloclist(1, {'id' : 0}).id, getloclist(3, {'id' : 0}).id)
+
enew | only
set efm&vim
endfunc
@@ -4201,17 +4268,22 @@ func Test_empty_qfbuf()
endfunc
" Test for the :cbelow, :cabove, :lbelow and :labove commands.
+" And for the :cafter, :cbefore, :lafter and :lbefore commands.
func Xtest_below(cchar)
call s:setup_commands(a:cchar)
" No quickfix/location list
call assert_fails('Xbelow', 'E42:')
call assert_fails('Xabove', 'E42:')
+ call assert_fails('Xbefore', 'E42:')
+ call assert_fails('Xafter', 'E42:')
" Empty quickfix/location list
call g:Xsetlist([])
call assert_fails('Xbelow', 'E42:')
call assert_fails('Xabove', 'E42:')
+ call assert_fails('Xbefore', 'E42:')
+ call assert_fails('Xafter', 'E42:')
call s:create_test_file('X1')
call s:create_test_file('X2')
@@ -4225,39 +4297,74 @@ func Xtest_below(cchar)
call assert_fails('Xabove', 'E42:')
call assert_fails('3Xbelow', 'E42:')
call assert_fails('4Xabove', 'E42:')
+ call assert_fails('Xbefore', 'E42:')
+ call assert_fails('Xafter', 'E42:')
+ call assert_fails('3Xbefore', 'E42:')
+ call assert_fails('4Xafter', 'E42:')
" Test the commands with various arguments
- Xexpr ["X1:5:L5", "X2:5:L5", "X2:10:L10", "X2:15:L15", "X3:3:L3"]
+ Xexpr ["X1:5:3:L5", "X2:5:2:L5", "X2:10:3:L10", "X2:15:4:L15", "X3:3:5:L3"]
edit +7 X2
Xabove
call assert_equal(['X2', 5], [bufname(''), line('.')])
call assert_fails('Xabove', 'E553:')
+ normal 7G
+ Xbefore
+ call assert_equal(['X2', 5, 2], [bufname(''), line('.'), col('.')])
+ call assert_fails('Xbefore', 'E553:')
+
normal 2j
Xbelow
call assert_equal(['X2', 10], [bufname(''), line('.')])
+ normal 7G
+ Xafter
+ call assert_equal(['X2', 10, 3], [bufname(''), line('.'), col('.')])
+
" Last error in this file
Xbelow 99
call assert_equal(['X2', 15], [bufname(''), line('.')])
call assert_fails('Xbelow', 'E553:')
+ normal gg
+ Xafter 99
+ call assert_equal(['X2', 15, 4], [bufname(''), line('.'), col('.')])
+ call assert_fails('Xafter', 'E553:')
+
" First error in this file
Xabove 99
call assert_equal(['X2', 5], [bufname(''), line('.')])
call assert_fails('Xabove', 'E553:')
+ normal G
+ Xbefore 99
+ call assert_equal(['X2', 5, 2], [bufname(''), line('.'), col('.')])
+ call assert_fails('Xbefore', 'E553:')
+
normal gg
Xbelow 2
call assert_equal(['X2', 10], [bufname(''), line('.')])
+ normal gg
+ Xafter 2
+ call assert_equal(['X2', 10, 3], [bufname(''), line('.'), col('.')])
+
normal G
Xabove 2
call assert_equal(['X2', 10], [bufname(''), line('.')])
+ normal G
+ Xbefore 2
+ call assert_equal(['X2', 10, 3], [bufname(''), line('.'), col('.')])
+
edit X4
call assert_fails('Xabove', 'E42:')
call assert_fails('Xbelow', 'E42:')
+ call assert_fails('Xbefore', 'E42:')
+ call assert_fails('Xafter', 'E42:')
if a:cchar == 'l'
" If a buffer has location list entries from some other window but not
" from the current window, then the commands should fail.
edit X1 | split | call setloclist(0, [], 'f')
call assert_fails('Xabove', 'E776:')
call assert_fails('Xbelow', 'E776:')
+ call assert_fails('Xbefore', 'E776:')
+ call assert_fails('Xafter', 'E776:')
close
endif
@@ -4268,31 +4375,52 @@ func Xtest_below(cchar)
edit +1 X2
Xbelow 2
call assert_equal(['X2', 10, 1], [bufname(''), line('.'), col('.')])
+ normal 1G
+ Xafter 2
+ call assert_equal(['X2', 5, 2], [bufname(''), line('.'), col('.')])
+
normal gg
Xbelow 99
call assert_equal(['X2', 15, 1], [bufname(''), line('.'), col('.')])
+ normal gg
+ Xafter 99
+ call assert_equal(['X2', 15, 3], [bufname(''), line('.'), col('.')])
+
normal G
Xabove 2
call assert_equal(['X2', 10, 1], [bufname(''), line('.'), col('.')])
normal G
+ Xbefore 2
+ call assert_equal(['X2', 15, 2], [bufname(''), line('.'), col('.')])
+
+ normal G
Xabove 99
call assert_equal(['X2', 5, 1], [bufname(''), line('.'), col('.')])
+ normal G
+ Xbefore 99
+ call assert_equal(['X2', 5, 1], [bufname(''), line('.'), col('.')])
+
normal 10G
Xabove
call assert_equal(['X2', 5, 1], [bufname(''), line('.'), col('.')])
+ normal 10G$
+ 2Xbefore
+ call assert_equal(['X2', 10, 2], [bufname(''), line('.'), col('.')])
+
normal 10G
Xbelow
call assert_equal(['X2', 15, 1], [bufname(''), line('.'), col('.')])
+ normal 9G
+ 5Xafter
+ call assert_equal(['X2', 15, 2], [bufname(''), line('.'), col('.')])
" Invalid range
if a:cchar == 'c'
- call assert_fails('-2cbelow', 'E553:')
- " TODO: should go to first error in the current line?
- 0cabove
+ call assert_fails('-2cbelow', 'E16:')
+ call assert_fails('-2cafter', 'E16:')
else
- call assert_fails('-2lbelow', 'E553:')
- " TODO: should go to first error in the current line?
- 0labove
+ call assert_fails('-2lbelow', 'E16:')
+ call assert_fails('-2lafter', 'E16:')
endif
call delete('X1')
@@ -4306,6 +4434,42 @@ func Test_cbelow()
call Xtest_below('l')
endfunc
+func Test_quickfix_count()
+ let commands = [
+ \ 'cNext',
+ \ 'cNfile',
+ \ 'cabove',
+ \ 'cbelow',
+ \ 'cfirst',
+ \ 'clast',
+ \ 'cnewer',
+ \ 'cnext',
+ \ 'cnfile',
+ \ 'colder',
+ \ 'cprevious',
+ \ 'crewind',
+ \
+ \ 'lNext',
+ \ 'lNfile',
+ \ 'labove',
+ \ 'lbelow',
+ \ 'lfirst',
+ \ 'llast',
+ \ 'lnewer',
+ \ 'lnext',
+ \ 'lnfile',
+ \ 'lolder',
+ \ 'lprevious',
+ \ 'lrewind',
+ \ ]
+ for cmd in commands
+ call assert_fails('-1' .. cmd, 'E16:')
+ call assert_fails('.' .. cmd, 'E16:')
+ call assert_fails('%' .. cmd, 'E16:')
+ call assert_fails('$' .. cmd, 'E16:')
+ endfor
+endfunc
+
" Test for aborting quickfix commands using QuickFixCmdPre
func Xtest_qfcmd_abort(cchar)
call s:setup_commands(a:cchar)
@@ -4461,6 +4625,24 @@ func Test_cquit()
call assert_fails('-3cquit', 'E16:')
endfunc
+" Running :lhelpgrep command more than once in a help window, doesn't jump to
+" the help topic
+func Test_lhelpgrep_from_help_window()
+ call mkdir('Xtestdir/doc', 'p')
+ call writefile(['window'], 'Xtestdir/doc/a.txt')
+ call writefile(['buffer'], 'Xtestdir/doc/b.txt')
+ let save_rtp = &rtp
+ let &rtp = 'Xtestdir'
+ lhelpgrep window
+ lhelpgrep buffer
+ call assert_equal('b.txt', fnamemodify(@%, ":p:t"))
+ lhelpgrep window
+ call assert_equal('a.txt', fnamemodify(@%, ":p:t"))
+ let &rtp = save_rtp
+ call delete('Xtestdir', 'rf')
+ new | only!
+endfunc
+
" Test for adding an invalid entry with the quickfix window open and making
" sure that the window contents are not changed
func Test_add_invalid_entry_with_qf_window()
diff --git a/src/nvim/testdir/test_usercommands.vim b/src/nvim/testdir/test_usercommands.vim
index 0a89066a2b..4621207d19 100644
--- a/src/nvim/testdir/test_usercommands.vim
+++ b/src/nvim/testdir/test_usercommands.vim
@@ -393,9 +393,13 @@ func Test_addr_all()
call assert_equal(len(gettabinfo()), g:a2)
bwipe
- command! -addr=other DoSomething echo 'nothing'
+ command! -addr=other DoSomething let g:a1 = <line1> | let g:a2 = <line2>
DoSomething
- call assert_fails('%DoSomething')
+ call assert_equal(line('.'), g:a1)
+ call assert_equal(line('.'), g:a2)
+ %DoSomething
+ call assert_equal(1, g:a1)
+ call assert_equal(line('$'), g:a2)
delcommand DoSomething
endfunc
@@ -421,7 +425,7 @@ func Test_command_list()
\ execute('command DoCmd'))
command! -count=2 DoCmd :
call assert_equal("\n Name Args Address Complete Definition"
- \ .. "\n DoCmd 0 2c :",
+ \ .. "\n DoCmd 0 2c ? :",
\ execute('command DoCmd'))
" Test with various -addr= argument values.
diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim
index bed39d0741..687b1cb989 100644
--- a/src/nvim/testdir/test_window_cmd.vim
+++ b/src/nvim/testdir/test_window_cmd.vim
@@ -856,7 +856,7 @@ func Test_window_resize()
wincmd l
let other_winnr = winnr('h')
call assert_notequal(winnr(), other_winnr)
- exe 'vert ' .. other_winnr .. 'resize -100'
+ exe 'vert ' .. other_winnr .. 'resize -' .. &columns
call assert_equal(0, winwidth(other_winnr))
%bwipe!