diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-09-21 12:54:06 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-09-21 12:54:06 +0200 |
commit | 036b09ca78c5516d2b914ebc9494bf7580b8fed8 (patch) | |
tree | 47cde47ccb0ebf73126ec4b802a17292a029fa4c | |
parent | b0e982bf05feb27eddb5f809b052c1137f4d4add (diff) | |
download | vim-git-036b09ca78c5516d2b914ebc9494bf7580b8fed8.tar.gz |
patch 8.1.0417: several command line arguments are not testedv8.1.0417
Problem: Several command line arguments are not tested.
Solution: Add tests for -m, -M, -R and -Vfile. (Dominique Pelle,
closes #3458)
-rw-r--r-- | src/testdir/test_startup.vim | 50 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 48 insertions, 4 deletions
diff --git a/src/testdir/test_startup.vim b/src/testdir/test_startup.vim index 3fc59bb5b..4a296ec01 100644 --- a/src/testdir/test_startup.vim +++ b/src/testdir/test_startup.vim @@ -194,8 +194,8 @@ func Test_o_arg() " Open 2 windows split vertically. Expect: " - 2 windows " - both windows should have the same or almost the same width - " - sum of both windows width (+ 1 separator) should be equal to the - " number of columns + " - sum of both windows width (+ 1 for the separator) should be equal to + " the number of columns " - both windows should have the same height " - window height (+ 2 for the statusline and Ex command) should be equal " to the number of lines @@ -269,6 +269,48 @@ func Test_V_arg() call assert_match("sourcing \"$VIMRUNTIME[\\/]defaults\.vim\"\r\nline 1: \" The default vimrc file\..* verbose=15\n", out) endfunc +" Test the -V[N]{filename} argument to set the 'verbose' option to N +" and set 'verbosefile' to filename. +func Test_V_file_arg() + if RunVim([], [], ' --clean -X -V2Xverbosefile -c "set verbose? verbosefile?" -cq') + let out = join(readfile('Xverbosefile'), "\n") + call assert_match("sourcing \"$VIMRUNTIME[\\/]defaults\.vim\"\n", out) + call assert_match("\n verbose=2\n", out) + call assert_match("\n verbosefile=Xverbosefile", out) + endif + + call delete('Xverbosefile') +endfunc + +" Test the -m, -M and -R arguments: +" -m resets 'write' +" -M resets 'modifiable' and 'write' +" -R sets 'readonly' +func Test_m_M_R() + let after = [ + \ 'call writefile([&write, &modifiable, &readonly, &updatecount], "Xtestout")', + \ 'qall', + \ ] + if RunVim([], after, '') + let lines = readfile('Xtestout') + call assert_equal(['1', '1', '0', '200'], lines) + endif + if RunVim([], after, '-m') + let lines = readfile('Xtestout') + call assert_equal(['0', '1', '0', '200'], lines) + endif + if RunVim([], after, '-M') + let lines = readfile('Xtestout') + call assert_equal(['0', '0', '0', '200'], lines) + endif + if RunVim([], after, '-R') + let lines = readfile('Xtestout') + call assert_equal(['1', '1', '1', '10000'], lines) + endif + + call delete('Xtestout') +endfunc + " Test the -A, -F and -H arguments (Arabic, Farsi and Hebrew modes). func Test_A_F_H_arg() let after = [ @@ -430,7 +472,7 @@ func Test_zzz_startinsert() call writefile(['123456'], 'Xtestout') let after = [ \ ':startinsert', - \ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")' + \ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")' \ ] if RunVim([], after, 'Xtestout') let lines = readfile('Xtestout') @@ -440,7 +482,7 @@ func Test_zzz_startinsert() call writefile(['123456'], 'Xtestout') let after = [ \ ':startinsert!', - \ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")' + \ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")' \ ] if RunVim([], after, 'Xtestout') let lines = readfile('Xtestout') diff --git a/src/version.c b/src/version.c index b76df9eea..1a6b94d9d 100644 --- a/src/version.c +++ b/src/version.c @@ -795,6 +795,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 417, +/**/ 416, /**/ 415, |