changeset 8742:03e5171c23e5 v7.4.1660

commit https://github.com/vim/vim/commit/819821c5a95fc60797ecbb5e5ca1302e397e3d9a Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 26 21:24:14 2016 +0100 patch 7.4.1660 Problem: has('patch-7.4.1') doesn't work. Solution: Fix off-by-one error. (Thinca)
author Christian Brabandt <cb@256bit.org>
date Sat, 26 Mar 2016 21:30:05 +0100
parents 8e668324528d
children 42940780f146
files src/eval.c src/testdir/test60.in src/testdir/test60.ok src/testdir/test_expr.vim src/version.c
diffstat 5 files changed, 18 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/eval.c
+++ b/src/eval.c
@@ -13838,7 +13838,7 @@ f_has(typval_T *argvars, typval_T *rettv
 	if (STRNICMP(name, "patch", 5) == 0)
 	{
 	    if (name[5] == '-'
-		    && STRLEN(name) > 11
+		    && STRLEN(name) >= 11
 		    && vim_isdigit(name[6])
 		    && vim_isdigit(name[8])
 		    && vim_isdigit(name[10]))
--- a/src/testdir/test60.in
+++ b/src/testdir/test60.in
@@ -589,15 +589,6 @@ endfunction
 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
--- a/src/testdir/test60.ok
+++ b/src/testdir/test60.ok
@@ -204,8 +204,3 @@ 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
--- a/src/testdir/test_expr.vim
+++ b/src/testdir/test_expr.vim
@@ -21,3 +21,18 @@ func Test_equal()
 
   call assert_fails('echo base.method > instance.method')
 endfunc
+
+func Test_version()
+  call assert_true(has('patch-7.4.001'))
+  call assert_true(has('patch-7.4.01'))
+  call assert_true(has('patch-7.4.1'))
+  call assert_true(has('patch-6.9.999'))
+  call assert_true(has('patch-7.1.999'))
+  call assert_true(has('patch-7.4.123'))
+
+  call assert_false(has('patch-7'))
+  call assert_false(has('patch-7.4'))
+  call assert_false(has('patch-7.4.'))
+  call assert_false(has('patch-9.1.0'))
+  call assert_false(has('patch-9.9.1'))
+endfunc
--- a/src/version.c
+++ b/src/version.c
@@ -749,6 +749,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1660,
+/**/
     1659,
 /**/
     1658,