0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.0282: Vim9: setting number option not tested

Problem:    Vim9: setting number option not tested.
Solution:   Add more tests.   Fix assigning to global variable.
This commit is contained in:
Bram Moolenaar
2020-02-19 18:14:44 +01:00
parent a2f6e42ded
commit 401d9ffb5a
4 changed files with 19 additions and 6 deletions

View File

@@ -596,8 +596,6 @@ let g:dict_one = #{one: 1}
let $TESTVAR = 'testvar' let $TESTVAR = 'testvar'
let @a = 'register a'
" test low level expression " test low level expression
def Test_expr7_number() def Test_expr7_number()
" number constant " number constant
@@ -675,6 +673,8 @@ def Test_expr7_option()
" option " option
set ts=11 set ts=11
assert_equal(11, &ts) assert_equal(11, &ts)
&ts = 9
assert_equal(9, &ts)
set ts=8 set ts=8
set grepprg=some\ text set grepprg=some\ text
assert_equal('some text', &grepprg) assert_equal('some text', &grepprg)
@@ -690,7 +690,7 @@ def Test_expr7_environment()
enddef enddef
def Test_expr7_register() def Test_expr7_register()
" register @a = 'register a'
assert_equal('register a', @a) assert_equal('register a', @a)
enddef enddef
@@ -724,7 +724,8 @@ func Test_expr7_fails()
call CheckDefFailure("let x = @", "E1002:") call CheckDefFailure("let x = @", "E1002:")
call CheckDefFailure("let x = @<", "E354:") call CheckDefFailure("let x = @<", "E354:")
call CheckDefFailure("let x = &notexist", "E113:") call CheckDefFailure("let x = &notexist", 'E113:')
call CheckDefExecFailure("&grepprg = [343]", 'E1051:')
endfunc endfunc
let g:Funcrefs = [function('add')] let g:Funcrefs = [function('add')]

View File

@@ -29,6 +29,7 @@ endfunc
let s:appendToMe = 'xxx' let s:appendToMe = 'xxx'
let s:addToMe = 111 let s:addToMe = 111
let g:existing = 'yes'
def Test_assignment() def Test_assignment()
let bool1: bool = true let bool1: bool = true
@@ -46,6 +47,13 @@ def Test_assignment()
let dict1: dict<string> = #{key: 'value'} let dict1: dict<string> = #{key: 'value'}
let dict2: dict<number> = #{one: 1, two: 2} let dict2: dict<number> = #{one: 1, two: 2}
g:newvar = 'new'
assert_equal('new', g:newvar)
assert_equal('yes', g:existing)
g:existing = 'no'
assert_equal('no', g:existing)
v:char = 'abc' v:char = 'abc'
assert_equal('abc', v:char) assert_equal('abc', v:char)

View File

@@ -738,6 +738,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 */
/**/
282,
/**/ /**/
281, 281,
/**/ /**/

View File

@@ -726,8 +726,10 @@ call_def_function(
int reg = iptr->isn_arg.number; int reg = iptr->isn_arg.number;
--ectx.ec_stack.ga_len; --ectx.ec_stack.ga_len;
tv = STACK_TV_BOT(0);
write_reg_contents(reg == '@' ? '"' : reg, write_reg_contents(reg == '@' ? '"' : reg,
tv_get_string(STACK_TV_BOT(0)), -1, FALSE); tv_get_string(tv), -1, FALSE);
clear_tv(tv);
} }
break; break;
@@ -746,7 +748,7 @@ call_def_function(
--ectx.ec_stack.ga_len; --ectx.ec_stack.ga_len;
di = find_var_in_ht(get_globvar_ht(), 0, di = find_var_in_ht(get_globvar_ht(), 0,
iptr->isn_arg.string, TRUE); iptr->isn_arg.string + 2, TRUE);
if (di == NULL) if (di == NULL)
{ {
funccal_entry_T entry; funccal_entry_T entry;