aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-03-26 19:23:51 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-04-01 07:23:04 -0400
commit3784827f8df9a324c395a0589d12fc80f4eea2d3 (patch)
tree8edf1d6005d921cfa7cb3abf2af67cf345258b90
parent3b04ba7544cf78ab4d9e7e9ee4536a2e7a916fe6 (diff)
downloadrneovim-3784827f8df9a324c395a0589d12fc80f4eea2d3.tar.gz
rneovim-3784827f8df9a324c395a0589d12fc80f4eea2d3.tar.bz2
rneovim-3784827f8df9a324c395a0589d12fc80f4eea2d3.zip
vim-patch:8.2.2656: some command line arguments and regexp errors not tested
Problem: Some command line arguments and regexp errors not tested. Solution: Add a few test cases. (Dominique Pellé, closes vim/vim#8013) https://github.com/vim/vim/commit/a2b3e7dc9201fb3d8782c6b4ab53862160e254da Cherry-pick Test_t_arg() from patch v8.2.0509.
-rw-r--r--src/nvim/testdir/test_startup.vim38
1 files changed, 34 insertions, 4 deletions
diff --git a/src/nvim/testdir/test_startup.vim b/src/nvim/testdir/test_startup.vim
index 63affd6910..744fae4e60 100644
--- a/src/nvim/testdir/test_startup.vim
+++ b/src/nvim/testdir/test_startup.vim
@@ -814,6 +814,34 @@ func Test_v_argv()
call assert_equal(['arg1', '--cmd', 'echo v:argv', '--cmd', 'q'']'], list[idx:])
endfunc
+" Test for the '-t' option to jump to a tag
+func Test_t_arg()
+ let before =<< trim [CODE]
+ set tags=Xtags
+ [CODE]
+ let after =<< trim [CODE]
+ let s = bufname('') .. ':L' .. line('.') .. 'C' .. col('.')
+ call writefile([s], "Xtestout")
+ qall
+ [CODE]
+ call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
+ \ "first\tXfile1\t/^ \\zsfirst$/",
+ \ "second\tXfile1\t/^ \\zssecond$/",
+ \ "third\tXfile1\t/^ \\zsthird$/"],
+ \ 'Xtags')
+ call writefile([' first', ' second', ' third'], 'Xfile1')
+
+ for t_arg in ['-t second', '-tsecond']
+ if RunVim(before, after, '-t second')
+ call assert_equal(['Xfile1:L2C5'], readfile('Xtestout'), t_arg)
+ call delete('Xtestout')
+ endif
+ endfor
+
+ call delete('Xtags')
+ call delete('Xfile1')
+endfunc
+
" Test the '-T' argument which sets the 'term' option.
func Test_T_arg()
throw 'skipped: Nvim does not support "-T" argument'
@@ -913,10 +941,12 @@ func Test_w_arg()
" A number argument sets the 'window' option
call writefile(["iwindow \<C-R>=&window\<CR>\<Esc>:wq! Xresult\<CR>"], 'Xscriptin', 'b')
- if RunVim([], [], '-s Xscriptin -w 17')
- call assert_equal(["window 17"], readfile('Xresult'))
- call delete('Xresult')
- endif
+ for w_arg in ['-w 17', '-w17']
+ if RunVim([], [], '-s Xscriptin ' .. w_arg)
+ call assert_equal(["window 17"], readfile('Xresult'), w_arg)
+ call delete('Xresult')
+ endif
+ endfor
call delete('Xscriptin')
endfunc