Compare commits

...

11 Commits

Author SHA1 Message Date
Bram Moolenaar
f65ed86f6f patch 8.2.2696: Lua test fails with Lua 5.4.3 and later
Problem:    Lua test fails with Lua 5.4.3 and later.
Solution:   Check for different error messages. (Yegappan Lakshmanan,
            closes #8050)
2021-04-03 14:13:33 +02:00
Bram Moolenaar
1e6bbfb560 patch 8.2.2695: cursor position reset with nested autocommands
Problem:    Cursor position reset with nested autocommands.
Solution:   Only check and reset line numbers for not nested autocommands.
            (closes #5820)
2021-04-03 13:19:26 +02:00
Bram Moolenaar
5b8cabfef7 patch 8.2.2694: when 'matchpairs' is empty every character beeps
Problem:    When 'matchpairs' is empty every character beeps. (Marco Hinz)
Solution:   Bail out when no character in 'matchpairs' was found.
            (closes #8053)  Add assert_nobeep().
2021-04-02 18:55:57 +02:00
Bram Moolenaar
dcf29ac87f patch 8.2.2693: Vim9: locked script variable can be changed
Problem:    Vim9: locked script variable can be changed.
Solution:   Check legacy script variable for being locked. (issue #8031)
2021-04-02 14:44:02 +02:00
Bram Moolenaar
f5906aa780 patch 8.2.2692: Vim9: locked script variable can be changed
Problem:    Vim9: locked script variable can be changed.
Solution:   Check for locked value. (closes #8031)
2021-04-02 14:35:15 +02:00
Bram Moolenaar
3fa5e64e0e patch 8.2.2691: autoconf may mess up compiler flags
Problem:    Autoconf may mess up compiler flags.
Solution:   Handle removing FORTIFY_SOURCE a bit better. (Vladimir Lomov,
            closes #8049)
2021-04-02 13:30:59 +02:00
Bram Moolenaar
ef38bcf051 patch 8.2.2690: PowerShell files are not recognized
Problem:    PowerShell files are not recognized.
Solution:   Recognize several PowerShell extension. (Heath Stewart,
            closes #8051)
2021-04-02 13:00:15 +02:00
Bram Moolenaar
160a2b4dac patch 8.2.2689: tiny build fails
Problem:    Tiny build fails.
Solution:   Add #ifdef around use of p_stl.
2021-04-01 21:57:46 +02:00
Bram Moolenaar
ca51cc0a33 patch 8.2.2688: Vim9: crash when using s: for script variable
Problem:    Vim9: crash when using s: for script variable.
Solution:   Pass the end pointer. (closes #8045)
2021-04-01 21:38:53 +02:00
Bram Moolenaar
d877a5700f patch 8.2.2687: Vim9: cannot use "const" for global variable in :def function
Problem:    Vim9: cannot use "const" for global variable in :def function.
Solution:   Do allow using :const for a global variable. (closes #8030)
2021-04-01 19:42:48 +02:00
Bram Moolenaar
ce0b75711a patch 8.2.2686: status line is not updated when going to cmdline mode
Problem:    Status line is not updated when going to cmdline mode.
Solution:   Redraw status lines if 'statusline' is set and going to status
            line mode. (based on patch from Justin M. Keyes et al.,
            closes #8044)
2021-04-01 18:47:14 +02:00
23 changed files with 261 additions and 44 deletions

View File

@@ -2440,6 +2440,7 @@ assert_inrange({lower}, {upper}, {actual} [, {msg}])
Number assert {actual} is inside the range
assert_match({pat}, {text} [, {msg}])
Number assert {pat} matches {text}
assert_nobeep({cmd}) Number assert {cmd} does not cause a beep
assert_notequal({exp}, {act} [, {msg}])
Number assert {exp} is not equal {act}
assert_notmatch({pat}, {text} [, {msg}])

View File

@@ -243,7 +243,8 @@ test_srand_seed([seed]) *test_srand_seed()*
assert_beeps({cmd}) *assert_beeps()*
Run {cmd} and add an error message to |v:errors| if it does
NOT produce a beep or visual bell.
Also see |assert_fails()| and |assert-return|.
Also see |assert_fails()|, |assert_nobeep()| and
|assert-return|.
Can also be used as a |method|: >
GetCmd()->assert_beeps()
@@ -376,6 +377,14 @@ assert_match({pattern}, {actual} [, {msg}])
Can also be used as a |method|: >
getFile()->assert_match('foo.*')
<
assert_nobeep({cmd}) *assert_nobeep()*
Run {cmd} and add an error message to |v:errors| if it
produces a beep or visual bell.
Also see |assert_beeps()|.
Can also be used as a |method|: >
GetCmd()->assert_nobeep()
<
*assert_notequal()*
assert_notequal({expected}, {actual} [, {msg}])

View File

@@ -1279,6 +1279,11 @@ au BufNewFile,BufRead .povrayrc setf povini
" Povray, Pascal, PHP or assembly
au BufNewFile,BufRead *.inc call dist#ft#FTinc()
" PowerShell
au BufNewFile,BufRead *.ps1,*.psd1,*.psm1,*.pssc setf ps1
au BufNewFile,BufRead *.ps1xml setf ps1xml
au BufNewFile,BufRead *.cdxml,*.psc1 setf xml
" Printcap and Termcap
au BufNewFile,BufRead *printcap
\ let b:ptcap_type = "print" | setf ptcap

4
src/auto/configure vendored
View File

@@ -14906,8 +14906,8 @@ $as_echo "no" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D_FORTIFY_SOURCE=1" >&5
$as_echo_n "checking whether we need -D_FORTIFY_SOURCE=1... " >&6; }
if test "$gccmajor" -gt "3"; then
CFLAGS=`echo "$CFLAGS" | sed -e 's/ *-Wp,-D_FORTIFY_SOURCE=.//g' -e 's/ *-D_FORTIFY_SOURCE=.//g' -e 's/ *-U_FORTIFY_SOURCE//g' -e 's/$/ -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1/'`
CPPFLAGS=`echo "$CPPFLAGS" | sed -e 's/ *-Wp,-D_FORTIFY_SOURCE=.//g' -e 's/ *-D_FORTIFY_SOURCE=.//g' -e 's/ *-U_FORTIFY_SOURCE//g'`
CFLAGS=`echo "$CFLAGS" | sed -e 's/-D_FORTIFY_SOURCE=.,//g' -e 's/,-D_FORTIFY_SOURCE=. //g' -e 's/ *-Wp,-D_FORTIFY_SOURCE=. //g' -e 's/ *-D_FORTIFY_SOURCE=.//g' -e 's/ *-U_FORTIFY_SOURCE//g' -e 's/$/ -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1/'`
CPPFLAGS=`echo "$CPPFLAGS" | sed -e 's/-D_FORTIFY_SOURCE=.,//g' -e 's/,-D_FORTIFY_SOURCE=. //g' -e 's/ *-Wp,-D_FORTIFY_SOURCE=. //g' -e 's/ *-D_FORTIFY_SOURCE=.//g' -e 's/ *-U_FORTIFY_SOURCE//g'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else

View File

@@ -2116,14 +2116,16 @@ apply_autocmds_group(
ap->last = FALSE;
ap->last = TRUE;
// make sure cursor and topline are valid
check_lnums(TRUE);
if (nesting == 1)
// make sure cursor and topline are valid
check_lnums(TRUE);
do_cmdline(NULL, getnextac, (void *)&patcmd,
DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT);
// restore cursor and topline, unless they were changed
reset_lnums();
if (nesting == 1)
// restore cursor and topline, unless they were changed
reset_lnums();
#ifdef FEAT_EVAL
if (eap != NULL)

View File

@@ -4484,8 +4484,8 @@ if test "$GCC" = yes; then
dnl And undefine it first to avoid a warning.
AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
if test "$gccmajor" -gt "3"; then
CFLAGS=`echo "$CFLAGS" | sed -e 's/ *-Wp,-D_FORTIFY_SOURCE=.//g' -e 's/ *-D_FORTIFY_SOURCE=.//g' -e 's/ *-U_FORTIFY_SOURCE//g' -e 's/$/ -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1/'`
CPPFLAGS=`echo "$CPPFLAGS" | sed -e 's/ *-Wp,-D_FORTIFY_SOURCE=.//g' -e 's/ *-D_FORTIFY_SOURCE=.//g' -e 's/ *-U_FORTIFY_SOURCE//g'`
CFLAGS=`echo "$CFLAGS" | sed -e 's/-D_FORTIFY_SOURCE=.,//g' -e 's/,-D_FORTIFY_SOURCE=. //g' -e 's/ *-Wp,-D_FORTIFY_SOURCE=. //g' -e 's/ *-D_FORTIFY_SOURCE=.//g' -e 's/ *-U_FORTIFY_SOURCE//g' -e 's/$/ -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1/'`
CPPFLAGS=`echo "$CPPFLAGS" | sed -e 's/-D_FORTIFY_SOURCE=.,//g' -e 's/,-D_FORTIFY_SOURCE=. //g' -e 's/ *-Wp,-D_FORTIFY_SOURCE=. //g' -e 's/ *-D_FORTIFY_SOURCE=.//g' -e 's/ *-U_FORTIFY_SOURCE//g'`
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)

View File

@@ -739,6 +739,8 @@ static funcentry_T global_functions[] =
ret_number_bool, f_assert_inrange},
{"assert_match", 2, 3, FEARG_2, NULL,
ret_number_bool, f_assert_match},
{"assert_nobeep", 1, 2, FEARG_1, NULL,
ret_number_bool, f_assert_nobeep},
{"assert_notequal", 2, 3, FEARG_2, NULL,
ret_number_bool, f_assert_notequal},
{"assert_notmatch", 2, 3, FEARG_2, NULL,

View File

@@ -1706,6 +1706,17 @@ getcmdline_int(
// and execute commands. Display may be messed up a bit.
if (did_emsg)
redrawcmd();
#ifdef FEAT_STL_OPT
// Redraw the statusline in case it uses the current mode using the mode()
// function.
if (!cmd_silent && msg_scrolled == 0 && *p_stl != NUL)
{
curwin->w_redr_status = TRUE;
redraw_statuslines();
}
#endif
did_emsg = FALSE;
got_int = FALSE;

View File

@@ -1,5 +1,6 @@
/* testing.c */
void f_assert_beeps(typval_T *argvars, typval_T *rettv);
void f_assert_nobeep(typval_T *argvars, typval_T *rettv);
void f_assert_equal(typval_T *argvars, typval_T *rettv);
void f_assert_equalfile(typval_T *argvars, typval_T *rettv);
void f_assert_notequal(typval_T *argvars, typval_T *rettv);

View File

@@ -2817,6 +2817,8 @@ showmatch(
if (*p == NUL)
return;
}
if (*p == NUL)
return;
if ((lpos = findmatch(NULL, NUL)) == NULL) // no match, so beep
vim_beep(BO_MATCH);

View File

@@ -0,0 +1,5 @@
> +0&#ffffff0@49
|~+0#4040ff13&| @48
|~| @48
|-+3#0000000&|n|-| @46
| +0&&@49

View File

@@ -0,0 +1,5 @@
| +0&#ffffff0@49
|~+0#4040ff13&| @48
|~| @48
|-+3#0000000&|c|-| @46
|:+0&&> @48

View File

@@ -387,6 +387,8 @@ let s:filename_checks = {
\ 'promela': ['file.pml'],
\ 'proto': ['file.proto'],
\ 'protocols': ['/etc/protocols', 'any/etc/protocols'],
\ 'ps1': ['file.ps1', 'file.psd1', 'file.psm1', 'file.pssc'],
\ 'ps1xml': ['file.ps1xml'],
\ 'psf': ['file.psf'],
\ 'puppet': ['file.pp'],
\ 'pyrex': ['file.pyx', 'file.pxd'],
@@ -538,7 +540,7 @@ let s:filename_checks = {
\ 'xhtml': ['file.xhtml', 'file.xht'],
\ 'xinetd': ['/etc/xinetd.conf', '/etc/xinetd.d/file', 'any/etc/xinetd.conf', 'any/etc/xinetd.d/file'],
\ 'xmath': ['file.msc', 'file.msf'],
\ 'xml': ['/etc/blkid.tab', '/etc/blkid.tab.old', 'file.xmi', 'file.csproj', 'file.csproj.user', 'file.ui', 'file.tpm', '/etc/xdg/menus/file.menu', 'fglrxrc', 'file.xlf', 'file.xliff', 'file.xul', 'file.wsdl', 'file.wpl', 'any/etc/blkid.tab', 'any/etc/blkid.tab.old', 'any/etc/xdg/menus/file.menu', 'file.atom', 'file.rss'],
\ 'xml': ['/etc/blkid.tab', '/etc/blkid.tab.old', 'file.xmi', 'file.csproj', 'file.csproj.user', 'file.ui', 'file.tpm', '/etc/xdg/menus/file.menu', 'fglrxrc', 'file.xlf', 'file.xliff', 'file.xul', 'file.wsdl', 'file.wpl', 'any/etc/blkid.tab', 'any/etc/blkid.tab.old', 'any/etc/xdg/menus/file.menu', 'file.atom', 'file.rss', 'file.cdxml', 'file.psc1'],
\ 'xmodmap': ['anyXmodmap', 'Xmodmap', 'some-Xmodmap', 'some-xmodmap', 'some-xmodmap-file', 'xmodmap', 'xmodmap-file'],
\ 'xf86conf': ['xorg.conf', 'xorg.conf-4'],
\ 'xpm2': ['file.xpm2'],

View File

@@ -12,13 +12,20 @@ endfunc
CheckFeature lua
CheckFeature float
let s:luaver = split(split(luaeval('_VERSION'), ' ')[1], '\.')
" Depending on the lua version, the error messages are different.
let s:luaver = split(split(systemlist('lua -v')[0], ' ')[1], '\.')
let s:major = str2nr(s:luaver[0])
let s:minor = str2nr(s:luaver[1])
if s:major < 5 || (s:major == 5 && s:minor < 3)
let s:lua_53_or_later = 0
else
let s:patch = str2nr(s:luaver[2])
let s:lua_53_or_later = 0
let s:lua_543_or_later = 0
if (s:major == 5 && s:minor >= 3) || s:major > 5
let s:lua_53_or_later = 1
if (s:major == 5
\ && ((s:minor == 4 && s:patch >= 3) || s:minor > 4))
\ || s:major > 5
let s:lua_543_or_later = 1
endif
endif
func TearDown()
@@ -55,10 +62,14 @@ func Test_lua_luado()
" Error cases
call assert_fails('luado string.format()',
\ "[string \"vim chunk\"]:1: bad argument #1 to 'format' (string expected, got no value)")
call assert_fails('luado func()',
\ s:lua_53_or_later
\ ? "[string \"vim chunk\"]:1: attempt to call a nil value (global 'func')"
\ : "[string \"vim chunk\"]:1: attempt to call global 'func' (a nil value)")
if s:lua_543_or_later
let msg = "[string \"vim chunk\"]:1: global 'func' is not callable (a nil value)"
elseif s:lua_53_or_later
let msg = "[string \"vim chunk\"]:1: attempt to call a nil value (global 'func')"
else
let msg = "[string \"vim chunk\"]:1: attempt to call global 'func' (a nil value)"
endif
call assert_fails('luado func()', msg)
call assert_fails('luado error("failed")', "[string \"vim chunk\"]:1: failed")
endfunc
@@ -143,10 +154,14 @@ func Test_lua_window()
" Window 3 does not exist so vim.window(3) should return nil
call assert_equal('nil', luaeval('tostring(vim.window(3))'))
call assert_fails("let n = luaeval('vim.window().xyz()')",
\ s:lua_53_or_later
\ ? "[string \"luaeval\"]:1: attempt to call a nil value (field 'xyz')"
\ : "[string \"luaeval\"]:1: attempt to call field 'xyz' (a nil value)")
if s:lua_543_or_later
let msg = "[string \"luaeval\"]:1: field 'xyz' is not callable (a nil value)"
elseif s:lua_53_or_later
let msg = "[string \"luaeval\"]:1: attempt to call a nil value (field 'xyz')"
else
let msg = "[string \"luaeval\"]:1: attempt to call field 'xyz' (a nil value)"
endif
call assert_fails("let n = luaeval('vim.window().xyz()')", msg)
call assert_fails('lua vim.window().xyz = 1',
\ "[string \"vim chunk\"]:1: invalid window property: `xyz'")
@@ -331,10 +346,14 @@ func Test_lua_buffer_insert()
call assert_equal('4', luaeval('vim.buffer()[4]'))
call assert_equal(v:null, luaeval('vim.buffer()[5]'))
call assert_equal(v:null, luaeval('vim.buffer()[{}]'))
call assert_fails('lua vim.buffer():xyz()',
\ s:lua_53_or_later
\ ? "[string \"vim chunk\"]:1: attempt to call a nil value (method 'xyz')"
\ : "[string \"vim chunk\"]:1: attempt to call method 'xyz' (a nil value)")
if s:lua_543_or_later
let msg = "[string \"vim chunk\"]:1: method 'xyz' is not callable (a nil value)"
elseif s:lua_53_or_later
let msg = "[string \"vim chunk\"]:1: attempt to call a nil value (method 'xyz')"
else
let msg = "[string \"vim chunk\"]:1: attempt to call method 'xyz' (a nil value)"
endif
call assert_fails('lua vim.buffer():xyz()', msg)
call assert_fails('lua vim.buffer()[1] = {}',
\ '[string "vim chunk"]:1: wrong argument to change')
bwipe!
@@ -438,10 +457,14 @@ func Test_lua_list()
lua ll = vim.eval('l')
let x = luaeval("ll[3]")
call assert_equal(v:null, x)
call assert_fails('let x = luaeval("ll:xyz(3)")',
\ s:lua_53_or_later
\ ? "[string \"luaeval\"]:1: attempt to call a nil value (method 'xyz')"
\ : "[string \"luaeval\"]:1: attempt to call method 'xyz' (a nil value)")
if s:lua_543_or_later
let msg = "[string \"luaeval\"]:1: method 'xyz' is not callable (a nil value)"
elseif s:lua_53_or_later
let msg = "[string \"luaeval\"]:1: attempt to call a nil value (method 'xyz')"
else
let msg = "[string \"luaeval\"]:1: attempt to call method 'xyz' (a nil value)"
endif
call assert_fails('let x = luaeval("ll:xyz(3)")', msg)
let y = luaeval("ll[{}]")
call assert_equal(v:null, y)
@@ -467,7 +490,7 @@ func Test_lua_list_table_insert_remove()
throw 'Skipped: Lua version < 5.3'
endif
let l = [1, 2]
let l = [1, 2]
lua t = vim.eval('l')
lua table.insert(t, 10)
lua t[#t + 1] = 20
@@ -625,10 +648,14 @@ func Test_lua_blob()
call assert_equal(2, n)
let n = luaeval('lb[6]')
call assert_equal(v:null, n)
call assert_fails('let x = luaeval("lb:xyz(3)")',
\ s:lua_53_or_later
\ ? "[string \"luaeval\"]:1: attempt to call a nil value (method 'xyz')"
\ : "[string \"luaeval\"]:1: attempt to call method 'xyz' (a nil value)")
if s:lua_543_or_later
let msg = "[string \"luaeval\"]:1: method 'xyz' is not callable (a nil value)"
elseif s:lua_53_or_later
let msg = "[string \"luaeval\"]:1: attempt to call a nil value (method 'xyz')"
else
let msg = "[string \"luaeval\"]:1: attempt to call method 'xyz' (a nil value)"
endif
call assert_fails('let x = luaeval("lb:xyz(3)")', msg)
let y = luaeval("lb[{}]")
call assert_equal(v:null, y)

View File

@@ -448,6 +448,27 @@ func Test_statusline_removed_group()
call delete('XTest_statusline')
endfunc
func Test_statusline_using_mode()
CheckScreendump
let lines =<< trim END
set laststatus=2
let &statusline = '-%{mode()}-'
END
call writefile(lines, 'XTest_statusline')
let buf = RunVimInTerminal('-S XTest_statusline', {'rows': 5, 'cols': 50})
call VerifyScreenDump(buf, 'Test_statusline_mode_1', {})
call term_sendkeys(buf, ":")
call VerifyScreenDump(buf, 'Test_statusline_mode_2', {})
" clean up
call term_sendkeys(buf, "\<CR>")
call StopVimInTerminal(buf)
call delete('XTest_statusline')
endfunc
func Test_statusline_after_split_vsplit()
only

View File

@@ -2002,5 +2002,32 @@ func Test_terminal_all_ansi_colors()
call delete('Xcolorscript')
endfunc
function On_BufFilePost()
doautocmd <nomodeline> User UserEvent
endfunction
func Test_terminal_nested_autocmd()
new
call setline(1, range(500))
$
let lastline = line('.')
augroup TermTest
autocmd BufFilePost * call On_BufFilePost()
autocmd User UserEvent silent
augroup END
let cmd = Get_cat_123_cmd()
let buf = term_start(cmd, #{term_finish: 'close', hidden: 1})
call assert_equal(lastline, line('.'))
call TermWait(buf)
exe buf . 'bwipe'
call delete('Xtext')
augroup TermTest
au!
augroup END
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -858,6 +858,14 @@ func Test_mps_latin1()
close!
endfunc
func Test_empty_matchpairs()
split
set matchpairs= showmatch
call assert_nobeep('call feedkeys("ax\tx\t\<Esc>", "xt")')
set matchpairs& noshowmatch
bwipe!
endfunc
func Test_mps_error()
let encoding_save = &encoding

View File

@@ -1277,6 +1277,13 @@ def Test_var_declaration()
g:FLIST[0] = 22
assert_equal([22], g:FLIST)
def SetGlobalConst()
const g:globConst = 123
enddef
SetGlobalConst()
assert_equal(123, g:globConst)
assert_true(islocked('g:globConst'))
const w:FOO: number = 46
assert_equal(46, w:FOO)
const w:FOOS = 'wfoos'
@@ -1339,6 +1346,38 @@ def Test_var_declaration_fails()
CheckScriptFailure(lines, 'E741:')
unlet g:constvar
lines =<< trim END
vim9script
var name = 'one'
lockvar name
def SetLocked()
name = 'two'
enddef
SetLocked()
END
CheckScriptFailure(lines, 'E741: Value is locked: name', 1)
lines =<< trim END
let s:legacy = 'one'
lockvar s:legacy
def SetLocked()
s:legacy = 'two'
enddef
call SetLocked()
END
CheckScriptFailure(lines, 'E741: Value is locked: s:legacy', 1)
lines =<< trim END
vim9script
def SetGlobalConst()
const g:globConst = 123
enddef
SetGlobalConst()
g:globConst = 234
END
CheckScriptFailure(lines, 'E741: Value is locked: globConst', 1)
unlet g:globConst
lines =<< trim END
vim9script
const cdict: dict<string> = {}

View File

@@ -1644,9 +1644,10 @@ def Test_vim9script_funcref()
# using the function from a compiled function
def TestMore(): string
return anAlias.GetString('text')
var s = s:anAlias.GetString('foo')
return s .. anAlias.GetString('bar')
enddef
assert_equal('text', TestMore())
assert_equal('foobar', TestMore())
# error when using a function that isn't exported
assert_fails('anAlias.Compare(1, 2)', 'E1049:')

View File

@@ -338,7 +338,7 @@ assert_append_cmd_or_arg(garray_T *gap, typval_T *argvars, char_u *cmd)
}
static int
assert_beeps(typval_T *argvars)
assert_beeps(typval_T *argvars, int no_beep)
{
char_u *cmd = tv_get_string_chk(&argvars[0]);
garray_T ga;
@@ -348,10 +348,13 @@ assert_beeps(typval_T *argvars)
suppress_errthrow = TRUE;
emsg_silent = FALSE;
do_cmdline_cmd(cmd);
if (!called_vim_beep)
if (no_beep ? called_vim_beep : !called_vim_beep)
{
prepare_assert_error(&ga);
ga_concat(&ga, (char_u *)"command did not beep: ");
if (no_beep)
ga_concat(&ga, (char_u *)"command did beep: ");
else
ga_concat(&ga, (char_u *)"command did not beep: ");
ga_concat(&ga, cmd);
assert_error(&ga);
ga_clear(&ga);
@@ -369,7 +372,16 @@ assert_beeps(typval_T *argvars)
void
f_assert_beeps(typval_T *argvars, typval_T *rettv)
{
rettv->vval.v_number = assert_beeps(argvars);
rettv->vval.v_number = assert_beeps(argvars, FALSE);
}
/*
* "assert_nobeep(cmd [, error])" function
*/
void
f_assert_nobeep(typval_T *argvars, typval_T *rettv)
{
rettv->vval.v_number = assert_beeps(argvars, TRUE);
}
/*

View File

@@ -750,6 +750,28 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2696,
/**/
2695,
/**/
2694,
/**/
2693,
/**/
2692,
/**/
2691,
/**/
2690,
/**/
2689,
/**/
2688,
/**/
2687,
/**/
2686,
/**/
2685,
/**/

View File

@@ -2822,7 +2822,7 @@ compile_load(
case 'v': res = generate_LOADV(cctx, name, error);
break;
case 's': res = compile_load_scriptvar(cctx, name,
NULL, NULL, error);
NULL, &end, error);
break;
case 'g': if (vim_strchr(name, AUTOLOAD_CHAR) == NULL)
isn_type = ISN_LOADG;
@@ -5752,7 +5752,8 @@ compile_lhs(
&lhs->lhs_opt_flags, &lhs->lhs_vimvaridx,
&lhs->lhs_type, cctx) == FAIL)
return FAIL;
if (lhs->lhs_dest != dest_local)
if (lhs->lhs_dest != dest_local
&& cmdidx != CMD_const && cmdidx != CMD_final)
{
// Specific kind of variable recognized.
declare_error = is_decl;
@@ -6519,6 +6520,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
else
{
if (is_decl && cmdidx == CMD_const && (lhs.lhs_dest == dest_script
|| lhs.lhs_dest == dest_global
|| lhs.lhs_dest == dest_local))
// ":const var": lock the value, but not referenced variables
generate_LOCKCONST(cctx);

View File

@@ -963,9 +963,12 @@ check_for_number(typval_T *tv)
store_var(char_u *name, typval_T *tv)
{
funccal_entry_T entry;
int flags = ASSIGN_DECL;
if (tv->v_lock)
flags |= ASSIGN_CONST;
save_funccal(&entry);
set_var_const(name, NULL, tv, FALSE, ASSIGN_DECL, 0);
set_var_const(name, NULL, tv, FALSE, flags, 0);
restore_funccal();
}
@@ -1939,6 +1942,9 @@ call_def_function(
store_var(name, STACK_TV_BOT(0));
else
{
SOURCING_LNUM = iptr->isn_lnum;
if (var_check_permission(di, name) == FAIL)
goto on_error;
clear_tv(&di->di_tv);
di->di_tv = *STACK_TV_BOT(0);
}
@@ -1955,6 +1961,13 @@ call_def_function(
if (sv == NULL)
goto failed;
--ectx.ec_stack.ga_len;
// "const" and "final" are checked at compile time, locking
// the value needs to be checked here.
SOURCING_LNUM = iptr->isn_lnum;
if (value_check_lock(sv->sv_tv->v_lock, sv->sv_name, FALSE))
goto on_error;
clear_tv(sv->sv_tv);
*sv->sv_tv = *STACK_TV_BOT(0);
}