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:
1729
src/evalfunc.c
1729
src/evalfunc.c
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -738,6 +738,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
427,
|
||||
/**/
|
||||
426,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user