Skip to content

Commit 819821c

Browse files
committed
patch 7.4.1660
Problem: has('patch-7.4.1') doesn't work. Solution: Fix off-by-one error. (Thinca)
1 parent e158130 commit 819821c

5 files changed

Lines changed: 18 additions & 15 deletions

File tree

src/eval.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13838,7 +13838,7 @@ f_has(typval_T *argvars, typval_T *rettv)
1383813838
if (STRNICMP(name, "patch", 5) == 0)
1383913839
{
1384013840
if (name[5] == '-'
13841-
&& STRLEN(name) > 11
13841+
&& STRLEN(name) >= 11
1384213842
&& vim_isdigit(name[6])
1384313843
&& vim_isdigit(name[8])
1384413844
&& vim_isdigit(name[10]))

src/testdir/test60.in

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -589,15 +589,6 @@ endfunction
589589
endfunction
590590
:call TestExists()
591591
:"
592-
:function TestHas()
593-
redir >> test.out
594-
for pl in ['6.9.999', '7.1.999', '7.4.123', '9.1.0', '9.9.1']
595-
echo 'has patch ' . pl . ': ' . has('patch-' . pl)
596-
endfor
597-
redir END
598-
endfunc
599-
:call TestHas()
600-
:"
601592
:delfunc TestExists
602593
:delfunc RunTest
603594
:delfunc TestFuncArg

src/testdir/test60.ok

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,3 @@ OK
204204
g:footest#x = 1
205205
footest#F() 0
206206
UndefFun() 0
207-
has patch 6.9.999: 1
208-
has patch 7.1.999: 1
209-
has patch 7.4.123: 1
210-
has patch 9.1.0: 0
211-
has patch 9.9.1: 0

src/testdir/test_expr.vim

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,18 @@ func Test_equal()
2121

2222
call assert_fails('echo base.method > instance.method')
2323
endfunc
24+
25+
func Test_version()
26+
call assert_true(has('patch-7.4.001'))
27+
call assert_true(has('patch-7.4.01'))
28+
call assert_true(has('patch-7.4.1'))
29+
call assert_true(has('patch-6.9.999'))
30+
call assert_true(has('patch-7.1.999'))
31+
call assert_true(has('patch-7.4.123'))
32+
33+
call assert_false(has('patch-7'))
34+
call assert_false(has('patch-7.4'))
35+
call assert_false(has('patch-7.4.'))
36+
call assert_false(has('patch-9.1.0'))
37+
call assert_false(has('patch-9.9.1'))
38+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,8 @@ static char *(features[]) =
748748

749749
static int included_patches[] =
750750
{ /* Add new patch number below this line */
751+
/**/
752+
1660,
751753
/**/
752754
1659,
753755
/**/

0 commit comments

Comments
 (0)