Skip to content

Commit 9e81db9

Browse files
committed
patch 8.1.0406: several command line arguments are not tested
Problem: Several command line arguments are not tested. Solution: Add tests for -A, -F, -H, -p and -V. (Dominique Pelle, closes #3446)
1 parent 664323e commit 9e81db9

2 files changed

Lines changed: 66 additions & 1 deletion

File tree

src/testdir/test_startup.vim

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func Test_o_arg()
199199
" - both windows should have the same height
200200
" - window height (+ 2 for the statusline and Ex command) should be equal
201201
" to the number of lines
202-
" - buffer of both windowns should have no name
202+
" - buffer of both windows should have no name
203203
let [wn, wh1, wh2, ln, ww1, ww2, cn, bn1, bn2] = readfile('Xtestout')
204204
call assert_equal('2', wn)
205205
call assert_inrange(0, 1, ww1 - ww2)
@@ -225,6 +225,69 @@ func Test_o_arg()
225225
call delete('Xtestout')
226226
endfunc
227227

228+
" Test the -p[N] argument to open N tabpages.
229+
func Test_p_arg()
230+
let after = [
231+
\ 'call writefile(split(execute("tabs"), "\n"), "Xtestout")',
232+
\ 'qall',
233+
\ ]
234+
if RunVim([], after, '-p2')
235+
let lines = readfile('Xtestout')
236+
call assert_equal(4, len(lines))
237+
call assert_equal('Tab page 1', lines[0])
238+
call assert_equal('> [No Name]', lines[1])
239+
call assert_equal('Tab page 2', lines[2])
240+
call assert_equal(' [No Name]', lines[3])
241+
endif
242+
243+
if RunVim([], after, '-p foo bar')
244+
let lines = readfile('Xtestout')
245+
call assert_equal(4, len(lines))
246+
call assert_equal('Tab page 1', lines[0])
247+
call assert_equal('> foo', lines[1])
248+
call assert_equal('Tab page 2', lines[2])
249+
call assert_equal(' bar', lines[3])
250+
endif
251+
252+
call delete('Xtestout')
253+
endfunc
254+
255+
" Test the -V[N] argument to set the 'version' option to [N]
256+
func Test_V_arg()
257+
let out = system(GetVimCommand() . ' --clean -es -X -V0 -c "set verbose?" -cq')
258+
call assert_equal(" verbose=0\n", out)
259+
260+
let out = system(GetVimCommand() . ' --clean -es -X -V2 -c "set verbose?" -cq')
261+
call assert_match("^sourcing \"$VIMRUNTIME/defaults\.vim\"\r\nSearching for \"filetype\.vim\".*\n verbose=2\n$", out)
262+
263+
let out = system(GetVimCommand() . ' --clean -es -X -V15 -c "set verbose?" -cq')
264+
call assert_match("\+*\nsourcing \"$VIMRUNTIME/defaults\.vim\"\r\nline 1: \" The default vimrc file\..*\n verbose=15\n\+*", out)
265+
endfunc
266+
267+
" Test the -A, -F and -H arguments (Arabic, Farsi and Hebrew modes).
268+
func Test_A_F_H_arg()
269+
let after = [
270+
\ 'call writefile([&rightleft, &arabic, &fkmap, &hkmap], "Xtestout")',
271+
\ 'qall',
272+
\ ]
273+
if has('arabic') && RunVim([], after, '-A')
274+
let lines = readfile('Xtestout')
275+
call assert_equal(['1', '1', '0', '0'], lines)
276+
endif
277+
278+
if has('farsi') && RunVim([], after, '-F')
279+
let lines = readfile('Xtestout')
280+
call assert_equal(['1', '0', '1', '0'], lines)
281+
endif
282+
283+
if has('rightleft') && RunVim([], after, '-H')
284+
let lines = readfile('Xtestout')
285+
call assert_equal(['1', '0', '0', '1'], lines)
286+
endif
287+
288+
call delete('Xtestout')
289+
endfunc
290+
228291
func Test_file_args()
229292
let after = [
230293
\ 'call writefile(argv(), "Xtestout")',

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,8 @@ static char *(features[]) =
794794

795795
static int included_patches[] =
796796
{ /* Add new patch number below this line */
797+
/**/
798+
406,
797799
/**/
798800
405,
799801
/**/

0 commit comments

Comments
 (0)