diff options
author | Bram Moolenaar <Bram@vim.org> | 2014-04-01 22:08:54 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2014-04-01 22:08:54 +0200 |
commit | 7f3be402cecb458ac2a8d385bb7303d8b27f9af4 (patch) | |
tree | 3d74574688e990af2c4f46dcc1500d07a469ad5b | |
parent | c7f025536e9e5b7b95b55d09094febb627395d05 (diff) | |
download | vim-git-7f3be402cecb458ac2a8d385bb7303d8b27f9af4.tar.gz |
updated for version 7.4.236v7.4.236
Problem: It's not that easy to check the Vim patch version.
Solution: Make has("patch-7.4.123") work. (partly by Marc Weber)
-rw-r--r-- | src/eval.c | 22 | ||||
-rw-r--r-- | src/testdir/test60.in | 12 | ||||
-rw-r--r-- | src/testdir/test60.ok | 5 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 39 insertions, 2 deletions
diff --git a/src/eval.c b/src/eval.c index 65419cb36..042afca36 100644 --- a/src/eval.c +++ b/src/eval.c @@ -12638,7 +12638,27 @@ f_has(argvars, rettv) if (n == FALSE) { if (STRNICMP(name, "patch", 5) == 0) - n = has_patch(atoi((char *)name + 5)); + { + if (name[5] == '-' + && STRLEN(name) > 11 + && vim_isdigit(name[6]) + && vim_isdigit(name[8]) + && vim_isdigit(name[10])) + { + int major = atoi((char *)name + 6); + int minor = atoi((char *)name + 8); + int patch = atoi((char *)name + 10); + + /* Expect "patch-9.9.01234". */ + n = (major < VIM_VERSION_MAJOR + || (major == VIM_VERSION_MAJOR + && (minor < VIM_VERSION_MINOR + || (minor == VIM_VERSION_MINOR + && patch <= highest_patch())))); + } + else + n = has_patch(atoi((char *)name + 5)); + } else if (STRICMP(name, "vim_starting") == 0) n = (starting != 0); #ifdef FEAT_MBYTE diff --git a/src/testdir/test60.in b/src/testdir/test60.in index 0f30142dc..8835df9e0 100644 --- a/src/testdir/test60.in +++ b/src/testdir/test60.in @@ -1,4 +1,4 @@ -Tests for the exists() function. vim: set ft=vim ts=8 : +Tests for the exists() and has() functions. vim: set ft=vim ts=8 sw=2 : STARTTEST :so small.vim @@ -588,6 +588,16 @@ endfunction redir END 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 0c382ad28..dabcd0c05 100644 --- a/src/testdir/test60.ok +++ b/src/testdir/test60.ok @@ -204,3 +204,8 @@ 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/version.c b/src/version.c index 295af344a..6b63fbc5a 100644 --- a/src/version.c +++ b/src/version.c @@ -735,6 +735,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 236, +/**/ 235, /**/ 234, |