mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.4395: some code lines not covered by tests
Problem: Some code lines not covered by tests. Solution: Add a few more test cases. Fix getting more than one error for invalid assignment.
This commit is contained in:
@@ -2788,7 +2788,8 @@ EXTERN char e_missing_argument_type_for_str[]
|
|||||||
INIT(= N_("E1077: Missing argument type for %s"));
|
INIT(= N_("E1077: Missing argument type for %s"));
|
||||||
// E1078 unused
|
// E1078 unused
|
||||||
// E1079 unused
|
// E1079 unused
|
||||||
// E1080 unused
|
EXTERN char e_invalid_assignment[]
|
||||||
|
INIT(= N_("E1080: Invalid assignment"));
|
||||||
EXTERN char e_cannot_unlet_str[]
|
EXTERN char e_cannot_unlet_str[]
|
||||||
INIT(= N_("E1081: Cannot unlet %s"));
|
INIT(= N_("E1081: Cannot unlet %s"));
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1107,7 +1107,8 @@ skip_var_list(
|
|||||||
{
|
{
|
||||||
if (*semicolon == 1)
|
if (*semicolon == 1)
|
||||||
{
|
{
|
||||||
emsg(_(e_double_semicolon_in_list_of_variables));
|
if (!silent)
|
||||||
|
emsg(_(e_double_semicolon_in_list_of_variables));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
*semicolon = 1;
|
*semicolon = 1;
|
||||||
|
@@ -1359,7 +1359,8 @@ def Test_assignment_failure()
|
|||||||
v9.CheckDefFailure(['var null = 1'], 'E1034:')
|
v9.CheckDefFailure(['var null = 1'], 'E1034:')
|
||||||
v9.CheckDefFailure(['var this = 1'], 'E1034:')
|
v9.CheckDefFailure(['var this = 1'], 'E1034:')
|
||||||
|
|
||||||
v9.CheckDefFailure(['[a; b; c] = g:list'], 'E452:')
|
v9.CheckDefFailure(['[a; b; c] = g:list'], 'E1001:')
|
||||||
|
v9.CheckDefFailure(['var [a; b; c] = g:list'], 'E1080:')
|
||||||
v9.CheckDefExecFailure(['var a: number',
|
v9.CheckDefExecFailure(['var a: number',
|
||||||
'[a] = test_null_list()'], 'E1093:')
|
'[a] = test_null_list()'], 'E1093:')
|
||||||
v9.CheckDefExecFailure(['var a: number',
|
v9.CheckDefExecFailure(['var a: number',
|
||||||
|
@@ -1354,6 +1354,13 @@ def Test_command_not_recognized()
|
|||||||
END
|
END
|
||||||
v9.CheckDefFailure(lines, 'E1146:', 1)
|
v9.CheckDefFailure(lines, 'E1146:', 1)
|
||||||
|
|
||||||
|
lines =<< trim END
|
||||||
|
if 0
|
||||||
|
d.key = 'asdf'
|
||||||
|
endif
|
||||||
|
END
|
||||||
|
v9.CheckDefSuccess(lines)
|
||||||
|
|
||||||
lines =<< trim END
|
lines =<< trim END
|
||||||
d['key'] = 'asdf'
|
d['key'] = 'asdf'
|
||||||
END
|
END
|
||||||
@@ -1621,6 +1628,11 @@ def Test_substitute_expr()
|
|||||||
s/text/\=['aaa', 'bbb', 'ccc']/
|
s/text/\=['aaa', 'bbb', 'ccc']/
|
||||||
assert_equal(['some aaa', 'bbb', 'ccc', ' here'], getline(1, '$'))
|
assert_equal(['some aaa', 'bbb', 'ccc', ' here'], getline(1, '$'))
|
||||||
bwipe!
|
bwipe!
|
||||||
|
|
||||||
|
# inside "if 0" substitute is ignored
|
||||||
|
if 0
|
||||||
|
s/a/\=nothing/ and | some more
|
||||||
|
endif
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_redir_to_var()
|
def Test_redir_to_var()
|
||||||
@@ -1663,6 +1675,12 @@ def Test_redir_to_var()
|
|||||||
END
|
END
|
||||||
v9.CheckDefFailure(lines, 'E1089:')
|
v9.CheckDefFailure(lines, 'E1089:')
|
||||||
|
|
||||||
|
lines =<< trim END
|
||||||
|
var text: string
|
||||||
|
redir => text
|
||||||
|
END
|
||||||
|
v9.CheckDefFailure(lines, 'E1185:')
|
||||||
|
|
||||||
lines =<< trim END
|
lines =<< trim END
|
||||||
var ls = 'asdf'
|
var ls = 'asdf'
|
||||||
redir => ls[1]
|
redir => ls[1]
|
||||||
|
@@ -3762,7 +3762,15 @@ def Test_go_beyond_end_of_cmd()
|
|||||||
v9.CheckScriptFailure(lines, 'E476:')
|
v9.CheckScriptFailure(lines, 'E476:')
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
" The following messes up syntax highlight, keep near the end.
|
||||||
if has('python3')
|
if has('python3')
|
||||||
|
def Test_python3_command()
|
||||||
|
py3 import vim
|
||||||
|
py3 vim.command("let g:done = 'yes'")
|
||||||
|
assert_equal('yes', g:done)
|
||||||
|
unlet g:done
|
||||||
|
enddef
|
||||||
|
|
||||||
def Test_python3_heredoc()
|
def Test_python3_heredoc()
|
||||||
py3 << trim EOF
|
py3 << trim EOF
|
||||||
import vim
|
import vim
|
||||||
@@ -3778,7 +3786,6 @@ if has('python3')
|
|||||||
enddef
|
enddef
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" This messes up syntax highlight, keep near the end.
|
|
||||||
if has('lua')
|
if has('lua')
|
||||||
def Test_lua_heredoc()
|
def Test_lua_heredoc()
|
||||||
g:d = {}
|
g:d = {}
|
||||||
|
@@ -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 */
|
||||||
|
/**/
|
||||||
|
4395,
|
||||||
/**/
|
/**/
|
||||||
4394,
|
4394,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -2420,7 +2420,7 @@ may_compile_assignment(exarg_T *eap, char_u **line, cctx_T *cctx)
|
|||||||
|
|
||||||
if (*eap->cmd == '[')
|
if (*eap->cmd == '[')
|
||||||
{
|
{
|
||||||
// [var, var] = expr
|
// might be "[var, var] = expr"
|
||||||
*line = compile_assignment(eap->cmd, eap, CMD_SIZE, cctx);
|
*line = compile_assignment(eap->cmd, eap, CMD_SIZE, cctx);
|
||||||
if (*line == NULL)
|
if (*line == NULL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@@ -2958,7 +2958,10 @@ compile_def_function(
|
|||||||
case CMD_decrement:
|
case CMD_decrement:
|
||||||
line = compile_assignment(p, &ea, ea.cmdidx, &cctx);
|
line = compile_assignment(p, &ea, ea.cmdidx, &cctx);
|
||||||
if (line == p)
|
if (line == p)
|
||||||
|
{
|
||||||
|
emsg(_(e_invalid_assignment));
|
||||||
line = NULL;
|
line = NULL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_unlet:
|
case CMD_unlet:
|
||||||
|
Reference in New Issue
Block a user