1
0
forked from aniani/vim

patch 8.2.0427: it is not possible to check for a typo in a feature name

Problem:    It is not possible to check for a typo in a feature name.
Solution:   Add an extra argument to has().
This commit is contained in:
Bram Moolenaar
2020-03-22 16:17:14 +01:00
parent 9b9be007e7
commit 7929651e05
5 changed files with 1232 additions and 536 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -6,6 +6,9 @@ command -nargs=1 MissingFeature throw 'Skipped: ' .. <args> .. ' feature missing
" Command to check for the presence of a feature.
command -nargs=1 CheckFeature call CheckFeature(<f-args>)
func CheckFeature(name)
if !has(a:name, 1)
throw 'Checking for non-existent feature ' .. a:name
endif
if !has(a:name)
MissingFeature a:name
endif

View File

@@ -20,6 +20,14 @@ func Test_00_bufexists()
call assert_equal(0, bufexists('Xfoo'))
endfunc
func Test_has()
call assert_equal(1, has('eval'))
call assert_equal(1, has('eval', 1))
call assert_equal(0, has('nonexistent'))
call assert_equal(0, has('nonexistent', 1))
endfunc
func Test_empty()
call assert_equal(1, empty(''))
call assert_equal(0, empty('a'))
@@ -1586,7 +1594,7 @@ func Test_confirm()
call assert_equal(2, a)
" confirm() should return 0 when pressing CTRL-C.
call feedkeys("\<C-c>", 'L')
call feedkeys("\<C-C>", 'L')
let a = confirm('Are you sure?', "&Yes\n&No")
call assert_equal(0, a)

View File

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