vim-patch:8.2.0047: cannot skip tests for specific MS-Windows platform (#13461)

Problem:    Cannot skip tests for specific MS-Windows platform.
Solution:   Add windowsversion().
0c1e3744ff
This commit is contained in:
Jan Edmund Lazo
2020-12-11 19:45:22 -05:00
committed by GitHub
parent a82bcf9d9c
commit 062576f679
7 changed files with 44 additions and 0 deletions

View File

@@ -392,6 +392,7 @@ return {
win_screenpos={args=1},
winbufnr={args=1},
wincol={},
windowsversion={},
winheight={args=1},
winlayout={args={0, 1}},
winline={},

View File

@@ -11213,6 +11213,13 @@ static void f_winwidth(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
}
// "windowsversion()" function
static void f_windowsversion(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
rettv->v_type = VAR_STRING;
rettv->vval.v_string = (char_u *)xstrdup(windowsVersion);
}
/// "wordcount()" function
static void f_wordcount(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{

View File

@@ -1052,4 +1052,7 @@ typedef enum {
#define MIN_CD_SCOPE kCdScopeWindow
#define MAX_CD_SCOPE kCdScopeGlobal
// Only filled for Win32.
EXTERN char windowsVersion[20] INIT(= { 0 });
#endif // NVIM_GLOBALS_H

View File

@@ -169,6 +169,14 @@ void early_init(mparm_T *paramp)
init_normal_cmds(); // Init the table of Normal mode commands.
highlight_init();
#ifdef WIN32
OSVERSIONINFO ovi;
ovi.dwOSVersionInfoSize = sizeof(ovi);
GetVersionEx(&ovi);
snprintf(windowsVersion, sizeof(windowsVersion), "%d.%d",
(int)ovi.dwMajorVersion, (int)ovi.dwMinorVersion);
#endif
#if defined(HAVE_LOCALE_H)
// Setup to use the current locale (for ctype() and many other things).
// NOTE: Translated messages with encodings other than latin1 will not

View File

@@ -348,6 +348,16 @@ func Test_set_values()
endif
endfunc
func Test_renderoptions()
throw 'skipped: Nvim does not support renderoptions'
" Only do this for Windows Vista and later, fails on Windows XP and earlier.
" Doesn't hurt to do this on a non-Windows system.
if windowsversion() !~ '^[345]\.'
set renderoptions=type:directx
set rop=type:directx
endif
endfunc
func ResetIndentexpr()
set indentexpr=
endfunc