0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 7.4.1660

Problem:    has('patch-7.4.1') doesn't work.
Solution:   Fix off-by-one error. (Thinca)
This commit is contained in:
Bram Moolenaar
2016-03-26 21:24:14 +01:00
parent e1581307d2
commit 819821c5a9
5 changed files with 18 additions and 15 deletions

View File

@@ -13838,7 +13838,7 @@ f_has(typval_T *argvars, typval_T *rettv)
if (STRNICMP(name, "patch", 5) == 0) if (STRNICMP(name, "patch", 5) == 0)
{ {
if (name[5] == '-' if (name[5] == '-'
&& STRLEN(name) > 11 && STRLEN(name) >= 11
&& vim_isdigit(name[6]) && vim_isdigit(name[6])
&& vim_isdigit(name[8]) && vim_isdigit(name[8])
&& vim_isdigit(name[10])) && vim_isdigit(name[10]))

View File

@@ -589,15 +589,6 @@ endfunction
endfunction endfunction
:call TestExists() :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 TestExists
:delfunc RunTest :delfunc RunTest
:delfunc TestFuncArg :delfunc TestFuncArg

View File

@@ -204,8 +204,3 @@ OK
g:footest#x = 1 g:footest#x = 1
footest#F() 0 footest#F() 0
UndefFun() 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

View File

@@ -21,3 +21,18 @@ func Test_equal()
call assert_fails('echo base.method > instance.method') call assert_fails('echo base.method > instance.method')
endfunc 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

View File

@@ -748,6 +748,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1660,
/**/ /**/
1659, 1659,
/**/ /**/