]> granicus.if.org Git - vim/commitdiff
updated for version 7.4.236 v7.4.236
authorBram Moolenaar <Bram@vim.org>
Tue, 1 Apr 2014 20:08:54 +0000 (22:08 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 1 Apr 2014 20:08:54 +0000 (22:08 +0200)
Problem:    It's not that easy to check the Vim patch version.
Solution:   Make has("patch-7.4.123") work. (partly by Marc Weber)

src/eval.c
src/testdir/test60.in
src/testdir/test60.ok
src/version.c

index 65419cb367b5e732dcb67d620254cf1fabf0ae71..042afca3695e696940d868fa1e9390b7f622879a 100644 (file)
@@ -12638,7 +12638,27 @@ f_has(argvars, rettv)
     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
index 0f30142dcfcebcf0766f82ea94ac2ed98828a5e1..8835df9e0ca62ccea9a148b2e07c78677cb184b0 100644 (file)
@@ -1,4 +1,4 @@
-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
@@ -588,6 +588,16 @@ endfunction
     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
index 0c382ad281ec9739694b9d9ddcc6e8f7ffeca988..dabcd0c05da21fe8663610a94c355bbbc2e49007 100644 (file)
@@ -204,3 +204,8 @@ OK
  g:footest#x = 1
    footest#F() 0
 UndefFun() 0
+has patch 6.9.999: 1
+has patch 7.1.999: 1
+has patch 7.4.123: 1
+has patch 9.1.0: 0
+has patch 9.9.1: 0
index 295af344ab4859162ae16dcfd7d9e342970cbb43..6b63fbc5a657fcc8af05184c3503a552eb59d7af 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    236,
 /**/
     235,
 /**/