if (n == FALSE)
{
if (STRNICMP(name, "patch", 5) == 0)
- n = has_patch(atoi((char *)name + 5));
+ {
+ if (name[5] == '-'
+ && STRLEN(name) > 11
+ && vim_isdigit(name[6])
+ && vim_isdigit(name[8])
+ && vim_isdigit(name[10]))
+ {
+ int major = atoi((char *)name + 6);
+ int minor = atoi((char *)name + 8);
+ int patch = atoi((char *)name + 10);
+
+ /* Expect "patch-9.9.01234". */
+ n = (major < VIM_VERSION_MAJOR
+ || (major == VIM_VERSION_MAJOR
+ && (minor < VIM_VERSION_MINOR
+ || (minor == VIM_VERSION_MINOR
+ && patch <= highest_patch()))));
+ }
+ else
+ n = has_patch(atoi((char *)name + 5));
+ }
else if (STRICMP(name, "vim_starting") == 0)
n = (starting != 0);
#ifdef FEAT_MBYTE
-Tests for the exists() function. vim: set ft=vim ts=8 :
+Tests for the exists() and has() functions. vim: set ft=vim ts=8 sw=2 :
STARTTEST
:so small.vim
redir END
endfunction
:call TestExists()
+:"
+:function TestHas()
+ redir >> test.out
+ for pl in ['6.9.999', '7.1.999', '7.4.123', '9.1.0', '9.9.1']
+ echo 'has patch ' . pl . ': ' . has('patch-' . pl)
+ endfor
+ redir END
+endfunc
+:call TestHas()
+:"
:delfunc TestExists
:delfunc RunTest
:delfunc TestFuncArg