From d152e2f3fd70fe76a6f6453754c0ed848ccef8c6 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Tue, 22 Nov 2016 07:24:26 +0900 Subject: vim-patch:7.4.1660 Problem: has('patch-7.4.1') doesn't work. Solution: Fix off-by-one error. (Thinca) https://github.com/vim/vim/commit/819821c5a95fc60797ecbb5e5ca1302e397e3d9a --- src/nvim/eval.c | 2 +- src/nvim/testdir/test_expr.vim | 15 +++++++++++++++ src/nvim/version.c | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 750ef4f94f..fc2f435508 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -10658,7 +10658,7 @@ static void f_has(typval_T *argvars, typval_T *rettv, FunPtr fptr) if (!n) { if (STRNICMP(name, "patch", 5) == 0) { if (name[5] == '-' - && strlen(name) > 11 + && strlen(name) >= 11 && ascii_isdigit(name[6]) && ascii_isdigit(name[8]) && ascii_isdigit(name[10])) { diff --git a/src/nvim/testdir/test_expr.vim b/src/nvim/testdir/test_expr.vim index 7ea4ebc7df..83b5e66fe0 100644 --- a/src/nvim/testdir/test_expr.vim +++ b/src/nvim/testdir/test_expr.vim @@ -1,5 +1,20 @@ " Tests for expressions. +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 + func Test_strgetchar() call assert_equal(char2nr('a'), strgetchar('axb', 0)) call assert_equal(char2nr('x'), strgetchar('axb', 1)) diff --git a/src/nvim/version.c b/src/nvim/version.c index 8f3619f1e8..56856397e6 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -784,7 +784,7 @@ static int included_patches[] = { 1663, // 1662 NA // 1661 NA - // 1660, + 1660, // 1659 NA 1658, // 1657 NA -- cgit