Compare commits

...

6 Commits

Author SHA1 Message Date
Bram Moolenaar
391b1dd040 patch 8.0.0404: not enough testing for quickfix
Problem:    Not enough testing for quickfix.
Solution:   Add some more tests. (Yegappan Lakshmanan)
2017-03-04 13:47:11 +01:00
Bram Moolenaar
24d7636e98 patch 8.0.0403: GUI tests may fail
Problem:    GUI tests may fail.
Solution:   Ignore the E285 error better. (Kazunobu Kuriyama)
2017-03-04 13:32:10 +01:00
Bram Moolenaar
cf5fdf7d16 patch 8.0.0402: :map completion does not have <special>
Problem:    :map completion does not have <special>. (Dominique Pelle)
Solution:   Recognize <special> in completion.  Add a test.
2017-03-02 23:05:51 +01:00
Bram Moolenaar
a0107bdf87 patch 8.0.0401: test fails with missing balloon feature
Problem:    Test fails with missing balloon feature.
Solution:   Add check for balloon feature.
2017-03-02 22:48:01 +01:00
Bram Moolenaar
358f6b0a36 patch 8.0.0400: some tests have a one second delay
Problem:    Some tests have a one second delay.
Solution:   Add --not-a-term in RunVim().
2017-03-02 22:43:01 +01:00
Bram Moolenaar
caf6434ac9 patch 8.0.0399: crash when using balloon_show() when not supported
Problem:    Crash when using balloon_show() when not supported. (Hirohito
            Higashi)
Solution:   Check for balloonEval not to be NULL. (Ken Takata)
2017-03-02 22:11:33 +01:00
9 changed files with 142 additions and 7 deletions

View File

@@ -1375,7 +1375,8 @@ f_atan2(typval_T *argvars, typval_T *rettv)
static void
f_balloon_show(typval_T *argvars, typval_T *rettv UNUSED)
{
gui_mch_post_balloon(balloonEval, get_tv_string_chk(&argvars[0]));
if (balloonEval != NULL)
gui_mch_post_balloon(balloonEval, get_tv_string_chk(&argvars[0]));
}
#endif

View File

