Skip to content

Commit 6318205

Browse files
committed
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 #2186)
1 parent 73f4439 commit 6318205

5 files changed

Lines changed: 28 additions & 8 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ src/pathdef.c
3838
src/Obj*/pathdef.c
3939
gvimext.dll
4040
gvimext.lib
41+
gvim.lib
4142
runtime/doc/uganda.nsis.txt
4243

4344
# Borland C++

src/testdir/Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,18 +126,21 @@ newtests: newtestssilent
126126
newtestssilent: $(NEW_TESTS)
127127

128128

129-
.vim.res:
130-
@echo "$(RUN_VIMTEST)" > vimcmd
129+
.vim.res: writevimcmd
130+
@echo "$(VIMPROG)" > vimcmd
131+
@echo "$(RUN_VIMTEST)" >> vimcmd
131132
$(RUN_VIMTEST) $(NO_INITS) -S runtest.vim $*.vim
132133
@rm vimcmd
133134

134135
test_gui.res: test_gui.vim
135-
@echo "$(RUN_GVIMTEST)" > vimcmd
136+
@echo "$(VIMPROG)" > vimcmd
137+
@echo "$(RUN_GVIMTEST)" >> vimcmd
136138
$(RUN_VIMTEST) -u NONE $(NO_INITS) -S runtest.vim $<
137139
@rm vimcmd
138140

139141
test_gui_init.res: test_gui_init.vim
140-
@echo "$(RUN_GVIMTEST_WITH_GVIMRC)" > vimcmd
142+
@echo "$(VIMPROG)" > vimcmd
143+
@echo "$(RUN_GVIMTEST_WITH_GVIMRC)" >> vimcmd
141144
$(RUN_VIMTEST) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $<
142145
@rm vimcmd
143146

src/testdir/shared.vim

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,15 @@ func s:feedkeys(timer)
170170
call feedkeys('x', 'nt')
171171
endfunc
172172

173+
" Get $VIMPROG to run Vim executable.
174+
" The Makefile writes it as the first line in the "vimcmd" file.
175+
func GetVimProg()
176+
if !filereadable('vimcmd')
177+
return ''
178+
endif
179+
return readfile('vimcmd')[0]
180+
endfunc
181+
173182
" Get the command to run Vim, with -u NONE and --not-a-term arguments.
174183
" If there is an argument use it instead of "NONE".
175184
" Returns an empty string on error.
@@ -182,7 +191,12 @@ func GetVimCommand(...)
182191
else
183192
let name = a:1
184193
endif
185-
let cmd = readfile('vimcmd')[0]
194+
" For Unix Makefile writes the command to use in the second line of the
195+
" "vimcmd" file, including environment options.
196+
" Other Makefiles just write the executable in the first line, so fall back
197+
" to that if there is no second line.
198+
let lines = readfile('vimcmd')
199+
let cmd = get(lines, 1, lines[0])
186200
let cmd = substitute(cmd, '-u \f\+', '-u ' . name, '')
187201
if cmd !~ '-u '. name
188202
let cmd = cmd . ' -u ' . name

src/testdir/test_popup.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -643,10 +643,10 @@ func Test_popup_and_window_resize()
643643
if h < 15
644644
return
645645
endif
646-
let g:buf = term_start([$VIMPROG, '--clean', '-c', 'set noswapfile'], {'term_rows': h / 3})
647-
call term_sendkeys(g:buf, (h / 3 - 1)."o\<esc>G")
648-
call term_sendkeys(g:buf, "i\<c-x>")
646+
let g:buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': h / 3})
647+
call term_sendkeys(g:buf, (h / 3 - 1)."o\<esc>")
649648
call term_wait(g:buf, 200)
649+
call term_sendkeys(g:buf, "Gi\<c-x>")
650650
call term_sendkeys(g:buf, "\<c-v>")
651651
call term_wait(g:buf, 100)
652652
" popup first entry "!" must be at the top

src/version.c

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

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
1179,
764766
/**/
765767
1178,
766768
/**/

0 commit comments

Comments
 (0)