mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.2583: Vim9: cannot compare result of getenv() with null
Problem: Vim9: cannot compare result of getenv() with null. Solution: Make the return type of getenv() "any". (closes #7943)
This commit is contained in:
@@ -1021,7 +1021,7 @@ static funcentry_T global_functions[] =
|
|||||||
{"getcwd", 0, 2, FEARG_1, NULL,
|
{"getcwd", 0, 2, FEARG_1, NULL,
|
||||||
ret_string, f_getcwd},
|
ret_string, f_getcwd},
|
||||||
{"getenv", 1, 1, FEARG_1, NULL,
|
{"getenv", 1, 1, FEARG_1, NULL,
|
||||||
ret_string, f_getenv},
|
ret_any, f_getenv},
|
||||||
{"getfontname", 0, 1, 0, NULL,
|
{"getfontname", 0, 1, 0, NULL,
|
||||||
ret_string, f_getfontname},
|
ret_string, f_getfontname},
|
||||||
{"getfperm", 1, 1, FEARG_1, NULL,
|
{"getfperm", 1, 1, FEARG_1, NULL,
|
||||||
|
@@ -472,6 +472,19 @@ def Test_getchar()
|
|||||||
getchar(true)->assert_equal(0)
|
getchar(true)->assert_equal(0)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
def Test_getenv()
|
||||||
|
if getenv('does-not_exist') == ''
|
||||||
|
assert_report('getenv() should return null')
|
||||||
|
endif
|
||||||
|
if getenv('does-not_exist') == null
|
||||||
|
else
|
||||||
|
assert_report('getenv() should return null')
|
||||||
|
endif
|
||||||
|
$SOMEENVVAR = 'some'
|
||||||
|
assert_equal('some', getenv('SOMEENVVAR'))
|
||||||
|
unlet $SOMEENVVAR
|
||||||
|
enddef
|
||||||
|
|
||||||
def Test_getcompletion()
|
def Test_getcompletion()
|
||||||
set wildignore=*.vim,*~
|
set wildignore=*.vim,*~
|
||||||
var l = getcompletion('run', 'file', true)
|
var l = getcompletion('run', 'file', true)
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2583,
|
||||||
/**/
|
/**/
|
||||||
2582,
|
2582,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user