@@ -4216,6 +4216,11 @@ set_context_in_map_cmd(
arg = skipwhite(arg + 8);
continue;
}
if (STRNCMP(arg, "<special>", 9) == 0)
{
arg = skipwhite(arg + 9);
continue;
}
#ifdef FEAT_EVAL
if (STRNCMP(arg, "<script>", 8) == 0)
{
@@ -4267,7 +4272,7 @@ ExpandMappings(
{
count = 0;
for (i = 0; i < 6; ++i)
for (i = 0; i < 7; ++i)
{
if (i == 0)
p = (char_u *)"<silent>";
@@ -4285,6 +4290,8 @@ ExpandMappings(
#endif
else if (i == 5)
p = (char_u *)"<nowait>";
else if (i == 6)
p = (char_u *)"<special>";
else
continue;

View File

@@ -192,6 +192,7 @@ func RunVimPiped(before, after, arguments, pipecmd)
if cmd !~ '-u NONE'
let cmd = cmd . ' -u NONE'
endif
let cmd .= ' --not-a-term'
" With pipecmd we can't set VIMRUNTIME.
if a:pipecmd != ''

View File

@@ -25,6 +25,26 @@ func Test_complete_wildmenu()
set nowildmenu
endfunc
func Test_map_completion()
if !has('cmdline_compl')
return
endif
call feedkeys(":map <unique> <si\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <unique> <silent>', getreg(':'))
call feedkeys(":map <script> <un\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <script> <unique>', getreg(':'))
call feedkeys(":map <expr> <sc\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <expr> <script>', getreg(':'))
call feedkeys(":map <buffer> <e\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <buffer> <expr>', getreg(':'))
call feedkeys(":map <nowait> <b\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <nowait> <buffer>', getreg(':'))
call feedkeys(":map <special> <no\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <special> <nowait>', getreg(':'))
call feedkeys(":map <silent> <sp\<Tab>\<Home>\"\<CR>", 'xt')
call assert_equal('"map <silent> <special>', getreg(':'))
endfunc
func Test_match_completion()
if !has('cmdline_compl')
return

View File

@@ -466,3 +466,10 @@ func Test_getbufvar()
set fileformats&
endfunc
func Test_balloon_show()
if has('balloon_eval')
" This won't do anything but must not crash either.
call balloon_show('hi!')
endif
endfunc

View File

@@ -85,15 +85,16 @@ func Test_quoteplus()
let vim_exe = exepath(v:progpath)
let testee = 'VIMRUNTIME=' . $VIMRUNTIME . '; export VIMRUNTIME;'
\ . vim_exe
\ . ' -f -g -u NONE -U NONE --noplugin --cmd ''%s'' -c ''%s'''
\ . ' -u NONE -U NONE --noplugin --not-a-term -c ''%s'''
" Ignore the "failed to create input context" error.
let cmd1 = 'call test_ignore_error("E285")'
let cmd2 = 'call feedkeys("'
let cmd = 'call test_ignore_error("E285") | '
\ . 'gui -f | '
\ . 'call feedkeys("'
\ . '\"+p'
\ . ':s/' . test_call . '/' . test_response . '/\<CR>'
\ . '\"+yis'
\ . ':q!\<CR>", "tx")'
let run_vimtest = printf(testee, cmd1, cmd2)
let run_vimtest = printf(testee, cmd)
" Set the quoteplus register to test_call, and another gvim will launched.
" Then, it first tries to paste the content of its own quotedplus register

View File

@@ -15,7 +15,10 @@ func TearDown()
call GUITearDownCommon()
endfunc
" Make sure that the tests will be done with the GUI activated.
" Ignore the "failed to create input context" error.
call test_ignore_error('E285')
" Start the GUI now, in the foreground.
gui -f
func Test_set_guiheadroom()

View File

@@ -128,6 +128,14 @@ func XlistTests(cchar)
let l = split(result, "\n")
call assert_equal([' 2 Xtestfile1:1 col 3: Line1',
\ ' 3: non-error 2', ' 4 Xtestfile2:2 col 2: Line2'], l)
" Test for '+'
redir => result
Xlist! +2
redir END
let l = split(result, "\n")
call assert_equal([' 2 Xtestfile1:1 col 3: Line1',
\ ' 3: non-error 2', ' 4 Xtestfile2:2 col 2: Line2'], l)
endfunc
func Test_clist()
@@ -925,6 +933,11 @@ func Test_efm2()
\ "(67,3) warning: 's' already defined"
\]
set efm=%+P[%f],(%l\\,%c)%*[\ ]%t%*[^:]:\ %m,%-Q
" To exercise the push/pop file functionality in quickfix, the test files
" need to be created.
call writefile(['Line1'], 'Xtestfile1')
call writefile(['Line2'], 'Xtestfile2')
call writefile(['Line3'], 'Xtestfile3')
cexpr ""
for l in lines
caddexpr l
@@ -935,6 +948,9 @@ func Test_efm2()
call assert_equal(2, l[2].col)
call assert_equal('w', l[2].type)
call assert_equal('e', l[3].type)
call delete('Xtestfile1')
call delete('Xtestfile2')
call delete('Xtestfile3')
" Tests for %E, %C and %Z format specifiers
let lines = ["Error 275",
@@ -1369,11 +1385,25 @@ func Test_switchbuf()
call assert_equal(2, winnr('$'))
call assert_equal(1, bufwinnr('Xqftestfile3'))
" If only quickfix window is open in the current tabpage, jumping to an
" entry with 'switchubf' set to 'usetab' should search in other tabpages.
enew | only
set switchbuf=usetab
tabedit Xqftestfile1
tabedit Xqftestfile2
tabedit Xqftestfile3
tabfirst
copen | only
clast
call assert_equal(4, tabpagenr())
tabfirst | tabonly | enew | only
call delete('Xqftestfile1')
call delete('Xqftestfile2')
call delete('Xqftestfile3')
set switchbuf&vim
enew | only
endfunc
func Xadjust_qflnum(cchar)
@@ -1691,3 +1721,56 @@ func Test_dirstack_cleanup()
caddbuffer
let &efm = save_efm
endfunc
" Tests for jumping to entries from the location list window and quickfix
" window
func Test_cwindow_jump()
set efm=%f%%%l%%%m
lgetexpr ["F1%10%Line 10", "F2%20%Line 20", "F3%30%Line 30"]
lopen | only
lfirst
call assert_true(winnr('$') == 2)
call assert_true(winnr() == 1)
" Location list for the new window should be set
call assert_true(getloclist(0)[2].text == 'Line 30')
" Open a scratch buffer
" Open a new window and create a location list
" Open the location list window and close the other window
" Jump to an entry.
" Should create a new window and jump to the entry. The scrtach buffer
" should not be used.
enew | only
set buftype=nofile
below new
lgetexpr ["F1%10%Line 10", "F2%20%Line 20", "F3%30%Line 30"]
lopen
2wincmd c
lnext
call assert_true(winnr('$') == 3)
call assert_true(winnr() == 2)
" Open two windows with two different location lists
" Open the location list window and close the previous window
" Jump to an entry in the location list window
" Should open the file in the first window and not set the location list.
enew | only
lgetexpr ["F1%5%Line 5"]
below new
lgetexpr ["F1%10%Line 10", "F2%20%Line 20", "F3%30%Line 30"]
lopen
2wincmd c
lnext
call assert_true(winnr() == 1)
call assert_true(getloclist(0)[0].text == 'Line 5')
enew | only
cgetexpr ["F1%10%Line 10", "F2%20%Line 20", "F3%30%Line 30"]
copen
cnext
call assert_true(winnr('$') == 2)
call assert_true(winnr() == 1)
enew | only
set efm&vim
endfunc

View File

@@ -764,6 +764,18 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
404,
/**/
403,
/**/
402,
/**/
401,
/**/
400,
/**/
399,
/**/
398,
/**/