summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-08-07 15:51:39 +0200
committerBram Moolenaar <Bram@vim.org>2016-08-07 15:51:39 +0200
commitba98bef1910094179bf90b9467b6e2d2f9462601 (patch)
treed187bbe78d68c2327fe968282014b27c883f28ad
parenta8e691d44937fd9d72dcbad2b8c673682277f13d (diff)
downloadvim-git-ba98bef1910094179bf90b9467b6e2d2f9462601.tar.gz
patch 7.4.2177v7.4.2177
Problem: No testing for -C and -N command line flags, file arguments, startuptime. Solution: Add tests.
-rw-r--r--src/testdir/shared.vim4
-rw-r--r--src/testdir/test_startup.vim86
-rw-r--r--src/version.c2
3 files changed, 89 insertions, 3 deletions
diff --git a/src/testdir/shared.vim b/src/testdir/shared.vim
index 5985ff9e1..a9b090543 100644
--- a/src/testdir/shared.vim
+++ b/src/testdir/shared.vim
@@ -130,7 +130,7 @@ func RunVim(before, after, arguments)
if !filereadable('vimcmd')
return 0
endif
- let args = a:arguments
+ let args = ''
if len(a:before) > 0
call writefile(a:before, 'Xbefore.vim')
let args .= ' --cmd "so Xbefore.vim"'
@@ -145,7 +145,7 @@ func RunVim(before, after, arguments)
if cmd !~ '-u NONE'
let cmd = cmd . ' -u NONE'
endif
- exe "silent !" . cmd . ' ' . args
+ exe "silent !" . cmd . args . ' ' . a:arguments
if len(a:before) > 0
call delete('Xbefore.vim')
diff --git a/src/testdir/test_startup.vim b/src/testdir/test_startup.vim
index f21f4c35b..384dcbe2e 100644
--- a/src/testdir/test_startup.vim
+++ b/src/testdir/test_startup.vim
@@ -69,7 +69,7 @@ func Test_help_arg()
if RunVim([], [], '--help >Xtestout')
let lines = readfile('Xtestout')
call assert_true(len(lines) > 20)
- call assert_true(lines[0] =~ 'Vi IMproved')
+ call assert_match('Vi IMproved', lines[0])
" check if couple of lines are there
let found = 0
@@ -85,3 +85,87 @@ func Test_help_arg()
endif
call delete('Xtestout')
endfunc
+
+func Test_compatible_args()
+ let after = [
+ \ 'call writefile([string(&compatible)], "Xtestout")',
+ \ 'set viminfo+=nviminfo',
+ \ 'quit',
+ \ ]
+ if RunVim([], after, '-C')
+ let lines = readfile('Xtestout')
+ call assert_equal('1', lines[0])
+ endif
+
+ if RunVim([], after, '-N')
+ let lines = readfile('Xtestout')
+ call assert_equal('0', lines[0])
+ endif
+
+ call delete('Xtestout')
+endfunc
+
+func Test_file_args()
+ let after = [
+ \ 'call writefile(argv(), "Xtestout")',
+ \ 'qall',
+ \ ]
+ if RunVim([], after, '')
+ let lines = readfile('Xtestout')
+ call assert_equal(0, len(lines))
+ endif
+
+ if RunVim([], after, 'one')
+ let lines = readfile('Xtestout')
+ call assert_equal(1, len(lines))
+ call assert_equal('one', lines[0])
+ endif
+
+ if RunVim([], after, 'one two three')
+ let lines = readfile('Xtestout')
+ call assert_equal(3, len(lines))
+ call assert_equal('one', lines[0])
+ call assert_equal('two', lines[1])
+ call assert_equal('three', lines[2])
+ endif
+
+ if RunVim([], after, 'one -c echo two')
+ let lines = readfile('Xtestout')
+ call assert_equal(2, len(lines))
+ call assert_equal('one', lines[0])
+ call assert_equal('two', lines[1])
+ endif
+
+ if RunVim([], after, 'one -- -c echo two')
+ let lines = readfile('Xtestout')
+ call assert_equal(4, len(lines))
+ call assert_equal('one', lines[0])
+ call assert_equal('-c', lines[1])
+ call assert_equal('echo', lines[2])
+ call assert_equal('two', lines[3])
+ endif
+
+ call delete('Xtestout')
+endfunc
+
+func Test_startuptime()
+ if !has('startuptime')
+ return
+ endif
+ let after = ['qall']
+ if RunVim([], after, '--startuptime Xtestout one')
+ let lines = readfile('Xtestout')
+ let expected = ['--- VIM STARTING ---', 'parsing arguments',
+ \ 'shell init', 'inits 3', 'start termcap', 'opening buffers']
+ let found = []
+ for line in lines
+ for exp in expected
+ if line =~ exp
+ call add(found, exp)
+ endif
+ endfor
+ endfor
+ call assert_equal(expected, found)
+ endif
+ call delete('Xtestout')
+endfunc
diff --git a/src/version.c b/src/version.c
index 4d6765f05..29d845fa1 100644
--- a/src/version.c
+++ b/src/version.c
@@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2177,
+/**/
2176,
/**/
2175,