diff --git a/src/eval.c b/src/eval.c index c1046955b7..49289070d2 100644 --- 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])) diff --git a/src/testdir/test60.in b/src/testdir/test60.in index 8835df9e0c..d3b299beba 100644 --- 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 diff --git a/src/testdir/test60.ok b/src/testdir/test60.ok index dabcd0c05d..0c382ad281 100644 --- 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 diff --git a/src/testdir/test_expr.vim b/src/testdir/test_expr.vim index 8e55bc53fe..f5c9e26c0c 100644 --- 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 diff --git a/src/version.c b/src/version.c index dccdb902d1..1bd90fa4b1 100644 --- a/src/version.c +++ b/src/version.c @@ -748,6 +748,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1660, /**/ 1659, /**/