Skip to content

Commit f8c52e8

Browse files
committed
patch 8.2.2611: conditions for startup tests are not exactly right
Problem: Conditions for startup tests are not exactly right. Solution: Check for type of GUI instead of MS-Windows. (Ozaki Kiichi, closes #7976)
1 parent 1e44846 commit f8c52e8

4 files changed

Lines changed: 36 additions & 7 deletions

File tree

src/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3542,8 +3542,11 @@ usage(void)
35423542
#endif // FEAT_GUI_X11
35433543
#ifdef FEAT_GUI_GTK
35443544
mch_msg(_("\nArguments recognised by gvim (GTK+ version):\n"));
3545+
main_msg(_("-background <color>\tUse <color> for the background (also: -bg)"));
3546+
main_msg(_("-foreground <color>\tUse <color> for normal text (also: -fg)"));
35453547
main_msg(_("-font <font>\t\tUse <font> for normal text (also: -fn)"));
35463548
main_msg(_("-geometry <geom>\tUse <geom> for initial geometry (also: -geom)"));
3549+
main_msg(_("-iconic\t\tStart Vim iconified"));
35473550
main_msg(_("-reverse\t\tUse reverse video (also: -rv)"));
35483551
main_msg(_("-display <display>\tRun Vim on <display> (also: --display)"));
35493552
main_msg(_("--role <role>\tSet a unique role to identify the main window"));

src/testdir/check.vim

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,29 @@ func CheckNotAsan()
199199
endif
200200
endfunc
201201

202+
" Command to check for satisfying any of the conditions.
203+
" e.g. CheckAnyOf Feature:bsd Feature:sun Linux
204+
command -nargs=+ CheckAnyOf call CheckAnyOf(<f-args>)
205+
func CheckAnyOf(...)
206+
let excp = []
207+
for arg in a:000
208+
try
209+
exe 'Check' .. substitute(arg, ':', ' ', '')
210+
return
211+
catch /^Skipped:/
212+
let excp += [substitute(v:exception, '^Skipped:\s*', '', '')]
213+
endtry
214+
endfor
215+
throw 'Skipped: ' .. join(excp, '; ')
216+
endfunc
217+
218+
" Command to check for satisfying all of the conditions.
219+
" e.g. CheckAllOf Unix Gui Option:ballooneval
220+
command -nargs=+ CheckAllOf call CheckAllOf(<f-args>)
221+
func CheckAllOf(...)
222+
for arg in a:000
223+
exe 'Check' .. substitute(arg, ':', ' ', '')
224+
endfor
225+
endfunc
226+
202227
" vim: shiftwidth=2 sts=2 expandtab

src/testdir/test_startup.vim

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,8 @@ func Test_pack_in_rtp_when_plugins_run()
109109
endfunc
110110

111111
func Test_help_arg()
112-
if !has('unix') && has('gui_running')
113-
throw 'Skipped: does not work with gvim on MS-Windows'
114-
endif
112+
" This does not work with a GUI-only binary, such as on MS-Windows.
113+
CheckAnyOf Unix NotGui
115114

116115
if RunVim([], [], '--help >Xtestout')
117116
let lines = readfile('Xtestout')
@@ -426,7 +425,7 @@ endfunction
426425
" Test the -reverse and +reverse arguments (for GUI only).
427426
func Test_reverse()
428427
CheckCanRunGui
429-
CheckNotMSWindows
428+
CheckAnyOf Feature:gui_gtk Feature:gui_motif Feature:gui_athena
430429

431430
let after =<< trim [CODE]
432431
call writefile([&background], "Xtest_reverse")
@@ -447,7 +446,7 @@ endfunc
447446
" Test the -background and -foreground arguments (for GUI only).
448447
func Test_background_foreground()
449448
CheckCanRunGui
450-
CheckNotMSWindows
449+
CheckAnyOf Feature:gui_gtk Feature:gui_motif Feature:gui_athena
451450

452451
" Is there a better way to check the effect of -background & -foreground
453452
" other than merely looking at &background (dark or light)?
@@ -496,7 +495,7 @@ endfunc
496495
" Test the -geometry argument (for GUI only).
497496
func Test_geometry()
498497
CheckCanRunGui
499-
CheckNotMSWindows
498+
CheckAnyOf Feature:gui_gtk Feature:gui_motif Feature:gui_athena
500499

501500
if has('gui_motif') || has('gui_athena')
502501
" FIXME: With GUI Athena or Motif, the value of getwinposx(),
@@ -528,7 +527,7 @@ endfunc
528527
" Test the -iconic argument (for GUI only).
529528
func Test_iconic()
530529
CheckCanRunGui
531-
CheckNotMSWindows
530+
CheckAnyOf Feature:gui_gtk Feature:gui_motif Feature:gui_athena
532531

533532
call RunVim([], [], '-f -g -iconic -cq')
534533

src/version.c

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

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2611,
753755
/**/
754756
2610,
755757
/**/

0 commit comments

Comments
 (0)