mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
vim-patch:8.0.1179: Test_popup_and_window_resize() does not always pass
Problem: Test_popup_and_window_resize() does not always pass. Solution: Do not use $VIMPROG, pass the Vim executable in the vimcmd file. (Ozaki Kiichi, closes vim/vim#2186)631820536e
vim-patch:8.0.1526: no test using a screen dump yet Problem: No test using a screen dump yet. Solution: Add a test for C syntax highlighting. Add helper functions.da65058a9c
NOTE: uses modified `GetVimProg()` (which is used with skipped tests only (mostly because of `!has('terminal')`)). Vim uses a 'vimcmd' file, while Nvim uses `$NVIM_TEST_ARGX` environment variables. Ref: https://github.com/vim/vim/pull/4806
This commit is contained in:
@@ -196,16 +196,26 @@ func s:feedkeys(timer)
|
|||||||
call feedkeys('x', 'nt')
|
call feedkeys('x', 'nt')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Get $VIMPROG to run Vim executable.
|
||||||
|
" The Makefile writes it as the first line in the "vimcmd" file.
|
||||||
|
" Nvim: uses $NVIM_TEST_ARG0.
|
||||||
|
func GetVimProg()
|
||||||
|
if empty($NVIM_TEST_ARG0)
|
||||||
|
" Assume the script was sourced instead of running "make".
|
||||||
|
return '../../../build/bin/nvim'
|
||||||
|
endif
|
||||||
|
return $NVIM_TEST_ARG0
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Get the command to run Vim, with -u NONE and --headless arguments.
|
" Get the command to run Vim, with -u NONE and --headless arguments.
|
||||||
" If there is an argument use it instead of "NONE".
|
" If there is an argument use it instead of "NONE".
|
||||||
" Returns an empty string on error.
|
|
||||||
func GetVimCommand(...)
|
func GetVimCommand(...)
|
||||||
if a:0 == 0
|
if a:0 == 0
|
||||||
let name = 'NONE'
|
let name = 'NONE'
|
||||||
else
|
else
|
||||||
let name = a:1
|
let name = a:1
|
||||||
endif
|
endif
|
||||||
let cmd = v:progpath
|
let cmd = GetVimProg()
|
||||||
let cmd = substitute(cmd, '-u \f\+', '-u ' . name, '')
|
let cmd = substitute(cmd, '-u \f\+', '-u ' . name, '')
|
||||||
if cmd !~ '-u '. name
|
if cmd !~ '-u '. name
|
||||||
let cmd = cmd . ' -u ' . name
|
let cmd = cmd . ' -u ' . name
|
||||||
@@ -215,6 +225,14 @@ func GetVimCommand(...)
|
|||||||
return cmd
|
return cmd
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Get the command to run Vim, with --clean.
|
||||||
|
func GetVimCommandClean()
|
||||||
|
let cmd = GetVimCommand()
|
||||||
|
let cmd = substitute(cmd, '-u NONE', '--clean', '')
|
||||||
|
let cmd = substitute(cmd, '--headless', '', '')
|
||||||
|
return cmd
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Run Vim, using the "vimcmd" file and "-u NORC".
|
" Run Vim, using the "vimcmd" file and "-u NORC".
|
||||||
" "before" is a list of Vim commands to be executed before loading plugins.
|
" "before" is a list of Vim commands to be executed before loading plugins.
|
||||||
" "after" is a list of Vim commands to be executed after loading plugins.
|
" "after" is a list of Vim commands to be executed after loading plugins.
|
||||||
|
@@ -669,10 +669,10 @@ func Test_popup_and_window_resize()
|
|||||||
if h < 15
|
if h < 15
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
let g:buf = term_start([$NVIM_PRG, '--clean', '-c', 'set noswapfile'], {'term_rows': h / 3})
|
let g:buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': h / 3})
|
||||||
call term_sendkeys(g:buf, (h / 3 - 1)."o\<esc>G")
|
call term_sendkeys(g:buf, (h / 3 - 1)."o\<esc>")
|
||||||
call term_sendkeys(g:buf, "i\<c-x>")
|
|
||||||
call term_wait(g:buf, 200)
|
call term_wait(g:buf, 200)
|
||||||
|
call term_sendkeys(g:buf, "Gi\<c-x>")
|
||||||
call term_sendkeys(g:buf, "\<c-v>")
|
call term_sendkeys(g:buf, "\<c-v>")
|
||||||
call term_wait(g:buf, 100)
|
call term_wait(g:buf, 100)
|
||||||
" popup first entry "!" must be at the top
|
" popup first entry "!" must be at the top
|
||||||
|
@@ -470,7 +470,7 @@ func Test_bg_detection()
|
|||||||
hi Normal ctermbg=NONE
|
hi Normal ctermbg=NONE
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
fun Test_synstack_synIDtrans()
|
func Test_synstack_synIDtrans()
|
||||||
new
|
new
|
||||||
setfiletype c
|
setfiletype c
|
||||||
syntax on
|
syntax on
|
||||||
@@ -494,6 +494,39 @@ fun Test_synstack_synIDtrans()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Check highlighting for a small piece of C code with a screen dump.
|
||||||
|
func Test_syntax_c()
|
||||||
|
if !has('terminal')
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
call writefile([
|
||||||
|
\ '/* comment line at the top */',
|
||||||
|
\ ' int',
|
||||||
|
\ 'main(int argc, char **argv)// another comment',
|
||||||
|
\ '{',
|
||||||
|
\ '#if 0',
|
||||||
|
\ ' int not_used;',
|
||||||
|
\ '#else',
|
||||||
|
\ ' int used;',
|
||||||
|
\ '#endif',
|
||||||
|
\ ' printf("Just an example piece of C code\n");',
|
||||||
|
\ ' return 0x0ff;',
|
||||||
|
\ '}',
|
||||||
|
\ ' static void',
|
||||||
|
\ 'myFunction(const double count, struct nothing, long there) {',
|
||||||
|
\ ' // 123: nothing to read here',
|
||||||
|
\ ' for (int i = 0; i < count; ++i) {',
|
||||||
|
\ ' break;',
|
||||||
|
\ ' }',
|
||||||
|
\ '}',
|
||||||
|
\ ], 'Xtest.c')
|
||||||
|
let buf = RunVimInTerminal('Xtest.c', {})
|
||||||
|
call VerifyScreenDump(buf, 'Test_syntax_c_01')
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
|
||||||
|
call delete('Xtest.c')
|
||||||
|
endfun
|
||||||
|
|
||||||
" Using \z() in a region with NFA failing should not crash.
|
" Using \z() in a region with NFA failing should not crash.
|
||||||
func Test_syn_wrong_z_one()
|
func Test_syn_wrong_z_one()
|
||||||
new
|
new
|
||||||
|
Reference in New Issue
Block a user